net.geant.edugain.attributes
Class RuleContext

java.lang.Object
  extended by net.geant.edugain.attributes.RuleContext

public class RuleContext
extends java.lang.Object

The RuleContext class provides a common context for one attribute converter Rule. This class is instantiated by the rule, and the instance lives until the Rule returns. RuleContext is responsible for the expression handling in the 'output' AttributeValues. This implementation uses JUEL EL implementation from odysseus.de. (http://juel.sourceforge.net). Also RuleContext provides access to the RequestContext which holds input and output attribute sets and other information related to the request.

Author:
Adam Lantos

Field Summary
private  de.odysseus.el.util.SimpleContext elContext
          EL Context
private  javax.el.ExpressionFactory factory
          EL Expression Factory
private  boolean hasMultivaluedMatch
          Whether this context already has multivalued match or not.
private  org.apache.log4j.Logger log
          Logger instance
private  java.util.List multivaluedMatches
          The values of the multivalued match.
private  java.lang.String multivaluedMatchID
          If the context containes multivalued match, this is the ID of it.
private  RequestContext requestContext
          The request context.
 
Constructor Summary
RuleContext(RequestContext requestContext)
          Creates new RuleContext instance.
 
Method Summary
 java.util.List<java.lang.String> getExpressionValues(java.lang.String expression)
          Resolves the EL expression.
 AttributeSet getFilterWorkAttributeSet()
          Returns the filter work AttributeSet this FilterRule operates on.
 AttributeSet getInputAttributeSet()
          Returns the input AttributeSet this Rule operates on.
 java.lang.String getLocalProvider()
          Returns the loal provider identifier from the RequestContext.
 AttributeSet getOutputAttributeSet()
          Returns the output AttributeSet this Rule operates on.
 java.lang.String getRemoteProvider()
          Returns the remote provider identifier from the RequestContext.
 RequestContext getRequestContext()
          Returns the RequestContext of this request.
 void putAttributeMatchValues(java.lang.String attributeMatchID, java.util.List attributeMatches)
          Put Attribute match values to the Rule Context.
 void putVariable(java.lang.String name, java.lang.Object value)
          Bind the variable to the EL Context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hasMultivaluedMatch

private boolean hasMultivaluedMatch
Whether this context already has multivalued match or not.


multivaluedMatchID

private java.lang.String multivaluedMatchID
If the context containes multivalued match, this is the ID of it.


multivaluedMatches

private java.util.List multivaluedMatches
The values of the multivalued match.


elContext

private de.odysseus.el.util.SimpleContext elContext
EL Context


factory

private javax.el.ExpressionFactory factory
EL Expression Factory


log

private org.apache.log4j.Logger log
Logger instance


requestContext

private RequestContext requestContext
The request context.

Constructor Detail

RuleContext

public RuleContext(RequestContext requestContext)
Creates new RuleContext instance.

Parameters:
requestContext -
Method Detail

getRemoteProvider

public java.lang.String getRemoteProvider()
Returns the remote provider identifier from the RequestContext.

Returns:

getLocalProvider

public java.lang.String getLocalProvider()
Returns the loal provider identifier from the RequestContext.

Returns:

putVariable

public void putVariable(java.lang.String name,
                        java.lang.Object value)
Bind the variable to the EL Context. Composite EL Resolver can resolve the following types of objects:

Parameters:
name -
value -

getExpressionValues

public java.util.List<java.lang.String> getExpressionValues(java.lang.String expression)
                                                     throws EvaluationException
Resolves the EL expression. When the context has multi-valued matches (eg. regexp match on multivalued attributes), the output of the expression can be multi valued.

Parameters:
expression -
Returns:
Throws:
EvaluationException

putAttributeMatchValues

public void putAttributeMatchValues(java.lang.String attributeMatchID,
                                    java.util.List attributeMatches)
Put Attribute match values to the Rule Context. These matches are often the regular expression matching groups - eg. the ^([^@]+)@(.*)$ regular expression has 3 matching groups: the whole match, the part before first '@' and the remaining part. When the regular expression containes no further matching groups, only the whole expression is bound to the context - like ${attrName}. Otherwise, it must be referenced like ${regexpMatch[1]}

Parameters:
attributeMatchID - The name for the attributeMatch.
attributeMatches - List of Lists for the regexp matcher groups.

getInputAttributeSet

public AttributeSet getInputAttributeSet()
Returns the input AttributeSet this Rule operates on.

Returns:

getOutputAttributeSet

public AttributeSet getOutputAttributeSet()
Returns the output AttributeSet this Rule operates on.

Returns:

getFilterWorkAttributeSet

public AttributeSet getFilterWorkAttributeSet()
Returns the filter work AttributeSet this FilterRule operates on.

Returns:

getRequestContext

public RequestContext getRequestContext()
Returns the RequestContext of this request.

Returns: