Package com.sun.corba.ee.impl.io
Class ValueHandlerImpl
- java.lang.Object
-
- com.sun.corba.ee.impl.io.ValueHandlerImpl
-
- All Implemented Interfaces:
ValueHandler,ValueHandlerMultiFormat
public final class ValueHandlerImpl extends java.lang.Object implements ValueHandlerMultiFormat
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFORMAT_VERSION_PROPERTYprivate java.util.Map<InputStream,IIOPInputStream>inputStreamPairsstatic shortkAbstractTypestatic shortkRemoteTypestatic shortkValueTypeprivate static byteMAX_STREAM_FORMAT_VERSIONprivate static byteMAX_SUPPORTED_FORMAT_VERSIONprivate static OMGSystemExceptionomgWrapperprivate java.util.Map<OutputStream,IIOPOutputStream>outputStreamPairsprivate static byteSTREAM_FORMAT_VERSION_1protected static UtilSystemExceptionutilWrapper
-
Constructor Summary
Constructors Modifier Constructor Description privateValueHandlerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateForAnyType(java.lang.Class cl)private IIOPInputStreamcreateInputStream()private IIOPOutputStreamcreateOutputStream()java.lang.ClassgetAnyClassFromType(java.lang.String id)java.lang.ClassgetClassFromType(java.lang.String id)java.lang.StringgetClassName(java.lang.String id)java.lang.StringgetDefinedInId(java.lang.String id)(package private) static ValueHandlerImplgetInstance()(package private) TCKindgetJavaCharTCKind()Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this.bytegetMaximumStreamFormatVersion()Returns the maximum stream format version for RMI/IDL custom value types that is supported by this ValueHandler object.private static bytegetMaxStreamFormatVersion()java.lang.StringgetRMIRepositoryID(java.lang.Class clz)Returns the repository ID for the given RMI value Class.RunTimegetRunTimeCodeBase()Returns the CodeBase for this ValueHandler.java.lang.StringgetSerialVersionUID(java.lang.String id)java.lang.StringgetUnqualifiedName(java.lang.String id)booleanisAbstractBase(java.lang.Class clazz)private booleanisArray(java.lang.String repId)booleanisCustomMarshaled(java.lang.Class clz)Indicates whether the given Class performs custom or default marshaling.booleanisSequence(java.lang.String id)private java.lang.Objectread_Array(IIOPInputStream bridge, InputStream in, java.lang.Class sequence, CodeBase sender, int offset)private voidreadCharArray(InputStream in, char[] array, int offset, int length)Encapsulates reading of Java char arrays so that the 1.3 subclass can override it without exposing internals across packages.java.io.SerializablereadValue(InputStream _in, int offset, java.lang.Class clazz, java.lang.String repositoryID, RunTime _sender)Reads a value from the stream using java semantics.private java.io.SerializablereadValueInternal(IIOPInputStream bridge, InputStream in, int offset, java.lang.Class<?> clazz, java.lang.String repositoryID, CodeBase sender)booleanuseFullValueDescription(java.lang.Class clazz, java.lang.String repositoryID)Returns a boolean of whether or not RepositoryId indicates FullValueDescriptor.private voidwrite_Array(OutputStream out, java.io.Serializable obj, java.lang.Class type)private voidwriteCharArray(OutputStream out, char[] array, int offset, int length)Encapsulates writing of Java char arrays so that the 1.3 subclass can override it without exposing internals across packages.java.io.SerializablewriteReplace(java.io.Serializable value)If the value contains a writeReplace method then the result is returned.voidwriteValue(OutputStream _out, java.io.Serializable value)Writes the value to the stream using java semantics.voidwriteValue(OutputStream out, java.io.Serializable value, byte streamFormatVersion)Allows the ORB to pass the stream format version for RMI/IDL custom value types.private voidwriteValueInternal(IIOPOutputStream bridge, OutputStream out, java.io.Serializable value, byte streamFormatVersion)private voidwriteValueWithVersion(OutputStream _out, java.io.Serializable value, byte streamFormatVersion)
-
-
-
Field Detail
-
omgWrapper
private static final OMGSystemException omgWrapper
-
utilWrapper
protected static final UtilSystemException utilWrapper
-
FORMAT_VERSION_PROPERTY
public static final java.lang.String FORMAT_VERSION_PROPERTY
- See Also:
- Constant Field Values
-
MAX_SUPPORTED_FORMAT_VERSION
private static final byte MAX_SUPPORTED_FORMAT_VERSION
- See Also:
- Constant Field Values
-
STREAM_FORMAT_VERSION_1
private static final byte STREAM_FORMAT_VERSION_1
- See Also:
- Constant Field Values
-
MAX_STREAM_FORMAT_VERSION
private static final byte MAX_STREAM_FORMAT_VERSION
-
kRemoteType
public static final short kRemoteType
- See Also:
- Constant Field Values
-
kAbstractType
public static final short kAbstractType
- See Also:
- Constant Field Values
-
kValueType
public static final short kValueType
- See Also:
- Constant Field Values
-
inputStreamPairs
private final java.util.Map<InputStream,IIOPInputStream> inputStreamPairs
-
outputStreamPairs
private final java.util.Map<OutputStream,IIOPOutputStream> outputStreamPairs
-
-
Method Detail
-
getMaxStreamFormatVersion
private static byte getMaxStreamFormatVersion()
-
getMaximumStreamFormatVersion
public byte getMaximumStreamFormatVersion()
Description copied from interface:ValueHandlerMultiFormatReturns the maximum stream format version for RMI/IDL custom value types that is supported by this ValueHandler object. The ValueHandler object must support the returned stream format version and all lower versions. An ORB may use this value to include in a standard IOR tagged component or service context to indicate to other ORBs the maximum RMI-IIOP stream format that it supports. If not included, the default for GIOP 1.2 is stream format version 1, and stream format version 2 for GIOP 1.3 and higher.- Specified by:
getMaximumStreamFormatVersionin interfaceValueHandlerMultiFormat- Returns:
- the maximum version supported
-
writeValue
public void writeValue(OutputStream out, java.io.Serializable value, byte streamFormatVersion)
Description copied from interface:ValueHandlerMultiFormatAllows the ORB to pass the stream format version for RMI/IDL custom value types. If the ORB calls this method, it must pass a stream format version between 1 and the value returned by the getMaximumStreamFormatVersion method inclusive, or else a BAD_PARAM exception with standard minor code will be thrown.If the ORB calls the older ValueHandler.writeValue(OutputStream, Serializable) method, stream format version 1 is implied.
The ORB output stream passed to the ValueHandlerMultiFormat.writeValue method must implement the ValueOutputStream interface, and the ORB input stream passed to the ValueHandler.readValue method must implement the ValueInputStream interface.- Specified by:
writeValuein interfaceValueHandlerMultiFormat- Parameters:
out- stream to write the value out tovalue- aSerializablevalue to writestreamFormatVersion- stream format version
-
getInstance
static ValueHandlerImpl getInstance()
-
writeValue
public void writeValue(OutputStream _out, java.io.Serializable value)
Writes the value to the stream using java semantics.- Specified by:
writeValuein interfaceValueHandler- Parameters:
_out- The stream to write the value tovalue- The value to be written to the stream
-
writeValueWithVersion
private void writeValueWithVersion(OutputStream _out, java.io.Serializable value, byte streamFormatVersion)
-
writeValueInternal
private void writeValueInternal(IIOPOutputStream bridge, OutputStream out, java.io.Serializable value, byte streamFormatVersion)
-
readValue
public java.io.Serializable readValue(InputStream _in, int offset, java.lang.Class clazz, java.lang.String repositoryID, RunTime _sender)
Reads a value from the stream using java semantics.- Specified by:
readValuein interfaceValueHandler- Parameters:
_in- The stream to read the value fromoffset- offset position in the streamclazz- The type of the value to be read inrepositoryID- repo ID for the value to read_sender- The sending context runtime- Returns:
- The serializable value read from the stream
-
readValueInternal
private java.io.Serializable readValueInternal(IIOPInputStream bridge, InputStream in, int offset, java.lang.Class<?> clazz, java.lang.String repositoryID, CodeBase sender)
-
getRMIRepositoryID
public java.lang.String getRMIRepositoryID(java.lang.Class clz)
Returns the repository ID for the given RMI value Class.- Specified by:
getRMIRepositoryIDin interfaceValueHandler- Parameters:
clz- The class to return a repository ID for.- Returns:
- the repository ID of the Class.
-
isCustomMarshaled
public boolean isCustomMarshaled(java.lang.Class clz)
Indicates whether the given Class performs custom or default marshaling.- Specified by:
isCustomMarshaledin interfaceValueHandler- Parameters:
clz- The class to test for custom marshaling.- Returns:
- True if the class performs custom marshaling, false if it does not.
-
getRunTimeCodeBase
public RunTime getRunTimeCodeBase()
Returns the CodeBase for this ValueHandler. This is used by the ORB runtime. The server sends the service context containing the IOR for this CodeBase on the first GIOP reply. The clients do the same on the first GIOP request.- Specified by:
getRunTimeCodeBasein interfaceValueHandler- Returns:
- the SendingContext.CodeBase of this ValueHandler.
-
useFullValueDescription
public boolean useFullValueDescription(java.lang.Class clazz, java.lang.String repositoryID) throws java.io.IOExceptionReturns a boolean of whether or not RepositoryId indicates FullValueDescriptor. used for backward compatability- Parameters:
clazz- The type to get description forrepositoryID- The repository ID- Returns:
- If full description should be retrieved
- Throws:
java.io.IOException- If suids do not match or if the repositoryID is not an RMIValueType.
-
getClassName
public java.lang.String getClassName(java.lang.String id)
-
getClassFromType
public java.lang.Class getClassFromType(java.lang.String id) throws java.lang.ClassNotFoundException- Throws:
java.lang.ClassNotFoundException
-
getAnyClassFromType
public java.lang.Class getAnyClassFromType(java.lang.String id) throws java.lang.ClassNotFoundException- Throws:
java.lang.ClassNotFoundException
-
createForAnyType
public java.lang.String createForAnyType(java.lang.Class cl)
-
getDefinedInId
public java.lang.String getDefinedInId(java.lang.String id)
-
getUnqualifiedName
public java.lang.String getUnqualifiedName(java.lang.String id)
-
getSerialVersionUID
public java.lang.String getSerialVersionUID(java.lang.String id)
-
isAbstractBase
public boolean isAbstractBase(java.lang.Class clazz)
-
isSequence
public boolean isSequence(java.lang.String id)
-
writeReplace
public java.io.Serializable writeReplace(java.io.Serializable value)
If the value contains a writeReplace method then the result is returned. Otherwise, the value itself is returned.- Specified by:
writeReplacein interfaceValueHandler- Parameters:
value- the value to be marshaled.- Returns:
- the true value to marshal on the wire.
-
writeCharArray
private void writeCharArray(OutputStream out, char[] array, int offset, int length)
Encapsulates writing of Java char arrays so that the 1.3 subclass can override it without exposing internals across packages. This is a fix for bug 4367783.
-
write_Array
private void write_Array(OutputStream out, java.io.Serializable obj, java.lang.Class type)
-
readCharArray
private void readCharArray(InputStream in, char[] array, int offset, int length)
Encapsulates reading of Java char arrays so that the 1.3 subclass can override it without exposing internals across packages. This is a fix for bug 4367783.
-
read_Array
private java.lang.Object read_Array(IIOPInputStream bridge, InputStream in, java.lang.Class sequence, CodeBase sender, int offset)
-
isArray
private boolean isArray(java.lang.String repId)
-
createOutputStream
private IIOPOutputStream createOutputStream()
-
createInputStream
private IIOPInputStream createInputStream()
-
getJavaCharTCKind
TCKind getJavaCharTCKind()
Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. The correct behavior is for a Java char to map to a CORBA wchar, but our older code mapped it to a CORBA char.
-
-