org.apache.camel.dataformat.castor
Class AbstractCastorDataFormat

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.dataformat.castor.AbstractCastorDataFormat
All Implemented Interfaces:
org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
Direct Known Subclasses:
CastorDataFormat

public abstract class AbstractCastorDataFormat
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.spi.DataFormat, org.apache.camel.CamelContextAware

An abstract class which implement data format (DataFormat) interface which leverage the Castor library for XML marshaling and unmarshaling


Field Summary
static String DEFAULT_ENCODING
          The default encoding used for stream access.
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
AbstractCastorDataFormat()
           
AbstractCastorDataFormat(org.exolab.castor.xml.XMLContext xmlContext)
           
 
Method Summary
 org.exolab.castor.xml.Marshaller createMarshaller(org.apache.camel.Exchange exchange)
           
 org.exolab.castor.xml.Unmarshaller createUnmarshaller(org.apache.camel.Exchange exchange)
           
protected  org.exolab.castor.xml.XMLContext createXMLContext(org.apache.camel.spi.ClassResolver resolver, ClassLoader contextClassLoader)
           
protected  void doStart()
           
protected  void doStop()
           
 org.apache.camel.CamelContext getCamelContext()
           
 String[] getClassNames()
           
 String getEncoding()
           
 String getMappingFile()
           
 String[] getPackages()
           
 boolean isValidation()
           
 void marshal(org.apache.camel.Exchange exchange, Object body, OutputStream outputStream)
           
 void setCamelContext(org.apache.camel.CamelContext camelContext)
           
 void setClassNames(String[] classNames)
           
 void setEncoding(String encoding)
           
 void setMappingFile(String mappingFile)
           
 void setPackages(String[] packages)
           
 void setValidation(boolean validation)
           
 void setXmlContext(org.exolab.castor.xml.XMLContext xmlContext)
           
 Object unmarshal(org.apache.camel.Exchange exchange, InputStream inputStream)
           
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static final String DEFAULT_ENCODING
The default encoding used for stream access.

See Also:
Constant Field Values
Constructor Detail

AbstractCastorDataFormat

public AbstractCastorDataFormat()

AbstractCastorDataFormat

public AbstractCastorDataFormat(org.exolab.castor.xml.XMLContext xmlContext)
Method Detail

marshal

public void marshal(org.apache.camel.Exchange exchange,
                    Object body,
                    OutputStream outputStream)
             throws Exception
Specified by:
marshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

unmarshal

public Object unmarshal(org.apache.camel.Exchange exchange,
                        InputStream inputStream)
                 throws Exception
Specified by:
unmarshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

createXMLContext

protected org.exolab.castor.xml.XMLContext createXMLContext(org.apache.camel.spi.ClassResolver resolver,
                                                            ClassLoader contextClassLoader)
                                                     throws Exception
Throws:
Exception

getCamelContext

public org.apache.camel.CamelContext getCamelContext()
Specified by:
getCamelContext in interface org.apache.camel.CamelContextAware

setCamelContext

public void setCamelContext(org.apache.camel.CamelContext camelContext)
Specified by:
setCamelContext in interface org.apache.camel.CamelContextAware

createUnmarshaller

public org.exolab.castor.xml.Unmarshaller createUnmarshaller(org.apache.camel.Exchange exchange)
                                                      throws Exception
Throws:
Exception

createMarshaller

public org.exolab.castor.xml.Marshaller createMarshaller(org.apache.camel.Exchange exchange)
                                                  throws Exception
Throws:
Exception

setXmlContext

public void setXmlContext(org.exolab.castor.xml.XMLContext xmlContext)

getMappingFile

public String getMappingFile()

setMappingFile

public void setMappingFile(String mappingFile)

getClassNames

public String[] getClassNames()

setClassNames

public void setClassNames(String[] classNames)

getPackages

public String[] getPackages()

setPackages

public void setPackages(String[] packages)

getEncoding

public String getEncoding()

setEncoding

public void setEncoding(String encoding)

isValidation

public boolean isValidation()

setValidation

public void setValidation(boolean validation)

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class org.apache.camel.support.ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class org.apache.camel.support.ServiceSupport
Throws:
Exception


Apache Camel