Interface OperationContext
-
- All Known Subinterfaces:
ActiveOperationContext
,ActiveSearchOperationContext
,CompletedOperationContext
,CompletedProxyOperationContext
,CompletedSearchOperationContext
,ProxyOperationContext
@NotExtensible @ThreadSafety(level=INTERFACE_NOT_THREADSAFE) public interface OperationContext
This interface defines a set of methods that may be used to obtain information about an operation being processed by the server.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addCustomLogElement(LogField field, java.lang.Object value)
Specifies an additional log element for this operation, which should be written to the log.void
addCustomLogElement(java.lang.String key, java.lang.Object value)
Specifies an additional log element for this operation, which should be written to the log.void
appendAdditionalLogMessage(java.lang.String message)
Indicates that the provided message should be included in the access log message for the operation but should not be returned to the client.void
deregisterOperationCompletedListener(RegisteredOperationCompletedListener listener)
Deregisters the provided server operation completed listener with the server.java.lang.Object
getAttachment(java.lang.String name)
Retrieves the object attached to the associated operation with the given name.java.lang.String
getAuthorizationDN()
Retrieves the DN of the user as whom the request is authorized.java.lang.String
getClientConnectionPolicyDN()
Retrieves the DN of the entry that defines the client connection policy to which the associated client connection is assigned.java.lang.String
getClientConnectionPolicyName()
Retrieves the name of the client connection policy to which the associated client connection is assigned.ClientContext
getClientContext()
Retrieves information about the client that requested this operation.long
getConnectionID()
Retrieves the identifier that has been assigned to the associated client connection.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getCustomLogElements()
Returns any additional log elements for this operation, which should be written to the log.InternalConnection
getInternalRootConnection()
Retrieves an internal connection that is authenticated as a root user that is not subject to access control.InternalConnection
getInternalRootConnection(boolean usePolicyFromConnection)
Retrieves an internal connection that is authenticated as a root user that is not subject to access control.InternalConnection
getInternalUserConnection()
Retrieves an internal connection that is authenticated as the same user that requested this operation and may be subject to access control.InternalConnection
getInternalUserConnection(boolean usePolicyFromConnection)
Retrieves an internal connection that is authenticated as the same user that requested this operation and may be subject to access control.int
getMessageID()
Retrieves the message ID for this operation from the client request.long
getOperationID()
Retrieves the identifier that has been assigned to this operation for the associated client connection.OperationType
getOperationType()
Retrieves the operation type for this operation.Request
getRequest()
Retrieves the request for the associated operation.ServerContext
getServerContext()
Retrieves information about the server in which this operation is being processed.boolean
isAdministrativeOperation()
Indicates whether this is an administrative operation.boolean
isInternalOperation()
Indicates whether this operation was initiated within the server rather than by an external client.boolean
isReplicationOperation()
Indicates whether this operation was initiated via replication rather than within the local server.boolean
isSecure()
Indicates whether this operation was requested over a secure connection.RegisteredOperationCompletedListener
registerOperationCompletedListener(OperationCompletedListener listener)
Registers the provided listener to be notified when the server completes an operation.void
setAttachment(java.lang.String name, java.lang.Object value)
Sets an attachment for the associated operation.java.lang.String
toString()
Retrieves a string representation of this operation.
-
-
-
Method Detail
-
getConnectionID
long getConnectionID()
Retrieves the identifier that has been assigned to the associated client connection.- Returns:
- The identifier that has been assigned to the associated client connection.
-
getOperationID
long getOperationID()
Retrieves the identifier that has been assigned to this operation for the associated client connection.- Returns:
- The identifier that has been assigned to this operation for the associated client connection.
-
getMessageID
int getMessageID()
Retrieves the message ID for this operation from the client request.- Returns:
- The message ID for this operation from the client request.
-
getOperationType
OperationType getOperationType()
Retrieves the operation type for this operation.- Returns:
- The operation type for this operation.
-
getRequest
Request getRequest()
Retrieves the request for the associated operation. The caller should not make any attempt to alter the request that is returned.- Returns:
- The request for the associated operation.
-
getServerContext
ServerContext getServerContext()
Retrieves information about the server in which this operation is being processed.- Returns:
- Information about the server in which this operation is being processed.
-
isInternalOperation
boolean isInternalOperation()
Indicates whether this operation was initiated within the server rather than by an external client.- Returns:
true
if this operation was initiated within the server, orfalse
if it was requested by an external client.
-
isAdministrativeOperation
boolean isAdministrativeOperation()
Indicates whether this is an administrative operation. An operation is considered administrative if theStartAdministrativeSessionExtendedRequest
extended request was used on the connection, or theAdministrativeOperationRequestControl
request control was used on the operation.- Returns:
true
if this operation is an administrative operation.
-
isReplicationOperation
boolean isReplicationOperation()
Indicates whether this operation was initiated via replication rather than within the local server.- Returns:
true
if this operation was initiated via replication, orfalse
if it was initiated locally within this server.
-
getAuthorizationDN
java.lang.String getAuthorizationDN()
Retrieves the DN of the user as whom the request is authorized. Note that this may change over the course of processing the operation (e.g., if the request includes a proxied authorization or intermediate client control).- Returns:
- The DN of the user as whom the request is authorized. It may be an empty string if the operation is to be authorized as an unauthenticated user.
-
getAttachment
java.lang.Object getAttachment(java.lang.String name)
Retrieves the object attached to the associated operation with the given name.- Parameters:
name
- The case-sensitive name of the attachment to retrieve. It must not benull
.- Returns:
- The requested attachment, or
null
if the operation does not have an attachment with the provided name.
-
setAttachment
void setAttachment(java.lang.String name, java.lang.Object value)
Sets an attachment for the associated operation.- Parameters:
name
- The name of the attachment to set. It must not benull
.value
- The value to set for the attachment. It may benull
if any existing attachment with the specified name should be removed.
-
getClientContext
ClientContext getClientContext()
Retrieves information about the client that requested this operation.- Returns:
- Information about the client that requested this operation.
-
getClientConnectionPolicyName
java.lang.String getClientConnectionPolicyName()
Retrieves the name of the client connection policy to which the associated client connection is assigned.- Returns:
- The name of the client connection policy to which the associated client connection is assigned.
-
getClientConnectionPolicyDN
java.lang.String getClientConnectionPolicyDN()
Retrieves the DN of the entry that defines the client connection policy to which the associated client connection is assigned.- Returns:
- The DN of the entry that defines the client connection policy to which the associated client connection policy is assigned.
-
isSecure
boolean isSecure()
Indicates whether this operation was requested over a secure connection. If the request included the intermediate client control, then its value will also be used in determining whether communication with downstream clients is also secure.- Returns:
true
if this operation was requested over a secure connection, orfalse
if not.
-
getInternalUserConnection
InternalConnection getInternalUserConnection() throws LDAPException
Retrieves an internal connection that is authenticated as the same user that requested this operation and may be subject to access control.
Note that the returned connection will use the client connection policy defined as the default policy for internal operations. If you wish to use the client connection policy associated with the connection on which this operation was requested, use thegetInternalUserConnection(boolean)
method.- Returns:
- An internal connection that is authenticated as the same user that requested this operation.
- Throws:
LDAPException
- If a problem occurs while attempting to obtain or authenticate the connection.
-
getInternalUserConnection
InternalConnection getInternalUserConnection(boolean usePolicyFromConnection) throws LDAPException
Retrieves an internal connection that is authenticated as the same user that requested this operation and may be subject to access control. It may optionally use the client connection policy from the associated client connection.- Parameters:
usePolicyFromConnection
- Iftrue
, the internal connection will use the same client connection policy as the associated client connection. Iffalse
, the internal connection will use the server's default client connection policy for internal connections.- Returns:
- An internal connection that is authenticated as the same user that requested this operation.
- Throws:
LDAPException
- If a problem occurs while attempting to obtain or authenticate the connection.
-
getInternalRootConnection
InternalConnection getInternalRootConnection()
Retrieves an internal connection that is authenticated as a root user that is not subject to access control.
Note that the returned connection will use the client connection policy defined as the default policy for internal operations. If you wish to use the client connection policy associated with the connection on which this operation was requested, use thegetInternalRootConnection(boolean)
method.- Returns:
- An internal connection that is authenticated as a root user.
-
getInternalRootConnection
InternalConnection getInternalRootConnection(boolean usePolicyFromConnection)
Retrieves an internal connection that is authenticated as a root user that is not subject to access control. It may optionally use the client connection policy from the associated client connection.- Parameters:
usePolicyFromConnection
- Iftrue
, the internal connection will use the same client connection policy as the associated client connection. Iffalse
, the internal connection will use the server's default client connection policy for internal connections.- Returns:
- An internal connection that is authenticated as a root user.
-
toString
java.lang.String toString()
Retrieves a string representation of this operation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this operation.
-
addCustomLogElement
void addCustomLogElement(java.lang.String key, java.lang.Object value)
Specifies an additional log element for this operation, which should be written to the log.- Parameters:
key
- The key of the log element being addedvalue
- The value of the log element being added
-
addCustomLogElement
void addCustomLogElement(LogField field, java.lang.Object value)
Specifies an additional log element for this operation, which should be written to the log.- Parameters:
field
- The field for the log element being addedvalue
- The value of the log element being added
-
getCustomLogElements
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getCustomLogElements()
Returns any additional log elements for this operation, which should be written to the log.- Returns:
- map of additional log elements to a list of values.
-
appendAdditionalLogMessage
void appendAdditionalLogMessage(java.lang.String message)
Indicates that the provided message should be included in the access log message for the operation but should not be returned to the client.- Parameters:
message
- The message to include in the log message. It must not benull
.
-
registerOperationCompletedListener
RegisteredOperationCompletedListener registerOperationCompletedListener(OperationCompletedListener listener)
Registers the provided listener to be notified when the server completes an operation.- Parameters:
listener
- The server operation completed listener to be registered. It must not benull
.- Returns:
- An object representing the operation completed listener that has been registered with the server.
-
deregisterOperationCompletedListener
void deregisterOperationCompletedListener(RegisteredOperationCompletedListener listener)
Deregisters the provided server operation completed listener with the server. This will have no effect if the provided listener is not registered.- Parameters:
listener
- The server operation completed listener to be deregistered. It must not benull
.
-
-