Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.soa.esb.actions.converters
Class ObjectToXStream

    java.lang.Object
      org.jboss.soa.esb.actions.AbstractActionLifecycle
          org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
              org.jboss.soa.esb.actions.converters.ObjectToXStream

All Implemented Interfaces:
  ActionLifecycle, ActionPipelineProcessor

    public class ObjectToXStream

extends AbstractActionPipelineProcessor

Object to XML processor.

Uses the XStream processor to generate an XML message String from the supplied object.

Sample Action Configuration:

     <Action name="Customer-To-XML" processor="ObjectToXStream">
         <property name="class-alias" value="Customer" /> <!-- Class alias used in call to XStream.alias(String, Class) prior to serialisation. -->
         <property name="exclude-package" value="false" /> <!-- Default "true".  Not applicable if a "class-alias" is specified. -->
         <property name="namespace-uri" value="namespace goes here" />
         <property name="aliases"> <!-- Optional list of extra aliases to add to XStream  -->
                    <alias name="aliasName" class="className" />
                    <alias name="aliasName" class="className" />
                    ...
         </property>
         <property name="namespaces"> <!-- Optional list of namespaces to register with XStream  -->
                    <namespace namespace-uri="http://www.xyz.com" local-part="xyz" />
                    <namespace namespace-uri="http://www.xyz.com/x" local-part="x" />
         </property>
                    ...
     </Action>

The XML root element is either set from the "class-alias" property or the classes full name. In the later case, the class package is excluded unless "exclude-package" is set to "false"/"no".

Since:
  Version 4.0
Author:
  tom.fennelly@jboss.com, daniel.bevenius@gmail.com

Field Summary
`static java.lang.String` | `ATTR_CLASS_ALIAS`
`static java.lang.String` | `ATTR_EXCLUDE_PACKAGE`
`static java.lang.String` | `ATTR_NAMESPACE_LOCALPART`
`static java.lang.String` | `ATTR_NAMESPACE_URI`
`static java.lang.String` | `ATTR_XSTREAM_MODE`

Fields inherited from interface org.jboss.soa.esb.actions.ActionPipelineProcessor
`PROCESS_EXCEPTION_METHOD, PROCESS_METHOD, PROCESS_SUCCESS_METHOD`

Constructor Summary
`ObjectToXStream(ConfigTree configTree)` Public constructor.

Method Summary
`protected com.thoughtworks.xstream.XStream` | `createXStreamInstance()` Creates an XStream instance.
`protected java.util.Map<java.lang.String,java.lang.String>` | `getNamespaces(ConfigTree configTree)` Will extract the namespace elements from the passed-in configTree
`Message` | `process(Message message)` Perform the action processing on the specified message.

Methods inherited from class org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
`processException, processSuccess`

Methods inherited from class org.jboss.soa.esb.actions.AbstractActionLifecycle
`destroy, initialise`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jboss.soa.esb.actions.ActionLifecycle
`destroy, initialise`

Field Detail

### ATTR_CLASS_ALIAS

    public static final java.lang.String ATTR_CLASS_ALIAS

See Also:
  Constant Field Values

### ATTR_EXCLUDE_PACKAGE

    public static final java.lang.String ATTR_EXCLUDE_PACKAGE

See Also:
  Constant Field Values

### ATTR_NAMESPACE_URI

    public static final java.lang.String ATTR_NAMESPACE_URI

See Also:
  Constant Field Values

### ATTR_NAMESPACE_LOCALPART

    public static final java.lang.String ATTR_NAMESPACE_LOCALPART

See Also:
  Constant Field Values

### ATTR_XSTREAM_MODE

    public static final java.lang.String ATTR_XSTREAM_MODE

See Also:
  Constant Field Values

Constructor Detail

### ObjectToXStream

    public ObjectToXStream(ConfigTree configTree)

  Public constructor.

  Parameters:
    `configTree` - Action Properties.
  Throws:
    `ConfigurationException` - Action not properly configured.

Method Detail

### process

    public Message process(Message message)
                    throws ActionProcessingException

  Description copied from interface: `ActionPipelineProcessor`
  Perform the action processing on the specified message. This method is invoked for each message passing throught the pipeline.

  Parameters:
    `message` - The current message being processed.
  Returns:
    The message to be passed to the next stage of the pipeline.
  Throws:
    `ActionProcessingException` - for errors during processing.

### createXStreamInstance

    protected com.thoughtworks.xstream.XStream createXStreamInstance()

  Creates an XStream instance. If namespace mappings have been defined the XStream instance is created with a StaxDriver configured with those mappings.

  Parameters:
    `aliases` - Map of aliases.
  Throws:
    `ActionProcessingException`

### getNamespaces

    protected java.util.Map<java.lang.String,java.lang.String> getNamespaces(ConfigTree configTree)

  Will extract the namespace elements from the passed-in configTree

  Parameters:
    `configTree` - the configuration for this class
  Returns:
    Map either an empty map or a map containing the name space URI as its key and the corresponding value is the local XML element name to map it to.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD