SunTM's XACML Implementation for JavaTM

com.sun.xacml.ctx
Class RequestCtx

java.lang.Object
  extended bycom.sun.xacml.ctx.RequestCtx

public class RequestCtx
extends Object

Represents a request made to the PDP. This is the class that contains all the data used to start a policy evaluation.

Since:
1.0

Constructor Summary
RequestCtx(Set subjects, Set resource, Set action, Set environment)
          Constructor that creates a RequestCtx from components.
RequestCtx(Set subjects, Set resource, Set action, Set environment, Node documentRoot)
          Constructor that creates a RequestCtx from components.
RequestCtx(Set subjects, Set resource, Set action, Set environment, Node documentRoot, String resourceContent)
          Constructor that creates a RequestCtx from components.
RequestCtx(Set subjects, Set resource, Set action, Set environment, String resourceContent)
          Constructor that creates a RequestCtx from components.
 
Method Summary
 void encode(OutputStream output)
          Encodes this context into its XML representation and writes this encoding to the given OutputStream.
 void encode(OutputStream output, Indenter indenter)
          Encodes this context into its XML representation and writes this encoding to the given OutputStream with indentation.
 Set getAction()
          Returns a Set containing Attribute objects.
 Node getDocumentRoot()
          Returns the root DOM node of the document used to create this object, or null if this object was created by hand (ie, not through the getInstance method) or if the root node was not provided to the constructor.
 Set getEnvironmentAttributes()
          Returns a Set containing Attribute objects.
static RequestCtx getInstance(InputStream input)
          Creates a new RequestCtx by parsing XML from an input stream.
static RequestCtx getInstance(Node root)
          Create a new RequestCtx by parsing a node.
 Set getResource()
          Returns a Set containing Attribute objects.
 Set getSubjects()
          Returns a Set containing Subject objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestCtx

public RequestCtx(Set subjects,
                  Set resource,
                  Set action,
                  Set environment)
Constructor that creates a RequestCtx from components.

Parameters:
subjects - a Set of Subjects
resource - a Set of Attributes
action - a Set of Attributes
environment - a Set of environment attributes

RequestCtx

public RequestCtx(Set subjects,
                  Set resource,
                  Set action,
                  Set environment,
                  Node documentRoot)
Constructor that creates a RequestCtx from components.

Parameters:
subjects - a Set of Subjects
resource - a Set of Attributes
action - a Set of Attributes
environment - a Set of environment attributes
documentRoot - the root node of the DOM tree for this request

RequestCtx

public RequestCtx(Set subjects,
                  Set resource,
                  Set action,
                  Set environment,
                  String resourceContent)
Constructor that creates a RequestCtx from components.

Parameters:
subjects - a Set of Subjects
resource - a Set of Attributes
action - a Set of Attributes
environment - a Set of environment attributes
resourceContent - a text-encoded version of the content, suitable for including in the RequestType, including the root RequestContent node

RequestCtx

public RequestCtx(Set subjects,
                  Set resource,
                  Set action,
                  Set environment,
                  Node documentRoot,
                  String resourceContent)
           throws IllegalArgumentException
Constructor that creates a RequestCtx from components.

Parameters:
subjects - a Set of Subjects
resource - a Set of Attributes
action - a Set of Attributes
environment - a Set of environment attributes
documentRoot - the root node of the DOM tree for this request
resourceContent - a text-encoded version of the content, suitable for including in the RequestType, including the root RequestContent node
Throws:
IllegalArgumentException - if the inputs are not well formed
Method Detail

getInstance

public static RequestCtx getInstance(Node root)
                              throws ParsingException
Create a new RequestCtx by parsing a node. This node should be created by schema-verified parsing of an XML document.

Parameters:
root - the node to parse for the RequestCtx
Returns:
a new RequestCtx constructed by parsing
Throws:
URISyntaxException - if there is a badly formed URI
ParsingException - if the DOM node is invalid

getInstance

public static RequestCtx getInstance(InputStream input)
                              throws ParsingException
Creates a new RequestCtx by parsing XML from an input stream. Note that this a convenience method, and it will not do schema validation by default. You should be parsing the data yourself, and then providing the root node to the other getInstance method. If you use this convenience method, you probably want to turn on validation by setting the context schema file (see the programmer guide for more information on this).

Parameters:
input - a stream providing the XML data
Returns:
a new RequestCtx
Throws:
ParserException - if there is an error parsing the input
ParsingException

getSubjects

public Set getSubjects()
Returns a Set containing Subject objects.

Returns:
the request's subject attributes

getResource

public Set getResource()
Returns a Set containing Attribute objects.

Returns:
the request's resource attributes

getAction

public Set getAction()
Returns a Set containing Attribute objects.

Returns:
the request's action attributes

getEnvironmentAttributes

public Set getEnvironmentAttributes()
Returns a Set containing Attribute objects.

Returns:
the request's environment attributes

getDocumentRoot

public Node getDocumentRoot()
Returns the root DOM node of the document used to create this object, or null if this object was created by hand (ie, not through the getInstance method) or if the root node was not provided to the constructor.

Returns:
the root DOM node or null

encode

public void encode(OutputStream output)
Encodes this context into its XML representation and writes this encoding to the given OutputStream. No indentation is used.

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

encode

public void encode(OutputStream output,
                   Indenter indenter)
Encodes this context 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.