org.openadaptor.adaptor.ldap
Class LDAPSink

java.lang.Object
  extended by org.openadaptor.adaptor.SimpleComponent
      extended by org.openadaptor.adaptor.AbstractWriter
          extended by org.openadaptor.adaptor.AbstractSimpleSink
              extended by org.openadaptor.adaptor.ldap.LDAPSink
All Implemented Interfaces:
CallbackProvider, Component, Configurable, IbafTransactionalResource, Sink, DOMessageReaderDelegate

public class LDAPSink
extends AbstractSimpleSink

This sink makes changes to an LDAP directory. DataObjects are expected to to represent objects of the org.openadaptor.adaptor.ldap.LDAPEventModification class and should be created using the LDAPEventModificationDO.entryModToDO helper method which will perform the necessary translation. The first thing this sink will try to do is recreate the LDAPEventModification using the twin of this helper method doToEntryMod.

Once an LDAPEntryModification has been received the sink will apply it to the LDAP server using the org.openadaptor.adaptor.ldap.LDAP class. There are no limitations imposed by this sink beyond those of the LDAP class on the nature of the event modification. It can contain multiple modifications for a single attribute, and deal with binary attributes.

The LDAP class does not handle referrals.

The following properties can be used to modify the behaviour of this sink:

Author:
Michael Roeschter, Mark Jenner, Russ Fennell

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openadaptor.adaptor.SimpleComponent
SimpleComponent.StateHolder
 
Field Summary
(package private) static org.apache.log4j.Logger log
           
 
Fields inherited from class org.openadaptor.adaptor.AbstractSimpleSink
_continue_on_exception
 
Fields inherited from class org.openadaptor.adaptor.AbstractWriter
_packetName, _packetSize, _record_delimiter, _string_writer, _writeBatchAsRecord, _writer, PACKET_NAME, PACKET_SIZE
 
Fields inherited from class org.openadaptor.adaptor.SimpleComponent
_controller, _formatter, _name, _propsPrefix, _readerDelegate, _textEncoding, MESSAGE_WRITER_PREFIX, MESSAGEID_ATTR, TEXT_ENCODING_ATTR
 
Constructor Summary
LDAPSink()
           
 
Method Summary
 void cleanUp()
          clean up the log writter settings
 void init(java.lang.String name, java.util.Properties props, java.lang.String prefix, Controller controller)
          Iniialize LDAPSink by reading all configuration properties.
 void processMessage(Message msg)
          Decomposes message into dataobjects and passes them individually to processSingleObject.
 void processSingleObject(DataObject ado)
          Process a single DataObject.
 
Methods inherited from class org.openadaptor.adaptor.AbstractSimpleSink
processHospitalException, writerHospitalException
 
Methods inherited from class org.openadaptor.adaptor.AbstractWriter
getDOStringWriter, getRecordDelimiter, getWriter, setDOStringWriter, setRecordDelimiter, setWriter, writeDataObjects, writeMessage, writerCleanUp, writeRecord, writerStartUp
 
Methods inherited from class org.openadaptor.adaptor.SimpleComponent
addCallback, canUpdateWhileRunning, customControl, didReceiveMessage, getAsProperties, getCallbackManager, getCurrentState, getCustomControlProperties, getLastUID, getName, getProperty, getProperty, getPropsPrefix, getRequestedState, getSecurityManager, getStatus, getTextEncoding, getXMLFormatter, notifyEvent, pause, removeCallback, resume, setCallbackManager, setCallbackManager, setCurrentState, setFromProperties, 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
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
canUpdateWhileRunning, getAsProperties, setFromProperties, setFromProperties
 
Methods inherited from interface org.openadaptor.adaptor.CallbackProvider
addCallback, getCallbackManager, notifyEvent, removeCallback, setCallbackManager, setCallbackManager
 

Field Detail

log

static org.apache.log4j.Logger log
Constructor Detail

LDAPSink

public LDAPSink()
Method Detail

init

public void init(java.lang.String name,
                 java.util.Properties props,
                 java.lang.String prefix,
                 Controller controller)
          throws IbafException
Iniialize LDAPSink by reading all configuration properties. See the class comment for a list of accepted properties.

Specified by:
init in interface Component
Overrides:
init in class AbstractSimpleSink
Parameters:
name - The name to be given to the component
props - Properties object
prefix - Prefix string to search for properties
controller - The component's controller object
Throws:
IbafException - Thrown if initialisation fails, mandatory properties are missing or properties cannot be parsed.
See Also:
Controller, SimpleController

processMessage

public void processMessage(Message msg)
                    throws PipelineException
Decomposes message into dataobjects and passes them individually to processSingleObject.

Specified by:
processMessage in interface Sink
Specified by:
processMessage in class AbstractSimpleSink
Parameters:
msg - The message to process.
Throws:
PipelineException - If there was a problem processing the message.

processSingleObject

public void processSingleObject(DataObject ado)
                         throws PipelineException
Process a single DataObject. This method will convert the DataObject into an EntryModification and then apply it to the LDAP server.

Parameters:
ado - The dataobject to process.
Throws:
PipelineException - If there was a problem processing the dataobject.

cleanUp

public void cleanUp()
             throws IbafException
clean up the log writter settings

Specified by:
cleanUp in interface Component
Overrides:
cleanUp in class AbstractSimpleSink
Throws:
IbafException