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

java.lang.Object
  extended by org.jboss.soa.esb.actions.converters.ObjectToCSVString
All Implemented Interfaces:
ActionProcessor

public class ObjectToCSVString
extends java.lang.Object
implements ActionProcessor

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
           
 
Constructor Summary
ObjectToCSVString(ConfigTree properties)
          Public constructor.
ObjectToCSVString(java.lang.String actionName, java.util.List<KeyValuePair> properties)
          Public constructor.
 
Method Summary
 java.io.Serializable getErrorNotification(Message message)
          Get the "Error" notification message for this processor.
 java.io.Serializable getOkNotification(Message message)
          Get the "OK" notification message for this processor.
 Message process(Message message)
          Perform the processing action on the message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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: ActionProcessor
Perform the processing action on the message

Specified by:
process in interface ActionProcessor
Parameters:
message - The message to be processed.
Returns:
Message - result of process
Throws:
ActionProcessingException - Exception during payload processing.

getOkNotification

public java.io.Serializable getOkNotification(Message message)
Description copied from interface: ActionProcessor
Get the "OK" notification message for this processor.

Specified by:
getOkNotification in interface ActionProcessor
Parameters:
message - The message Object.
Returns:
The OK message.

getErrorNotification

public java.io.Serializable getErrorNotification(Message message)
Description copied from interface: ActionProcessor
Get the "Error" notification message for this processor.

Specified by:
getErrorNotification in interface ActionProcessor
Parameters:
message - The message Object.
Returns:
The Error message.