Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.xacml.ctx
Class Result  view Result download Result.java

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

public class Result
extends java.lang.Object

Represents the ResultType XML object from the Context schema. Any number of these may included in a ResponseCtx. This class encodes the decision effect, as well as an optional resource identifier and optional status data. Any number of obligations may also be included.

Since:
1.0

Field Summary
private  int decision
           
static int DECISION_DENY
          The decision to deny the request
static int DECISION_INDETERMINATE
          The decision that a decision about the request cannot be made
static int DECISION_NOT_APPLICABLE
          The decision that nothing applied to us
static int DECISION_PERMIT
          The decision to permit the request
static java.lang.String[] DECISIONS
           
private  java.util.Set obligations
           
private  java.lang.String resource
           
private  Status status
           
 
Constructor Summary
Result(int decision)
          Constructs a Result object with default status data (OK).
Result(int decision, java.util.Set obligations)
          Constructs a Result object with default status data (OK), and obligations, but no resource identifier.
Result(int decision, Status status)
          Constructs a Result object with status data but without a resource identifier.
Result(int decision, Status status, java.util.Set obligations)
          Constructs a Result object with status data and obligations but without a resource identifier.
Result(int decision, Status status, java.lang.String resource)
          Constructs a Result object with status data and a resource identifier.
Result(int decision, Status status, java.lang.String resource, java.util.Set obligations)
          Constructs a Result object with status data, a resource identifier, and obligations.
Result(int decision, java.lang.String resource)
          Constructs a Result object with a resource identifier, but default status data (OK).
Result(int decision, java.lang.String resource, java.util.Set obligations)
          Constructs a Result object with a resource identifier, and obligations, but default status data (OK).
 
Method Summary
 void addObligation(com.sun.xacml.Obligation obligation)
          Adds an obligation to the set of obligations that the PEP must fulfill
 void encode(java.io.OutputStream output)
          Encodes this Result into its XML form and writes this out to the provided OutputStream with no indentation.
 void encode(java.io.OutputStream output, com.sun.xacml.Indenter indenter)
          Encodes this Result into its XML form and writes this out to the provided OutputStream with indentation.
 int getDecision()
          Returns the decision associated with this Result.
static Result getInstance(org.w3c.dom.Node root)
          Creates a new instance of a Result based on the given DOM root node.
 java.util.Set getObligations()
          Returns the set of obligations that the PEP must fulfill, which may be empty.
 java.lang.String getResource()
          Returns the resource to which this Result applies, or null if none is specified.
 Status getStatus()
          Returns the status data included in this Result.
private static java.util.Set parseObligations(org.w3c.dom.Node root)
          Helper method that handles the obligations
 boolean setResource(java.lang.String resource)
          Sets the resource identifier if it has not already been set before.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DECISION_PERMIT

public static final int DECISION_PERMIT
The decision to permit the request

See Also:
Constant Field Values

DECISION_DENY

public static final int DECISION_DENY
The decision to deny the request

See Also:
Constant Field Values

DECISION_INDETERMINATE

public static final int DECISION_INDETERMINATE
The decision that a decision about the request cannot be made

See Also:
Constant Field Values

DECISION_NOT_APPLICABLE

public static final int DECISION_NOT_APPLICABLE
The decision that nothing applied to us

See Also:
Constant Field Values

DECISIONS

public static final java.lang.String[] DECISIONS

decision

private int decision

status

private Status status

resource

private java.lang.String resource

obligations

private java.util.Set obligations
Constructor Detail

Result

public Result(int decision)
       throws java.lang.IllegalArgumentException
Constructs a Result object with default status data (OK).


Result

public Result(int decision,
              java.util.Set obligations)
       throws java.lang.IllegalArgumentException
Constructs a Result object with default status data (OK), and obligations, but no resource identifier.


Result

public Result(int decision,
              Status status)
       throws java.lang.IllegalArgumentException
Constructs a Result object with status data but without a resource identifier. Typically the decision is DECISION_INDETERMINATE in this case, though that's not always true.


Result

public Result(int decision,
              Status status,
              java.util.Set obligations)
       throws java.lang.IllegalArgumentException
Constructs a Result object with status data and obligations but without a resource identifier. Typically the decision is DECISION_INDETERMINATE in this case, though that's not always true.


Result

public Result(int decision,
              java.lang.String resource)
       throws java.lang.IllegalArgumentException
Constructs a Result object with a resource identifier, but default status data (OK). The resource being named must match the resource (or a descendent of the resource in the case of a hierarchical resource) from the associated request.


Result

public Result(int decision,
              java.lang.String resource,
              java.util.Set obligations)
       throws java.lang.IllegalArgumentException
Constructs a Result object with a resource identifier, and obligations, but default status data (OK). The resource being named must match the resource (or a descendent of the resource in the case of a hierarchical resource) from the associated request.


Result

public Result(int decision,
              Status status,
              java.lang.String resource)
       throws java.lang.IllegalArgumentException
Constructs a Result object with status data and a resource identifier.


Result

public Result(int decision,
              Status status,
              java.lang.String resource,
              java.util.Set obligations)
       throws java.lang.IllegalArgumentException
Constructs a Result object with status data, a resource identifier, and obligations.

Method Detail

getInstance

public static Result getInstance(org.w3c.dom.Node root)
                          throws com.sun.xacml.ParsingException
Creates a new instance of a Result based on the given DOM root node. A ParsingException is thrown if the DOM root doesn't represent a valid ResultType.


parseObligations

private static java.util.Set parseObligations(org.w3c.dom.Node root)
                                       throws com.sun.xacml.ParsingException
Helper method that handles the obligations


getDecision

public int getDecision()
Returns the decision associated with this Result. This will be one of the four DECISION_* fields in this class.


getStatus

public Status getStatus()
Returns the status data included in this Result. Typically this will be STATUS_OK except when the decision is INDETERMINATE.


getResource

public java.lang.String getResource()
Returns the resource to which this Result applies, or null if none is specified.


setResource

public boolean setResource(java.lang.String resource)
Sets the resource identifier if it has not already been set before. The core code does not set the resource identifier, so this is useful if you want to write wrapper code that needs this information.


getObligations

public java.util.Set getObligations()
Returns the set of obligations that the PEP must fulfill, which may be empty.


addObligation

public void addObligation(com.sun.xacml.Obligation obligation)
Adds an obligation to the set of obligations that the PEP must fulfill


encode

public void encode(java.io.OutputStream output)
Encodes this Result into its XML form and writes this out to the provided OutputStream with no indentation.


encode

public void encode(java.io.OutputStream output,
                   com.sun.xacml.Indenter indenter)
Encodes this Result into its XML form and writes this out to the provided OutputStream with indentation.