uka.patch
Class PatchAdapterImpl.Output

java.lang.Object
  extended byuka.patch.PatchAdapterImpl.Output
All Implemented Interfaces:
PatchOutput
Enclosing class:
PatchAdapterImpl

final class PatchAdapterImpl.Output
extends java.lang.Object
implements PatchOutput


Field Summary
private  AbstractPatchWriter writer
           
 
Constructor Summary
PatchAdapterImpl.Output(AbstractPatchWriter writer)
           
 
Method Summary
 void createCompletePatch()
          Creates a complete patch for all objects currently registered in the object space.
 void createPatchAnonymous(java.lang.Object orig, java.lang.Object copy)
           
private  void doCreatePatchRecord(java.lang.Object orig, java.lang.Object copy)
          Creates a single patch record for the given (orig, copy) object pair.
 MarshalStream getOutput(int rank)
          Experimental low-level API: Patch creation for the expert.
 boolean writeDiff(boolean value, boolean copy)
          Called from a patchable object's Patchable.createPatch(Object, PatchOutput) method for each instance variable of matching type.
 boolean writeDiff(byte value, byte copy)
           
 boolean writeDiff(char value, char copy)
           
 boolean writeDiff(double value, double copy)
           
 boolean writeDiff(float value, float copy)
           
 boolean writeDiff(int value, int copy)
           
 boolean writeDiff(long value, long copy)
           
 java.lang.Object writeDiff(java.lang.Object ref, java.lang.Object copy)
          Like writeDiff(int, int) for instance variables of reference type.
 boolean writeDiff(short value, short copy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

private final AbstractPatchWriter writer
Constructor Detail

PatchAdapterImpl.Output

public PatchAdapterImpl.Output(AbstractPatchWriter writer)
                        throws java.io.IOException
Method Detail

createCompletePatch

public void createCompletePatch()
                         throws java.io.IOException
Creates a complete patch for all objects currently registered in the object space. This patch may include patch records to objects that are no longer referenced, because the reference graph is not traversed.

Throws:
java.io.IOException

doCreatePatchRecord

private void doCreatePatchRecord(java.lang.Object orig,
                                 java.lang.Object copy)
                          throws java.io.IOException
Creates a single patch record for the given (orig, copy) object pair.

Throws:
java.io.IOException

writeDiff

public boolean writeDiff(boolean value,
                         boolean copy)
                  throws java.io.IOException
Called from a patchable object's Patchable.createPatch(Object, PatchOutput) method for each instance variable of matching type.

Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
PatchOutput.writeDiff(int, int)

writeDiff

public boolean writeDiff(byte value,
                         byte copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public boolean writeDiff(char value,
                         char copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public boolean writeDiff(short value,
                         short copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public boolean writeDiff(int value,
                         int copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Parameters:
value - the value of currently inspected instance variable of a patchable object.
copy - the value of the corresponding instance variable of the backup copy.
Returns:
whether a difference was detected and a patch record was written. If there is a difference, the instance variable of the backup copy needs to be updated to the current value.
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public boolean writeDiff(float value,
                         float copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public boolean writeDiff(long value,
                         long copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public boolean writeDiff(double value,
                         double copy)
                  throws java.io.IOException
Specified by:
writeDiff in interface PatchOutput
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

writeDiff

public java.lang.Object writeDiff(java.lang.Object ref,
                                  java.lang.Object copy)
                           throws java.io.IOException
Description copied from interface: PatchOutput
Like PatchOutput.writeDiff(int, int) for instance variables of reference type. But instead of a modification notification the new reference (normally the one that was passed as first argument) is returned. In case of partial replication, there is an exception to that rule: If the application has decided not to replicate an object on the node, where it was created on, the reference is deleted during update. In that case, this method will return null insted. The responsibility of the Patchable.createPatch(Object, PatchOutput) method is to assign the returned reference to the corresponding instance variables of the original and the backup copy.

Specified by:
writeDiff in interface PatchOutput
Returns:
the value of parameter r, or null, if r is not being replicated on the local node.
Throws:
java.io.IOException
See Also:
writeDiff(boolean, boolean)

createPatchAnonymous

public void createPatchAnonymous(java.lang.Object orig,
                                 java.lang.Object copy)
                          throws java.io.IOException
Specified by:
createPatchAnonymous in interface PatchOutput
Throws:
java.io.IOException

getOutput

public MarshalStream getOutput(int rank)
                        throws java.io.IOException
Description copied from interface: PatchOutput
Experimental low-level API: Patch creation for the expert.

Specified by:
getOutput in interface PatchOutput
Throws:
java.io.IOException