issrg.pba.rbac.xmlpolicy.ifstatement
Class OperatorNode

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.OperationNode
              extended by issrg.pba.rbac.xmlpolicy.ifstatement.OperatorNode
All Implemented Interfaces:
Term

public class OperatorNode
extends OperationNode

This is the class for Operator node of the IF-statement. Its functionality is very much determined by OperationNode, which is configured to deliver the following semantics:

This operation expects no or any number of Terms of any type, and returns a value of type determined by the matching Interpreter. There must be an interpreter for the required set of Terms, and it implements the semantics of the evaluation.

It is possible to register the interpreters for specific combinations of Terms. Use registerOperatorInterpreter method to do that. There is no default Interpreter.

Author:
A.Otenko
See Also:
registerOperatorInterpreter(java.lang.String, issrg.pba.rbac.xmlpolicy.ifstatement.Interpreter)

Field Summary
static java.lang.String OPERATOR_NODE
           
 
Fields inherited from class issrg.pba.rbac.xmlpolicy.ifstatement.OperationNode
interpreter, type
 
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 OperatorNode()
           
  OperatorNode(XMLPolicyParser p, org.xml.sax.Attributes attrs)
          This constructor builds a OperatorNode given the XMLPolicyParser and the set of attributes of this XML element.
 
Method Summary
static void register()
          This method should be called to register the node with the XML Parser
static void registerOperatorInterpreter(java.lang.String name, Interpreter i)
          This method maintains a register of interpreters for specific combinations of Terms for the specified operator.
 
Methods inherited from class issrg.pba.rbac.xmlpolicy.ifstatement.OperationNode
construct, evaluate, getType
 
Methods inherited from class issrg.pba.rbac.xmlpolicy.ifstatement.TermNode
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

OPERATOR_NODE

public static final java.lang.String OPERATOR_NODE
See Also:
Constant Field Values
Constructor Detail

OperatorNode

protected OperatorNode()

OperatorNode

public OperatorNode(XMLPolicyParser p,
                    org.xml.sax.Attributes attrs)
             throws PolicyParsingException
This constructor builds a OperatorNode given the XMLPolicyParser and the set of attributes of this XML element. It expects that there are no or many child nodes. It expects there is a issrg.pba.rbac.xmlpolicy.XMLTags.NAME_ATTRIBUTE ("Name") attribute in this XML element.

Parameters:
p - - the XMLPolicyParser that builds this LtNode
attrs - - the attributes of this XML element
Throws:
PolicyParsingException - if there is no issrg.pba.rbac.xmlpolicy.XMLTags.NAME_ATTRIBUTE in this XML element
Method Detail

register

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


registerOperatorInterpreter

public static void registerOperatorInterpreter(java.lang.String name,
                                               Interpreter i)
This method maintains a register of interpreters for specific combinations of Terms for the specified operator. If no special interpreters are registered, the evaluation error occurs. The semantics of the interpreters ensure the semantics of evaluation of the operator.

Parameters:
name - - the operator name
i - - the Interpreter instance that can evaluate the expression for some combination of Terms
See Also:
Interpreter.evaluate(issrg.pba.rbac.xmlpolicy.ifstatement.Environment, issrg.pba.rbac.xmlpolicy.ifstatement.Term[])