Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1755/com/sun/xacml/finder
Modified Files:
ResourceFinder.java ResourceFinderModule.java
Log Message:
added new interfaces to include context and deprecated the old interfaces
Index: ResourceFinder.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/ResourceFinder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ResourceFinder.java 29 Apr 2004 20:58:41 -0000 1.3
--- ResourceFinder.java 30 Apr 2004 17:56:43 -0000 1.4
***************
*** 37,40 ****
--- 37,42 ----
package com.sun.xacml.finder;
+ import com.sun.xacml.EvaluationCtx;
+
import com.sun.xacml.attr.AttributeValue;
***************
*** 59,62 ****
--- 61,74 ----
* they can handle. So, you must be careful when assigning to ordering of
* the modules in this finder.
+ * <p>
+ * Note that in release 1.2 the interfaces were updated to include the
+ * evaluation context. In the next major release the interfaces without the
+ * context information will be removed, but for now both exist. This means
+ * that if this finder is called with the context, then only the methods
+ * in <code>ResourceFinderModule</code> supporting the context will be
+ * called (and likewise only the methods without context will be called
+ * when this finder is called without the context). In practice this
+ * means that the methods with context will always get invoked, since this
+ * is what the default PDP implementation calls.
*
* @since 1.0
***************
*** 124,127 ****
--- 136,175 ----
*
* @param parentResourceId the root of the resources
+ * @param context the representation of the request data
+ *
+ * @return the result of looking for child resources
+ */
+ public ResourceFinderResult findChildResources(AttributeValue
+ parentResourceId,
+ EvaluationCtx context) {
+ Iterator it = childModules.iterator();
+
+ while (it.hasNext()) {
+ ResourceFinderModule module = (ResourceFinderModule)(it.next());
+
+ // ask the module to find the resources
+ ResourceFinderResult result =
+ module.findChildResources(parentResourceId, context);
+
+ // if we found something, then always return that result
+ if (! result.isEmpty())
+ return result;
+ }
+
+ // no modules applied, so we return an empty result
+ return new ResourceFinderResult();
+ }
+
+ /**
+ * Finds Resource Ids using the Children scope, and returns all resolved
+ * identifiers as well as any errors that occurred. If no modules can
+ * handle the given Resource Id, then an empty result is returned.
+ *
+ * @deprecated As of version 1.2, replaced by
+ * {@link #findChildResources(AttributeValue,EvaluationCtx)}.
+ * This version does not provide the evaluation context to
+ * the modules, and will be removed in a future release.
+ *
+ * @param parentResourceId the root of the resources
*
* @return the result of looking for child resources
***************
*** 146,150 ****
return new ResourceFinderResult();
}
!
/**
* Finds Resource Ids using the Descendants scope, and returns all resolved
--- 194,198 ----
return new ResourceFinderResult();
}
!
/**
* Finds Resource Ids using the Descendants scope, and returns all resolved
***************
*** 153,160 ****
--- 201,245 ----
*
* @param parentResourceId the root of the resources
+ * @param context the representation of the request data
*
* @return the result of looking for descendant resources
*/
public ResourceFinderResult findDescendantResources(AttributeValue
+ parentResourceId,
+ EvaluationCtx
+ context) {
+ Iterator it = descendantModules.iterator();
+
+ while (it.hasNext()) {
+ ResourceFinderModule module = (ResourceFinderModule)(it.next());
+
+ // ask the module to find the resources
+ ResourceFinderResult result =
+ module.findDescendantResources(parentResourceId, context);
+
+ // if we found something, then always return that result
+ if (! result.isEmpty())
+ return result;
+ }
+
+ // no modules applied, so we return an empty result
+ return new ResourceFinderResult();
+ }
+
+ /**
+ * Finds Resource Ids using the Descendants scope, and returns all resolved
+ * identifiers as well as any errors that occurred. If no modules can
+ * handle the given Resource Id, then an empty result is returned.
+ *
+ * @deprecated As of version 1.2, replaced by
+ * {@link #findDescendantResources(AttributeValue,EvaluationCtx)}.
+ * This version does not provide the evaluation context to
+ * the modules, and will be removed in a future release.
+ *
+ * @param parentResourceId the root of the resources
+ *
+ * @return the result of looking for child resources
+ */
+ public ResourceFinderResult findDescendantResources(AttributeValue
parentResourceId) {
Iterator it = descendantModules.iterator();
Index: ResourceFinderModule.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/ResourceFinderModule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ResourceFinderModule.java 17 Mar 2004 18:03:39 -0000 1.2
--- ResourceFinderModule.java 30 Apr 2004 17:56:43 -0000 1.3
***************
*** 37,40 ****
--- 37,42 ----
package com.sun.xacml.finder;
+ import com.sun.xacml.EvaluationCtx;
+
import com.sun.xacml.attr.AttributeValue;
***************
*** 80,83 ****
--- 82,109 ----
*
* @param parentResourceId the parent resource identifier
+ * @param context the representation of the request data
+ *
+ * @return the result of finding child resources
+ */
+ public ResourceFinderResult findChildResources(AttributeValue
+ parentResourceId,
+ EvaluationCtx context) {
+ return new ResourceFinderResult();
+ }
+
+ /**
+ * Tries to find the child Resource Ids associated with the parent. If
+ * this module cannot handle the given identifier, then an empty result is
+ * returned, otherwise the result will always contain at least the
+ * parent Resource Id, either as a successfully resolved Resource Id or an
+ * error case, but never both.
+ *
+ * @deprecated As of version 1.2, replaced by
+ * {@link #findChildResources(AttributeValue,EvaluationCtx)}.
+ * This version does not provide the evaluation context,
+ * and will be removed in a future release. Also, not that
+ * this will never get called when using the default PDP.
+ *
+ * @param parentResourceId the parent resource identifier
*
* @return the result of finding child resources
***************
*** 96,99 ****
--- 122,150 ----
*
* @param parentResourceId the parent resource identifier
+ * @param context the representation of the request data
+ *
+ * @return the result of finding descendant resources
+ */
+ public ResourceFinderResult findDescendantResources(AttributeValue
+ parentResourceId,
+ EvaluationCtx
+ context) {
+ return new ResourceFinderResult();
+ }
+
+ /**
+ * Tries to find the descendant Resource Ids associated with the parent. If
+ * this module cannot handle the given identifier, then an empty result is
+ * returned, otherwise the result will always contain at least the
+ * parent Resource Id, either as a successfuly resolved Resource Id or an
+ * error case, but never both.
+ *
+ * @deprecated As of version 1.2, replaced by
+ * {@link #findDescendantResources(AttributeValue,EvaluationCtx)}.
+ * This version does not provide the evaluation context,
+ * and will be removed in a future release. Also, not that
+ * this will never get called when using the default PDP.
+ *
+ * @param parentResourceId the parent resource identifier
*
* @return the result of finding descendant resources
|