com.unboundid.directory.sdk.sync.types
Interface SyncOperation


public interface SyncOperation

This interface represents a single synchronized change from the Sync Source to the Sync Destination. It exists from when a change is detected all the way through when the change is applied at the destination.


Method Summary
 void addModifiedDestinationAttribute(java.lang.String attributeName)
          Add the name of a destination attribute that should be synchronized.
 void addModifiedSourceAttribute(java.lang.String attributeName)
          Add an additional source attribute that should be synchronized to the destination.
 java.lang.Object getAttachment(java.lang.Object key)
          Returns an attachment from the operation that was previously set with a call to putAttachment(java.lang.Object, java.lang.Object).
 com.unboundid.ldap.sdk.ChangeLogEntry getChangeLogEntry()
          Return the original changelog entry that was detected for this operation.
 ChangeRecord getChangeRecord()
          Return the original change record that was detected for this operation.
 DatabaseChangeRecord getDatabaseChangeRecord()
          Return the DatabaseChangeRecord that was detected from a RDBMS.
 com.unboundid.ldap.sdk.Entry getDestinationEntryAfterChange()
          Returns a representation of the target destination entry after it is modified or renamed.
 com.unboundid.ldap.sdk.Entry getDestinationEntryBeforeChange()
          Returns a representation of the target destination entry before it is modified or renamed.
 java.lang.String getIdentifiableInfo()
          Return a String that can be used to correlate this change back to the source entry.
 java.util.Collection<java.lang.String> getModifiedSourceAttributes()
          Return the names of the attributes that were modified at the source.
 com.unboundid.ldap.sdk.Entry getSourceEntry()
          Return the Entry that was fetched from the sync source.
 SyncClass getSyncClass()
          Return the SyncClass for the operation being processed.
 java.lang.String getSyncClassName()
          Return the name of the Sync Class for the operation being processed.
 java.lang.String getSyncPipeName()
          Return the name of the Sync Pipe for the operation being processed.
 SyncOperationType getType()
          Return the type of this SynchronizationOperation.
 com.unboundid.ldap.sdk.unboundidds.UnboundIDChangeLogEntry getUnboundIDChangeLogEntry()
          Return the original changelog entry that was detected for this operation.
 java.lang.String getUniqueId()
          Return a unique ID for this SyncOperation.
 java.util.List<java.lang.String> getWarnings()
          Returns a list of warning messages (if any) about this SyncOperation.
 boolean isModifyDN()
          Determines whether this SyncOperation represents a modify DN operation on the source entry (if the source is an LDAP directory).
 void logError(java.lang.String message)
          Logs an error message to the synchronization log for this change.
 void logInfo(java.lang.String message)
          Logs an informational message to the synchronization log for this change.
 void putAttachment(java.lang.Object key, java.lang.Object value)
          Stores an attachment in the operation.
 void removeModifiedSourceAttribute(java.lang.String attributeName)
          Remove a source attribute that should not be synchronized to the destination.
 void setSourceEntry(com.unboundid.ldap.sdk.Entry sourceEntry, boolean isDeletedEntry)
          Sets the entry that was fetched from the sync source.
 

Method Detail

getType

SyncOperationType getType()
Return the type of this SynchronizationOperation.

Returns:
The type of this SynchronizationOperation.

getIdentifiableInfo

java.lang.String getIdentifiableInfo()
Return a String that can be used to correlate this change back to the source entry. For example, if the source endpoint is a directory server, this will be a DN.

Returns:
A String that can be used to correlate this change back to the source entry.

getUniqueId

java.lang.String getUniqueId()
Return a unique ID for this SyncOperation. This ID is used in log messages.

Returns:
A unique ID for this operation.

getSourceEntry

com.unboundid.ldap.sdk.Entry getSourceEntry()
Return the Entry that was fetched from the sync source. This may be null if the source entry no longer exists or has not yet been fetched.

Returns:
The entry entry that was fetched from the source server.

setSourceEntry

void setSourceEntry(com.unboundid.ldap.sdk.Entry sourceEntry,
                    boolean isDeletedEntry)
Sets the entry that was fetched from the sync source. If the entry was deleted, then sufficient information about the entry must be provided so that it can be correlated to a destination entry.

Parameters:
sourceEntry - The entry that was fetched from the source.
isDeletedEntry - true if and only if the entry was deleted at the source.

getChangeLogEntry

com.unboundid.ldap.sdk.ChangeLogEntry getChangeLogEntry()
Return the original changelog entry that was detected for this operation. This is only applicable when synchronizing from a data source that supplies an LDAP changelog as described in draft-good-ldap-changelog, such as the UnboundID Directory Server or Sun Directory Server.

Note that this is the raw changelog entry and does not have any mappings or filterings applied to it.

Returns:
a ChangeLogEntry instance, or null if the source endpoint does not use an LDAP changelog for change detection.

getUnboundIDChangeLogEntry

com.unboundid.ldap.sdk.unboundidds.UnboundIDChangeLogEntry getUnboundIDChangeLogEntry()
Return the original changelog entry that was detected for this operation. This is only applicable when synchronizing from an UnboundID Directory Server. The UnboundID LDAP Changelog provides additional functionality not present in other directory servers.

Note that this is the raw changelog entry and does not have any mappings or filterings applied to it.

Returns:
a UnboundIDChangeLogEntry instance, or null if the source endpoint is not an UnboundID Directory Server.

getChangeRecord

ChangeRecord getChangeRecord()
Return the original change record that was detected for this operation. This is only applicable when synchronizing from a data source that is implemented by the SyncSource or ScriptedSyncSource extension type.

Returns:
a ChangeRecord instance, or null if the source endpoint is not an instance of SyncSource or ScriptedSyncSource.

getDatabaseChangeRecord

DatabaseChangeRecord getDatabaseChangeRecord()
Return the DatabaseChangeRecord that was detected from a RDBMS. This is only applicable when synchronizing from a database environment, and will be null otherwise.

Returns:
a DatabaseChangeRecord that was detected from a database, or null if the sync source is not a JDBC sync source.

isModifyDN

boolean isModifyDN()
Determines whether this SyncOperation represents a modify DN operation on the source entry (if the source is an LDAP directory). The result of this method is undefined if the source is a relational database or some other type of endpoint.

Returns:
true if the entry has been renamed, false otherwise.

getDestinationEntryBeforeChange

com.unboundid.ldap.sdk.Entry getDestinationEntryBeforeChange()
Returns a representation of the target destination entry before it is modified or renamed. This can be used to obtain the before-values of any attributes. The returned entry cannot be modified.

This value is only defined after the SyncOperation has made it past the post-mapping stage in the SyncPipe.

Returns:
a Entry instance.

getDestinationEntryAfterChange

com.unboundid.ldap.sdk.Entry getDestinationEntryAfterChange()
Returns a representation of the target destination entry after it is modified or renamed. This can be used to obtain the after-values of any attributes.

This value is only defined after the SyncOperation has made it past the post-mapping stage in the SyncPipe.

The returned entry is modifiable and can be used to influence the final list of modifications to apply at the destination. The Synchronization Server computes a diff between this entry and the existing entry returned from the destination. Any modifications to this entry would have to take place in either LDAPSyncDestinationPlugin.preFetch or LDAPSyncDestinationPlugin.postFetch.

Returns:
a Entry instance.

getModifiedSourceAttributes

java.util.Collection<java.lang.String> getModifiedSourceAttributes()
Return the names of the attributes that were modified at the source.

Returns:
The names of the attributes that were modified at the source.

addModifiedSourceAttribute

void addModifiedSourceAttribute(java.lang.String attributeName)
Add an additional source attribute that should be synchronized to the destination.

Parameters:
attributeName - The attribute to add to the set of attributes to synchronize.

removeModifiedSourceAttribute

void removeModifiedSourceAttribute(java.lang.String attributeName)
Remove a source attribute that should not be synchronized to the destination.

Parameters:
attributeName - The attribute to remove from the set of attributes to synchronize.

addModifiedDestinationAttribute

void addModifiedDestinationAttribute(java.lang.String attributeName)
Add the name of a destination attribute that should be synchronized.

Parameters:
attributeName - The name of the destination attribute to synchronize.

getSyncPipeName

java.lang.String getSyncPipeName()
Return the name of the Sync Pipe for the operation being processed.

Returns:
The name of the Sync Pipe for the operation being processed.

getSyncClassName

java.lang.String getSyncClassName()
Return the name of the Sync Class for the operation being processed.

Returns:
The name of the Sync Class for the operation being processed.

getSyncClass

SyncClass getSyncClass()
Return the SyncClass for the operation being processed. This can be used to determine the correlation attributes and other properties configured for this type of change.

Returns:
The Sync Class that this operation falls into, or null if no Sync Class has been determined yet.

putAttachment

void putAttachment(java.lang.Object key,
                   java.lang.Object value)
Stores an attachment in the operation. This can be used by an extension to have information carried in the synchronization operation from one extension point to the next.

Parameters:
key - The key of the attachment. To avoid conflicts, the fully-qualified class name of the extension should be used as a prefix of the key.
value - The value of the attachment.

getAttachment

java.lang.Object getAttachment(java.lang.Object key)
Returns an attachment from the operation that was previously set with a call to putAttachment(java.lang.Object, java.lang.Object).

Parameters:
key - The key of the attachment.
Returns:
The value of the attachment or null if no attachment was set for the specified key.

getWarnings

java.util.List<java.lang.String> getWarnings()
Returns a list of warning messages (if any) about this SyncOperation. For example, if a changelog entry omitted some data because an attribute had too many values, there will be a message in the returned list indicating so. Typically synchronization of this SyncOperation can continue despite these warnings.

Returns:
a list of warning messages; the list will be empty if there are no warnings.

logError

void logError(java.lang.String message)
Logs an error message to the synchronization log for this change. Messages logged here should pertain to this specific change. For general logging capabilities, see SyncServerContext

Parameters:
message - The message to log.

logInfo

void logInfo(java.lang.String message)
Logs an informational message to the synchronization log for this change. Messages logged here should pertain to this specific change. For general logging capabilities, see SyncServerContext

Parameters:
message - The message to log.