JBoss port of sunxacml 2.0.8.Final-redhat-1

org.jboss.security.xacml.sunxacml.cond
Class VariableManager

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.cond.VariableManager

public class VariableManager
extends Object

This class is used by the parsing routines to handle the relationships between variable references and definitions. Specifically, it takes care of the fact that definitions can be placed after their first reference, and can use references to create circular or recursive relationships. It keeps track of what's in the process of being parsed and will pre-parse elements as needed.

Note that you should never have to use this class directly. It is really meant only as a utility for the internal parsing routines. Also, note that the operations on this class are not thread-safe. Typically this doesn't matter, since the code doesn't support using more than one thread to parse a single Policy.

Since:
2.0
Author:
Seth Proctor

Constructor Summary
VariableManager(Map variableIds, PolicyMetaData metaData)
          Creates a manager with a fixed set of supported identifiers.
 
Method Summary
 VariableDefinition getDefinition(String variableId)
          Returns the definition with the given identifier.
 URI getVariableType(String variableId)
          Returns the datatype that the identified definition's expression resolves to on evaluation.
 boolean returnsBag(String variableId)
          Returns true if the identified definition's expression resolves to a bag on evaluation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableManager

public VariableManager(Map variableIds,
                       PolicyMetaData metaData)
Creates a manager with a fixed set of supported identifiers. For each of these identifiers, the map supplies a cooresponding DOM node used to parse the definition. This is used if, in the course of parsing one definition, a reference requires that you have information about another definition available. All parsed definitions are cached so that each is only parsed once. If a node is not provided, then the parsing code may throw an exception if out-of-order or circular refereces are used.

Note that the use of a DOM node may change to an arbitrary interface, so that you could use your own mechanism, but this is still being hashed out. This interface will be forzed before a 2.0 release.

Parameters:
variableIds - a Map from an identifier to the Node that is the root of the cooresponding variable definition, or null
metaData - the meta-data associated with the containing policy
Method Detail

getDefinition

public VariableDefinition getDefinition(String variableId)
Returns the definition with the given identifier. If the definition is not available, then this method will try to get the definition based on the DOM node given for this identifier. If parsing the definition requires loading another definition (because of a reference) then this method will be recursively invoked. This may make it slow to call this method once, but all retrieved definitions are cached, and once this manager has started parsing a definition it will never try parsing that definition again. If the definition cannot be retrieved, then an exception is thrown.

Parameters:
variableId - the definition's identifier
Returns:
the identified definition
Throws:
ProcessingException - if the definition cannot be resolved

getVariableType

public URI getVariableType(String variableId)
Returns the datatype that the identified definition's expression resolves to on evaluation. Note that this method makes every attempt to discover this value, including parsing dependent definitions if needed and possible.

Parameters:
variableId - the identifier for the definition
Returns:
the datatype that the identified definition's expression evaluates to
Throws:
ProcessingException - if the identifier is not supported or if the result cannot be resolved

returnsBag

public boolean returnsBag(String variableId)
Returns true if the identified definition's expression resolves to a bag on evaluation. Note that this method makes every attempt to discover this value, including parsing dependent definitions if needed and possible.

Parameters:
variableId - the identifier for the definition
Returns:
true if the identified definition's expression evaluates to a bag
Throws:
ProcessingException - if the identifier is not supported or if the result cannot be resolved

JBoss port of sunxacml 2.0.8.Final-redhat-1

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.