SunTM's XACML Implementation for JavaTM

com.sun.xacml.attr
Class AttributeDesignator

java.lang.Object
  extended bycom.sun.xacml.attr.AttributeDesignator
All Implemented Interfaces:
Evaluatable

public class AttributeDesignator
extends Object
implements Evaluatable

Represents all four kinds of Designators in XACML.

Since:
1.0

Field Summary
static int ACTION_TARGET
          Tells designator to search in the action section of the request
static int ENVIRONMENT_TARGET
          Tells designator to search in the environment section of the request
static int RESOURCE_TARGET
          Tells designator to search in the resource section of the request
static String SUBJECT_CATEGORY_DEFAULT
          The standard URI for the default subject category value
static int SUBJECT_TARGET
          Tells designator to search in the subject section of the request
 
Constructor Summary
AttributeDesignator(int target, URI type, URI id, boolean mustBePresent)
          Creates a new AttributeDesignator without the optional issuer.
AttributeDesignator(int target, URI type, URI id, boolean mustBePresent, URI issuer)
          Creates a new AttributeDesignator with the optional issuer.
 
Method Summary
 void encode(OutputStream output)
          Encodes this designator into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this designator into its XML representation and writes this encoding to the given OutputStream with indentation.
 EvaluationResult evaluate(EvaluationCtx context)
          Evaluates the pre-assigned meta-data against the given context, trying to find some matching values.
 boolean evaluatesToBag()
          Always returns true, since a designator always returns a bag of attribute values.
 URI getCategory()
          Returns the subject category for this designator.
 List getChildren()
          Always returns an empty list since designators never have children.
 int getDesignatorType()
          Returns the type of this designator as specified by the *_TARGET fields.
 URI getId()
          Returns the AttributeId of the values resolved by this designator.
static AttributeDesignator getInstance(Node root, int target)
          Creates a new AttributeDesignator based on the DOM root of the XML data.
 URI getIssuer()
          Returns the issuer of the values resolved by this designator if specified.
 URI getType()
          Returns the type of attribute that is resolved by this designator.
 boolean mustBePresent()
          Returns whether or not a value is required to be resolved by this designator.
 void setSubjectCategory(URI category)
          Sets the category if this is a SubjectAttributeDesignatorType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBJECT_TARGET

public static final int SUBJECT_TARGET
Tells designator to search in the subject section of the request

See Also:
Constant Field Values

RESOURCE_TARGET

public static final int RESOURCE_TARGET
Tells designator to search in the resource section of the request

See Also:
Constant Field Values

ACTION_TARGET

public static final int ACTION_TARGET
Tells designator to search in the action section of the request

See Also:
Constant Field Values

ENVIRONMENT_TARGET

public static final int ENVIRONMENT_TARGET
Tells designator to search in the environment section of the request

See Also:
Constant Field Values

SUBJECT_CATEGORY_DEFAULT

public static final String SUBJECT_CATEGORY_DEFAULT
The standard URI for the default subject category value

See Also:
Constant Field Values
Constructor Detail

AttributeDesignator

public AttributeDesignator(int target,
                           URI type,
                           URI id,
                           boolean mustBePresent)
Creates a new AttributeDesignator without the optional issuer.

Parameters:
target - the type of designator as specified by the 4 member *_TARGET fields
type - the data type resolved by this designator
id - the attribute id looked for by this designator
mustBePresent - whether resolution must find a value

AttributeDesignator

public AttributeDesignator(int target,
                           URI type,
                           URI id,
                           boolean mustBePresent,
                           URI issuer)
                    throws IllegalArgumentException
Creates a new AttributeDesignator with the optional issuer.

Parameters:
target - the type of designator as specified by the 4 member *_TARGET fields
type - the data type resolved by this designator
id - the attribute id looked for by this designator
mustBePresent - whether resolution must find a value
issuer - the issuer of the values to search for or null if no issuer is specified
Throws:
IllegalArgumentException - if the input target isn't a valid value
Method Detail

setSubjectCategory

public void setSubjectCategory(URI category)
Sets the category if this is a SubjectAttributeDesignatorType

Parameters:
category - the subject category

getInstance

public static AttributeDesignator getInstance(Node root,
                                              int target)
                                       throws ParsingException
Creates a new AttributeDesignator based on the DOM root of the XML data.

Parameters:
root - the DOM root of the AttributeDesignatorType XML type
target - the type of designator to create as specified in the four member *_TARGET fields
Returns:
the designator
Throws:
ParsingException - if the AttributeDesignatorType was invalid

getDesignatorType

public int getDesignatorType()
Returns the type of this designator as specified by the *_TARGET fields.

Returns:
the designator type

getType

public URI getType()
Returns the type of attribute that is resolved by this designator. While an AD will always return a bag, this method will always return the type that is stored in the bag.

Specified by:
getType in interface Evaluatable
Returns:
the attribute type

getId

public URI getId()
Returns the AttributeId of the values resolved by this designator.

Returns:
identifier for the values to resolve

getCategory

public URI getCategory()
Returns the subject category for this designator. If this is not a SubjectAttributeDesignator then this will always return null.

Returns:
the subject category or null if this isn't a SubjectAttributeDesignator

getIssuer

public URI getIssuer()
Returns the issuer of the values resolved by this designator if specified.

Returns:
the attribute issuer or null if unspecified

mustBePresent

public boolean mustBePresent()
Returns whether or not a value is required to be resolved by this designator.

Returns:
true if a value is required, false otherwise

evaluatesToBag

public boolean evaluatesToBag()
Always returns true, since a designator always returns a bag of attribute values.

Specified by:
evaluatesToBag in interface Evaluatable
Returns:
true

getChildren

public List getChildren()
Always returns an empty list since designators never have children.

Specified by:
getChildren in interface Evaluatable
Returns:
an empty List

evaluate

public EvaluationResult evaluate(EvaluationCtx context)
Evaluates the pre-assigned meta-data against the given context, trying to find some matching values.

Specified by:
evaluate in interface Evaluatable
Parameters:
context - the representation of the request
Returns:
a result containing a bag either empty because no values were found or containing at least one value, or status associated with an Indeterminate result

encode

public void encode(OutputStream output)
Encodes this designator into its XML representation and writes this encoding to the given OutputStream with no indentation.

Specified by:
encode in interface Evaluatable
Parameters:
output - a stream into which the XML-encoded data is written

encode

public void encode(OutputStream output,
                   Indenter indenter)
Encodes this designator into its XML representation and writes this encoding to the given OutputStream with indentation.

Specified by:
encode in interface Evaluatable
Parameters:
output - a stream into which the XML-encoded data is written
indenter - an object that creates indentation strings

Sun's XACML Implementation Version 1.2

Copyright 2003-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

Sun, Sun Microsystems, the Sun Logo, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.