Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7308/com/sun/xacml/finder
Modified Files:
AttributeFinder.java PolicyFinder.java ResourceFinder.java
Log Message:
Introduced some new, basic logging
Index: ResourceFinder.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/ResourceFinder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ResourceFinder.java 30 Apr 2004 17:56:43 -0000 1.4
--- ResourceFinder.java 4 Jun 2004 17:50:40 -0000 1.5
***************
*** 45,48 ****
--- 45,51 ----
import java.util.List;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+
/**
***************
*** 87,90 ****
--- 90,97 ----
private List descendantModules;
+ // the logger we'll use for all messages
+ private static final Logger logger =
+ Logger.getLogger(ResourceFinder.class.getName());
+
/**
* Default constructor.
***************
*** 158,161 ****
--- 165,172 ----
// no modules applied, so we return an empty result
+ if (logger.isLoggable(Level.INFO))
+ logger.info("No ResourceFinderModule existed to handle the " +
+ "children of " + parentResourceId.encode());
+
return new ResourceFinderResult();
}
***************
*** 192,195 ****
--- 203,210 ----
// no modules applied, so we return an empty result
+ if (logger.isLoggable(Level.INFO))
+ logger.info("No ResourceFinderModule existed to handle the " +
+ "children of " + parentResourceId.encode());
+
return new ResourceFinderResult();
}
***************
*** 224,227 ****
--- 239,246 ----
// no modules applied, so we return an empty result
+ if (logger.isLoggable(Level.INFO))
+ logger.info("No ResourceFinderModule existed to handle the " +
+ "descendants of " + parentResourceId.encode());
+
return new ResourceFinderResult();
}
***************
*** 258,261 ****
--- 277,284 ----
// no modules applied, so we return an empty result
+ if (logger.isLoggable(Level.INFO))
+ logger.info("No ResourceFinderModule existed to handle the " +
+ "descendants of " + parentResourceId.encode());
+
return new ResourceFinderResult();
}
Index: AttributeFinder.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/AttributeFinder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AttributeFinder.java 12 May 2004 21:26:23 -0000 1.4
--- AttributeFinder.java 4 Jun 2004 17:50:40 -0000 1.5
***************
*** 50,53 ****
--- 50,56 ----
import java.util.Set;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+
import org.w3c.dom.Node;
***************
*** 83,86 ****
--- 86,93 ----
private List selectorModules;
+ // the logger we'll use for all messages
+ private static final Logger logger =
+ Logger.getLogger(AttributeFinder.class.getName());
+
/**
* Default constructor.
***************
*** 155,159 ****
AttributeFinderModule module = (AttributeFinderModule)(it.next());
! // see if the module support this type
Set types = module.getSupportedDesignatorTypes();
if ((types == null) || (types.
--- 162,166 ----
AttributeFinderModule module = (AttributeFinderModule)(it.next());
! // see if the module supports this type
Set types = module.getSupportedDesignatorTypes();
if ((types == null) || (types.
***************
*** 166,171 ****
// if there was an error, we stop right away
! if (result.indeterminate())
return result;
// if the result wasn't empty, then return the result
--- 173,182 ----
// if there was an error, we stop right away
! if (result.indeterminate()) {
! if (logger.isLoggable(Level.INFO))
! logger.info("Error while trying to resolve values: " +
! result.getStatus().getMessage());
return result;
+ }
// if the result wasn't empty, then return the result
***************
*** 178,181 ****
--- 189,196 ----
// if we got here then there were no errors but there were also no
// matches, so we have to return an empty bag
+ if (logger.isLoggable(Level.INFO))
+ logger.info("Failed to resolve any values for " +
+ attributeId.toString());
+
return new EvaluationResult(BagAttribute.
createEmptyBag(attributeType));
***************
*** 216,221 ****
// if there was an error, we stop right away
! if (result.indeterminate())
return result;
// if the result wasn't empty, then return the result
--- 231,240 ----
// if there was an error, we stop right away
! if (result.indeterminate()) {
! if (logger.isLoggable(Level.INFO))
! logger.info("Error while trying to resolve values: " +
! result.getStatus().getMessage());
return result;
+ }
// if the result wasn't empty, then return the result
***************
*** 227,230 ****
--- 246,252 ----
// if we got here then there were no errors but there were also no
// matches, so we have to return an empty bag
+ if (logger.isLoggable(Level.INFO))
+ logger.info("Failed to resolve any values for " + contextPath);
+
return new EvaluationResult(BagAttribute.
createEmptyBag(attributeType));
Index: PolicyFinder.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/PolicyFinder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PolicyFinder.java 14 May 2004 18:46:23 -0000 1.3
--- PolicyFinder.java 4 Jun 2004 17:50:40 -0000 1.4
***************
*** 49,52 ****
--- 49,55 ----
import java.util.Set;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+
/**
***************
*** 88,91 ****
--- 91,98 ----
private Set referenceModules;
+ // the logger we'll use for all messages
+ private static final Logger logger =
+ Logger.getLogger(PolicyFinder.class.getName());
+
/**
* Returns the unordered <code>Set</code> of modules used by this class
***************
*** 126,129 ****
--- 133,138 ----
*/
public void init() {
+ logger.finer("Initializing PolicyFinder");
+
Iterator it = allModules.iterator();
***************
*** 154,159 ****
// if there was an error, we stop right away
! if (newResult.indeterminate())
return newResult;
// if we found a policy...
--- 163,174 ----
// if there was an error, we stop right away
! if (newResult.indeterminate()) {
! if (logger.isLoggable(Level.INFO))
! logger.info("An error occured while trying to find a " +
! "single applicable policy for a request: " +
! newResult.getStatus().getMessage());
!
return newResult;
+ }
// if we found a policy...
***************
*** 161,164 ****
--- 176,182 ----
// ...if we already had found a policy, this is an error...
if (result != null) {
+ logger.info("More than one top-level applicable policy " +
+ "for the request");
+
ArrayList code = new ArrayList();
code.add(Status.STATUS_PROCESSING_ERROR);
***************
*** 175,182 ****
// if we got here then we didn't have any errors, so the only
// question is whether or not we found anything
! if (result != null)
return result;
! else
return new PolicyFinderResult();
}
--- 193,203 ----
// if we got here then we didn't have any errors, so the only
// question is whether or not we found anything
! if (result != null) {
return result;
! } else {
! logger.info("No applicable policies were found for the request");
!
return new PolicyFinderResult();
+ }
}
***************
*** 212,217 ****
// if there was an error, we stop right away
! if (newResult.indeterminate())
return newResult;
// if we found a policy...
--- 233,244 ----
// if there was an error, we stop right away
! if (newResult.indeterminate()) {
! if (logger.isLoggable(Level.INFO))
! logger.info("An error occured while trying to find the " +
! "referenced policy " + idReference.toString() +
! ": " + newResult.getStatus().getMessage());
!
return newResult;
+ }
// if we found a policy...
***************
*** 219,222 ****
--- 246,252 ----
// ...if we already had found a policy, this is an error...
if (result != null) {
+ if (logger.isLoggable(Level.INFO))
+ logger.info("More than one policy applies for the " +
+ "reference: " + idReference.toString());
ArrayList code = new ArrayList();
code.add(Status.STATUS_PROCESSING_ERROR);
***************
*** 233,240 ****
// if we got here then we didn't have any errors, so the only
// question is whether or not we found anything
! if (result != null)
return result;
! else
return new PolicyFinderResult();
}
--- 263,275 ----
// if we got here then we didn't have any errors, so the only
// question is whether or not we found anything
! if (result != null) {
return result;
! } else {
! if (logger.isLoggable(Level.INFO))
! logger.info("No policies were resolved for the reference: " +
! idReference.toString());
!
return new PolicyFinderResult();
+ }
}
|