001/*
002 * $RCSfile: ObjectMismatchTrigger.java,v $
003 * $Revision: 1.1.2.3 $ $Date: 2015/01/27 03:24:35 $
004 * 
005 *  Copyright 2011-2015 Cloud Software Group, Inc. ALL RIGHTS RESERVED.
006 *  Cloud Software Group, Inc. Confidential Information
007 */
008
009package com.kabira.platform;
010
011import java.io.ObjectStreamClass;
012import java.io.ObjectOutputStream;
013import java.io.ObjectInputStream;
014import java.io.IOException;
015
016/**
017 * Indicate that this class implements mismtached object triggers.
018 * These triggers are invoked for an instance when an class change has
019 * been detected on a remote node. 
020 * <p>
021 * This interface will only affect Managed types.
022 */
023public interface ObjectMismatchTrigger
024{
025    /**
026     * Called when writing data to a mismatched node. The remoteClassDescriptor
027     * will be populated by distribution, and will contain the field
028     * description of the remote class, the application can use that to
029     * determine what to write.
030     * @param remoteClassDescriptor ManagedObjectStreamClass to use.
031     * @param out Output stream that is written to.
032     * @exception IOException An IO exception happened during the write.
033     */
034    public void writeObjectToStream(
035                ManagedObjectStreamClass remoteClassDescriptor,
036                ObjectOutputStream out) throws IOException;
037
038    /**
039     * Called when reading data from a mismatched node. The
040     * remoteClassDescriptor will be populated by distribution, and will
041     * contain the field description of the remote class, the application
042     * will use that to determine how to read the stream.
043     * @param remoteClassDescriptor ManagedObjectStreamClass to use.
044     * @param in Inout stream that is read from.
045     * @exception IOException An IO exception happened during the read.
046     */
047    public void readObjectFromStream(
048                ManagedObjectStreamClass remoteClassDescriptor,
049                ObjectInputStream in) throws IOException;
050}
051