SunTM's XACML Implementation for JavaTM

com.sun.xacml
Class Target

java.lang.Object
  extended bycom.sun.xacml.Target

public class Target
extends Object

Represents the TargetType XML type in XACML. This also stores several other XML types: Subjects, Resources, and Actions. The target is used to quickly identify whether the parent element (a policy set, policy, or rule) is applicable to a given request.

Since:
1.0

Constructor Summary
Target(List subjects, List resources, List actions)
          Constructor that creates a Target from components.
 
Method Summary
 void encode(OutputStream output)
          Encodes this Target into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this Target into its XML representation and writes this encoding to the given OutputStream with indentation.
 List getActions()
          Returns an unmodifiable List that represents the Actions section of this target.
static Target getInstance(Node root, String xpathVersion)
          Creates a Target by parsing a node.
 List getResources()
          Returns an unmodifiable List that represents the Resources section of this target.
 List getSubjects()
          Returns an unmodifiable List that represents the Subjects section of this target.
 MatchResult match(EvaluationCtx context)
          Determines whether this Target matches the input request (whether it is applicable).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Target

public Target(List subjects,
              List resources,
              List actions)
Constructor that creates a Target from components.

Parameters:
subjects - A List containing the subjects or null if this represents AnySubject. The list is of the form described in getSubjects.
resources - A List containing the resources or null if this represents AnyResource The list is of the form described in getResources.
actions - A List containing the actions or null if this represents AnyAction The list is of the form described in getActions.
Method Detail

getInstance

public static Target getInstance(Node root,
                                 String xpathVersion)
                          throws ParsingException
Creates a Target by parsing a node.

Parameters:
root - the node to parse for the Target
xpathVersion - the XPath version to use in any selectors, or null if this is unspecified (ie, not supplied in the defaults section of the policy)
Returns:
a new Target constructed by parsing
Throws:
ParsingException - if the DOM node is invalid

getSubjects

public List getSubjects()
Returns an unmodifiable List that represents the Subjects section of this target. Each entry in the List is another List that represents the Subject section. In turn, each of these Lists contains TargetMatch objects that represent SubjectMatch XML structures.

Note that future versions of this code may use intermediary classes to make the structure clearer, but this depends on the future structure of XACML Targets.

Returns:
the matching elements or null of the match is any

getResources

public List getResources()
Returns an unmodifiable List that represents the Resources section of this target. Each entry in the List is another List that represents the Resource section. In turn, each of these Lists contains TargetMatch objects that represent ResourceMatch XML structures.

Note that future versions of this code may use intermediary classes to make the structure clearer, but this depends on the future structure of XACML Targets.

Returns:
the matching elements or null of the match is any

getActions

public List getActions()
Returns an unmodifiable List that represents the Actions section of this target. Each entry in the List is another List that represents the Action section. In turn, each of these Lists contains TargetMatch objects that represent ActionMatch XML structures.

Note that future versions of this code may use intermediary classes to make the structure clearer, but this depends on the future structure of XACML Targets.

Returns:
the matching elements or null of the match is any

match

public MatchResult match(EvaluationCtx context)
Determines whether this Target matches the input request (whether it is applicable).

Parameters:
context - the representation of the request
Returns:
the result of trying to match the target and the request

encode

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

Parameters:
output - a stream into which the XML-encoded data is written

encode

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

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.