[jboss-cvs] JBossAS SVN: r64176 - in projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml: core and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jul 21 16:13:26 EDT 2007


Author: anil.saldhana at jboss.com
Date: 2007-07-21 16:13:26 -0400 (Sat, 21 Jul 2007)
New Revision: 64176

Modified:
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/JBossPolicyFinder.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossRequestContext.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossResponseContext.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyAttributeFactory.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestAttributeFactory.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestResponseContextFactory.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ContextMapOp.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/RequestContext.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ResponseContext.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XMLSchemaConstants.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/AbstractJBossPolicyLocator.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java
Log:
javadoc + minor fixes

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/JBossPolicyFinder.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/JBossPolicyFinder.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/JBossPolicyFinder.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -28,6 +28,10 @@
 /**
  *  Represents a consolidated PolicyFinder
  *  that can contain all the PolicyFinderModules
+ *  
+ *  - Use this in the creation of the PolicySet 
+ *  from the PolicyFactory
+ *  
  *  @author Anil.Saldhana at redhat.com
  *  @since  Jul 19, 2007 
  *  @version $Revision$

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -79,10 +79,17 @@
    
    private JBossPolicyFinder policyFinder = new JBossPolicyFinder(); 
    
+   /**
+    * CTR
+    */
    public JBossPDP()
    {   
    }
    
+   /**
+    * Create a PDP
+    * @param configFile Inputstream for the JBossXACML Config File
+    */
    public JBossPDP(InputStream configFile)
    {  
       createValidatingUnMarshaller();
@@ -97,6 +104,10 @@
       }
    }
    
+   /**
+    * Create a PDP
+    * @param configFile InputSource for the JBossXACML Config File
+    */
    public JBossPDP(InputSource configFile)
    {  
       createValidatingUnMarshaller();
@@ -111,6 +122,10 @@
       }
    }
    
+   /**
+    * Create a PDP
+    * @param configFile Parsed Node for the JBossXACML Config File
+    */
    public JBossPDP(Node configFile)
    { 
       createValidatingUnMarshaller();
@@ -125,6 +140,10 @@
       }
    }
    
+   /**
+    * Create a PDP
+    * @param configFile XMLStreamReader for the JBossXACML Config File
+    */
    public JBossPDP(XMLStreamReader configFile)
    { 
       createValidatingUnMarshaller();
@@ -139,16 +158,25 @@
       }
    } 
 
+   /**
+    * @see PolicyDecisionPoint#setLocators(Set)
+    */
    public void setLocators(Set<PolicyLocator> locators)
    { 
       this.locators = locators;
    }
 
+   /**
+    * @see PolicyDecisionPoint#setPolicies(Set)
+    */
    public void setPolicies(Set<XACMLPolicy> policies)
    { 
       this.policies = policies;
    }  
 
+   /**
+    * @see PolicyDecisionPoint#evaluate(RequestContext)
+    */
    public ResponseContext evaluate(RequestContext request)
    { 
       HashSet<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>();

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossRequestContext.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossRequestContext.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossRequestContext.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -35,6 +35,7 @@
 
 import org.jboss.security.xacml.core.model.context.ObjectFactory;
 import org.jboss.security.xacml.core.model.context.RequestType;
+import org.jboss.security.xacml.interfaces.ContextMapOp;
 import org.jboss.security.xacml.interfaces.RequestContext;
 import org.jboss.security.xacml.interfaces.XACMLConstants;
 import org.w3c.dom.Document;
@@ -51,21 +52,29 @@
  *  @since  Jul 6, 2007 
  *  @version $Revision$
  */
-public class JBossRequestContext implements RequestContext
+public class JBossRequestContext implements RequestContext, ContextMapOp
 {
    private Map<String,Object> map = new HashMap<String,Object>();
 
+   /**
+    * @see ContextMapOp#get(String)
+    */
    public <T> T get(String key)
    {
      return (T) map.get(key);
    }
 
+   /**
+    * @see ContextMapOp#set(String, Object)
+    */
    public <T> void set(String key, T obj)
    {
      map.put(key, obj);
    }
    
-
+   /**
+    * @see RequestContext#setRequest(RequestType)
+    */
    public void setRequest(RequestType requestType) throws IOException
    {
       JAXBElement<RequestType> requestJAXB = new ObjectFactory().createRequest(requestType);
@@ -75,6 +84,9 @@
       readRequest(bis);  
    }
 
+   /**
+    * @see RequestContext#readRequest(InputStream)
+    */
    public void readRequest(InputStream is) throws IOException
    { 
       try
@@ -88,6 +100,9 @@
       }
    } 
  
+   /**
+    * @see RequestContext#marshall(OutputStream)
+    */
    public void marshall(OutputStream os) throws IOException
    {
       RequestCtx storedRequest = get(XACMLConstants.REQUEST_CTX);    

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossResponseContext.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossResponseContext.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossResponseContext.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -25,6 +25,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.security.xacml.interfaces.ContextMapOp;
 import org.jboss.security.xacml.interfaces.ResponseContext;
 import org.jboss.security.xacml.interfaces.XACMLConstants;
 
@@ -39,22 +40,31 @@
  *  @since  Jul 6, 2007 
  *  @version $Revision$
  */
-public class JBossResponseContext implements ResponseContext
+public class JBossResponseContext implements ResponseContext, ContextMapOp
 {
    private int decision = XACMLConstants.DECISION_DENY;
    
    private Map<String,Object> map = new HashMap<String,Object>();
 
+   /**
+    * @see ContextMapOp#get(String)
+    */
    public <T> T get(String key)
    {
       return (T) map.get(key);
    }
-
+   
+   /**
+    * @see ContextMapOp#set(String, Object)
+    */
    public <T> void set(String key, T obj)
    {
       map.put(key, obj);
    }
 
+   /**
+    * @see ResponseContext#getDecision()
+    */
    public int getDecision()
    { 
       ResponseCtx response = (ResponseCtx) map.get(XACMLConstants.RESPONSE_CTX);

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -29,6 +29,7 @@
 import java.util.Map;
 
 import org.jboss.security.xacml.bridge.JBossPolicyFinder;
+import org.jboss.security.xacml.interfaces.ContextMapOp;
 import org.jboss.security.xacml.interfaces.XACMLConstants;
 import org.jboss.security.xacml.interfaces.XACMLPolicy;
 import org.jboss.security.xacml.util.XACMLPolicyUtil;
@@ -43,7 +44,7 @@
  *  @since  Jul 6, 2007 
  *  @version $Revision$
  */
-public class JBossXACMLPolicy implements XACMLPolicy
+public class JBossXACMLPolicy implements XACMLPolicy, ContextMapOp
 {  
    private JBossPolicyFinder finder = new JBossPolicyFinder();
    
@@ -53,11 +54,25 @@
    
    private Map<String, Object> map = new HashMap<String, Object>();
    
+   /**
+    * Construct a JBossXACMLPolicy  
+    * @param url url to the policy file
+    * @param type type (Policy or PolicySet) 
+    * @throws Exception
+    * @see XACMLConstants
+    */
    public JBossXACMLPolicy(URL url, int type) throws Exception
    {
       this(url.openStream(), type);
    }
    
+   /**
+    * Construct a JBossXACMLPolicy
+    * @param is Inputstream to the policy file
+    * @param type type (Policy or PolicySet)
+    * @throws Exception
+    * @see XACMLConstants
+    */
    public JBossXACMLPolicy(InputStream is, int type) throws Exception
    {
       AbstractPolicy policy = null;
@@ -79,6 +94,14 @@
       map.put(XACMLConstants.UNDERLYING_POLICY, policy); 
    }
    
+   /**
+    * Construct a JBossXACMLPolicy instance
+    * @param is Inputstream to the policy/policyset file
+    * @param type policy or policyset
+    * @param theFinder PolicySet processing needs this
+    * @throws Exception
+    * @see XACMLConstants
+    */
    public JBossXACMLPolicy(InputStream is, int type, JBossPolicyFinder theFinder) throws Exception
    {
       AbstractPolicy policy = null;
@@ -86,6 +109,8 @@
       this.policyType = type;
       if(type == XACMLPolicy.POLICYSET)
       {
+         if(theFinder == null)
+            throw new IllegalArgumentException("policy finder is null");
          policy = xpu.createPolicySet(is, theFinder);  
          map.put(XACMLConstants.POLICY_FINDER, theFinder);
       }
@@ -100,26 +125,42 @@
       map.put(XACMLConstants.UNDERLYING_POLICY, policy); 
    }
    
+   /**
+    * @see XACMLPolicy#getType()
+    * @see XACMLConstants
+    */
    public int getType()
    {
       return this.policyType;
    }
 
+   /**
+    * @see XACMLPolicy#setEnclosingPolicies(List)
+    */
    public void setEnclosingPolicies(List<XACMLPolicy> policies)
    { 
       enclosingPolicies.addAll(policies);
    }
 
+   /**
+    * @see XACMLPolicy#getEnclosingPolicies()
+    */
    public List<XACMLPolicy> getEnclosingPolicies()
    { 
       return enclosingPolicies;
    } 
 
+   /**
+    * @see ContextMapOp#get(String)
+    */
    public <T> T get(String key)
    { 
       return (T) map.get(key);
    }
 
+   /**
+    * @see ContextMapOp#set(String, Object)
+    */
    public <T> void set(String key, T obj)
    {
       map.put(key, obj);

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -34,6 +34,10 @@
  */
 public class SecurityActions
 {
+   /**
+    * Obtain the Thread Context ClassLoader
+    * @return
+    */
    public static ClassLoader getContextClassLoader()
    {
       return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction()

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyAttributeFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyAttributeFactory.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyAttributeFactory.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -33,8 +33,8 @@
 
 import org.jboss.security.xacml.core.model.policy.AttributeDesignatorType;
 import org.jboss.security.xacml.core.model.policy.AttributeValueType;
-import org.jboss.security.xacml.core.model.policy.ResourceMatchType;
 import org.jboss.security.xacml.core.model.policy.SubjectAttributeDesignatorType;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
 
 //$Id$
 
@@ -50,37 +50,37 @@
 
    public static AttributeValueType createAnyURIAttributeType(URI value)
    {
-      return getBareAttributeValueType(""+value, "http://www.w3.org/2001/XMLSchema#anyURI");
+      return getBareAttributeValueType(""+value, XMLSchemaConstants.DATATYPE_ANYURI);
    }
    
    public static AttributeValueType createBase64BinaryAttributeType(byte[] value)
    {
-      return getBareAttributeValueType(value, "http://www.w3.org/2001/XMLSchema#base64Binary");
+      return getBareAttributeValueType(value, XMLSchemaConstants.DATATYPE_BASE64BINARY);
    }
    
    public static AttributeValueType createBooleanAttributeType( boolean value)
    {
-      return getBareAttributeValueType(value, "http://www.w3.org/2001/XMLSchema#boolean");
+      return getBareAttributeValueType(value, XMLSchemaConstants.DATATYPE_BOOLEAN);
    }
    
    public static AttributeValueType createDateAttributeType()
    {
-      return getBareAttributeValueType(getXMLDate(), "http://www.w3.org/2001/XMLSchema#date");
+      return getBareAttributeValueType(getXMLDate(), XMLSchemaConstants.DATATYPE_DATE);
    }
    
    public static AttributeValueType createDateAttributeType(XMLGregorianCalendar value)
    {
-      return getBareAttributeValueType(value.toXMLFormat(), "http://www.w3.org/2001/XMLSchema#date");
+      return getBareAttributeValueType(value.toXMLFormat(), XMLSchemaConstants.DATATYPE_DATE);
    }
    
    public static AttributeValueType createDateTimeAttributeType()
    {
-      return getBareAttributeValueType(getXMLDate(), "http://www.w3.org/2001/XMLSchema#dateTime");
+      return getBareAttributeValueType(getXMLDate(), XMLSchemaConstants.DATATYPE_DATE_TIME);
    }
    
    public static AttributeValueType createDateTimeAttributeType(XMLGregorianCalendar value)
    {
-      return getBareAttributeValueType(value.toXMLFormat(), "http://www.w3.org/2001/XMLSchema#dateTime");
+      return getBareAttributeValueType(value.toXMLFormat(), XMLSchemaConstants.DATATYPE_DATE_TIME);
    }
    
    public static AttributeValueType createDNSNameAttributeType(String hostname)
@@ -90,7 +90,7 @@
    
    public static AttributeValueType createDoubleAttributeType(double value)
    {
-      return getBareAttributeValueType("" + value, "http://www.w3.org/2001/XMLSchema#double");
+      return getBareAttributeValueType("" + value, XMLSchemaConstants.DATATYPE_DOUBLE);
    }
    
    public static AttributeValueType createEmailAttributeType(String value)
@@ -100,12 +100,12 @@
    
    public static AttributeValueType createHexBinaryAttributeType(byte[] value)
    {
-      return getBareAttributeValueType(value, "http://www.w3.org/2001/XMLSchema#hexBinary");
+      return getBareAttributeValueType(value, XMLSchemaConstants.DATATYPE_HEXBINARY);
    }
    
    public static AttributeValueType createIntegerAttributeType(int value)
    {
-      return getBareAttributeValueType("" + value, "http://www.w3.org/2001/XMLSchema#integer"); 
+      return getBareAttributeValueType("" + value, XMLSchemaConstants.DATATYPE_INTEGER); 
    }
    
    public static AttributeValueType createIPAddressAttributeType(InetAddress address)
@@ -115,17 +115,17 @@
    
    public static AttributeValueType createStringAttributeType(String value)
    {
-      return getBareAttributeValueType(value, "http://www.w3.org/2001/XMLSchema#string"); 
+      return getBareAttributeValueType(value, XMLSchemaConstants.DATATYPE_STRING); 
    }
    
    public static AttributeValueType createTimeAttributeType()
    {
-      return getBareAttributeValueType(getXMLDate(), "http://www.w3.org/2001/XMLSchema#time"); 
+      return getBareAttributeValueType(getXMLDate(), XMLSchemaConstants.DATATYPE_TIME); 
    }
    
    public static AttributeValueType createTimeAttributeType(XMLGregorianCalendar value)
    {
-      return getBareAttributeValueType(value.toXMLFormat(), "http://www.w3.org/2001/XMLSchema#time"); 
+      return getBareAttributeValueType(value.toXMLFormat(), XMLSchemaConstants.DATATYPE_TIME); 
    }
    
    public static AttributeValueType createX509NameAttributeType(X500Principal value)

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestAttributeFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestAttributeFactory.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestAttributeFactory.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -33,6 +33,7 @@
 
 import org.jboss.security.xacml.core.model.context.AttributeType;
 import org.jboss.security.xacml.core.model.context.AttributeValueType;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
 
 //$Id$
 
@@ -48,37 +49,37 @@
    
    public static AttributeType createAnyURIAttributeType(String attrID, String issuer,URI value)
    {
-      return getBareAttributeType(attrID, issuer, ""+value, "http://www.w3.org/2001/XMLSchema#anyURI");
+      return getBareAttributeType(attrID, issuer, ""+value, XMLSchemaConstants.DATATYPE_ANYURI);
    }
    
    public static AttributeType createBase64BinaryAttributeType(String attrID, String issuer,byte[] value)
    {
-      return getBareAttributeType(attrID, issuer, value, "http://www.w3.org/2001/XMLSchema#base64Binary");
+      return getBareAttributeType(attrID, issuer, value, XMLSchemaConstants.DATATYPE_BASE64BINARY);
    }
    
    public static AttributeType createBooleanAttributeType(String attrID, String issuer,boolean value)
    {
-      return getBareAttributeType(attrID, issuer, value, "http://www.w3.org/2001/XMLSchema#boolean");
+      return getBareAttributeType(attrID, issuer, value, XMLSchemaConstants.DATATYPE_BOOLEAN);
    }
    
    public static AttributeType createDateAttributeType(String attrID, String issuer)
    {
-      return getBareAttributeType(attrID, issuer, getXMLDate(), "http://www.w3.org/2001/XMLSchema#date");
+      return getBareAttributeType(attrID, issuer, getXMLDate(), XMLSchemaConstants.DATATYPE_DATE);
    }
    
    public static AttributeType createDateAttributeType(String attrID, String issuer,XMLGregorianCalendar value)
    {
-      return getBareAttributeType(attrID, issuer, value.toXMLFormat(), "http://www.w3.org/2001/XMLSchema#date");
+      return getBareAttributeType(attrID, issuer, value.toXMLFormat(), XMLSchemaConstants.DATATYPE_DATE);
    }
    
    public static AttributeType createDateTimeAttributeType(String attrID, String issuer)
    {
-      return getBareAttributeType(attrID, issuer, getXMLDate(), "http://www.w3.org/2001/XMLSchema#dateTime");
+      return getBareAttributeType(attrID, issuer, getXMLDate(), XMLSchemaConstants.DATATYPE_DATE_TIME);
    }
    
    public static AttributeType createDateTimeAttributeType(String attrID, String issuer,XMLGregorianCalendar value)
    {
-      return getBareAttributeType(attrID, issuer, value.toXMLFormat(), "http://www.w3.org/2001/XMLSchema#dateTime");
+      return getBareAttributeType(attrID, issuer, value.toXMLFormat(), XMLSchemaConstants.DATATYPE_DATE_TIME);
    }
    
    public static AttributeType createDNSNameAttributeType(String attrID, String issuer,String hostname)
@@ -88,7 +89,7 @@
    
    public static AttributeType createDoubleAttributeType(String attrID, String issuer,double value)
    {
-      return getBareAttributeType(attrID, issuer, "" + value, "http://www.w3.org/2001/XMLSchema#double");
+      return getBareAttributeType(attrID, issuer, "" + value, XMLSchemaConstants.DATATYPE_DOUBLE);
    }
    
    public static AttributeType createEmailAttributeType(String attrID, String issuer,String value)
@@ -98,12 +99,12 @@
    
    public static AttributeType createHexBinaryAttributeType(String attrID, String issuer,byte[] value)
    {
-      return getBareAttributeType(attrID, issuer, value, "http://www.w3.org/2001/XMLSchema#hexBinary");
+      return getBareAttributeType(attrID, issuer, value, XMLSchemaConstants.DATATYPE_HEXBINARY);
    }
    
    public static AttributeType createIntegerAttributeType(String attrID, String issuer, int value)
    {
-     return getBareAttributeType(attrID, issuer, ""+value, "http://www.w3.org/2001/XMLSchema#integer"); 
+     return getBareAttributeType(attrID, issuer, ""+value, XMLSchemaConstants.DATATYPE_INTEGER); 
    }
    
    public static AttributeType createIPAddressAttributeType(String attrID, String issuer,InetAddress address)
@@ -113,17 +114,17 @@
    
    public static AttributeType createStringAttributeType(String attrID, String issuer, String value)
    {
-      return getBareAttributeType(attrID, issuer, value, "http://www.w3.org/2001/XMLSchema#string"); 
+      return getBareAttributeType(attrID, issuer, value, XMLSchemaConstants.DATATYPE_STRING); 
    }
    
    public static AttributeType createTimeAttributeType(String attrID, String issuer)
    { 
-      return getBareAttributeType(attrID, issuer, getXMLDate(), "http://www.w3.org/2001/XMLSchema#time"); 
+      return getBareAttributeType(attrID, issuer, getXMLDate(), XMLSchemaConstants.DATATYPE_TIME); 
    }
    
    public static AttributeType createTimeAttributeType(String attrID, String issuer, XMLGregorianCalendar value)
    {
-      return getBareAttributeType(attrID, issuer, value.toXMLFormat(), "http://www.w3.org/2001/XMLSchema#time"); 
+      return getBareAttributeType(attrID, issuer, value.toXMLFormat(), XMLSchemaConstants.DATATYPE_TIME); 
    }
    
    public static AttributeType createX509NameAttributeType(String attrID, String issuer, X500Principal value)

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestResponseContextFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestResponseContextFactory.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestResponseContextFactory.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -36,11 +36,20 @@
  */
 public class RequestResponseContextFactory
 { 
+   /**
+    * Create a bare RequestContext object
+    * @see RequestContext#setRequest(org.jboss.security.xacml.core.model.context.RequestType)
+    * @return a RequestContext object
+    */
    public static RequestContext createRequestCtx()
    {
       return new JBossRequestContext();
    }
    
+   /**
+    * Create a ResponseContext object
+    * @return a ResponseContext object
+    */
    public static ResponseContext createResponseContext()
    {
       return new JBossResponseContext();

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ContextMapOp.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ContextMapOp.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ContextMapOp.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -32,6 +32,19 @@
  */
 public interface ContextMapOp
 {
+   /**
+    * Get an element from the map
+    * @param <T> object from the map
+    * @param key Key
+    * @return object from the map
+    */
    <T> T get(String key);  
+   
+   /**
+    * Set an object on the map
+    * @param <T>
+    * @param key Key for the map
+    * @param obj Object to be placed
+    */
    <T> void set(String key, T obj);
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -33,7 +33,27 @@
  */
 public interface PolicyDecisionPoint 
 {
+   /**
+    * Set a set of Policy/PolicySet instances on the PDP
+    * - Remember to also pass a set of PolicyLocators 
+    * if you have not used a JBossXACML config file
+    * @param policies  a Set of Policy/PolicySet instances
+    */
    void setPolicies(Set<XACMLPolicy> policies);
+   
+   /**
+    * Set a set of policy locators.
+    * - This method is primarily used when the policy/policyset
+    * instances are created without the usage of the JBossXACML 
+    * Config File. In this case, do not forget to set the policy
+    * objects in the locators via their setPolicies method
+    * @param locators a set of PolicyLocator instances
+    */
    void setLocators(Set<PolicyLocator> locators); 
+   
+   /**
+    * Method to evaluate a XACML Request
+    * @param request The RequestContext that contains the XACML Request
+    */
    ResponseContext evaluate(RequestContext request);
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -36,6 +36,15 @@
  */
 public interface PolicyLocator extends ContextMapOp
 {
-   void setOptions(List<Option> options);  
+   /**
+    * Set a list of options on the locator
+    * @param options
+    */
+   void setOptions(List<Option> options); 
+   
+   /**
+    * Set of policies that this locator is able to return
+    * @param policies
+    */
    void setPolicies(Set<XACMLPolicy> policies);
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/RequestContext.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/RequestContext.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/RequestContext.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -37,7 +37,24 @@
  */
 public interface RequestContext extends ContextMapOp
 { 
+   /**
+    * Place the Request instance on the context
+    * @param requestType An instance of RequestType 
+    * @throws IOException
+    */
    void setRequest(RequestType requestType) throws IOException;
+   
+   /**
+    * Read the Request from a stream
+    * @param is InputStream for the request 
+    * @throws IOException
+    */
    void readRequest(InputStream is) throws IOException;
+   
+   /**
+    * Marshall the request context onto an Output Stream
+    * @param os OutputStream (System.out, ByteArrayOutputStream etc)
+    * @throws IOException
+    */
    void marshall(OutputStream os) throws IOException;
 } 
\ No newline at end of file

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ResponseContext.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ResponseContext.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ResponseContext.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -31,5 +31,10 @@
  */
 public interface ResponseContext extends ContextMapOp
 { 
+   /**
+    * Decision based on the evaluation of policies
+    * @return int value {@see XACMLConstants#DECISION_PERMIT}
+    * @see XACMLConstants
+    */
    int getDecision();
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -33,10 +33,32 @@
  */
 public interface XACMLPolicy extends ContextMapOp
 { 
+   /**
+    * Type identifying a PolicySet
+    */
    int POLICYSET = 0;
+   
+   /**
+    * Type identifying a Policy
+    */
    int POLICY = 1;
    
+   /**
+    * Return a type (PolicySet or Policy)
+    * @return int value representing type
+    */
    int getType();
+   
+   /**
+    * A PolicySet can contain policies within.
+    * Setter to set the policies inside a policyset
+    * @param policies a list of policies
+    */
    void setEnclosingPolicies(List<XACMLPolicy> policies);
+   
+   /**
+    * Return the enclosing policies for a PolicySet
+    * @return a list of policies
+    */
    List<XACMLPolicy> getEnclosingPolicies(); 
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XMLSchemaConstants.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XMLSchemaConstants.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XMLSchemaConstants.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -32,5 +32,14 @@
 public interface XMLSchemaConstants
 {
    String DATATYPE_ANYURI = "http://www.w3.org/2001/XMLSchema#anyURI";
+   String DATATYPE_BASE64BINARY = "http://www.w3.org/2001/XMLSchema#base64Binary";
+   String DATATYPE_BOOLEAN  = "http://www.w3.org/2001/XMLSchema#boolean";
+   String DATATYPE_DATE = "http://www.w3.org/2001/XMLSchema#date";
+   String DATATYPE_DATE_TIME = "http://www.w3.org/2001/XMLSchema#dateTime";
+   String DATATYPE_DOUBLE = "http://www.w3.org/2001/XMLSchema#double";
+   String DATATYPE_HEXBINARY = "http://www.w3.org/2001/XMLSchema#hexBinary";
+   String DATATYPE_INTEGER = "http://www.w3.org/2001/XMLSchema#integer";
+   
    String DATATYPE_STRING = "http://www.w3.org/2001/XMLSchema#string";
+   String DATATYPE_TIME = "http://www.w3.org/2001/XMLSchema#time";
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/AbstractJBossPolicyLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/AbstractJBossPolicyLocator.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/AbstractJBossPolicyLocator.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -26,6 +26,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.security.xacml.interfaces.ContextMapOp;
 import org.jboss.security.xacml.interfaces.PolicyLocator;
 import org.jboss.security.xacml.interfaces.XACMLPolicy;
 import org.jboss.security.xacml.jaxb.Option;
@@ -38,28 +39,38 @@
  *  @since  Jul 6, 2007 
  *  @version $Revision$
  */
-public abstract class AbstractJBossPolicyLocator implements PolicyLocator
+public abstract class AbstractJBossPolicyLocator implements PolicyLocator, ContextMapOp
 {
    protected List<Option> options = null; 
    protected Map<String,Object> map = new HashMap<String,Object>(); 
    protected Set<XACMLPolicy> policies;
    
-   
-   
+   /**
+    * @see PolicyLocator#setOptions(List)
+    */
    public void setOptions(List<Option> theoptions)
    { 
       this.options = theoptions;
    }
 
+   /**
+    * @see ContextMapOp#get(String)
+    */
    public <T> T get(String key)
    { 
       return (T)map.get(key);
    }
 
+   /**
+    * @see ContextMapOp#set(String, Object)
+    */
    public <T> void set(String key, T obj)
    {
       map.put(key, obj); 
    }
 
+   /**
+    * @see PolicyLocator#setPolicies(Set)
+    */
    public abstract void setPolicies(Set<XACMLPolicy> policies); 
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java	2007-07-21 14:37:22 UTC (rev 64175)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/util/XACMLPolicyUtil.java	2007-07-21 20:13:26 UTC (rev 64176)
@@ -44,22 +44,50 @@
  */
 public class XACMLPolicyUtil 
 {
+   /**
+    * Create a PolicySet
+    * @param location location of the policy set file
+    * @param finder PolicyFinder instance
+    * @return
+    * @throws Exception
+    */
 	public PolicySet createPolicySet(URL location, PolicyFinder finder) throws Exception
 	{
         return createPolicySet(location.openStream(),  finder); 
 	}
 	
+    /**
+     * Create a policyset
+     * @param is
+     * @param finder
+     * @return
+     * @throws Exception
+     */
 	public PolicySet createPolicySet(InputStream is, PolicyFinder finder) throws Exception  
 	{
+       if(finder == null)
+          throw new IllegalArgumentException("Policy Finder is null");
 		Document doc = getDocument(is);
 		return PolicySet.getInstance(doc.getFirstChild(), finder); 
 	}
 
+    /**
+     * Create a Policy
+     * @param location Policy File
+     * @return
+     * @throws Exception
+     */
 	public Policy createPolicy(URL location) throws Exception
 	{  
 		return createPolicy(location.openStream());
 	}
 
+    /**
+     * Create a policy
+     * @param is Inputstream of the policy file
+     * @return
+     * @throws Exception
+     */
 	public Policy createPolicy(InputStream is) throws Exception
 	{ 
 		Document doc = getDocument(is);




More information about the jboss-cvs-commits mailing list