de.netseeker.ejoe.adapter
Class CastorAdapter

java.lang.Object
  extended byde.netseeker.ejoe.adapter.CastorAdapter
All Implemented Interfaces:
java.io.Serializable, SerializeAdapter

public class CastorAdapter
extends java.lang.Object
implements SerializeAdapter

An adapter for (de)serializing objects via the Castor XML library. This adapter implementation uses the performance hints described in the Castor Marshalling FAQ, that means it does:

Furthermore it does reuse one Unmarshaller instance.

Author:
netseeker
See Also:
Serialized Form

Constructor Summary
CastorAdapter()
          Creates a new instance of this adapter.
CastorAdapter(boolean validate)
          Creates a new instance of this adapter.
CastorAdapter(org.exolab.castor.mapping.Mapping mapping)
          Creates a new instance of this adapter using the given Castor mapping.
CastorAdapter(java.lang.String pathToMappingFile)
          Creates a new instance of this adapter using the Castor mapping loaded from the given mapping file.
CastorAdapter(java.net.URL pathToMappingFile)
          Creates a new instance of this adapter using the Castor mapping loaded from the given mapping file.
 
Method Summary
 void handleClassLoaderChange(java.lang.ClassLoader classLoader)
          Signals a change of the ContextClassLoader of the current thread to the adapter.
 java.lang.Object read(java.io.InputStream in)
          Deserializes an object out of an given InputStream
 void setValidation(boolean enable)
          Either enables or disables Castors validation feature.
 void write(java.lang.Object obj, java.io.OutputStream out)
          Serializes an object into an output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CastorAdapter

public CastorAdapter()
Creates a new instance of this adapter.


CastorAdapter

public CastorAdapter(boolean validate)
Creates a new instance of this adapter. Castor validation is enabled/disabled according to the given value.

Parameters:
validate - either Castor validation should be enabled or not.

CastorAdapter

public CastorAdapter(org.exolab.castor.mapping.Mapping mapping)
              throws org.exolab.castor.mapping.MappingException
Creates a new instance of this adapter using the given Castor mapping.

Parameters:
mapping - existing Castor mapping to use
Throws:
org.exolab.castor.mapping.MappingException

CastorAdapter

public CastorAdapter(java.lang.String pathToMappingFile)
              throws java.io.IOException,
                     org.exolab.castor.mapping.MappingException
Creates a new instance of this adapter using the Castor mapping loaded from the given mapping file.

Parameters:
pathToMappingFile - path of the Castor mapping file to use
Throws:
java.io.IOException
org.exolab.castor.mapping.MappingException

CastorAdapter

public CastorAdapter(java.net.URL pathToMappingFile)
              throws java.io.IOException,
                     org.exolab.castor.mapping.MappingException
Creates a new instance of this adapter using the Castor mapping loaded from the given mapping file.

Parameters:
pathToMappingFile - path of the Castor mapping file to use
Throws:
java.io.IOException
org.exolab.castor.mapping.MappingException
Method Detail

setValidation

public void setValidation(boolean enable)
Either enables or disables Castors validation feature.

Parameters:
enable -

read

public java.lang.Object read(java.io.InputStream in)
                      throws java.io.IOException
Description copied from interface: SerializeAdapter
Deserializes an object out of an given InputStream

Specified by:
read in interface SerializeAdapter
Parameters:
in - the input stream to use for deserialization
Returns:
a deserialized object instance
Throws:
java.io.IOException

write

public void write(java.lang.Object obj,
                  java.io.OutputStream out)
           throws java.io.IOException
Description copied from interface: SerializeAdapter
Serializes an object into an output stream

Specified by:
write in interface SerializeAdapter
Parameters:
obj - object that should get serialized
out - the outputstream into which the object should serialized
Throws:
java.io.IOException

handleClassLoaderChange

public void handleClassLoaderChange(java.lang.ClassLoader classLoader)
Description copied from interface: SerializeAdapter
Signals a change of the ContextClassLoader of the current thread to the adapter. This method will be called when the EJOE client is started with support for remote classloading.

Specified by:
handleClassLoaderChange in interface SerializeAdapter
Parameters:
classLoader -


Copyright © 2005-2006 netseeker. All Rights Reserved.