org.wso2.balana.ctx
Class BasicEvaluationCtx

java.lang.Object
  extended by org.wso2.balana.ctx.BasicEvaluationCtx
All Implemented Interfaces:
EvaluationCtx
Direct Known Subclasses:
XACML2EvaluationCtx, XACML3EvaluationCtx

public abstract class BasicEvaluationCtx
extends Object
implements EvaluationCtx

Implementation of EvaluationCtx. This implements some generic methods that commons to most of the implementations


Field Summary
protected  DateAttribute currentDate
          the cached current date, time, and date time, which we may or may not be using depending on how this object was constructed
protected  DateTimeAttribute currentDateTime
           
protected  TimeAttribute currentTime
           
protected  PDPConfig pdpConfig
          PDP configurations
protected  AbstractRequestCtx requestCtx
          Represents a XACML request made to the PDP
protected  Node requestRoot
          the DOM root the original RequestContext document
protected  boolean useCachedEnvValues
          TODO what is this?
 
Constructor Summary
BasicEvaluationCtx()
           
 
Method Summary
protected  EvaluationResult callHelper(URI type, URI id, String issuer, URI category)
          Private helper that calls the finder if it's non-null, or else returns an empty bag
 EvaluationResult getAttribute(String path, URI type, URI category, URI contextSelector, String xpathVersion)
          Returns the attribute value(s) retrieved using the given XPath expression.
 DateAttribute getCurrentDate()
          Returns the value for the current date.
 DateTimeAttribute getCurrentDateTime()
          Returns the value for the current dateTime.
 TimeAttribute getCurrentTime()
          Returns the value for the current time.
 AbstractRequestCtx getRequestCtx()
          Returns XACML request
 Node getRequestRoot()
          Returns the DOM root of the original RequestType XML document.
 boolean isSearching()
          TODO
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.wso2.balana.ctx.EvaluationCtx
getAttribute, getMultipleEvaluationCtx, getXacmlVersion
 

Field Detail

currentDate

protected DateAttribute currentDate
the cached current date, time, and date time, which we may or may not be using depending on how this object was constructed


currentTime

protected TimeAttribute currentTime

currentDateTime

protected DateTimeAttribute currentDateTime

useCachedEnvValues

protected boolean useCachedEnvValues
TODO what is this?


requestRoot

protected Node requestRoot
the DOM root the original RequestContext document


requestCtx

protected AbstractRequestCtx requestCtx
Represents a XACML request made to the PDP


pdpConfig

protected PDPConfig pdpConfig
PDP configurations

Constructor Detail

BasicEvaluationCtx

public BasicEvaluationCtx()
Method Detail

getRequestRoot

public Node getRequestRoot()
Returns the DOM root of the original RequestType XML document.

Specified by:
getRequestRoot in interface EvaluationCtx
Returns:
the DOM root node

isSearching

public boolean isSearching()
TODO

Specified by:
isSearching in interface EvaluationCtx
Returns:

getCurrentTime

public TimeAttribute getCurrentTime()
Returns the value for the current time. The current time, current date, and current dateTime are consistent, so that they all represent the same moment. If this is the first time that one of these three values has been requested, and caching is enabled, then the three values will be resolved and stored.

Note that the value supplied here applies only to dynamically resolved values, not those supplied in the Request. In other words, this always returns a dynamically resolved value local to the PDP, even if a different value was supplied in the Request. This is handled correctly when the value is requested by its identifier.

Specified by:
getCurrentTime in interface EvaluationCtx
Returns:
the current time

getCurrentDate

public DateAttribute getCurrentDate()
Returns the value for the current date. The current time, current date, and current dateTime are consistent, so that they all represent the same moment. If this is the first time that one of these three values has been requested, and caching is enabled, then the three values will be resolved and stored.

Note that the value supplied here applies only to dynamically resolved values, not those supplied in the Request. In other words, this always returns a dynamically resolved value local to the PDP, even if a different value was supplied in the Request. This is handled correctly when the value is requested by its identifier.

Specified by:
getCurrentDate in interface EvaluationCtx
Returns:
the current date

getCurrentDateTime

public DateTimeAttribute getCurrentDateTime()
Returns the value for the current dateTime. The current time, current date, and current dateTime are consistent, so that they all represent the same moment. If this is the first time that one of these three values has been requested, and caching is enabled, then the three values will be resolved and stored.

Note that the value supplied here applies only to dynamically resolved values, not those supplied in the Request. In other words, this always returns a dynamically resolved value local to the PDP, even if a different value was supplied in the Request. This is handled correctly when the value is requested by its identifier.

Specified by:
getCurrentDateTime in interface EvaluationCtx
Returns:
the current dateTime

getRequestCtx

public AbstractRequestCtx getRequestCtx()
Description copied from interface: EvaluationCtx
Returns XACML request

Specified by:
getRequestCtx in interface EvaluationCtx
Returns:
AbstractRequestCtx

getAttribute

public EvaluationResult getAttribute(String path,
                                     URI type,
                                     URI category,
                                     URI contextSelector,
                                     String xpathVersion)
Returns the attribute value(s) retrieved using the given XPath expression.

Specified by:
getAttribute in interface EvaluationCtx
Parameters:
path - the XPath expression to search
type - the type of the attribute value(s) to find
category - the category the attribute value(s) must be in
contextSelector - the selector to find the context to apply XPath expression if this is null, applied for default content
xpathVersion - the version of XPath to use
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

callHelper

protected EvaluationResult callHelper(URI type,
                                      URI id,
                                      String issuer,
                                      URI category)
Private helper that calls the finder if it's non-null, or else returns an empty bag

Parameters:
type - the type of the attribute value(s) to find
id - the id of the attribute value(s) to find
issuer - the issuer of the attribute value(s) to find or null
category - the category the attribute value(s) must be in
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


Copyright © 2015 WSO2. All rights reserved.