org.entityfs
Class AbstractAccessController

java.lang.Object
  extended by org.entityfs.AbstractAccessController
All Implemented Interfaces:
AccessController
Direct Known Subclasses:
AccessGranterAccessController, DisabledAccessController

public abstract class AbstractAccessController
extends Object
implements AccessController

Abstract base class for AccessController implementations. It stores a thread's subject as an InheritableThreadLocal.

Since:
1.0
Author:
Karl Gustafsson

Constructor Summary
AbstractAccessController()
           
 
Method Summary
 void checkPermission(Permission p)
          Verify that the current Subject is authorized for the permission.
 Collection<? extends LockCommand> getLockCommandsForAccessControl(Entity ev)
          Get the collection of lock commands that have to be executed in order to get all required locks for performing an access control on the supplied entity.
 Subject getSubject()
          Get the Subject for the current thread.
 void setSubject(Subject s)
          Set the subject for the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.entityfs.security.AccessController
hasPermission, isEnabled
 

Constructor Detail

AbstractAccessController

public AbstractAccessController()
Method Detail

setSubject

public void setSubject(Subject s)
Description copied from interface: AccessController
Set the subject for the current thread. Don't invoke this method directly; use one of the Subject.doAs(java.security.PrivilegedAction) or Subject.doAs(java.security.PrivilegedExceptionAction) methods instead.

Specified by:
setSubject in interface AccessController
Parameters:
s - The new subject for the current thread. May be null.

getSubject

public Subject getSubject()
Description copied from interface: AccessController
Get the Subject for the current thread.

Specified by:
getSubject in interface AccessController
Returns:
The Subject, or null if the current thread does not have a Subject set.

checkPermission

public void checkPermission(Permission p)
Description copied from interface: AccessController
Verify that the current Subject is authorized for the permission.

The AccessController.hasPermission(Permission) method performs the same checks as this method, but returns false instead of throwing an exception if the subject does not have the requested permission.

Specified by:
checkPermission in interface AccessController
Parameters:
p - The permission. When EntityFS methods are calling this method, this is always an EntityPermission.
See Also:
AccessController.hasPermission(Permission), AccessController.getLockCommandsForAccessControl(Entity)

getLockCommandsForAccessControl

public Collection<? extends LockCommand> getLockCommandsForAccessControl(Entity ev)
Description copied from interface: AccessController
Get the collection of lock commands that have to be executed in order to get all required locks for performing an access control on the supplied entity.

Specified by:
getLockCommandsForAccessControl in interface AccessController
Parameters:
ev - The entity to perform access controls on. The entity must be in the file system that owns this AccessController.
Returns:
null
See Also:
AccessController.checkPermission(Permission)