org.apache.slide.common
Interface SlideToken

All Known Implementing Classes:
SlideTokenImpl, SlideTokenWrapper

public interface SlideToken

The SlideToken interface identifies the current acting principal and its credentials, and maintains information about the state of the user transaction.

An object implementing this interface is required to use any of the methods provided by the helpers API. The default implementation of this interface is SlideTokenImpl. In the context of a Java servlet, such an object should be instantiated like this:

   Principal principal = request.getUserPrincipal();
   CredentialsToken credentials;
   if (principal == null) {
       credentials = new CredentialsToken("");
   } else {
       credentials = new CredentialsToken(principal);
   }
   SlideToken token = new SlideTokenImpl(credentials);
   

Version:
$Revision: 1.19.2.1 $

Method Summary
 void addLockToken(java.lang.String lockId)
          Add a new lock token to the lock token list.
 void addParameter(java.lang.String parameterName, java.lang.Object parameterValue)
          Add a new parameter to the parameter list.
 void cacheLock(ObjectNode object, ActionNode action, boolean lock)
          allows to cache the result of a lock check
 void cacheMatchPrincipal(SubjectNode checkSubject, SubjectNode matchSubject, boolean match)
          Allows to cache the result of a matchPrincipal operation
 void cachePermission(ObjectNode object, ActionNode action, boolean permission)
          allows to cache the result of a permission check
 void cacheResolve(Uri uri, ResourceId resourceId)
          Allows to cache the result of a resolve operation
 java.lang.Boolean checkLockCache(ObjectNode object, ActionNode action)
          checks if the lock cache contains an entry for the ObjectNode and ActionNode combination.
 boolean checkLockToken(java.lang.String lockToken)
          Checks if the given lock token is present.
 java.lang.Boolean checkMatchPrincipalCache(SubjectNode checkSubject, SubjectNode matchSubject)
          Checks if the matchPrincipal cache
 java.lang.Boolean checkPermissionCache(ObjectNode object, ActionNode action)
          checks if the permission cache contains an entry for the ObjectNode and ActionNode combination.
 ResourceId checkResolveCache(Uri uri)
          Checks if the resolve cache contains an entry for the specified uri.
 void clearLockTokens()
          Clears the lock token list.
 void clearParameters()
          Clears the parameter list.
 CacheInfoToken getCacheInfoToken()
          Returns the CacheInfo token.
 CredentialsToken getCredentialsToken()
          Returns the credentials token.
 java.lang.Object getParameter(java.lang.String name)
          Returns a parameter given by name.
 java.util.Enumeration getParameterNames()
          Return parameter list.
 boolean isEnforceLockTokens()
          Use lock tokens in lock resolution ?
 boolean isExternalTransaction()
          Checks if this request is part of an externally controlled transaction.
 boolean isForceLock()
          Force lock check.
 boolean isForceSecurity()
          Force security check.
 boolean isForceStoreEnlistment()
          Force store enlistment flag accessor.
 void removeLockToken(java.lang.String lockId)
          Removes a lock token from the lock token list.
 void removeParameter(java.lang.String parameterName)
          Removes a parameter from the parameter list.
 void setCacheInfoToken(CacheInfoToken cacheInfoToken)
          CacheInfo token mutator.
 void setCredentialsToken(CredentialsToken credentialsToken)
          Credentials token mutator.
 void setEnforceLockTokens(boolean enforceLockTokens)
          Enforce lock tokens flag mutator.
 void setExternalTx()
          Sets if this request is part of an externally controlled transaction.
 void setForceLock(boolean forceLock)
           
 void setForceSecurity(boolean forceSecurity)
           
 void setForceStoreEnlistment(boolean forceStoreEnlistment)
          Force store enlistment flag mutator.
 java.util.List showLockTokens()
          For debugging purposes ONLY
 

Method Detail

getCredentialsToken

public CredentialsToken getCredentialsToken()
Returns the credentials token.

Returns:
String

setCredentialsToken

public void setCredentialsToken(CredentialsToken credentialsToken)
Credentials token mutator.


getCacheInfoToken

public CacheInfoToken getCacheInfoToken()
Returns the CacheInfo token.

Returns:
CacheInfoToken

setCacheInfoToken

public void setCacheInfoToken(CacheInfoToken cacheInfoToken)
CacheInfo token mutator.


isEnforceLockTokens

public boolean isEnforceLockTokens()
Use lock tokens in lock resolution ?

Returns:
boolean

setEnforceLockTokens

public void setEnforceLockTokens(boolean enforceLockTokens)
Enforce lock tokens flag mutator.

Parameters:
enforceLockTokens - New flag value

isForceStoreEnlistment

public boolean isForceStoreEnlistment()
Force store enlistment flag accessor. If true, that will cause Slide to enlist the store in the current transaction for all operations, to be able to prevent dirty reads when doing complex updates.

Returns:
boolean

setForceStoreEnlistment

public void setForceStoreEnlistment(boolean forceStoreEnlistment)
Force store enlistment flag mutator. If set to true, that will cause Slide to enlist the store in the current transaction for all operations, to be able to prevent dirty reads when doing complex updates. That value should be set to true only in some very specific critical sections of the code, as this would greatly decrease the ability of Slide to handle multiple concurrent requests.

Parameters:
forceStoreEnlistment - New flag value

addLockToken

public void addLockToken(java.lang.String lockId)
Add a new lock token to the lock token list.

Parameters:
lockId - Lock token to add

removeLockToken

public void removeLockToken(java.lang.String lockId)
Removes a lock token from the lock token list.

Parameters:
lockId - Lock token to remove

clearLockTokens

public void clearLockTokens()
Clears the lock token list.


showLockTokens

public java.util.List showLockTokens()
For debugging purposes ONLY


checkLockToken

public boolean checkLockToken(java.lang.String lockToken)
Checks if the given lock token is present.

Parameters:
lockToken - Lock token to check
Returns:
boolean True if the given lock token is present

addParameter

public void addParameter(java.lang.String parameterName,
                         java.lang.Object parameterValue)
Add a new parameter to the parameter list.

Parameters:
parameterName - Parameter to add
parameterValue - Parameter value

removeParameter

public void removeParameter(java.lang.String parameterName)
Removes a parameter from the parameter list.

Parameters:
parameterName - Parameter to remove

clearParameters

public void clearParameters()
Clears the parameter list.


getParameterNames

public java.util.Enumeration getParameterNames()
Return parameter list.


getParameter

public java.lang.Object getParameter(java.lang.String name)
Returns a parameter given by name.

Returns:
the Object associated with name or null if no such parameter exists.

cachePermission

public void cachePermission(ObjectNode object,
                            ActionNode action,
                            boolean permission)
allows to cache the result of a permission check


checkPermissionCache

public java.lang.Boolean checkPermissionCache(ObjectNode object,
                                              ActionNode action)
checks if the permission cache contains an entry for the ObjectNode and ActionNode combination.

Returns:
true if granted, false if denied, null if nothing in the cache.

isForceSecurity

public boolean isForceSecurity()
Force security check. If false, checkCredentials of SecurityImpl will return immediately.

Returns:
a boolean

setForceSecurity

public void setForceSecurity(boolean forceSecurity)

cacheLock

public void cacheLock(ObjectNode object,
                      ActionNode action,
                      boolean lock)
allows to cache the result of a lock check


checkLockCache

public java.lang.Boolean checkLockCache(ObjectNode object,
                                        ActionNode action)
checks if the lock cache contains an entry for the ObjectNode and ActionNode combination.

Returns:
true if locked, false otherwise

cacheResolve

public void cacheResolve(Uri uri,
                         ResourceId resourceId)
Allows to cache the result of a resolve operation


cacheMatchPrincipal

public void cacheMatchPrincipal(SubjectNode checkSubject,
                                SubjectNode matchSubject,
                                boolean match)
Allows to cache the result of a matchPrincipal operation


checkMatchPrincipalCache

public java.lang.Boolean checkMatchPrincipalCache(SubjectNode checkSubject,
                                                  SubjectNode matchSubject)
Checks if the matchPrincipal cache

Returns:
the cached Boolean or null

checkResolveCache

public ResourceId checkResolveCache(Uri uri)
Checks if the resolve cache contains an entry for the specified uri.

Returns:
the cached resourceId or null

isForceLock

public boolean isForceLock()
Force lock check. If false, checkLock of LockImpl will return immediately.

Returns:
a boolean

setForceLock

public void setForceLock(boolean forceLock)

isExternalTransaction

public boolean isExternalTransaction()
Checks if this request is part of an externally controlled transaction.


setExternalTx

public void setExternalTx()
Sets if this request is part of an externally controlled transaction.