org.opends.server.core
Class ModifyDNOperationBasis

java.lang.Object
  extended by org.opends.server.types.AbstractOperation
      extended by org.opends.server.core.ModifyDNOperationBasis
All Implemented Interfaces:
java.lang.Runnable, ModifyDNOperation, Operation, InProgressOperation, PluginOperation, PostResponseModifyDNOperation, PostResponseOperation, PreParseModifyDNOperation, PreParseOperation, SubordinateModifyDNOperation

public class ModifyDNOperationBasis
extends AbstractOperation
implements ModifyDNOperation, PreParseModifyDNOperation, PostResponseModifyDNOperation

This class defines an operation that may be used to alter the DN of an entry in the Directory Server.


Field Summary
 
Fields inherited from class org.opends.server.types.AbstractOperation
cancelRequest, cancelResult, clientConnection, messageID, NO_RESPONSE_CONTROLS, operationID, useNanoTime
 
Fields inherited from interface org.opends.server.types.Operation
LOCALBACKENDOPERATIONS
 
Constructor Summary
ModifyDNOperationBasis(ClientConnection clientConnection, long operationID, int messageID, java.util.List<Control> requestControls, ByteString rawEntryDN, ByteString rawNewRDN, boolean deleteOldRDN, ByteString rawNewSuperior)
          Creates a new modify DN operation with the provided information.
ModifyDNOperationBasis(ClientConnection clientConnection, long operationID, int messageID, java.util.List<Control> requestControls, DN entryDN, RDN newRDN, boolean deleteOldRDN, DN newSuperior)
          Creates a new modify DN operation with the provided information.
 
Method Summary
 void addModification(Modification modification)
          Adds the provided modification to the set of modifications to be applied as part of the update.
 void addResponseControl(Control control)
          Adds the provided control to the set of controls to include in the response to the client.
 boolean deleteOldRDN()
          Indicates whether the current RDN value should be removed from the entry.
 long getChangeNumber()
          Retrieves the change number that has been assigned to this operation.
 DN getEntryDN()
          Retrieves the DN of the entry to rename.
 java.util.List<Modification> getModifications()
          Retrieves the set of modifications applied to attributes of the target entry in the course of processing this modify DN operation.
 DN getNewDN()
          Retrieves the new DN for the entry.
 RDN getNewRDN()
          Retrieves the new RDN to use for the entry.
 DN getNewSuperior()
          Retrieves the newSuperior DN for the entry.
 OperationType getOperationType()
          Retrieves the operation type for this operation.
 Entry getOriginalEntry()
          Retrieves the current entry, before it is renamed.
 DN getProxiedAuthorizationDN()
          Retrieves the proxied authorization DN for this operation if proxied authorization has been requested.
 ByteString getRawEntryDN()
          Retrieves the raw, unprocessed entry DN as included in the client request.
 ByteString getRawNewRDN()
          Retrieves the raw, unprocessed newRDN as included in the request from the client.
 ByteString getRawNewSuperior()
          Retrieves the raw, unprocessed newSuperior from the client request.
 java.lang.String[][] getRequestLogElements()
          Retrieves a standard set of elements that should be logged in requests for this type of operation.
 java.util.List<Control> getResponseControls()
          Retrieves the set of controls to include in the response to the client.
 java.lang.String[][] getResponseLogElements()
          Retrieves a standard set of elements that should be logged in responses for this type of operation.
 Entry getUpdatedEntry()
          Retrieves the new entry, as it will appear after it is renamed.
 void removeResponseControl(Control control)
          Removes the provided control from the set of controls to include in the response to the client.
 void run()
          Performs the work of actually processing this operation.
 void setChangeNumber(long changeNumber)
          Specifies the change number that has been assigned to this operation by the synchronization mechanism.
 void setDeleteOldRDN(boolean deleteOldRDN)
          Specifies whether the current RDN value should be removed from the entry.
 void setProxiedAuthorizationDN(DN dn)
          Sets the proxied authorization DN for this operation if proxied authorization has been requested.
 void setRawEntryDN(ByteString rawEntryDN)
          Specifies the raw, unprocessed entry DN as included in the client request.
 void setRawNewRDN(ByteString rawNewRDN)
          Specifies the raw, unprocessed newRDN as included in the request from the client.
 void setRawNewSuperior(ByteString rawNewSuperior)
          Specifies the raw, unprocessed newSuperior for this modify DN operation, as provided in the request from the client.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this operation to the provided buffer.
 
Methods inherited from class org.opends.server.types.AbstractOperation
abort, addRequestControl, appendAdditionalLogMessage, appendErrorMessage, cancel, checkIfCanceled, disconnectClient, dontSynchronize, getAdditionalLogMessage, getAttachment, getAttachments, getAuthorizationDN, getAuthorizationEntry, getCancelRequest, getCancelResult, getClientConnection, getCommonLogElements, getConnectionID, getErrorMessage, getMatchedDN, getMessageID, getOperationID, getProcessingNanoTime, getProcessingStartTime, getProcessingStopTime, getProcessingTime, getReferralURLs, getRequestControls, getResultCode, isInternalOperation, isSynchronizationOperation, operationCompleted, removeAttachment, removeRequestControl, setAdditionalLogMessage, setAttachment, setAttachments, setAuthorizationEntry, setDontSynchronize, setErrorMessage, setInternalOperation, setMatchedDN, setProcessingStartTime, setProcessingStopTime, setReferralURLs, setResponseData, setResultCode, setSynchronizationOperation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opends.server.types.Operation
abort, addRequestControl, appendAdditionalLogMessage, appendErrorMessage, cancel, checkIfCanceled, disconnectClient, dontSynchronize, getAdditionalLogMessage, getAttachment, getAttachments, getAuthorizationDN, getAuthorizationEntry, getCancelRequest, getCancelResult, getClientConnection, getCommonLogElements, getConnectionID, getErrorMessage, getMatchedDN, getMessageID, getOperationID, getProcessingNanoTime, getProcessingStartTime, getProcessingStopTime, getProcessingTime, getReferralURLs, getRequestControls, getResultCode, isInternalOperation, isSynchronizationOperation, operationCompleted, removeAttachment, removeRequestControl, setAdditionalLogMessage, setAttachment, setAttachments, setAuthorizationEntry, setDontSynchronize, setErrorMessage, setInternalOperation, setMatchedDN, setReferralURLs, setResponseData, setResultCode, setSynchronizationOperation, toString
 
Methods inherited from interface org.opends.server.types.operation.InProgressOperation
appendAdditionalLogMessage, appendErrorMessage, getAdditionalLogMessage, getAuthorizationDN, getErrorMessage, getMatchedDN, getReferralURLs, getResultCode, setAdditionalLogMessage, setErrorMessage, setMatchedDN, setReferralURLs, setResponseData, setResultCode
 
Methods inherited from interface org.opends.server.types.operation.PluginOperation
checkIfCanceled, disconnectClient, getAttachment, getAttachments, getClientConnection, getConnectionID, getMessageID, getOperationID, getProcessingStartTime, getRequestControls, isInternalOperation, isSynchronizationOperation, removeAttachment, setAttachment, toString
 
Methods inherited from interface org.opends.server.types.operation.PreParseOperation
addRequestControl, appendAdditionalLogMessage, appendErrorMessage, getAdditionalLogMessage, getErrorMessage, removeRequestControl, setAdditionalLogMessage, setErrorMessage
 
Methods inherited from interface org.opends.server.types.operation.PostResponseOperation
getAdditionalLogMessage, getAuthorizationDN, getErrorMessage, getMatchedDN, getProcessingStopTime, getProcessingTime, getReferralURLs, getResultCode
 

Constructor Detail

ModifyDNOperationBasis

public ModifyDNOperationBasis(ClientConnection clientConnection,
                              long operationID,
                              int messageID,
                              java.util.List<Control> requestControls,
                              ByteString rawEntryDN,
                              ByteString rawNewRDN,
                              boolean deleteOldRDN,
                              ByteString rawNewSuperior)
Creates a new modify DN operation with the provided information.

Parameters:
clientConnection - The client connection with which this operation is associated.
operationID - The operation ID for this operation.
messageID - The message ID of the request with which this operation is associated.
requestControls - The set of controls included in the request.
rawEntryDN - The raw, unprocessed entry DN as included in the client request.
rawNewRDN - The raw, unprocessed newRDN as included in the client request.
deleteOldRDN - Indicates whether to delete the old RDN value from the entry.
rawNewSuperior - The raw, unprocessed newSuperior as included in the client request.

ModifyDNOperationBasis

public ModifyDNOperationBasis(ClientConnection clientConnection,
                              long operationID,
                              int messageID,
                              java.util.List<Control> requestControls,
                              DN entryDN,
                              RDN newRDN,
                              boolean deleteOldRDN,
                              DN newSuperior)
Creates a new modify DN operation with the provided information.

Parameters:
clientConnection - The client connection with which this operation is associated.
operationID - The operation ID for this operation.
messageID - The message ID of the request with which this operation is associated.
requestControls - The set of controls included in the request.
entryDN - The current entry DN for this modify DN operation.
newRDN - The new RDN for this modify DN operation.
deleteOldRDN - Indicates whether to delete the old RDN value from the entry.
newSuperior - The newSuperior DN for this modify DN operation.
Method Detail

getRawEntryDN

public final ByteString getRawEntryDN()
Retrieves the raw, unprocessed entry DN as included in the client request. The DN that is returned may or may not be a valid DN, since no validation will have been performed upon it.

Specified by:
getRawEntryDN in interface ModifyDNOperation
Specified by:
getRawEntryDN in interface PostResponseModifyDNOperation
Specified by:
getRawEntryDN in interface PreParseModifyDNOperation
Specified by:
getRawEntryDN in interface SubordinateModifyDNOperation
Returns:
The raw, unprocessed entry DN as included in the client request.

setRawEntryDN

public final void setRawEntryDN(ByteString rawEntryDN)
Specifies the raw, unprocessed entry DN as included in the client request. This should only be called by pre-parse plugins.

Specified by:
setRawEntryDN in interface ModifyDNOperation
Specified by:
setRawEntryDN in interface PreParseModifyDNOperation
Parameters:
rawEntryDN - The raw, unprocessed entry DN as included in the client request.

getEntryDN

public final DN getEntryDN()
Retrieves the DN of the entry to rename. This should not be called by pre-parse plugins because the processed DN will not be available yet. Instead, they should call the getRawEntryDN method.

Specified by:
getEntryDN in interface ModifyDNOperation
Specified by:
getEntryDN in interface PostResponseModifyDNOperation
Specified by:
getEntryDN in interface SubordinateModifyDNOperation
Returns:
The DN of the entry to rename, or null if the raw entry DN has not yet been processed.

getRawNewRDN

public final ByteString getRawNewRDN()
Retrieves the raw, unprocessed newRDN as included in the request from the client. This may or may not contain a valid RDN, as no validation will have been performed on it.

Specified by:
getRawNewRDN in interface ModifyDNOperation
Specified by:
getRawNewRDN in interface PostResponseModifyDNOperation
Specified by:
getRawNewRDN in interface PreParseModifyDNOperation
Specified by:
getRawNewRDN in interface SubordinateModifyDNOperation
Returns:
The raw, unprocessed newRDN as included in the request from the client.

setRawNewRDN

public final void setRawNewRDN(ByteString rawNewRDN)
Specifies the raw, unprocessed newRDN as included in the request from the client. This should only be called by pre-parse plugins and should not be used in later stages of processing.

Specified by:
setRawNewRDN in interface ModifyDNOperation
Specified by:
setRawNewRDN in interface PreParseModifyDNOperation
Parameters:
rawNewRDN - The raw, unprocessed newRDN as included in the request from the client.

getNewRDN

public final RDN getNewRDN()
Retrieves the new RDN to use for the entry. This should not be called by pre-parse plugins, because the processed newRDN will not yet be available. Pre-parse plugins should instead use the getRawNewRDN method.

Specified by:
getNewRDN in interface ModifyDNOperation
Specified by:
getNewRDN in interface PostResponseModifyDNOperation
Specified by:
getNewRDN in interface SubordinateModifyDNOperation
Returns:
The new RDN to use for the entry, or null if the raw newRDN has not yet been processed.

deleteOldRDN

public final boolean deleteOldRDN()
Indicates whether the current RDN value should be removed from the entry.

Specified by:
deleteOldRDN in interface ModifyDNOperation
Specified by:
deleteOldRDN in interface PostResponseModifyDNOperation
Specified by:
deleteOldRDN in interface PreParseModifyDNOperation
Specified by:
deleteOldRDN in interface SubordinateModifyDNOperation
Returns:
true if the current RDN value should be removed from the entry, or false if not.

setDeleteOldRDN

public final void setDeleteOldRDN(boolean deleteOldRDN)
Specifies whether the current RDN value should be removed from the entry.

Specified by:
setDeleteOldRDN in interface ModifyDNOperation
Specified by:
setDeleteOldRDN in interface PreParseModifyDNOperation
Parameters:
deleteOldRDN - Specifies whether the current RDN value should be removed from the entry.

getRawNewSuperior

public final ByteString getRawNewSuperior()
Retrieves the raw, unprocessed newSuperior from the client request. This may or may not contain a valid DN, as no validation will have been performed on it.

Specified by:
getRawNewSuperior in interface ModifyDNOperation
Specified by:
getRawNewSuperior in interface PostResponseModifyDNOperation
Specified by:
getRawNewSuperior in interface PreParseModifyDNOperation
Specified by:
getRawNewSuperior in interface SubordinateModifyDNOperation
Returns:
The raw, unprocessed newSuperior from the client request, or null if there is none.

setRawNewSuperior

public final void setRawNewSuperior(ByteString rawNewSuperior)
Specifies the raw, unprocessed newSuperior for this modify DN operation, as provided in the request from the client. This method should only be called by pre-parse plugins.

Specified by:
setRawNewSuperior in interface ModifyDNOperation
Specified by:
setRawNewSuperior in interface PreParseModifyDNOperation
Parameters:
rawNewSuperior - The raw, unprocessed newSuperior as provided in the request from the client.

getNewSuperior

public final DN getNewSuperior()
Retrieves the newSuperior DN for the entry. This should not be called by pre-parse plugins, because the processed DN will not yet be available at that time. Instead, they should use the getRawNewSuperior method.

Specified by:
getNewSuperior in interface ModifyDNOperation
Specified by:
getNewSuperior in interface PostResponseModifyDNOperation
Specified by:
getNewSuperior in interface SubordinateModifyDNOperation
Returns:
The newSuperior DN for the entry, or null if there is no newSuperior DN for this request or if the raw newSuperior has not yet been processed.

getModifications

public final java.util.List<Modification> getModifications()
Retrieves the set of modifications applied to attributes of the target entry in the course of processing this modify DN operation. This will include attribute-level changes from the modify DN itself (e.g., removing old RDN values if deleteOldRDN is set, or adding new RDN values that don't already exist), but it may also be used by pre-operation plugins to cause additional changes in the entry. In this case, those plugins may add modifications to this list (they may not remove existing modifications) if any changes should be processed in addition to the core modify DN processing. Backends may read this list to identify which attribute-level changes were applied in order to more easily apply updates to attribute indexes.

Specified by:
getModifications in interface ModifyDNOperation
Specified by:
getModifications in interface PostResponseModifyDNOperation
Returns:
The set of modifications applied to attributes during the course of the modify DN processing, or null if that information is not yet available (e.g., during pre-parse plugins).

addModification

public final void addModification(Modification modification)
Adds the provided modification to the set of modifications to be applied as part of the update. This should only be called by pre-operation plugins.

Specified by:
addModification in interface ModifyDNOperation
Parameters:
modification - The modification to add to the set of modifications to apply to the entry.

getOriginalEntry

public final Entry getOriginalEntry()
Retrieves the current entry, before it is renamed. This will not be available to pre-parse plugins or during the conflict resolution portion of the synchronization processing.

Specified by:
getOriginalEntry in interface ModifyDNOperation
Specified by:
getOriginalEntry in interface PostResponseModifyDNOperation
Specified by:
getOriginalEntry in interface SubordinateModifyDNOperation
Returns:
The current entry, or null if it is not yet available.

getUpdatedEntry

public final Entry getUpdatedEntry()
Retrieves the new entry, as it will appear after it is renamed. This will not be available to pre-parse plugins or during the conflict resolution portion of the synchronization processing.

Specified by:
getUpdatedEntry in interface ModifyDNOperation
Specified by:
getUpdatedEntry in interface PostResponseModifyDNOperation
Specified by:
getUpdatedEntry in interface SubordinateModifyDNOperation
Returns:
The updated entry, or null if it is not yet available.

getChangeNumber

public final long getChangeNumber()
Retrieves the change number that has been assigned to this operation.

Specified by:
getChangeNumber in interface ModifyDNOperation
Returns:
The change number that has been assigned to this operation, or -1 if none has been assigned yet or if there is no applicable synchronization mechanism in place that uses change numbers.

setChangeNumber

public final void setChangeNumber(long changeNumber)
Specifies the change number that has been assigned to this operation by the synchronization mechanism.

Specified by:
setChangeNumber in interface ModifyDNOperation
Parameters:
changeNumber - The change number that has been assigned to this operation by the synchronization mechanism.

getOperationType

public final OperationType getOperationType()
Retrieves the operation type for this operation.

Specified by:
getOperationType in interface Operation
Specified by:
getOperationType in interface PluginOperation
Specified by:
getOperationType in class AbstractOperation
Returns:
The operation type for this operation.

getRequestLogElements

public final java.lang.String[][] getRequestLogElements()
Retrieves a standard set of elements that should be logged in requests for this type of operation. Each element in the array will itself be a two-element array in which the first element is the name of the field and the second is a string representation of the value, or null if there is no value for that field.

Specified by:
getRequestLogElements in interface Operation
Specified by:
getRequestLogElements in class AbstractOperation
Returns:
A standard set of elements that should be logged in requests for this type of operation.

getResponseLogElements

public final java.lang.String[][] getResponseLogElements()
Retrieves a standard set of elements that should be logged in responses for this type of operation. Each element in the array will itself be a two-element array in which the first element is the name of the field and the second is a string representation of the value, or null if there is no value for that field.

Specified by:
getResponseLogElements in interface Operation
Specified by:
getResponseLogElements in class AbstractOperation
Returns:
A standard set of elements that should be logged in responses for this type of operation.

getProxiedAuthorizationDN

public DN getProxiedAuthorizationDN()
Retrieves the proxied authorization DN for this operation if proxied authorization has been requested.

Specified by:
getProxiedAuthorizationDN in interface ModifyDNOperation
Returns:
The proxied authorization DN for this operation if proxied authorization has been requested, or null if proxied authorization has not been requested.

getResponseControls

public final java.util.List<Control> getResponseControls()
Retrieves the set of controls to include in the response to the client. The contents of this list must not be altered.

Specified by:
getResponseControls in interface Operation
Specified by:
getResponseControls in interface PluginOperation
Specified by:
getResponseControls in class AbstractOperation
Returns:
The set of controls to include in the response to the client.

addResponseControl

public final void addResponseControl(Control control)
Adds the provided control to the set of controls to include in the response to the client. This method may not be called by post-response plugins.

Specified by:
addResponseControl in interface Operation
Specified by:
addResponseControl in interface InProgressOperation
Specified by:
addResponseControl in interface PreParseOperation
Specified by:
addResponseControl in class AbstractOperation
Parameters:
control - The control to add to the set of controls to include in the response to the client.

removeResponseControl

public final void removeResponseControl(Control control)
Removes the provided control from the set of controls to include in the response to the client. This method may not be called by post-response plugins.

Specified by:
removeResponseControl in interface Operation
Specified by:
removeResponseControl in interface InProgressOperation
Specified by:
removeResponseControl in interface PreParseOperation
Specified by:
removeResponseControl in class AbstractOperation
Parameters:
control - The control to remove from the set of controls to include in the response to the client.

run

public final void run()
Performs the work of actually processing this operation. This should include all processing for the operation, including invoking plugins, logging messages, performing access control, managing synchronization, and any other work that might need to be done in the course of processing.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class AbstractOperation

toString

public final void toString(java.lang.StringBuilder buffer)
Appends a string representation of this operation to the provided buffer.

Specified by:
toString in interface Operation
Specified by:
toString in interface PluginOperation
Specified by:
toString in class AbstractOperation
Parameters:
buffer - The buffer into which a string representation of this operation should be appended.

setProxiedAuthorizationDN

public void setProxiedAuthorizationDN(DN dn)
Sets the proxied authorization DN for this operation if proxied authorization has been requested.

Specified by:
setProxiedAuthorizationDN in interface ModifyDNOperation
Parameters:
dn - The proxied authorization DN for this operation if proxied authorization has been requested, or null if proxied authorization has not been requested.

getNewDN

public DN getNewDN()
Retrieves the new DN for the entry.

Specified by:
getNewDN in interface ModifyDNOperation
Returns:
The new DN for the entry, or null if there is neither newRDN, nor entryDN for this request.