org.apache.camel.model.dataformat
Class DataFormatType

java.lang.Object
  extended by org.apache.camel.model.IdentifiedType
      extended by org.apache.camel.model.dataformat.DataFormatType
All Implemented Interfaces:
DataFormat
Direct Known Subclasses:
ArtixDSDataFormat, CsvDataFormat, FlatpackDataFormat, HL7DataFormat, JaxbDataFormat, JsonDataFormat, SerializationDataFormat, StringDataFormat, XMLBeansDataFormat, XStreamDataFormat, ZipDataFormat

public class DataFormatType
extends IdentifiedType
implements DataFormat

Represents the base XML type for DataFormat.

Version:
$Revision: 51529 $

Constructor Summary
  DataFormatType()
           
  DataFormatType(DataFormat dataFormat)
           
protected DataFormatType(String dataFormatTypeName)
           
 
Method Summary
protected  void configureDataFormat(DataFormat dataFormat)
          Allows derived classes to customize the data format
protected  DataFormat createDataFormat(RouteContext routeContext)
          Factory method to create the data format instance
 DataFormat getDataFormat(RouteContext routeContext)
           
static DataFormat getDataFormat(RouteContext routeContext, DataFormatType type, String ref)
           
 void marshal(Exchange exchange, Object graph, OutputStream stream)
          Marshals the object to the given Stream.
protected  void setProperty(Object bean, String name, Object value)
          Sets a named property on the data format instance using introspection
 Object unmarshal(Exchange exchange, InputStream stream)
          Unmarshals the given stream into an object.
 
Methods inherited from class org.apache.camel.model.IdentifiedType
getId, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFormatType

public DataFormatType()

DataFormatType

public DataFormatType(DataFormat dataFormat)

DataFormatType

protected DataFormatType(String dataFormatTypeName)
Method Detail

getDataFormat

public static DataFormat getDataFormat(RouteContext routeContext,
                                       DataFormatType type,
                                       String ref)

marshal

public void marshal(Exchange exchange,
                    Object graph,
                    OutputStream stream)
             throws Exception
Description copied from interface: DataFormat
Marshals the object to the given Stream.

Specified by:
marshal in interface DataFormat
Parameters:
exchange - the current exchange
graph - the object to be marshalled
stream - the output stream to write the marshalled rersult to
Throws:
Exception - can be thrown

unmarshal

public Object unmarshal(Exchange exchange,
                        InputStream stream)
                 throws Exception
Description copied from interface: DataFormat
Unmarshals the given stream into an object.

Notice: The result is set as body on the exchange OUT message. It is possible to mutate the OUT message provided in the given exchange parameter. For instance adding headers to the OUT message will be preserved.

Specified by:
unmarshal in interface DataFormat
Parameters:
exchange - the current exchange
stream - the input stream with the object to be unmarshalled
Returns:
the unmarshalled object
Throws:
Exception - can be thrown

getDataFormat

public DataFormat getDataFormat(RouteContext routeContext)

createDataFormat

protected DataFormat createDataFormat(RouteContext routeContext)
Factory method to create the data format instance


configureDataFormat

protected void configureDataFormat(DataFormat dataFormat)
Allows derived classes to customize the data format


setProperty

protected void setProperty(Object bean,
                           String name,
                           Object value)
Sets a named property on the data format instance using introspection



Copyright © 2008 IONA Open Source Community. All Rights Reserved.