issrg.pba.rbac.xmlpolicy.ifstatement
Class ConstantNode

java.lang.Object
  extended by issrg.pba.rbac.xmlpolicy.PolicyXMLNode
      extended by issrg.pba.rbac.xmlpolicy.ifstatement.TermNode
          extended by issrg.pba.rbac.xmlpolicy.ifstatement.ConstantNode
All Implemented Interfaces:
Term

public class ConstantNode
extends TermNode

This is the class that represents a Constant node and evaluates the contant specified in the policy XML.

If the policy contains the constant of type for which there is no constructor provided by the AEF (not registered with the Types), an EvaluationException will occur at construction-time.

Author:
A.Otenko

Field Summary
static java.lang.String CONSTANT_NODE
          This is the name of the node that represents the Constant - a static value specified in the policy.
protected  java.lang.String type
           
protected  java.lang.Object value
           
 
Fields inherited from class issrg.pba.rbac.xmlpolicy.ifstatement.TermNode
maxOperand, minOperand, terms
 
Fields inherited from class issrg.pba.rbac.xmlpolicy.PolicyXMLNode
attributes, children, name, nodeStr
 
Constructor Summary
protected ConstantNode()
           
  ConstantNode(XMLPolicyParser p, org.xml.sax.Attributes attr)
          This constructor builds an ConstantNode, given a XMLPolicyParser and the set of attributes of this XML element.
 
Method Summary
 java.lang.Object evaluate(Environment env)
          This method returns the value of the constant evaluated at construction time.
 java.lang.String getType()
          This method returns the Type of the constant as determined at construction time.
static void register()
          This method should be called to register the node with the XML Parser
 
Methods inherited from class issrg.pba.rbac.xmlpolicy.ifstatement.TermNode
construct, getInterpretersForNode, registerInterpreterForNode
 
Methods inherited from class issrg.pba.rbac.xmlpolicy.PolicyXMLNode
addChild, addString, getAttributes, getChildren, getName, getString, toString, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTANT_NODE

public static final java.lang.String CONSTANT_NODE
This is the name of the node that represents the Constant - a static value specified in the policy.

See Also:
Constant Field Values

type

protected java.lang.String type

value

protected java.lang.Object value
Constructor Detail

ConstantNode

protected ConstantNode()

ConstantNode

public ConstantNode(XMLPolicyParser p,
                    org.xml.sax.Attributes attr)
             throws EvaluationException,
                    PolicyParsingException
This constructor builds an ConstantNode, given a XMLPolicyParser and the set of attributes of this XML element. It expects that a issrg.pba.rbac.xmlpolicy.XMLTags.TYPE_ATTRIBUTE and issrg.pba.rbac.xmlpolicy.XMLTags.VALUE_ATTRIBUTE ("Type" and "Value") are present in this XML element. The value is converted from string into a Java object using the Types.construct() method, so the type of the value must be registered there.

Parameters:
p - - the XMLPolicyParser that builds this ConstantNode
attr - - the attributes of this XML element
Throws:
EvaluationException, - if the value could not be decoded using available types
EvaluationException
PolicyParsingException
See Also:
Types.construct(java.lang.String, java.lang.String)
Method Detail

register

public static void register()
This method should be called to register the node with the XML Parser


getType

public java.lang.String getType()
This method returns the Type of the constant as determined at construction time.

Returns:
a case-sensitive type name as calculated at run-time

evaluate

public java.lang.Object evaluate(Environment env)
                          throws EvaluationException
This method returns the value of the constant evaluated at construction time. It doesn't actually throw EvaluationExceptions, but the clause is kept for subclasses, if there will be any.

Parameters:
env - is the execution environment
Returns:
an object representing the result
Throws:
EvaluationException - if the term cannot be evaluated