net.geant.edugain.attributes.rules
Class AbstractRule

java.lang.Object
  extended by net.geant.edugain.attributes.rules.AbstractRule
All Implemented Interfaces:
Rule
Direct Known Subclasses:
BasicRule, FilterRule, MergeRule, SplitRule

public abstract class AbstractRule
extends java.lang.Object
implements Rule

Abstract base class for all Attribute manipulating rules

Author:
Adam Lantos

Field Summary
protected  ConditionType condition
          Parsed condition data
protected  RuleType configuration
          Parsed configuration data
private  org.apache.log4j.Logger log
           
protected  java.util.List<Matcher> matchers
          Matcher helper objects
protected  java.util.List<AttributeType> outputAttributeConfiguration
          Parsed output attribute configuration
 
Constructor Summary
AbstractRule()
           
 
Method Summary
protected  boolean doOutputAttribute(RuleContext c)
          Creates new Attributes in RuleContext's AttributeSet
protected  boolean evaluateConditions(RuleContext c)
          Call all matchers.
 ConditionType getCondition()
           
protected  RuleType getConfiguration()
           
 java.util.List<Matcher> getMatchers()
           
 java.util.List<AttributeType> getOutputAttributeConfiguration()
           
 void init(RuleType configuration)
          Initialize the rule with the parsed configuration.
 void process(RequestContext requestContext)
          Process the current Attributes according to the remote side.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configuration

protected RuleType configuration
Parsed configuration data


condition

protected ConditionType condition
Parsed condition data


outputAttributeConfiguration

protected java.util.List<AttributeType> outputAttributeConfiguration
Parsed output attribute configuration


matchers

protected java.util.List<Matcher> matchers
Matcher helper objects


log

private org.apache.log4j.Logger log
Constructor Detail

AbstractRule

public AbstractRule()
Method Detail

init

public void init(RuleType configuration)
Initialize the rule with the parsed configuration. This method is called once after instantiation. Subclasses should override this method and process configuration data. When overridden, subclass must call super.init() first. Any RuntimeException thrown is considered to be a fatal error.

Specified by:
init in interface Rule
Parameters:
configuration -

process

public void process(RequestContext requestContext)
Process the current Attributes according to the remote side. Its a template method, subclasses should not override it. Subclasses must override the abstract doXXXX methods instead. The Attribute processing context is stored in a RuleContext object. This context stores all runtime information (regular expression matches, remote provider id).

Specified by:
process in interface Rule
Parameters:
aSet -
remote -
See Also:
RuleContext

evaluateConditions

protected boolean evaluateConditions(RuleContext c)
Call all matchers.

Parameters:
c -
Returns:

doOutputAttribute

protected boolean doOutputAttribute(RuleContext c)
                             throws EvaluationException
Creates new Attributes in RuleContext's AttributeSet

Parameters:
c -
Returns:
Throws:
EvaluationException

getConfiguration

protected RuleType getConfiguration()

getCondition

public ConditionType getCondition()

getMatchers

public java.util.List<Matcher> getMatchers()

getOutputAttributeConfiguration

public java.util.List<AttributeType> getOutputAttributeConfiguration()