com.cafesoft.cams.access
Class AbstractAccessControlRule

java.lang.Object
  |
  +--com.cafesoft.cams.access.AbstractAccessControlRule
All Implemented Interfaces:
AccessControlRule, AccessControlRuleElement, Debuggable

public abstract class AbstractAccessControlRule
extends Object
implements AccessControlRule

AbstractAccessControlRule is an abstract implementation of AccessControlRule that provides an implementation for basic methods. Concrete AbstractControlRule implementations may extend this class and override the "evaluate" method.


Field Summary
protected  Config config
          The Config from which resources are made available.
protected  boolean debug
          A flag that enables/disables DEBUG-level messages.
protected  String desc
          A textual description of the AccessControlRule.
protected  String id
          The AccessControlRule ID (unique within SecurityDomain).
protected  Logger logger
          Logger for this object
 
Constructor Summary
AbstractAccessControlRule()
          Create a new AccessControlRule.
AbstractAccessControlRule(String id)
          Create a new AccessControlRule with the specified ID.
 
Method Summary
 void destroy()
          Destroy the AccessControlRule.
abstract  boolean evaluate(InternalAccessControlRequest accessRequest, InternalAccessControlResponse accessResponse)
          Evaluate the AccessControlRule.
 String getDescription()
          Get a description of this AccessControlRule.
 String getId()
          Get the identifier.
 void initialize(Config config)
          Initialize the AccessControlRule.
 boolean setDebug(boolean enable)
          Enable or disable debugging.
 void setDescription(String desc)
          Set a description of this AccessControlRule.
 void setId(String id)
          Set the identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected boolean debug
A flag that enables/disables DEBUG-level messages.


id

protected String id
The AccessControlRule ID (unique within SecurityDomain).


desc

protected String desc
A textual description of the AccessControlRule.


config

protected Config config
The Config from which resources are made available.


logger

protected Logger logger
Logger for this object

Constructor Detail

AbstractAccessControlRule

public AbstractAccessControlRule()
Create a new AccessControlRule.


AbstractAccessControlRule

public AbstractAccessControlRule(String id)
Create a new AccessControlRule with the specified ID.

Parameters:
id - the AccessControlRule identifier.
Method Detail

setDebug

public boolean setDebug(boolean enable)
Enable or disable debugging.

Specified by:
setDebug in interface Debuggable
Parameters:
enable - if true, enable debugging, else disable debugging.
Returns:
the previous value of the debug flag, which is useful for restoring the debug state if temporarily changed.

initialize

public void initialize(Config config)
                throws ConfigException
Initialize the AccessControlRule.

Specified by:
initialize in interface AccessControlRule
Parameters:
config - a Config object that provides access to configuration parameters and a runtime Context.
ConfigException

getId

public String getId()
Get the identifier.

Specified by:
getId in interface AccessControlRule
Returns:
a unique identifier for the AccessControlRule for use it referencing and looking it up. Return null if no identifier.

setId

public void setId(String id)
Set the identifier.

Specified by:
setId in interface AccessControlRule
Parameters:
id - a unique identifier for the AccessControlRule.

getDescription

public String getDescription()
Get a description of this AccessControlRule.

Specified by:
getDescription in interface AccessControlRule
Returns:
a textual description of this rule or null if none available.

setDescription

public void setDescription(String desc)
Set a description of this AccessControlRule.

Specified by:
setDescription in interface AccessControlRule
Parameters:
desc - a textual description of this rule.

evaluate

public abstract boolean evaluate(InternalAccessControlRequest accessRequest,
                                 InternalAccessControlResponse accessResponse)
                          throws EvaluationException
Evaluate the AccessControlRule.

Specified by:
evaluate in interface AccessControlRule
Parameters:
accessRequest - the access request.
accessResponse - the access response.
Returns:
true if the rule evaluates to true, else false.
Throws:
EvaluationException - if an error when attempting to evaluate the rule.

destroy

public void destroy()
Destroy the AccessControlRule. This method enables AccessControlRule implementations to release any runtime resources they may be holding.

Specified by:
destroy in interface AccessControlRule


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.