net.geant.edugain.attributes.matchers
Class AttributeMatcher

java.lang.Object
  extended by net.geant.edugain.attributes.matchers.AttributeMatcher
All Implemented Interfaces:
Matcher

public class AttributeMatcher
extends java.lang.Object
implements Matcher

Matcher class for simple and regular expression matching against attributes. Simple match is done by attributeName checking - if attribute exists with the given name - the match succeeds. Regular expression match is done against the attribute values of the given attribute. Only the matching attribute values are to be bound to the RuleContext.

Author:
Adam Lantos

Field Summary
private  java.lang.String attributeName
           
private  AttributeMatchType configuration
           
private  RegularExpressionHelper helper
           
private  org.apache.log4j.Logger log
           
 
Constructor Summary
AttributeMatcher()
           
 
Method Summary
 void init(MatchType configuration)
          Initialize this matcher with the parsed configuration.
 boolean match(RuleContext c)
          Do a match against the attributes in rule context.
private  boolean match(RuleContext c, AttributeSet aSet)
          Internal method to support attribute set matching.
protected  boolean regexpMatch(RuleContext c, AttributeValues values)
          Match against the regular expression defined as the text value in AttributeMatch node.
protected  boolean simpleMatch(RuleContext c, AttributeValues values)
          Simple match - check only the attributeName, and put the attribute in the RuleContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configuration

private AttributeMatchType configuration

attributeName

private java.lang.String attributeName

helper

private RegularExpressionHelper helper

log

private org.apache.log4j.Logger log
Constructor Detail

AttributeMatcher

public AttributeMatcher()
Method Detail

init

public void init(MatchType configuration)
Initialize this matcher with the parsed configuration.

Specified by:
init in interface Matcher
Parameters:
configuration -

match

public boolean match(RuleContext c)
Do a match against the attributes in rule context. When the AttributeMatch node containes anything, regular expression matching is in effect, else this class makes 'simple' match: check only the attributeName.

Specified by:
match in interface Matcher
Parameters:
c -
Returns:

match

private boolean match(RuleContext c,
                      AttributeSet aSet)
Internal method to support attribute set matching.

Parameters:
c -
aSet -
Returns:

simpleMatch

protected boolean simpleMatch(RuleContext c,
                              AttributeValues values)
Simple match - check only the attributeName, and put the attribute in the RuleContext.

Parameters:
c -
values -
Returns:

regexpMatch

protected boolean regexpMatch(RuleContext c,
                              AttributeValues values)
Match against the regular expression defined as the text value in AttributeMatch node. When the id attribute is set, bind the regular expression group matches to the RuleContext. When no id is set, bind the attribute value itself.

Parameters:
c -
values -
Returns: