org.jboss.soa.esb.actions.converters
Class ObjectToCSVString

java.lang.Object
  extended by org.jboss.soa.esb.actions.AbstractActionLifecycle
      extended by org.jboss.soa.esb.actions.AbstractActionPipelineProcessor
          extended by org.jboss.soa.esb.actions.converters.ObjectToCSVString
All Implemented Interfaces:
ActionLifecycle, ActionPipelineProcessor

public class ObjectToCSVString
extends AbstractActionPipelineProcessor

Object to CSV String processor.

Returns a CSV string based on the supplied message object and a comma-separated "bean-properties" action property that specifies a list of bean property names.

Sample Action Configuration:

 <Action name="Customer-To-CSV" processor="ObjectToCSVString">
     <property name="bean-properties" value="name,address1,address2,phone" />
     <property name="fail-on-missing-property" value="true" /> <!-- (Optional) Default of false. -->
 </Action>
 

TODO: Add support for arrays ala producing the contents of a CSV file.

Since:
Version 4.0
Author:
tom.fennelly@jboss.com

Field Summary
static java.lang.String BEAN_PROPERTIES_PROP
           
static java.lang.String FAIL_ON_MISSING_PROPERTY
           
 
Fields inherited from interface org.jboss.soa.esb.actions.ActionPipelineProcessor
PROCESS_EXCEPTION_METHOD, PROCESS_METHOD, PROCESS_SUCCESS_METHOD
 
Constructor Summary
ObjectToCSVString(ConfigTree properties)
          Public constructor.
ObjectToCSVString(java.lang.String actionName, java.util.List<KeyValuePair> properties)
          Public constructor.
 
Method Summary
 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

BEAN_PROPERTIES_PROP

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

FAIL_ON_MISSING_PROPERTY

public static final java.lang.String FAIL_ON_MISSING_PROPERTY
See Also:
Constant Field Values
Constructor Detail

ObjectToCSVString

public ObjectToCSVString(ConfigTree properties)
                  throws ConfigurationException
Public constructor.

Parameters:
properties - Action Properties.
Throws:
ConfigurationException - Action not properly configured.

ObjectToCSVString

public ObjectToCSVString(java.lang.String actionName,
                         java.util.List<KeyValuePair> properties)
                  throws ConfigurationException
Public constructor.

Parameters:
actionName - Action name.
properties - 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.