|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.types.AbstractOperation
@PublicAPI(stability=VOLATILE, mayInstantiate=false, mayExtend=false, mayInvoke=true) public abstract class AbstractOperation
This class defines a generic operation that may be processed by the
Directory Server. Specific subclasses should implement specific
functionality appropriate for the type of operation.
Note that this class is not intended to be subclassed by any
third-party code outside of the OpenDS project. It should only be
extended by the operation types included in the
org.opends.server.core
package.
Field Summary | |
---|---|
protected CancelRequest |
cancelRequest
The cancel request for this operation. |
protected CancelResult |
cancelResult
The cancel result for this operation. |
protected ClientConnection |
clientConnection
The client connection with which this operation is associated. |
protected int |
messageID
The message ID for this operation. |
protected static java.util.List<Control> |
NO_RESPONSE_CONTROLS
The set of response controls that will always be returned for an abandon operation. |
protected long |
operationID
The operation ID for this operation. |
protected boolean |
useNanoTime
Wether nanotime was used for this operation. |
Fields inherited from interface org.opends.server.types.Operation |
---|
LOCALBACKENDOPERATIONS |
Constructor Summary | |
---|---|
protected |
AbstractOperation(ClientConnection clientConnection,
long operationID,
int messageID,
java.util.List<Control> requestControls)
Creates a new operation with the provided information. |
Method Summary | |
---|---|
void |
abort(CancelRequest cancelRequest)
Attempts to cancel this operation before processing has completed without waiting for a cancel result. |
void |
addRequestControl(Control control)
Adds the provided control to the set of request controls for this operation. |
abstract void |
addResponseControl(Control control)
Adds the provided control to the set of controls to include in the response to the client. |
void |
appendAdditionalLogMessage(Message message)
Appends the provided message to the additional log information for this operation. |
void |
appendErrorMessage(Message message)
Appends the provided message to the error message buffer. |
CancelResult |
cancel(CancelRequest cancelRequest)
Attempts to cancel this operation before processing has completed. |
void |
checkIfCanceled(boolean signalTooLate)
Checks to see if this operation requested to cancel in which case CanceledOperationException will be thrown. |
void |
disconnectClient(DisconnectReason disconnectReason,
boolean sendNotification,
Message message)
Terminates the client connection being used to process this operation. |
boolean |
dontSynchronize()
Indicates whether this operation needs to be synchronized to other copies of the data. |
MessageBuilder |
getAdditionalLogMessage()
Retrieves the additional log message for this operation, which should be written to the log but not included in the response to the client. |
java.lang.Object |
getAttachment(java.lang.String name)
Retrieves the attachment with the specified name. |
java.util.Map<java.lang.String,java.lang.Object> |
getAttachments()
Retrieves the set of attachments defined for this operation, as a mapping between the attachment name and the associated object. |
DN |
getAuthorizationDN()
Retrieves the authorization DN for this operation. |
Entry |
getAuthorizationEntry()
Retrieves the entry for the user that should be considered the authorization identity for this operation. |
CancelRequest |
getCancelRequest()
Retrieves the cancel request that has been issued for this operation, if there is one. |
CancelResult |
getCancelResult()
Retrieves the cancel result for this operation. |
ClientConnection |
getClientConnection()
Retrieves the client connection with which this operation is associated. |
java.lang.String[][] |
getCommonLogElements()
Retrieves a set of standard elements that should be logged in all requests and responses for all types of operations. |
long |
getConnectionID()
Retrieves the unique identifier that is assigned to the client connection that submitted this operation. |
MessageBuilder |
getErrorMessage()
Retrieves the error message for this operation. |
DN |
getMatchedDN()
Retrieves the matched DN for this operation. |
int |
getMessageID()
Retrieves the message ID assigned to this operation. |
long |
getOperationID()
Retrieves the operation ID for this operation. |
abstract OperationType |
getOperationType()
Retrieves the operation type for this operation. |
long |
getProcessingNanoTime()
Retrieves the length of time in nanoseconds that the server spent processing this operation if available. |
long |
getProcessingStartTime()
Retrieves the time that processing started for this operation. |
long |
getProcessingStopTime()
Retrieves the time that processing stopped for this operation. |
long |
getProcessingTime()
Retrieves the length of time in milliseconds that the server spent processing this operation. |
java.util.List<java.lang.String> |
getReferralURLs()
Retrieves the set of referral URLs for this operation. |
java.util.List<Control> |
getRequestControls()
Retrieves the set of controls included in the request from the client. |
abstract java.lang.String[][] |
getRequestLogElements()
Retrieves a standard set of elements that should be logged in requests for this type of operation. |
abstract java.util.List<Control> |
getResponseControls()
Retrieves the set of controls to include in the response to the client. |
abstract java.lang.String[][] |
getResponseLogElements()
Retrieves a standard set of elements that should be logged in responses for this type of operation. |
ResultCode |
getResultCode()
Retrieves the result code for this operation. |
boolean |
isInternalOperation()
Indicates whether this is an internal operation rather than one that was requested by an external client. |
boolean |
isSynchronizationOperation()
Indicates whether this is a synchronization operation rather than one that was requested by an external client. |
void |
operationCompleted()
Indicates that processing on this operation has completed successfully and that the client should perform any associated cleanup work. |
java.lang.Object |
removeAttachment(java.lang.String name)
Removes the attachment with the specified name. |
void |
removeRequestControl(Control control)
Removes the provided control from the set of request controls for this operation. |
abstract void |
removeResponseControl(Control control)
Removes the provided control from the set of controls to include in the response to the client. |
abstract void |
run()
Performs the work of actually processing this operation. |
void |
setAdditionalLogMessage(MessageBuilder additionalLogMessage)
Specifies the additional log message for this operation, which should be written to the log but not included in the response to the client. |
java.lang.Object |
setAttachment(java.lang.String name,
java.lang.Object value)
Sets the value of the specified attachment. |
void |
setAttachments(java.util.Map<java.lang.String,java.lang.Object> attachments)
Set the attachments to the operation. |
void |
setAuthorizationEntry(Entry authorizationEntry)
Provides the entry for the user that should be considered the authorization identity for this operation. |
void |
setDontSynchronize(boolean dontSynchronize)
Specifies whether this operation must be synchronized to other copies of the data. |
void |
setErrorMessage(MessageBuilder errorMessage)
Specifies the error message for this operation. |
void |
setInternalOperation(boolean isInternalOperation)
Specifies whether this is an internal operation rather than one that was requested by an external client. |
void |
setMatchedDN(DN matchedDN)
Specifies the matched DN for this operation. |
void |
setProcessingStartTime()
Set the time at which the processing started for this operation. |
void |
setProcessingStopTime()
Set the time at which the processing stopped for this operation. |
void |
setReferralURLs(java.util.List<java.lang.String> referralURLs)
Specifies the set of referral URLs for this operation. |
void |
setResponseData(DirectoryException directoryException)
Sets the response elements for this operation based on the information contained in the provided DirectoryException
object. |
void |
setResultCode(ResultCode resultCode)
Specifies the result code for this operation. |
void |
setSynchronizationOperation(boolean isSynchronizationOperation)
Specifies whether this is a synchronization operation rather than one that was requested by an external client. |
java.lang.String |
toString()
Retrieves a string representation of this operation. |
abstract void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this operation to the provided buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.util.List<Control> NO_RESPONSE_CONTROLS
protected final ClientConnection clientConnection
protected final int messageID
protected final long operationID
protected final boolean useNanoTime
protected CancelRequest cancelRequest
protected CancelResult cancelResult
Constructor Detail |
---|
protected AbstractOperation(ClientConnection clientConnection, long operationID, int messageID, java.util.List<Control> requestControls)
clientConnection
- The client connection with which this
operation is associated.operationID
- The identifier assigned to this
operation for the client connection.messageID
- The message ID of the request with
which this operation is associated.requestControls
- The set of controls included in the
request.Method Detail |
---|
public abstract OperationType getOperationType()
getOperationType
in interface Operation
getOperationType
in interface PluginOperation
public void disconnectClient(DisconnectReason disconnectReason, boolean sendNotification, Message message)
disconnectClient
in interface Operation
disconnectClient
in interface PluginOperation
disconnectReason
- The disconnect reason that provides the
generic cause for the disconnect.sendNotification
- Indicates whether to try to provide
notification
to the client that the connection will
be closed.message
- The message to send to the client. It
may be null
if no notification
is to be sent.public final java.lang.String[][] getCommonLogElements()
null
if there is no value
for that field.
getCommonLogElements
in interface Operation
public abstract java.lang.String[][] getRequestLogElements()
null
if there is no value for that
field.
getRequestLogElements
in interface Operation
public abstract java.lang.String[][] getResponseLogElements()
null
if there is no value for that
field.
getResponseLogElements
in interface Operation
public final ClientConnection getClientConnection()
getClientConnection
in interface Operation
getClientConnection
in interface PluginOperation
public final long getConnectionID()
getConnectionID
in interface Operation
getConnectionID
in interface PluginOperation
public final long getOperationID()
getOperationID
in interface Operation
getOperationID
in interface PluginOperation
public final int getMessageID()
getMessageID
in interface Operation
getMessageID
in interface PluginOperation
public final java.util.List<Control> getRequestControls()
getRequestControls
in interface Operation
getRequestControls
in interface PluginOperation
public final void addRequestControl(Control control)
addRequestControl
in interface Operation
addRequestControl
in interface PreParseOperation
control
- The control to add to the set of request
controls for this operation.public final void removeRequestControl(Control control)
removeRequestControl
in interface Operation
removeRequestControl
in interface PreParseOperation
control
- The control to remove from the set of request
controls for this operation.public abstract java.util.List<Control> getResponseControls()
getResponseControls
in interface Operation
getResponseControls
in interface PluginOperation
public abstract void addResponseControl(Control control)
addResponseControl
in interface Operation
addResponseControl
in interface PreParseOperation
control
- The control to add to the set of controls to
include in the response to the client.public abstract void removeResponseControl(Control control)
removeResponseControl
in interface Operation
removeResponseControl
in interface PreParseOperation
control
- The control to remove from the set of controls
to include in the response to the client.public final ResultCode getResultCode()
getResultCode
in interface Operation
getResultCode
in interface PostResponseOperation
UNDEFINED
if the operation has not yet
completed.public final void setResultCode(ResultCode resultCode)
setResultCode
in interface Operation
resultCode
- The result code for this operation.public final MessageBuilder getErrorMessage()
getErrorMessage
in interface Operation
getErrorMessage
in interface PostResponseOperation
getErrorMessage
in interface PreParseOperation
public final void setErrorMessage(MessageBuilder errorMessage)
setErrorMessage
in interface Operation
setErrorMessage
in interface PreParseOperation
errorMessage
- The error message for this operation.public final void appendErrorMessage(Message message)
appendErrorMessage
in interface Operation
appendErrorMessage
in interface PreParseOperation
message
- The message to append to the error message
buffer.public final MessageBuilder getAdditionalLogMessage()
getAdditionalLogMessage
in interface Operation
getAdditionalLogMessage
in interface PostResponseOperation
getAdditionalLogMessage
in interface PreParseOperation
public final void setAdditionalLogMessage(MessageBuilder additionalLogMessage)
setAdditionalLogMessage
in interface Operation
setAdditionalLogMessage
in interface PreParseOperation
additionalLogMessage
- The additional log message for this
operation.public final void appendAdditionalLogMessage(Message message)
appendAdditionalLogMessage
in interface Operation
appendAdditionalLogMessage
in interface PreParseOperation
message
- The message that should be appended to the
additional log information for this operation.public final DN getMatchedDN()
getMatchedDN
in interface Operation
getMatchedDN
in interface PostResponseOperation
null
if
the operation has not yet completed or does not have a
matched DN.public final void setMatchedDN(DN matchedDN)
setMatchedDN
in interface Operation
matchedDN
- The matched DN for this operation.public final java.util.List<java.lang.String> getReferralURLs()
getReferralURLs
in interface Operation
getReferralURLs
in interface PostResponseOperation
null
if the operation is not yet complete or
does not have a set of referral URLs.public final void setReferralURLs(java.util.List<java.lang.String> referralURLs)
setReferralURLs
in interface Operation
referralURLs
- The set of referral URLs for this
operation.public final void setResponseData(DirectoryException directoryException)
DirectoryException
object. This method may not be called by post-response plugins.
setResponseData
in interface Operation
directoryException
- The exception containing the
information to use for the response
elements.public final boolean isInternalOperation()
isInternalOperation
in interface Operation
isInternalOperation
in interface PluginOperation
true
if this is an internal operation, or
false
if it is not.public final void setInternalOperation(boolean isInternalOperation)
setInternalOperation
in interface Operation
isInternalOperation
- Specifies whether this is an
internal operation rather than one
that was requested by an external
client.public final boolean isSynchronizationOperation()
isSynchronizationOperation
in interface Operation
isSynchronizationOperation
in interface PluginOperation
true
if this is a data synchronization
operation, or false
if it is not.public final void setSynchronizationOperation(boolean isSynchronizationOperation)
setSynchronizationOperation
in interface Operation
isSynchronizationOperation
- Specifies whether this is a
synchronization operation
rather than one that was
requested by an external
client.public boolean dontSynchronize()
dontSynchronize
in interface Operation
true
if this operation should not be
synchronized, or false
if it should be
synchronized.public final void setDontSynchronize(boolean dontSynchronize)
setDontSynchronize
in interface Operation
dontSynchronize
- Specifies whether this operation must be
synchronized to other copies
of the data.public final Entry getAuthorizationEntry()
null
if no authentication has been
performed on that connection. However, it may be some other
value if special processing has been requested (e.g., the
operation included a proxied authorization control). This method
should not be called by pre-parse plugins because the correct
value may not yet have been determined.
getAuthorizationEntry
in interface Operation
null
if the authorization identity should be the
unauthenticated user.public final void setAuthorizationEntry(Entry authorizationEntry)
setAuthorizationEntry
in interface Operation
authorizationEntry
- The entry for the user that should be
considered the authorization identity
for this operation, or null
if it should be the unauthenticated
user.public final DN getAuthorizationDN()
getAuthorizationDN
in interface Operation
getAuthorizationDN
in interface PostResponseOperation
public final java.util.Map<java.lang.String,java.lang.Object> getAttachments()
getAttachments
in interface Operation
getAttachments
in interface PluginOperation
public final void setAttachments(java.util.Map<java.lang.String,java.lang.Object> attachments)
setAttachments
in interface Operation
attachments
- - Attachments to register within the
operationpublic final java.lang.Object getAttachment(java.lang.String name)
getAttachment
in interface Operation
getAttachment
in interface PluginOperation
name
- The name for the attachment to retrieve. It will
be treated in a case-sensitive manner.
null
if it
does not exist.public final java.lang.Object removeAttachment(java.lang.String name)
removeAttachment
in interface Operation
removeAttachment
in interface PluginOperation
name
- The name for the attachment to remove. It will be
treated in a case-sensitive manner.
null
if it
does not exist.public final java.lang.Object setAttachment(java.lang.String name, java.lang.Object value)
setAttachment
in interface Operation
setAttachment
in interface PluginOperation
name
- The name to use for the attachment.value
- The value to use for the attachment.
null
if there was previously no such
attachment.public final void operationCompleted()
operationCompleted
in interface Operation
public CancelResult cancel(CancelRequest cancelRequest)
cancel
in interface Operation
cancelRequest
- Information about the way in which the
operation should be canceled.
public void abort(CancelRequest cancelRequest)
abort
in interface Operation
cancelRequest
- Information about the way in which the
operation should be canceled.public final void checkIfCanceled(boolean signalTooLate) throws CanceledOperationException
checkIfCanceled
in interface Operation
checkIfCanceled
in interface PluginOperation
signalTooLate
- true
to signal that any further
cancel requests will be too late after
return from this call or false
otherwise.
CanceledOperationException
- if this operation should
be cancelled.public final CancelRequest getCancelRequest()
getCancelRequest
in interface Operation
null
if there has not been any
request to cancel.public final CancelResult getCancelResult()
getCancelResult
in interface Operation
null
if the operation has not seen and reacted
to a cancel request.public final java.lang.String toString()
toString
in interface Operation
toString
in interface PluginOperation
toString
in class java.lang.Object
public abstract void toString(java.lang.StringBuilder buffer)
toString
in interface Operation
toString
in interface PluginOperation
buffer
- The buffer into which a string representation of
this operation should be appended.public final long getProcessingStartTime()
getProcessingStartTime
in interface Operation
getProcessingStartTime
in interface PluginOperation
public final void setProcessingStartTime()
public final long getProcessingStopTime()
getProcessingStopTime
in interface Operation
getProcessingStopTime
in interface PostResponseOperation
public final void setProcessingStopTime()
public final long getProcessingTime()
getProcessingTime
in interface Operation
getProcessingTime
in interface PostResponseOperation
public final long getProcessingNanoTime()
getProcessingNanoTime
in interface Operation
public abstract void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |