org.opends.server.core
Class ExtendedOperationBasis

java.lang.Object
  extended by org.opends.server.types.AbstractOperation
      extended by org.opends.server.core.ExtendedOperationBasis
All Implemented Interfaces:
java.lang.Runnable, ExtendedOperation, Operation, PluginOperation, PostOperationExtendedOperation, PostOperationOperation, PostResponseExtendedOperation, PostResponseOperation, PreOperationExtendedOperation, PreOperationOperation, PreParseExtendedOperation, PreParseOperation

public class ExtendedOperationBasis
extends AbstractOperation
implements ExtendedOperation, PreParseExtendedOperation, PreOperationExtendedOperation, PostOperationExtendedOperation, PostResponseExtendedOperation

This class defines an extended operation, which can perform virtually any kind of task.


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
ExtendedOperationBasis(ClientConnection clientConnection, long operationID, int messageID, java.util.List<Control> requestControls, java.lang.String requestOID, ASN1OctetString requestValue)
          Creates a new extended operation with the provided information.
 
Method Summary
 void addResponseControl(Control control)
          Adds the provided control to the set of controls to include in the response to the client.
 OperationType getOperationType()
          Retrieves the operation type for this operation.
 java.lang.String[][] getRequestLogElements()
          Retrieves a standard set of elements that should be logged in requests for this type of operation.
 java.lang.String getRequestOID()
          Retrieves the OID for the request associated with this extended operation.
 ASN1OctetString getRequestValue()
          Retrieves the value for the request associated with this extended 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.
 java.lang.String getResponseOID()
          Retrieves the OID to include in the response to the client.
 ASN1OctetString getResponseValue()
          Retrieves the value to include in the response to the client.
 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 sendExtendedResponse()
          Sends an extended response to the client if none has already been sent.
 void setRequestOID(java.lang.String requestOID)
          Specifies the OID for the request associated with this extended operation.
 void setRequestValue(ASN1OctetString requestValue)
          Specifies the value for the request associated with this extended operation.
 void setResponseOID(java.lang.String responseOID)
          Specifies the OID to include in the response to the client.
 void setResponseSent()
          Indicates that the response for this extended operation has been sent from somewhere outside of this class.
 void setResponseValue(ASN1OctetString responseValue)
          Specifies the value to include in the response to 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.PreParseOperation
addRequestControl, appendAdditionalLogMessage, appendErrorMessage, getAdditionalLogMessage, getErrorMessage, removeRequestControl, setAdditionalLogMessage, setErrorMessage
 
Methods inherited from interface org.opends.server.types.operation.PreOperationOperation
appendAdditionalLogMessage, appendErrorMessage, getAdditionalLogMessage, getAuthorizationDN, getErrorMessage, setAdditionalLogMessage, setErrorMessage
 
Methods inherited from interface org.opends.server.types.operation.PostOperationOperation
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
 

Constructor Detail

ExtendedOperationBasis

public ExtendedOperationBasis(ClientConnection clientConnection,
                              long operationID,
                              int messageID,
                              java.util.List<Control> requestControls,
                              java.lang.String requestOID,
                              ASN1OctetString requestValue)
Creates a new extended 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.
requestOID - The OID for the request associated with this extended operation.
requestValue - The value for the request associated with this extended operation.
Method Detail

getRequestOID

public final java.lang.String getRequestOID()
Retrieves the OID for the request associated with this extended operation.

Specified by:
getRequestOID in interface ExtendedOperation
Specified by:
getRequestOID in interface PostOperationExtendedOperation
Specified by:
getRequestOID in interface PostResponseExtendedOperation
Specified by:
getRequestOID in interface PreOperationExtendedOperation
Specified by:
getRequestOID in interface PreParseExtendedOperation
Returns:
The OID for the request associated with this extended operation.

setRequestOID

public final void setRequestOID(java.lang.String requestOID)
Specifies the OID for the request associated with this extended operation. This should only be called by pre-parse plugins.

Specified by:
setRequestOID in interface PreParseExtendedOperation
Parameters:
requestOID - The OID for the request associated with this extended operation.

getRequestValue

public final ASN1OctetString getRequestValue()
Retrieves the value for the request associated with this extended operation.

Specified by:
getRequestValue in interface ExtendedOperation
Specified by:
getRequestValue in interface PostOperationExtendedOperation
Specified by:
getRequestValue in interface PostResponseExtendedOperation
Specified by:
getRequestValue in interface PreOperationExtendedOperation
Specified by:
getRequestValue in interface PreParseExtendedOperation
Returns:
The value for the request associated with this extended operation.

setRequestValue

public final void setRequestValue(ASN1OctetString requestValue)
Specifies the value for the request associated with this extended operation. This should only be called by pre-parse plugins.

Specified by:
setRequestValue in interface PreParseExtendedOperation
Parameters:
requestValue - The value for the request associated with this extended operation.

getResponseOID

public final java.lang.String getResponseOID()
Retrieves the OID to include in the response to the client.

Specified by:
getResponseOID in interface ExtendedOperation
Specified by:
getResponseOID in interface PostOperationExtendedOperation
Specified by:
getResponseOID in interface PostResponseExtendedOperation
Returns:
The OID to include in the response to the client.

setResponseOID

public final void setResponseOID(java.lang.String responseOID)
Specifies the OID to include in the response to the client.

Specified by:
setResponseOID in interface ExtendedOperation
Specified by:
setResponseOID in interface PostOperationExtendedOperation
Specified by:
setResponseOID in interface PreOperationExtendedOperation
Specified by:
setResponseOID in interface PreParseExtendedOperation
Parameters:
responseOID - The OID to include in the response to the client.

getResponseValue

public final ASN1OctetString getResponseValue()
Retrieves the value to include in the response to the client.

Specified by:
getResponseValue in interface ExtendedOperation
Specified by:
getResponseValue in interface PostOperationExtendedOperation
Specified by:
getResponseValue in interface PostResponseExtendedOperation
Returns:
The value to include in the response to the client.

setResponseValue

public final void setResponseValue(ASN1OctetString responseValue)
Specifies the value to include in the response to the client.

Specified by:
setResponseValue in interface ExtendedOperation
Specified by:
setResponseValue in interface PostOperationExtendedOperation
Specified by:
setResponseValue in interface PreOperationExtendedOperation
Specified by:
setResponseValue in interface PreParseExtendedOperation
Parameters:
responseValue - The value to include in the response to the client.

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.

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 PostOperationOperation
Specified by:
addResponseControl in interface PreOperationOperation
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 PostOperationOperation
Specified by:
removeResponseControl in interface PreOperationOperation
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

sendExtendedResponse

public final void sendExtendedResponse()
Sends an extended response to the client if none has already been sent. Note that extended operation handlers are strongly discouraged from using this method when it is not necessary because its use will prevent the response from being sent after post-operation plugin processing, which may impact the result that should be included. Nevertheless, it may be needed in some special cases in which the response must be sent before the extended operation handler completes its processing (e.g., the StartTLS operation in which the response must be sent in the clear before actually enabling TLS protection).


setResponseSent

public final void setResponseSent()
Indicates that the response for this extended operation has been sent from somewhere outside of this class. This should only be used by the StartTLS extended operation for the case in which it needs to send a response in the clear after TLS negotiation has already started on the connection.

Specified by:
setResponseSent in interface ExtendedOperation

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.