org.openadaptor.adaptor.standard
Class DOWrapperPipe

java.lang.Object
  extended by org.openadaptor.adaptor.SimpleComponent
      extended by org.openadaptor.adaptor.AbstractSimplePipe
          extended by org.openadaptor.adaptor.standard.DOWrapperPipe
All Implemented Interfaces:
CallbackProvider, Component, Configurable, IbafTransactionalResource, Sink, DOMessageReaderDelegate

public class DOWrapperPipe
extends AbstractSimplePipe

takes each DataObject from the message and "wraps" each one as the payload inside another DataObject. The attributes of the wrapper DataObject are defined in the properties file. Additionally, the original DataObject's type is stored as an attribute of the new DataObject.

Unless overridden in the properties file, the original DataObject is stored in the "payload" attribute of the wrapper. Note that if you define a similarly named attribute int he properties file then it's value will be overwritten.

Author:
Russ Fennell

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openadaptor.adaptor.SimpleComponent
SimpleComponent.StateHolder
 
Field Summary
(package private)  java.lang.Object[] _newAttributes
          array of the new attributes to be added to the wrapper DataObject
(package private)  SimpleDataObject _wrapper
          reference to the current wrapper DataObject
(package private) static org.apache.log4j.Logger log
           
 
Fields inherited from class org.openadaptor.adaptor.AbstractSimplePipe
_continue_on_exception, _deepCopy, _deepCopyOnlySDO, _disruptive
 
Fields inherited from class org.openadaptor.adaptor.SimpleComponent
_controller, _formatter, _name, _propsPrefix, _readerDelegate, _textEncoding, MESSAGE_WRITER_PREFIX, MESSAGEID_ATTR, TEXT_ENCODING_ATTR
 
Constructor Summary
DOWrapperPipe()
           
 
Method Summary
 void init(java.lang.String name, java.util.Properties properties, java.lang.String propsPrefix, Controller controller)
          initialises the pipe.
protected  DataObject[] transformDataObjects(DataObject[] inDobs)
          returns an array of DataObjects that is made up of the original DataObjects wrapped inside an wrapper DataObject whose new attributes are based on the definitions in the properties file.
 
Methods inherited from class org.openadaptor.adaptor.AbstractSimplePipe
canUpdateWhileRunning, getAsProperties, postProcessMessage, processHospitalException, processMessage, setDeepCopy, setDeepCopyUnlessSet, setDisruptive, setFromProperties
 
Methods inherited from class org.openadaptor.adaptor.SimpleComponent
addCallback, cleanUp, customControl, didReceiveMessage, getCallbackManager, getCurrentState, getCustomControlProperties, getLastUID, getName, getProperty, getProperty, getPropsPrefix, getRequestedState, getSecurityManager, getStatus, getTextEncoding, getXMLFormatter, notifyEvent, pause, removeCallback, resume, setCallbackManager, setCallbackManager, setCurrentState, setFromProperties, setFromResource, setName, setPropsPrefix, setRequestedState, terminate, txnBegin, txnCommit, txnCommitWithExceptions, txnRollback, txnRollback, waitForRequestedStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openadaptor.adaptor.Component
cleanUp, customControl, getName, getPropsPrefix, getRequestedState, getStatus, pause, resume, setName, setPropsPrefix, terminate
 
Methods inherited from interface org.openadaptor.adaptor.IbafTransactionalResource
txnBegin, txnCommit, txnCommitWithExceptions, txnRollback, txnRollback
 
Methods inherited from interface org.openadaptor.adaptor.Configurable
setFromProperties
 
Methods inherited from interface org.openadaptor.adaptor.CallbackProvider
addCallback, getCallbackManager, notifyEvent, removeCallback, setCallbackManager, setCallbackManager
 

Field Detail

log

static org.apache.log4j.Logger log

_wrapper

SimpleDataObject _wrapper
reference to the current wrapper DataObject


_newAttributes

java.lang.Object[] _newAttributes
array of the new attributes to be added to the wrapper DataObject

Constructor Detail

DOWrapperPipe

public DOWrapperPipe()
Method Detail

init

public void init(java.lang.String name,
                 java.util.Properties properties,
                 java.lang.String propsPrefix,
                 Controller controller)
          throws IbafException
initialises the pipe. Gets any wrapper attributes, the DataObject type to filter by and the name of the attribute that will hold the incoming DataObject as the payload.

Specified by:
init in interface Component
Overrides:
init in class AbstractSimplePipe
Parameters:
name - the adaptor name
properties - reference to the properties file
propsPrefix - property tag prefix made up of adaptor and component names
controller - reference to the adaptor controller
Throws:
IbafException
See Also:
AbstractSimpleSink.init(String,Properties,String,Controller), CheckMandatory.init(String,Properties,String,Controller)

transformDataObjects

protected DataObject[] transformDataObjects(DataObject[] inDobs)
                                     throws PipelineException
returns an array of DataObjects that is made up of the original DataObjects wrapped inside an wrapper DataObject whose new attributes are based on the definitions in the properties file.

Specified by:
transformDataObjects in class AbstractSimplePipe
Parameters:
inDobs - array of DataOBjects to be modified
Returns:
the array of wrapper DataObjects
Throws:
PipelineException
See Also:
AbstractSimplePipe.processMessage(Message)