com.unboundid.directory.sdk.common.types
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
 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.
 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.
 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 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.
 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, or false if it was requested by an external client.

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, or false 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 be null.
Returns:
The requested attachment, or null if the operation does not have an attachment with the provided name.

getClientContext

ClientContext getClientContext()
Retrieves information about the client that requested this operation.

Returns:
Information about the client that requested this operation.

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, or false if not.

getInternalUserConnection

InternalConnection getInternalUserConnection()
                                             throws com.unboundid.ldap.sdk.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 the getInternalUserConnection(boolean) method.

Returns:
An internal connection that is authenticated as the same user that requested this operation.
Throws:
com.unboundid.ldap.sdk.LDAPException - If a problem occurs while attempting to obtain or authenticate the connection.

getInternalUserConnection

InternalConnection getInternalUserConnection(boolean usePolicyFromConnection)
                                             throws com.unboundid.ldap.sdk.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 - If true, the internal connection will use the same client connection policy as the associated client connection. If false, 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:
com.unboundid.ldap.sdk.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 the getInternalRootConnection(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 - If true, the internal connection will use the same client connection policy as the associated client connection. If false, 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 class java.lang.Object
Returns:
A string representation of this operation.