SunTM's XACML Implementation for JavaTM

com.sun.xacml
Class TargetMatch

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

public class TargetMatch
extends Object

Represents the SubjectMatch, ResourceMatch, or ActionMatch XML types in XACML, depending on the value of the type field. This is the part of the Target that actually evaluates whether the specified attribute values in the Target match the corresponding attribute values in the request context.

Since:
1.0

Field Summary
static int ACTION
          An integer value indicating that this class represents an ActionMatch
static int RESOURCE
          An integer value indicating that this class represents a ResourceMatch
static int SUBJECT
          An integer value indicating that this class represents a SubjectMatch
 
Constructor Summary
TargetMatch(int type, Function function, Evaluatable eval, AttributeValue attrValue)
          Constructor that creates a TargetMatch from components.
 
Method Summary
 void encode(OutputStream output)
          Encodes this TargetMatch into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this TargetMatch into its XML representation and writes this encoding to the given OutputStream with indentation.
static TargetMatch getInstance(Node root, String prefix, String xpathVersion)
          Creates a TargetMatch by parsing a node, using the input prefix to determine whether this is a SubjectMatch, ResourceMatch, or ActionMatch.
 Evaluatable getMatchEvaluatable()
          Returns the AttributeDesignator or AttributeSelector used by the matching function.
 Function getMatchFunction()
          Returns the Function used to do the matching.
 AttributeValue getMatchValue()
          Returns the AttributeValue used by the matching function.
 int getType()
          Returns the type of this TargetMatch, either SUBJECT, RESOURCE, or ACTION.
 MatchResult match(EvaluationCtx context)
          Determines whether this TargetMatch 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
 

Field Detail

SUBJECT

public static final int SUBJECT
An integer value indicating that this class represents a SubjectMatch

See Also:
Constant Field Values

RESOURCE

public static final int RESOURCE
An integer value indicating that this class represents a ResourceMatch

See Also:
Constant Field Values

ACTION

public static final int ACTION
An integer value indicating that this class represents an ActionMatch

See Also:
Constant Field Values
Constructor Detail

TargetMatch

public TargetMatch(int type,
                   Function function,
                   Evaluatable eval,
                   AttributeValue attrValue)
            throws IllegalArgumentException
Constructor that creates a TargetMatch from components.

Parameters:
type - an integer indicating whether this class represents a SubjectMatch, ResourceMatch, or ActionMatch
function - the Function that represents the MatchId
eval - the AttributeDesignator or AttributeSelector to be used to select attributes from the request context
attrValue - the AttributeValue to compare against
Throws:
IllegalArgumentException - if the input type isn't a valid value
Method Detail

getInstance

public static TargetMatch getInstance(Node root,
                                      String prefix,
                                      String xpathVersion)
                               throws ParsingException,
                                      IllegalArgumentException
Creates a TargetMatch by parsing a node, using the input prefix to determine whether this is a SubjectMatch, ResourceMatch, or ActionMatch.

Parameters:
root - the node to parse for the TargetMatch
prefix - a String indicating what type of TargetMatch to instantiate (Subject, Resource, or Action)
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 TargetMatch constructed by parsing
Throws:
ParsingException - if there was an error during parsing
IllegalArgumentException - if the input prefix isn't a valid value

getType

public int getType()
Returns the type of this TargetMatch, either SUBJECT, RESOURCE, or ACTION.

Returns:
the type

getMatchFunction

public Function getMatchFunction()
Returns the Function used to do the matching.

Returns:
the match function

getMatchValue

public AttributeValue getMatchValue()
Returns the AttributeValue used by the matching function.

Returns:
the AttributeValue for the match

getMatchEvaluatable

public Evaluatable getMatchEvaluatable()
Returns the AttributeDesignator or AttributeSelector used by the matching function.

Returns:
the designator or selector for the match

match

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

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

encode

public void encode(OutputStream output)
Encodes this TargetMatch 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 TargetMatch 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.