issrg.pba.rbac.xmlpolicy.ifstatement
Class NamedTermNode

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.NamedTermNode
All Implemented Interfaces:
Term
Direct Known Subclasses:
ArgNode, EnvironmentNode

public abstract class NamedTermNode
extends TermNode

This class defines the behaviour of the named terms - the Terms that have name meaningful outside the policy. Basically, it keeps the name and type of the node as specified in the policy, and also maintains a collection of nodes by their names.

Version:
1.0
Author:
A.Otenko

Field Summary
protected  java.lang.String parameter_name
           
protected static java.util.Map s_namedTerms
           
protected  java.lang.String 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 NamedTermNode()
           
  NamedTermNode(java.lang.String nodeName, org.xml.sax.Attributes attr, java.lang.String typeAttr, java.lang.String nameAttr)
          This constructor builds a node given its name, a set of attributes, and the names of the attributes defining the type and the name of the term.
 
Method Summary
static java.util.Map getAllNamedTerms()
          This method returns a Map of Sets of all NamedTerms, indexed by the term node name.
 java.lang.String getName()
          This method returns the name of this NamedTerm.
static java.util.Set getNamedTerms(java.lang.String termName)
          This method returns a Set of NamedTerm, given the name of the term node.
 java.lang.String getType()
          This method returns the type of this NamedTerm.
static void resetNamedTerms()
          This method should be used by the parser to reset the collection of NamedTerms before parsing a new policy.
 
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, getString, toString, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface issrg.pba.rbac.xmlpolicy.ifstatement.Term
evaluate
 

Field Detail

s_namedTerms

protected static java.util.Map s_namedTerms

type

protected java.lang.String type

parameter_name

protected java.lang.String parameter_name
Constructor Detail

NamedTermNode

protected NamedTermNode()

NamedTermNode

public NamedTermNode(java.lang.String nodeName,
                     org.xml.sax.Attributes attr,
                     java.lang.String typeAttr,
                     java.lang.String nameAttr)
              throws PolicyParsingException
This constructor builds a node given its name, a set of attributes, and the names of the attributes defining the type and the name of the term.

Parameters:
nodeName - the name of the XML element
attr - the attributes of the XML element being parsed
typeAttr - the name of the attribute containing the type of the term
nameAttr - the name of the attribute containing the name of the term
Throws:
PolicyParsingException
Method Detail

getType

public java.lang.String getType()
This method returns the type of this NamedTerm.

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

getName

public java.lang.String getName()
This method returns the name of this NamedTerm.

Overrides:
getName in class PolicyXMLNode
Returns:
String name of the XML element represented by this object

getNamedTerms

public static java.util.Set getNamedTerms(java.lang.String termName)
This method returns a Set of NamedTerm, given the name of the term node.

Parameters:
termName - the name of the NamedTerm node (for example Arg or Environment)
Returns:
Set of NamedTerm, or null, if no such nodes exist in the policy

getAllNamedTerms

public static java.util.Map getAllNamedTerms()
This method returns a Map of Sets of all NamedTerms, indexed by the term node name. May be empty, but never null.

Because of how the named terms are collected, the Map is valid until the next call to resetNamedTerms(), which will normally happen as soon as the policy has been parsed. Use PolicyParser methods to obtain the actual nodes for a particular policy.


resetNamedTerms

public static void resetNamedTerms()
This method should be used by the parser to reset the collection of NamedTerms before parsing a new policy. As the policy parsing completes, the parser should collect the set of NamedTerms using getNamedTerms() or getAllNamedTerms()