org.openorb.orb.rmi
Class ValueHandlerImpl

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.openorb.orb.rmi.ValueHandlerImpl
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, javax.rmi.CORBA.ValueHandler

public final class ValueHandlerImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements javax.rmi.CORBA.ValueHandler

This class is able to marshal and to unmarshal a RMI value.

Author:
Jerome Daniel, Michael Rumpf

Method Summary
static ValueHandlerImpl createValueHandler(org.apache.avalon.framework.logger.Logger logger)
          Create a value handler instance.
 java.lang.String getRMIRepositoryID(java.lang.Class clz)
          This method returns the RMI-style repository ID string for clz.
 org.omg.SendingContext.RunTime getRunTimeCodeBase()
          This method returns the ValueHandler object's SendingContext::RunTime object reference, which is used to construct the SendingContextRuntTime service context.
 boolean isCustomMarshaled(java.lang.Class clz)
          This method returns true if the value is custom marshaled and therefore requires a chunked encoding, and false otherwise.
 java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in_sub, int offset, java.lang.Class expected, java.lang.String repoID, org.omg.SendingContext.RunTime sender)
          The readValue method can be used to read GIOP data, including RMI remote objects and serialized data objects, from an underlying portable InputStream.
 java.io.Serializable writeReplace(java.io.Serializable value)
          This method returns the serialization replacement for the value object.
 java.io.Serializable writeReplaceExt(java.io.Serializable value, RMIObjectStreamClass descrip)
           
 void writeValue(org.omg.CORBA.portable.OutputStream out_sub, java.io.Serializable value)
          The writeValue method can be used to write GIOP data, including RMI remote objects and serialized data objects, to an underlying portable OutputStream.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createValueHandler

public static ValueHandlerImpl createValueHandler(org.apache.avalon.framework.logger.Logger logger)
Create a value handler instance. Only one instance will be created, as the ValueHandler is a singleton for the ORB instance. Subsequent calls to this method return the same instance.
Parameters:
logger - The logger for the ValueHandler instance.
Returns:
The singleton ValueHandler instance.

writeValue

public void writeValue(org.omg.CORBA.portable.OutputStream out_sub,
                       java.io.Serializable value)
The writeValue method can be used to write GIOP data, including RMI remote objects and serialized data objects, to an underlying portable OutputStream. The implementation of the writeValue method interacts with the core Java serialization machinery. The data generated during serialization is written using the underlying OutputStream object.
Specified by:
writeValue in interface javax.rmi.CORBA.ValueHandler
Parameters:
out_sub - The stream to write the value to.
value - The value to write to the stream.

readValue

public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in_sub,
                                      int offset,
                                      java.lang.Class expected,
                                      java.lang.String repoID,
                                      org.omg.SendingContext.RunTime sender)
The readValue method can be used to read GIOP data, including RMI remote objects and serialized data objects, from an underlying portable InputStream. The implementation of the readValue method interacts with the core Java serialization machinery. The data required during deserialization is read using the underlying InputStream object.
Specified by:
readValue in interface javax.rmi.CORBA.ValueHandler
Parameters:
in_sub - The input stream to read the value from.
offset - the offset in the stream of the value being unmarshaled.
expected - Java class of the value to be unmarshaled.
repoID - repository ID unmarshaled from the value header by the caller of readValue.
sender - the sending context object passed in the optional service context tagged SendingContextRunTime in the GIOP header, if any, or null if no sending context was passed.
Returns:
The value read from the stream.

getRMIRepositoryID

public java.lang.String getRMIRepositoryID(java.lang.Class clz)
This method returns the RMI-style repository ID string for clz.
Specified by:
getRMIRepositoryID in interface javax.rmi.CORBA.ValueHandler
Parameters:
clz - The class to get the RMI reopsitory id for.
Returns:
The RMI repository id for the class clz.

isCustomMarshaled

public boolean isCustomMarshaled(java.lang.Class clz)
This method returns true if the value is custom marshaled and therefore requires a chunked encoding, and false otherwise.
Specified by:
isCustomMarshaled in interface javax.rmi.CORBA.ValueHandler
Parameters:
clz - The class to check whether it is custom marshaled or not.
Returns:
True if class clz is custom marshalled, false otherwise.

getRunTimeCodeBase

public org.omg.SendingContext.RunTime getRunTimeCodeBase()
This method returns the ValueHandler object's SendingContext::RunTime object reference, which is used to construct the SendingContextRuntTime service context.
Specified by:
getRunTimeCodeBase in interface javax.rmi.CORBA.ValueHandler
Returns:
null, needs to be implemented.

writeReplace

public java.io.Serializable writeReplace(java.io.Serializable value)
This method returns the serialization replacement for the value object.
Specified by:
writeReplace in interface javax.rmi.CORBA.ValueHandler
Parameters:
value - The value for which to call the writeReplace method.
Returns:
The replaced value returned by the writeReplace method.

writeReplaceExt

public java.io.Serializable writeReplaceExt(java.io.Serializable value,
                                            RMIObjectStreamClass descrip)