Thread: [Sunxacml-commit] sunxacml/com/sun/xacml PDP.java,1.6,1.7
Brought to you by:
farrukh_najmi,
sethp
From: Seth P. <se...@us...> - 2004-05-03 18:34:48
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30603/com/sun/xacml Modified Files: PDP.java Log Message: updated to use EvaluationCtx interface, added an evaluate(EvaluationCtx), and deprecated evaluate(InputStream) Index: PDP.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/PDP.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PDP.java 30 Apr 2004 18:04:00 -0000 1.6 --- PDP.java 3 May 2004 18:34:36 -0000 1.7 *************** *** 98,103 **** /** ! * Attempts to evaluate a request against the policies known to this ! * PDP. This is really the core method of the entire XACML specification. * Note that if the request is somehow invalid (it was missing a required * attribute, it was using an unsupported scope, etc), then the result --- 98,107 ---- /** ! * Attempts to evaluate the request against the policies known to this ! * PDP. This is really the core method of the entire XACML specification, ! * and for most people will provide what you want. If you need any special ! * handling, you should look at the version of this method that takes an ! * <code>EvaluationCtx</code>. ! * <p> * Note that if the request is somehow invalid (it was missing a required * attribute, it was using an unsupported scope, etc), then the result *************** *** 109,121 **** */ public ResponseCtx evaluate(RequestCtx request) { - EvaluationCtx context = null; - // try to create the EvaluationCtx out of the request try { ! context = new EvaluationCtx(request, attributeFinder); } catch (ParsingException pe) { // there was something wrong with the request, so we return // Indeterminate with a status of syntax error...though this ! // may change is a more appropriate status type exists ArrayList code = new ArrayList(); code.add(Status.STATUS_SYNTAX_ERROR); --- 113,123 ---- */ public ResponseCtx evaluate(RequestCtx request) { // try to create the EvaluationCtx out of the request try { ! return evaluate(new BasicEvaluationCtx(request, attributeFinder)); } catch (ParsingException pe) { // there was something wrong with the request, so we return // Indeterminate with a status of syntax error...though this ! // may change if a more appropriate status type exists ArrayList code = new ArrayList(); code.add(Status.STATUS_SYNTAX_ERROR); *************** *** 123,131 **** return new ResponseCtx(new Result(Result.DECISION_INDETERMINATE, ! status, ! context.getResourceId(). ! encode())); } // see if we need to call the resource finder if (context.getScope() != EvaluationCtx.SCOPE_IMMEDIATE) { --- 125,147 ---- return new ResponseCtx(new Result(Result.DECISION_INDETERMINATE, ! status)); } + } + /** + * Uses the given <code>EvaluationCtx</code> against the available + * policies to determine a response. If you are starting with a standard + * XACML Request, then you should use the version of this method that + * takes a <code>RequestCtx</code>. This method should be used only if + * you have a real need to directly construct an evaluation context (or + * if you need to use an <code>EvaluationCtx</code> implementation other + * than <code>BasicEvaluationCtx</code>). + * + * @param context representation of the request and the context used + * for evaluation + * + * @return a response based on the contents of the context + */ + public ResponseCtx evaluate(EvaluationCtx context) { // see if we need to call the resource finder if (context.getScope() != EvaluationCtx.SCOPE_IMMEDIATE) { *************** *** 231,234 **** --- 247,256 ---- * then this will always return a decision of INDETERMINATE. * + * @deprecated As of 1.2 this method should not be used. Instead, you + * should do your own stream handling, and then use one of + * the other <code>evaluate</code> methods. The problem + * with this method is that it often doesn't handle stream + * termination correctly (eg, with sockets). + * * @param input a stream that contains an XML RequestType * |