org.apache.directory.server.core
Class MockOperation

java.lang.Object
  extended by org.apache.directory.server.core.MockOperation
All Implemented Interfaces:
OperationContext

public class MockOperation
extends java.lang.Object
implements OperationContext


Constructor Summary
MockOperation(int count)
           
 
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.
 ReferralHandlingMode getReferralHandlingMode()
           
 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 isCollateralOperation()
           
 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)
           
 EntryFilteringCursor search(SearchOperationContext opContext)
           
 EntryFilteringCursor search(SearchOperationContext opContext, java.util.Collection<java.lang.String> bypass)
           
 void setByPassed(java.util.Collection<java.lang.String> byPassed)
          Sets the set of bypassed Interceptors.
 void setCollateralOperation(boolean collateralOperation)
           
 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 setReferralHandlingMode(ReferralHandlingMode referralHandlingMode)
           
 void throwReferral()
          Set the throwReferral flag to true
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockOperation

public MockOperation(int count)
              throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

search

public EntryFilteringCursor search(SearchOperationContext opContext)
                            throws javax.naming.NamingException
Throws:
javax.naming.NamingException

search

public EntryFilteringCursor search(SearchOperationContext opContext,
                                   java.util.Collection<java.lang.String> bypass)
                            throws javax.naming.NamingException
Throws:
javax.naming.NamingException

addRequestControl

public void addRequestControl(org.apache.directory.shared.ldap.message.control.Control requestControl)
Description copied from interface: OperationContext
Adds a request control to this operation.

Specified by:
addRequestControl in interface OperationContext
Parameters:
requestControl - the request control to add to this operation

addRequestControls

public void addRequestControls(org.apache.directory.shared.ldap.message.control.Control[] requestControls)
Description copied from interface: OperationContext
Adds many request controls to this operation.

Specified by:
addRequestControls in interface OperationContext
Parameters:
requestControls - the request controls to add to this operation

addResponseControl

public void addResponseControl(org.apache.directory.shared.ldap.message.control.Control responseControl)
Description copied from interface: OperationContext
Adds a response control to this operation.

Specified by:
addResponseControl in interface OperationContext
Parameters:
responseControl - the response control to add to this operation

getByPassed

public java.util.Collection<java.lang.String> getByPassed()
Description copied from interface: OperationContext
Gets the set of bypassed Interceptors.

Specified by:
getByPassed in interface OperationContext
Returns:
the set of bypassed Interceptors

getDn

public org.apache.directory.shared.ldap.name.DN getDn()
Specified by:
getDn in interface OperationContext
Returns:
The associated DN

getName

public java.lang.String getName()
Specified by:
getName in interface OperationContext
Returns:
the operation's name

getRequestControl

public org.apache.directory.shared.ldap.message.control.Control getRequestControl(java.lang.String numericOid)
Description copied from interface: OperationContext
Gets a request control if present for this request.

Specified by:
getRequestControl in interface OperationContext
Parameters:
numericOid - the numeric OID of the control also known as it's type OID
Returns:
the control if present

getResponseControl

public org.apache.directory.shared.ldap.message.control.Control getResponseControl(java.lang.String numericOid)
Description copied from interface: OperationContext
Gets a response control if present for this request.

Specified by:
getResponseControl in interface OperationContext
Parameters:
numericOid - the numeric OID of the control also known as it's type OID
Returns:
the control if present

getResponseControlCount

public int getResponseControlCount()
Description copied from interface: OperationContext
Checks the number of response controls have been generated for this operation.

Specified by:
getResponseControlCount in interface OperationContext
Returns:
the number of response controls that have been generated

getResponseControls

public org.apache.directory.shared.ldap.message.control.Control[] getResponseControls()
Description copied from interface: OperationContext
Gets all the response controls producted during this operation.

Specified by:
getResponseControls in interface OperationContext
Returns:
an array over all the response controls

getSession

public CoreSession getSession()
Description copied from interface: OperationContext
Gets the session associated with this operation.

Specified by:
getSession in interface OperationContext
Returns:
the session associated with this operation

hasBypass

public boolean hasBypass()
Description copied from interface: OperationContext
Checks to see if any Interceptors are bypassed by this Invocation.

Specified by:
hasBypass in interface OperationContext
Returns:
true if at least one bypass exists

hasRequestControl

public boolean hasRequestControl(java.lang.String numericOid)
Description copied from interface: OperationContext
Checks to see if a request control is present on this request.

Specified by:
hasRequestControl in interface OperationContext
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

public boolean hasRequestControls()
Description copied from interface: OperationContext
Checks if any request controls exists for this operation.

Specified by:
hasRequestControls in interface OperationContext
Returns:
true if any request controls exist, false otherwise

hasResponseControl

public boolean hasResponseControl(java.lang.String numericOid)
Description copied from interface: OperationContext
Checks to see if a response control is present on this operation.

Specified by:
hasResponseControl in interface OperationContext
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

hasResponseControls

public boolean hasResponseControls()
Description copied from interface: OperationContext
Checks if any response controls have been generated for this operation.

Specified by:
hasResponseControls in interface OperationContext
Returns:
true if any response controls have been generated, false otherwise

isBypassed

public boolean isBypassed(java.lang.String interceptorName)
Description copied from interface: OperationContext
Checks to see if an Interceptor is bypassed for this operation.

Specified by:
isBypassed in interface OperationContext
Parameters:
interceptorName - the interceptorName of the Interceptor to check for bypass
Returns:
true if the Interceptor should be bypassed, false otherwise

isCollateralOperation

public boolean isCollateralOperation()

lookup

public ClonedServerEntry lookup(org.apache.directory.shared.ldap.name.DN dn,
                                java.util.Collection<java.lang.String> bypass)
                         throws java.lang.Exception
Specified by:
lookup in interface OperationContext
Throws:
java.lang.Exception

lookup

public ClonedServerEntry lookup(LookupOperationContext lookupContext)
                         throws java.lang.Exception
Specified by:
lookup in interface OperationContext
Throws:
java.lang.Exception

newLookupContext

public LookupOperationContext newLookupContext(org.apache.directory.shared.ldap.name.DN dn)
Specified by:
newLookupContext in interface OperationContext

setByPassed

public void setByPassed(java.util.Collection<java.lang.String> byPassed)
Description copied from interface: OperationContext
Sets the set of bypassed Interceptors.

Specified by:
setByPassed in interface OperationContext
Parameters:
byPassed - the set of bypassed Interceptors

setCollateralOperation

public void setCollateralOperation(boolean collateralOperation)

setDn

public void setDn(org.apache.directory.shared.ldap.name.DN dn)
Description copied from interface: OperationContext
Set the context DN

Specified by:
setDn in interface OperationContext
Parameters:
dn - The DN to set

getEffectivePrincipal

public LdapPrincipal getEffectivePrincipal()
Description copied from interface: OperationContext
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.

Specified by:
getEffectivePrincipal in interface OperationContext
Returns:
the effective principal for this operation
See Also:
CoreSession.getAuthenticatedPrincipal(), CoreSession.getEffectivePrincipal()

getFirstOperation

public OperationContext getFirstOperation()
Description copied from interface: OperationContext
Gets the first, direct operation issued against the DirectoryService.

Specified by:
getFirstOperation in interface OperationContext
Returns:
the first, direct operation issued

getLastOperation

public OperationContext getLastOperation()
Description copied from interface: OperationContext
Gets the last, operation issued on the DirectoryService.

Specified by:
getLastOperation in interface OperationContext
Returns:
the last, operation issued

getNextOperation

public OperationContext getNextOperation()
Description copied from interface: OperationContext
Gets the next, indirect operation issued on the DirectoryService.

Specified by:
getNextOperation in interface OperationContext
Returns:
the next, indirect operation issued

getPreviousOperation

public OperationContext getPreviousOperation()
Description copied from interface: OperationContext
Gets the previous, operation issued on the DirectoryService.

Specified by:
getPreviousOperation in interface OperationContext
Returns:
the previous, operation issued

isFirstOperation

public boolean isFirstOperation()
Description copied from interface: OperationContext
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.

Specified by:
isFirstOperation in interface OperationContext
Returns:
true if the operation is the first, false otherwise

add

public void add(org.apache.directory.shared.ldap.entry.ServerEntry entry,
                java.util.Collection<java.lang.String> bypass)
         throws java.lang.Exception
Specified by:
add in interface OperationContext
Throws:
java.lang.Exception

delete

public void delete(org.apache.directory.shared.ldap.name.DN dn,
                   java.util.Collection<java.lang.String> bypass)
            throws java.lang.Exception
Specified by:
delete in interface OperationContext
Throws:
java.lang.Exception

modify

public 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
Specified by:
modify in interface OperationContext
Throws:
java.lang.Exception

hasEntry

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

Specified by:
hasEntry in interface OperationContext
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

getReferralHandlingMode

public ReferralHandlingMode getReferralHandlingMode()

setReferralHandlingMode

public void setReferralHandlingMode(ReferralHandlingMode referralHandlingMode)

getEntry

public ClonedServerEntry getEntry()
Description copied from interface: OperationContext
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.

Specified by:
getEntry in interface OperationContext
Returns:
target entry associated with the DN of this OperationContext

setEntry

public void setEntry(ClonedServerEntry entry)
Description copied from interface: OperationContext
Sets the server entry associated with the target DN of this OperationContext.

Specified by:
setEntry in interface OperationContext
Parameters:
entry - the entry whose DN is associated with this OperationContext.

throwReferral

public void throwReferral()
Description copied from interface: OperationContext
Set the throwReferral flag to true

Specified by:
throwReferral in interface OperationContext

isReferralThrown

public boolean isReferralThrown()
Specified by:
isReferralThrown in interface OperationContext
Returns:
true if the referrals are thrown

ignoreReferral

public void ignoreReferral()
Description copied from interface: OperationContext
Set the throwReferral flag to false

Specified by:
ignoreReferral in interface OperationContext

isReferralIgnored

public boolean isReferralIgnored()
Specified by:
isReferralIgnored in interface OperationContext
Returns:
true if the referrals are ignored


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