org.openadaptor.adaptor.ldap
Class LDAPSink
java.lang.Object
org.openadaptor.adaptor.SimpleComponent
org.openadaptor.adaptor.AbstractWriter
org.openadaptor.adaptor.AbstractSimpleSink
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:
- Directory: The URL of the LDAP server to connect to ldap://[server]
- Username: The username to bind as to the server, or in ldap-speak the
ldap authentification principal e.g. cn=Directory Manager
- Password: The password for username.
- DoSmartModifications: If true, then it try to "do the right thing"
with modifications. When modifying, if the entry does not exist
it will add it (adding when there is already an existing entry
still generates an error),
deleting non-existing attributes does generate an error etc. If false
then the modification will sent as-is to the server, JNDI imposes
a very strict interpretation of the modification. Default: true
- DoModifications: If true, then modifications will be made to the
server. This may seem strange, but it is handy for testing to see
what changes would have been made.
- ChangeLogCreate: If true, then a log will be created for all
changes made to the server. This will still be created even if
doModifications is false, allowing you to see what changes would have
been made. The delimiter between events in the log will indicate
whether changes were actually being made to the server.
Default: true
- ChangeLogFileName: The name of the file to put the change log into.
Default: changelog.txt
- ChangeLogOverwrite: Overwrite the change log file when a new sink is
initialised. Default: true
- RollbackLogCreate: If true, then a log will be created containing
modifications in LDIF that will return the server to its original
state. Default: true
- RollbackLogFileName: The name of the file to put the rollback log into.
Default: rollbacklog.ldif
- RollbackLogOverwrite: Overwrite the rollback log file when a new
sink is initialised. Default: true
- Author:
- Michael Roeschter, Mark Jenner, Russ Fennell
Field Summary |
(package private) static org.apache.log4j.Logger |
log
|
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.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 |
log
static org.apache.log4j.Logger log
LDAPSink
public LDAPSink()
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 componentprops
- Properties objectprefix
- Prefix string to search for propertiescontroller
- 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