org.jboss.remoting.marshal.serializable
Class SerializableUnMarshaller

java.lang.Object
  extended by org.jboss.remoting.marshal.serializable.SerializableUnMarshaller
All Implemented Interfaces:
java.io.Serializable, PreferredStreamUnMarshaller, SerialUnMarshaller, UnMarshaller, VersionedUnMarshaller
Direct Known Subclasses:
CompressingUnMarshaller, EncryptingUnMarshaller, HTTPUnMarshaller

public class SerializableUnMarshaller
extends java.lang.Object
implements PreferredStreamUnMarshaller, VersionedUnMarshaller

Will perform the deserialization of objects off the wire.

Author:
Tom Elrod
See Also:
Serialized Form

Field Summary
protected  java.lang.ClassLoader customClassLoader
           
static java.lang.String DATATYPE
           
protected  java.lang.String serializationType
           
 
Constructor Summary
SerializableUnMarshaller()
           
 
Method Summary
 UnMarshaller cloneUnMarshaller()
           
 java.io.InputStream getMarshallingStream(java.io.InputStream inputStream)
          An application that calls getMarshallingStream() should provide a basic InpputStream, e.g., SocketIntputStream, which can be wrapped to provide the facilities desired by the PreferredStreamUnMarshaller.
 java.io.InputStream getMarshallingStream(java.io.InputStream inputStream, java.util.Map config)
          SerializableUnMarshaller prefers to read from an ObjectOutputStream wrapped around a BufferedInputStream
 java.lang.String getSerializationType()
           
 java.lang.Object read(java.io.InputStream inputStream, java.util.Map metadata)
          Reads the data from the input stream and converts to an Object.
 java.lang.Object read(java.io.InputStream inputStream, java.util.Map metadata, int version)
          Reads the data from the input stream and converts to an Object.
 void setClassLoader(java.lang.ClassLoader classloader)
          Sets the classloader to be used when deserializing objects off the wire.
 void setSerializationType(java.lang.String serializationType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATATYPE

public static final java.lang.String DATATYPE
See Also:
Constant Field Values

customClassLoader

protected java.lang.ClassLoader customClassLoader

serializationType

protected java.lang.String serializationType
Constructor Detail

SerializableUnMarshaller

public SerializableUnMarshaller()
Method Detail

getMarshallingStream

public java.io.InputStream getMarshallingStream(java.io.InputStream inputStream)
                                         throws java.io.IOException
Description copied from interface: PreferredStreamUnMarshaller
An application that calls getMarshallingStream() should provide a basic InpputStream, e.g., SocketIntputStream, which can be wrapped to provide the facilities desired by the PreferredStreamUnMarshaller.

Specified by:
getMarshallingStream in interface PreferredStreamUnMarshaller
Parameters:
inputStream - a raw IntputStream
Returns:
the InputStream to be used for marshalling
Throws:
java.io.IOException - if unable to create InputStream

getMarshallingStream

public java.io.InputStream getMarshallingStream(java.io.InputStream inputStream,
                                                java.util.Map config)
                                         throws java.io.IOException
SerializableUnMarshaller prefers to read from an ObjectOutputStream wrapped around a BufferedInputStream

Specified by:
getMarshallingStream in interface PreferredStreamUnMarshaller
Parameters:
inputStream - a raw IntputStream
config - a Map with configuration information (e.g., serialization type)
Returns:
the InputStream to be used for marshalling
Throws:
java.io.IOException - if unable to create InputStream

read

public java.lang.Object read(java.io.InputStream inputStream,
                             java.util.Map metadata)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Reads the data from the input stream and converts to an Object.

If the inputStream passed is an ObjectInputStream (which would prefer it not be), it will just use it as given. If the input stream is not an instance of ObjectInputStream, will wrap it with a custom ObjectInputStream (ObjectInputStreamWithClassLoader) and use it. The ObjectInputStreamWithClassLoader will use the custom class loader set in order to ensure that any classes not found within the local classloader can be loaded from the server and used within the client VM. If the inpustream is of type ObjectInputStreamWithClassLoader, then will just set the classloader to the custom classloader and proceed.

Specified by:
read in interface UnMarshaller
Parameters:
inputStream -
metadata -
Returns:
Throws:
java.io.IOException
java.lang.ClassNotFoundException

read

public java.lang.Object read(java.io.InputStream inputStream,
                             java.util.Map metadata,
                             int version)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Reads the data from the input stream and converts to an Object.

If the inputStream passed is an ObjectInputStream (which would prefer it not be), it will just use it as given. If the input stream is not an instance of ObjectInputStream, will wrap it with a custom ObjectInputStream (ObjectInputStreamWithClassLoader) and use it. The ObjectInputStreamWithClassLoader will use the custom class loader set in order to ensure that any classes not found within the local classloader can be loaded from the server and used within the client VM. If the inpustream is of type ObjectInputStreamWithClassLoader, then will just set the classloader to the custom classloader and proceed.

Specified by:
read in interface VersionedUnMarshaller
Parameters:
inputStream -
metadata -
version -
Returns:
Throws:
java.io.IOException
java.lang.ClassNotFoundException

setClassLoader

public void setClassLoader(java.lang.ClassLoader classloader)
Sets the classloader to be used when deserializing objects off the wire. This will ONLY be used in the when the input stream passed to the read() method is NOT an instance of ObjectInputStream.

Specified by:
setClassLoader in interface UnMarshaller
Parameters:
classloader -

cloneUnMarshaller

public UnMarshaller cloneUnMarshaller()
                               throws java.lang.CloneNotSupportedException
Specified by:
cloneUnMarshaller in interface UnMarshaller
Throws:
java.lang.CloneNotSupportedException

setSerializationType

public void setSerializationType(java.lang.String serializationType)
Specified by:
setSerializationType in interface SerialUnMarshaller

getSerializationType

public java.lang.String getSerializationType()
Specified by:
getSerializationType in interface SerialUnMarshaller


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.