org.opends.server.core
Class ModifyOperationBasis

java.lang.Object
  extended by org.opends.server.types.AbstractOperation
      extended by org.opends.server.core.ModifyOperationBasis
All Implemented Interfaces:
java.lang.Runnable, ModifyOperation, Operation, PluginOperation, PostResponseModifyOperation, PostResponseOperation, PreParseModifyOperation, PreParseOperation

public class ModifyOperationBasis
extends AbstractOperation
implements ModifyOperation, PreParseModifyOperation, PostResponseModifyOperation

This class defines an operation that may be used to modify 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
ModifyOperationBasis(ClientConnection clientConnection, long operationID, int messageID, java.util.List<Control> requestControls, ByteString rawEntryDN, java.util.List<RawModification> rawModifications)
          Creates a new modify operation with the provided information.
ModifyOperationBasis(ClientConnection clientConnection, long operationID, int messageID, java.util.List<Control> requestControls, DN entryDN, java.util.List<Modification> modifications)
          Creates a new modify operation with the provided information.
 
Method Summary
 void addModification(Modification modification)
          Adds the provided modification to the set of modifications to this modify operation.
 void addRawModification(RawModification rawModification)
          Adds the provided modification to the set of raw modifications for this modify operation.
 void addResponseControl(Control control)
          Adds the provided control to the set of controls to include in the response to the client.
 long getChangeNumber()
          Retrieves the change number that has been assigned to this operation.
 Entry getCurrentEntry()
          Retrieves the current entry before any modifications are applied.
 java.util.List<AttributeValue> getCurrentPasswords()
          Retrieves the set of clear-text current passwords for the user, if available.
 DN getEntryDN()
          Retrieves the DN of the entry to modify.
 java.util.List<Modification> getModifications()
          Retrieves the set of modifications for this modify operation.
 Entry getModifiedEntry()
          Retrieves the modified entry that is to be written to the backend.
 java.util.List<AttributeValue> getNewPasswords()
          Retrieves the set of clear-text new passwords for the user, if available.
 OperationType getOperationType()
          Retrieves the operation type for this operation.
 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.
 java.util.List<RawModification> getRawModifications()
          Retrieves the set of raw, unprocessed modifications as included in 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.
 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 setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
          Set 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 setRawModifications(java.util.List<RawModification> rawModifications)
          Specifies the raw modifications for this modify operation.
 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.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
 
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
 

Constructor Detail

ModifyOperationBasis

public ModifyOperationBasis(ClientConnection clientConnection,
                            long operationID,
                            int messageID,
                            java.util.List<Control> requestControls,
                            ByteString rawEntryDN,
                            java.util.List<RawModification> rawModifications)
Creates a new modify 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 DN of the entry to modify, as included in the client request.
rawModifications - The raw, unprocessed set of modifications for this modify operation as included in the client request.

ModifyOperationBasis

public ModifyOperationBasis(ClientConnection clientConnection,
                            long operationID,
                            int messageID,
                            java.util.List<Control> requestControls,
                            DN entryDN,
                            java.util.List<Modification> modifications)
Creates a new modify 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 entry DN for the modify operation.
modifications - The set of modifications for this modify 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 ModifyOperation
Specified by:
getRawEntryDN in interface PostResponseModifyOperation
Specified by:
getRawEntryDN in interface PreParseModifyOperation
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 ModifyOperation
Specified by:
setRawEntryDN in interface PreParseModifyOperation
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 modify. 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 ModifyOperation
Specified by:
getEntryDN in interface PostResponseModifyOperation
Returns:
The DN of the entry to modify, or null if the raw entry DN has not yet been processed.

getRawModifications

public final java.util.List<RawModification> getRawModifications()
Retrieves the set of raw, unprocessed modifications as included in the client request. Note that this may contain one or more invalid modifications, as no validation will have been performed on this information. The list returned must not be altered by the caller.

Specified by:
getRawModifications in interface ModifyOperation
Specified by:
getRawModifications in interface PostResponseModifyOperation
Specified by:
getRawModifications in interface PreParseModifyOperation
Returns:
The set of raw, unprocessed modifications as included in the client request.

addRawModification

public final void addRawModification(RawModification rawModification)
Adds the provided modification to the set of raw modifications for this modify operation. This must only be called by pre-parse plugins.

Specified by:
addRawModification in interface ModifyOperation
Specified by:
addRawModification in interface PreParseModifyOperation
Parameters:
rawModification - The modification to add to the set of raw modifications for this modify operation.

setRawModifications

public final void setRawModifications(java.util.List<RawModification> rawModifications)
Specifies the raw modifications for this modify operation.

Specified by:
setRawModifications in interface ModifyOperation
Specified by:
setRawModifications in interface PreParseModifyOperation
Parameters:
rawModifications - The raw modifications for this modify operation.

getModifications

public final java.util.List<Modification> getModifications()
Retrieves the set of modifications for this modify operation. Its contents should not be altered. It will not be available to pre-parse plugins.

Specified by:
getModifications in interface ModifyOperation
Specified by:
getModifications in interface PostResponseModifyOperation
Returns:
The set of modifications for this modify operation, or null if the modifications have not yet been processed.

addModification

public final void addModification(Modification modification)
                           throws DirectoryException
Adds the provided modification to the set of modifications to this modify operation. This may only be called by pre-operation plugins.

Specified by:
addModification in interface ModifyOperation
Parameters:
modification - The modification to add to the set of changes for this modify operation.
Throws:
DirectoryException - If an unexpected problem occurs while applying the modification to the entry.

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 ModifyOperation
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 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 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.

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.

getChangeNumber

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

Specified by:
getChangeNumber in interface ModifyOperation
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 void setChangeNumber(long changeNumber)
Specifies the change number that has been assigned to this operation by the synchronization mechanism.

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

setProxiedAuthorizationDN

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

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

run

public final void run()
Performs the work of actually processing this operation. This should include all processing for the operation, including invoking pre-parse and post-response plugins, logging messages 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

getCurrentEntry

public Entry getCurrentEntry()
Retrieves the current entry before any modifications are applied. It should not be modified by the caller. This method always returns null.

Specified by:
getCurrentEntry in interface PostResponseModifyOperation
Returns:
The current entry before any modifications are applied.

getCurrentPasswords

public java.util.List<AttributeValue> getCurrentPasswords()
Retrieves the set of clear-text current passwords for the user, if available. This will only be available if the modify operation contains one or more delete elements that target the password attribute and provide the values to delete in the clear. This list should not be altered by the caller. This method always returns null.

Specified by:
getCurrentPasswords in interface PostResponseModifyOperation
Returns:
The set of clear-text current password values as provided in the modify request, or null if there were none.

getModifiedEntry

public Entry getModifiedEntry()
Retrieves the modified entry that is to be written to the backend. It should not be modified by the caller. This method always returns null.

Specified by:
getModifiedEntry in interface PostResponseModifyOperation
Returns:
The modified entry that is to be written to the backend.

getNewPasswords

public java.util.List<AttributeValue> getNewPasswords()
Retrieves the set of clear-text new passwords for the user, if available. This will only be available if the modify operation contains one or more add or replace elements that target the password attribute and provide the values in the clear. This list should not be altered by the caller. This method always returns null.

Specified by:
getNewPasswords in interface PostResponseModifyOperation
Returns:
The set of clear-text new passwords as provided in the modify request, or null if there were none.