org.wso2.balana.cond
Class VariableDefinition

java.lang.Object
  extended by org.wso2.balana.cond.VariableDefinition

public class VariableDefinition
extends Object

This class supports the VariableDefinitionType type introuced in XACML 2.0. It allows a Policy to pre-define any number of expression blocks for general use. Note that it's legal (though not usually useful) to define expressions that don't get referenced within the Policy. It is illegal to have more than one definition with the same identifier within a Policy.

Since:
2.0
Author:
Seth Proctor

Constructor Summary
VariableDefinition(String variableId, Expression expression)
          Creates a new VariableDefinition with the given identifier and expression.
 
Method Summary
 String encode()
          Encodes this VariableDefinition into its XML form
 void encode(StringBuilder builder)
          Encodes this VariableDefinition into its XML form and writes this out to the provided StringBuilder
 Expression getExpression()
          Returns the expression provided by this definition.
static VariableDefinition getInstance(Node root, PolicyMetaData metaData, VariableManager manager)
          Returns a new instance of the VariableDefinition class based on a DOM node.
 String getVariableId()
          Returns the identifier for this definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableDefinition

public VariableDefinition(String variableId,
                          Expression expression)
Creates a new VariableDefinition with the given identifier and expression.

Parameters:
variableId - the identifier for this definition
expression - the expression defined here
Method Detail

getInstance

public static VariableDefinition getInstance(Node root,
                                             PolicyMetaData metaData,
                                             VariableManager manager)
                                      throws ParsingException
Returns a new instance of the VariableDefinition class based on a DOM node. The node must be the root of an XML VariableDefinitionType.

Parameters:
root - the DOM root of a VariableDefinitionType XML type
metaData - the meta-data associated with the containing policy
manager - VariableManager used to connect references to this definition
Throws:
ParsingException - if the VariableDefinitionType is invalid

getVariableId

public String getVariableId()
Returns the identifier for this definition.

Returns:
the definition's identifier

getExpression

public Expression getExpression()
Returns the expression provided by this definition.

Returns:
the definition's expression

encode

public String encode()
Encodes this VariableDefinition into its XML form

Returns:
String

encode

public void encode(StringBuilder builder)
Encodes this VariableDefinition into its XML form and writes this out to the provided StringBuilder

Parameters:
builder - string stream into which the XML-encoded data is written


Copyright © 2015 WSO2. All rights reserved.