org.apache.directory.server.core.interceptor.context
Interface OperationContext

All Known Subinterfaces:
ChangeOperationContext
All Known Implementing Classes:
AbstractChangeOperationContext, AbstractOperationContext, AddContextPartitionOperationContext, AddOperationContext, BindOperationContext, CompareOperationContext, DeleteOperationContext, EmptyOperationContext, EntryOperationContext, GetMatchedNameOperationContext, GetRootDSEOperationContext, GetSuffixOperationContext, ListOperationContext, ListSuffixOperationContext, LookupOperationContext, MockOperation, ModifyOperationContext, MoveAndRenameOperationContext, MoveOperationContext, RemoveContextPartitionOperationContext, RenameOperationContext, SearchingOperationContext, SearchOperationContext, UnbindOperationContext

public interface OperationContext

This interface represent the context passed as an argument to each interceptor. It will contain data used by all the operations.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Method Summary
 void add(org.apache.directory.shared.ldap.entry.ServerEntry entry, java.util.Collection<java.lang.String> byPass)
           
 void addRequestControl(org.apache.directory.shared.ldap.message.control.Control requestControl)
          Adds a request control to this operation.
 void addRequestControls(org.apache.directory.shared.ldap.message.control.Control[] requestControls)
          Adds many request controls to this operation.
 void addResponseControl(org.apache.directory.shared.ldap.message.control.Control responseControl)
          Adds a response control to this operation.
 void delete(org.apache.directory.shared.ldap.name.DN dn, java.util.Collection<java.lang.String> byPass)
           
 java.util.Collection<java.lang.String> getByPassed()
          Gets the set of bypassed Interceptors.
 org.apache.directory.shared.ldap.name.DN getDn()
           
 LdapPrincipal getEffectivePrincipal()
          Gets the effective principal for this operation which may not be the same as the authenticated principal when the session for this context has an explicit authorization id, or this operation was applied with the proxy authorization control.
 ClonedServerEntry getEntry()
          Gets the server entry associated with the target DN of this OperationContext.
 OperationContext getFirstOperation()
          Gets the first, direct operation issued against the DirectoryService.
 OperationContext getLastOperation()
          Gets the last, operation issued on the DirectoryService.
 java.lang.String getName()
           
 OperationContext getNextOperation()
          Gets the next, indirect operation issued on the DirectoryService.
 OperationContext getPreviousOperation()
          Gets the previous, operation issued on the DirectoryService.
 org.apache.directory.shared.ldap.message.control.Control getRequestControl(java.lang.String numericOid)
          Gets a request control if present for this request.
 org.apache.directory.shared.ldap.message.control.Control getResponseControl(java.lang.String numericOid)
          Gets a response control if present for this request.
 int getResponseControlCount()
          Checks the number of response controls have been generated for this operation.
 org.apache.directory.shared.ldap.message.control.Control[] getResponseControls()
          Gets all the response controls producted during this operation.
 CoreSession getSession()
          Gets the session associated with this operation.
 boolean hasBypass()
          Checks to see if any Interceptors are bypassed by this Invocation.
 boolean hasEntry(org.apache.directory.shared.ldap.name.DN dn, java.util.Collection<java.lang.String> byPass)
          Checks to see if an entry exists.
 boolean hasRequestControl(java.lang.String numericOid)
          Checks to see if a request control is present on this request.
 boolean hasRequestControls()
          Checks if any request controls exists for this operation.
 boolean hasResponseControl(java.lang.String numericOid)
          Checks to see if a response control is present on this operation.
 boolean hasResponseControls()
          Checks if any response controls have been generated for this operation.
 void ignoreReferral()
          Set the throwReferral flag to false
 boolean isBypassed(java.lang.String interceptorName)
          Checks to see if an Interceptor is bypassed for this operation.
 boolean isFirstOperation()
          Checks to see if this operation is the first operation in a chain of operations performed on the DirectoryService.
 boolean isReferralIgnored()
           
 boolean isReferralThrown()
           
 ClonedServerEntry lookup(org.apache.directory.shared.ldap.name.DN dn, java.util.Collection<java.lang.String> byPass)
           
 ClonedServerEntry lookup(LookupOperationContext lookupContext)
           
 void modify(org.apache.directory.shared.ldap.name.DN dn, java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods, java.util.Collection<java.lang.String> byPass)
           
 LookupOperationContext newLookupContext(org.apache.directory.shared.ldap.name.DN dn)
           
 void setByPassed(java.util.Collection<java.lang.String> byPassed)
          Sets the set of bypassed Interceptors.
 void setDn(org.apache.directory.shared.ldap.name.DN dn)
          Set the context DN
 void setEntry(ClonedServerEntry entry)
          Sets the server entry associated with the target DN of this OperationContext.
 void throwReferral()
          Set the throwReferral flag to true
 

Method Detail

isFirstOperation

boolean isFirstOperation()
Checks to see if this operation is the first operation in a chain of operations performed on the DirectoryService. The first operation in a sequence of operations, is not a byproduct of another operation unlike operations following in the sequence. The other operations following the first, occur as a side effect to complete this first operation.

Returns:
true if the operation is the first, false otherwise

getFirstOperation

OperationContext getFirstOperation()
Gets the first, direct operation issued against the DirectoryService.

Returns:
the first, direct operation issued

getPreviousOperation

OperationContext getPreviousOperation()
Gets the previous, operation issued on the DirectoryService.

Returns:
the previous, operation issued

getNextOperation

OperationContext getNextOperation()
Gets the next, indirect operation issued on the DirectoryService.

Returns:
the next, indirect operation issued

getLastOperation

OperationContext getLastOperation()
Gets the last, operation issued on the DirectoryService.

Returns:
the last, operation issued

getEffectivePrincipal

LdapPrincipal getEffectivePrincipal()
Gets the effective principal for this operation which may not be the same as the authenticated principal when the session for this context has an explicit authorization id, or this operation was applied with the proxy authorization control.

Returns:
the effective principal for this operation
See Also:
CoreSession.getAuthenticatedPrincipal(), CoreSession.getEffectivePrincipal()

getDn

org.apache.directory.shared.ldap.name.DN getDn()
Returns:
The associated DN

setDn

void setDn(org.apache.directory.shared.ldap.name.DN dn)
Set the context DN

Parameters:
dn - The DN to set

getEntry

ClonedServerEntry getEntry()
Gets the server entry associated with the target DN of this OperationContext. The entry associated with the DN may be altered during the course of processing an LDAP operation through the InterceptorChain. This place holder is put here to prevent the need for repetitive lookups of the target entry. Furthermore the returned entry may be altered by any Interceptor in the chain and this is why a ClonedServerEntry is returned instead of a ServerEntry. A ClonedServerEntry has an immutable reference to the original state of the target entry. The original state can be accessed via a call to ClonedServerEntry.getOriginalEntry(). The return value may be null in which case any lookup performed to access it may set it to prevent the need for subsequent lookups. Also note that during the course of handling some operations such as those that rename, move or rename and move the entry, may alter the DN of this entry. Interceptor implementors should not presume the DN or the values contained in this entry are currently what is present in the DIT. The original entry contained in the ClonedServerEntry shoudl be used as the definitive source of information about the state of the entry in the DIT before returning from the Partition subsystem.

Returns:
target entry associated with the DN of this OperationContext

setEntry

void setEntry(ClonedServerEntry entry)
Sets the server entry associated with the target DN of this OperationContext.

Parameters:
entry - the entry whose DN is associated with this OperationContext.

addResponseControl

void addResponseControl(org.apache.directory.shared.ldap.message.control.Control responseControl)
Adds a response control to this operation.

Parameters:
responseControl - the response control to add to this operation

hasResponseControl

boolean hasResponseControl(java.lang.String numericOid)
Checks to see if a response control is present on this operation.

Parameters:
numericOid - the numeric OID of the control also known as it's type OID
Returns:
true if the control is associated with this operation, false otherwise

getResponseControl

org.apache.directory.shared.ldap.message.control.Control getResponseControl(java.lang.String numericOid)
Gets a response control if present for this request.

Parameters:
numericOid - the numeric OID of the control also known as it's type OID
Returns:
the control if present

getResponseControls

org.apache.directory.shared.ldap.message.control.Control[] getResponseControls()
Gets all the response controls producted during this operation.

Returns:
an array over all the response controls

hasResponseControls

boolean hasResponseControls()
Checks if any response controls have been generated for this operation.

Returns:
true if any response controls have been generated, false otherwise

getResponseControlCount

int getResponseControlCount()
Checks the number of response controls have been generated for this operation.

Returns:
the number of response controls that have been generated

addRequestControl

void addRequestControl(org.apache.directory.shared.ldap.message.control.Control requestControl)
Adds a request control to this operation.

Parameters:
requestControl - the request control to add to this operation

hasRequestControl

boolean hasRequestControl(java.lang.String numericOid)
Checks to see if a request control is present on this request.

Parameters:
numericOid - the numeric OID of the control also known as it's type OID
Returns:
true if the control is associated with this operation, false otherwise

hasRequestControls

boolean hasRequestControls()
Checks if any request controls exists for this operation.

Returns:
true if any request controls exist, false otherwise

getRequestControl

org.apache.directory.shared.ldap.message.control.Control getRequestControl(java.lang.String numericOid)
Gets a request control if present for this request.

Parameters:
numericOid - the numeric OID of the control also known as it's type OID
Returns:
the control if present

addRequestControls

void addRequestControls(org.apache.directory.shared.ldap.message.control.Control[] requestControls)
Adds many request controls to this operation.

Parameters:
requestControls - the request controls to add to this operation

getName

java.lang.String getName()
Returns:
the operation's name

isBypassed

boolean isBypassed(java.lang.String interceptorName)
Checks to see if an Interceptor is bypassed for this operation.

Parameters:
interceptorName - the interceptorName of the Interceptor to check for bypass
Returns:
true if the Interceptor should be bypassed, false otherwise

hasBypass

boolean hasBypass()
Checks to see if any Interceptors are bypassed by this Invocation.

Returns:
true if at least one bypass exists

getByPassed

java.util.Collection<java.lang.String> getByPassed()
Gets the set of bypassed Interceptors.

Returns:
the set of bypassed Interceptors

setByPassed

void setByPassed(java.util.Collection<java.lang.String> byPassed)
Sets the set of bypassed Interceptors.

Parameters:
byPassed - the set of bypassed Interceptors

getSession

CoreSession getSession()
Gets the session associated with this operation.

Returns:
the session associated with this operation

newLookupContext

LookupOperationContext newLookupContext(org.apache.directory.shared.ldap.name.DN dn)

lookup

ClonedServerEntry lookup(org.apache.directory.shared.ldap.name.DN dn,
                         java.util.Collection<java.lang.String> byPass)
                         throws java.lang.Exception
Throws:
java.lang.Exception

lookup

ClonedServerEntry lookup(LookupOperationContext lookupContext)
                         throws java.lang.Exception
Throws:
java.lang.Exception

modify

void modify(org.apache.directory.shared.ldap.name.DN dn,
            java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods,
            java.util.Collection<java.lang.String> byPass)
            throws java.lang.Exception
Throws:
java.lang.Exception

add

void add(org.apache.directory.shared.ldap.entry.ServerEntry entry,
         java.util.Collection<java.lang.String> byPass)
         throws java.lang.Exception
Throws:
java.lang.Exception

delete

void delete(org.apache.directory.shared.ldap.name.DN dn,
            java.util.Collection<java.lang.String> byPass)
            throws java.lang.Exception
Throws:
java.lang.Exception

hasEntry

boolean hasEntry(org.apache.directory.shared.ldap.name.DN dn,
                 java.util.Collection<java.lang.String> byPass)
                 throws java.lang.Exception
Checks to see if an entry exists.

Parameters:
dn - the distinguished name of the entry to check
byPass - collection of Interceptor's to bypass for this check
Returns:
true if the entry exists, false if it does not
Throws:
java.lang.Exception - on failure to perform this operation

throwReferral

void throwReferral()
Set the throwReferral flag to true


isReferralThrown

boolean isReferralThrown()
Returns:
true if the referrals are thrown

ignoreReferral

void ignoreReferral()
Set the throwReferral flag to false


isReferralIgnored

boolean isReferralIgnored()
Returns:
true if the referrals are ignored


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.