[jboss-cvs] JBossAS SVN: r63885 - 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
Fri Jul 6 17:56:34 EDT 2007


Author: anil.saldhana at jboss.com
Date: 2007-07-06 17:56:34 -0400 (Fri, 06 Jul 2007)
New Revision: 63885

Added:
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/WrapperPolicyFinderModule.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/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/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/XACMLConstants.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/locators/JBossPolicyLocator.java
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/JBossXACMLPolicy.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.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/XACMLPolicy.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java
Log:
SECURITY-60:XACML SPI

Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/WrapperPolicyFinderModule.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/WrapperPolicyFinderModule.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/bridge/WrapperPolicyFinderModule.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,85 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.bridge;
+
+import java.net.URI;
+
+import com.sun.xacml.EvaluationCtx;
+import com.sun.xacml.Policy;
+import com.sun.xacml.PolicyMetaData;
+import com.sun.xacml.VersionConstraints;
+import com.sun.xacml.finder.PolicyFinder;
+import com.sun.xacml.finder.PolicyFinderModule;
+import com.sun.xacml.finder.PolicyFinderResult;
+ 
+
+/**
+ *  PolicyFinderModule that returns the enclosing Policy Object
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public class WrapperPolicyFinderModule extends PolicyFinderModule
+{ 
+   protected PolicyFinder policyFinder = null;
+   private Policy policy = null;;
+   
+   public WrapperPolicyFinderModule(Policy policy)
+   {
+      this.policy  = policy;
+   }
+   
+   /**
+    * @see PolicyFinderModule#init(com.sun.xacml.finder.PolicyFinder)
+    */
+   public void init(PolicyFinder policyFinder)
+   {
+      this.policyFinder = policyFinder;
+   }
+ 
+   /**
+    * @see PolicyFinderModule#findPolicy(com.sun.xacml.EvaluationCtx)
+    */
+   public PolicyFinderResult findPolicy(EvaluationCtx evaluationCtx)
+   {
+      return new PolicyFinderResult(policy);
+   }
+ 
+   /**
+    * @see PolicyFinderModule#findPolicy(java.net.URI, int, 
+    *        com.sun.xacml.VersionConstraints, com.sun.xacml.PolicyMetaData)
+    */
+   public PolicyFinderResult findPolicy(URI arg0, int arg1, 
+         VersionConstraints arg2, PolicyMetaData arg3)
+   {
+      return new PolicyFinderResult(policy);
+   }
+ 
+   /**
+    * @see PolicyFinderModule#isRequestSupported()
+    */
+   public boolean isRequestSupported()
+   {
+      return true;
+   }
+   
+}

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-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -37,16 +37,33 @@
 import javax.xml.validation.SchemaFactory;
 
 import org.jboss.security.xacml.factories.PolicyFactory;
+import org.jboss.security.xacml.factories.RequestResponseContextFactory;
 import org.jboss.security.xacml.interfaces.PolicyDecisionPoint;
 import org.jboss.security.xacml.interfaces.PolicyLocator;
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
 import org.jboss.security.xacml.interfaces.XACMLPolicy;
+import org.jboss.security.xacml.jaxb.LocatorType;
+import org.jboss.security.xacml.jaxb.LocatorsType;
 import org.jboss.security.xacml.jaxb.PDP;
 import org.jboss.security.xacml.jaxb.PoliciesType;
 import org.jboss.security.xacml.jaxb.PolicySetType;
 import org.jboss.security.xacml.jaxb.PolicyType;
+import org.jboss.security.xacml.locators.JBossPolicySetLocator;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 
+import com.sun.xacml.PDPConfig;
+import com.sun.xacml.ctx.RequestCtx;
+import com.sun.xacml.ctx.ResponseCtx;
+import com.sun.xacml.finder.AttributeFinder;
+import com.sun.xacml.finder.AttributeFinderModule;
+import com.sun.xacml.finder.PolicyFinder;
+import com.sun.xacml.finder.PolicyFinderModule;
+import com.sun.xacml.finder.impl.CurrentEnvModule;
+import com.sun.xacml.finder.impl.SelectorModule;
+
 //$Id$
 
 /**
@@ -61,6 +78,8 @@
    private Set<PolicyLocator> locators = new HashSet<PolicyLocator>();
    private Set<XACMLPolicy> policies = new HashSet<XACMLPolicy>();
    
+   private PolicyFinder policyFinder = new PolicyFinder(); 
+   
    public JBossPDP()
    {   
    }
@@ -70,8 +89,8 @@
       createValidatingUnMarshaller();
       try
       {
-         JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
-         createPolicyObjects((PDP) jxb.getValue());
+         JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile); 
+         bootstrap((PDP) jxb.getValue());
       }
       catch (Exception e)
       {
@@ -85,7 +104,7 @@
       try
       {
          JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
-         createPolicyObjects((PDP) jxb.getValue());
+         bootstrap((PDP) jxb.getValue());
       }
       catch ( Exception e)
       {
@@ -99,7 +118,7 @@
       try
       {
          JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
-         createPolicyObjects((PDP) jxb.getValue());
+         bootstrap((PDP) jxb.getValue());
       }
       catch ( Exception e)
       {
@@ -113,7 +132,7 @@
       try
       {
          JAXBElement<?> jxb = (JAXBElement<?>) unmarshaller.unmarshal(configFile);
-         createPolicyObjects((PDP) jxb.getValue());
+         bootstrap((PDP) jxb.getValue());
       }
       catch ( Exception e)
       {
@@ -129,16 +148,45 @@
    public void setPolicies(Set<XACMLPolicy> policies)
    { 
       this.policies = policies;
-   } 
+   }  
+
+   public ResponseContext evaluate(RequestContext request)
+   { 
+      HashSet<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>();
+      //Go through the Locators
+      for(PolicyLocator locator: locators)
+      { 
+         policyModules.addAll((List)locator.get(XACMLConstants.POLICY_FINDER_MODULE));
+      }  
+      policyFinder.setModules(policyModules);
+      
+      AttributeFinder attributeFinder = new AttributeFinder();
+      List<AttributeFinderModule> attributeModules = new ArrayList<AttributeFinderModule>();  
+      attributeModules.add(new CurrentEnvModule());
+      attributeModules.add(new SelectorModule());
+      attributeFinder.setModules(attributeModules);
+      
+      com.sun.xacml.PDP pdp = new com.sun.xacml.PDP(new PDPConfig(attributeFinder, 
+            policyFinder, null)); 
+      RequestCtx req = (RequestCtx) request.get(XACMLConstants.REQUEST_CTX);
+      if(req == null)
+         throw new IllegalStateException("Request Context does not contain a request");
+      
+      ResponseCtx resp = pdp.evaluate(req);
+      
+      ResponseContext response = RequestResponseContextFactory.createResponseContext();
+      response.set(XACMLConstants.RESPONSE_CTX, resp);
+      return response;
+   }
    
-   private void createPolicyObjects(PDP pdp) throws Exception
-   {  
+   private void bootstrap(PDP pdp) throws Exception
+   {   
       PoliciesType policiesType = pdp.getPolicies();
       List<PolicySetType> pset = policiesType.getPolicySet();
       for(PolicySetType pst: pset)
       {
          String loc = pst.getLocation(); 
-         XACMLPolicy policySet = PolicyFactory.createPolicySet(getInputStream(loc));
+         XACMLPolicy policySet = PolicyFactory.createPolicySet(getInputStream(loc),policyFinder);
          List<PolicyType> policyTypeList =  pst.getPolicy();
          
          List<XACMLPolicy> policyList = new ArrayList<XACMLPolicy>();
@@ -156,6 +204,16 @@
       {
          policies.add(PolicyFactory.createPolicy(getInputStream(pt.getLocation())));
       }
+      
+      //Take care of the locators
+      LocatorsType locatorsType = pdp.getLocators(); 
+      List<LocatorType> locs = locatorsType.getLocator();
+      for(LocatorType lt:locs)
+      {
+         PolicyLocator pl = (PolicyLocator) loadClass(lt.getName()).newInstance();
+         pl.setPolicies(policies);
+         this.locators.add(pl);
+      }
    }
    
    private void createValidatingUnMarshaller()
@@ -196,4 +254,10 @@
       }
       return is; 
    }
+   
+   private Class loadClass(String fqn) throws Exception
+   {
+      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+      return tcl.loadClass(fqn);
+   }
 }

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossRequestContext.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.security.xacml.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.sun.xacml.ctx.RequestCtx;
+
+//$Id$
+
+/**
+ *  Implementation of the RequestContext interface
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public class JBossRequestContext implements RequestContext
+{
+   private Map<String,Object> map = new HashMap<String,Object>();
+
+   public <T> T get(String key)
+   {
+     return (T) map.get(key);
+   }
+
+   public <T> void set(String key, T obj)
+   {
+     map.put(key, obj);
+   }
+
+   public void readRequest(InputStream is) throws IOException
+   { 
+      try
+      {
+         RequestCtx request = RequestCtx.getInstance(getRequest(is));
+         set(XACMLConstants.REQUEST_CTX, request);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   } 
+   
+   private Node getRequest(InputStream is) throws Exception
+   {
+      String contextSchema = "urn:oasis:names:tc:xacml:2.0:context:schema:os"; 
+      DocumentBuilderFactory factory =
+         DocumentBuilderFactory.newInstance();
+      factory.setNamespaceAware(true);
+      factory.setIgnoringComments(true); 
+      Document doc = factory.newDocumentBuilder().parse(is);
+      NodeList nodes = doc.getElementsByTagNameNS(contextSchema, "Request");  
+      return nodes.item(0);  
+   }
+}

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossResponseContext.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,70 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.core;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+
+import com.sun.xacml.ctx.ResponseCtx;
+import com.sun.xacml.ctx.Result;
+
+//$Id$
+
+/**
+ *  Implementation of the ResponseContext interface
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public class JBossResponseContext implements ResponseContext
+{
+   private int decision = XACMLConstants.DECISION_DENY;
+   
+   private Map<String,Object> map = new HashMap<String,Object>();
+
+   public <T> T get(String key)
+   {
+      return (T) map.get(key);
+   }
+
+   public <T> void set(String key, T obj)
+   {
+      map.put(key, obj);
+   }
+
+   public int getDecision()
+   { 
+      ResponseCtx response = (ResponseCtx) map.get(XACMLConstants.RESPONSE_CTX);
+      if(response != null)
+      {
+         Set<Result> results = response.getResults();
+         Result res = results.iterator().next();
+         decision = res.getDecision();
+      } 
+      return decision;
+         
+   } 
+}

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-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossXACMLPolicy.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -24,8 +24,11 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+import org.jboss.security.xacml.interfaces.XACMLConstants;
 import org.jboss.security.xacml.interfaces.XACMLPolicy;
 import org.jboss.security.xacml.util.XACMLPolicyUtil;
 
@@ -41,14 +44,15 @@
  *  @version $Revision$
  */
 public class JBossXACMLPolicy implements XACMLPolicy
-{
-   //The base SunXACML Policy
-   private AbstractPolicy policy = null;
-   private PolicyFinder policyFinder = new PolicyFinder();
+{  
+   private PolicyFinder finder = new PolicyFinder();
+   
    private List<XACMLPolicy> enclosingPolicies = new ArrayList<XACMLPolicy>();
    
    private int policyType = XACMLPolicy.POLICY;
    
+   private Map<String, Object> map = new HashMap<String, Object>();
+   
    public JBossXACMLPolicy(URL url, int type) throws Exception
    {
       this(url.openStream(), type);
@@ -56,11 +60,13 @@
    
    public JBossXACMLPolicy(InputStream is, int type) throws Exception
    {
+      AbstractPolicy policy = null;
       XACMLPolicyUtil xpu = new XACMLPolicyUtil();
       this.policyType = type;
       if(type == XACMLPolicy.POLICYSET)
       {
-         policy = xpu.createPolicySet(is, policyFinder); 
+         policy = xpu.createPolicySet(is, finder);  
+         map.put(XACMLConstants.POLICY_FINDER, finder);
       }
       else
          if(type == XACMLPolicy.POLICY)
@@ -69,8 +75,31 @@
          }
          else
             throw new RuntimeException("Unknown type");
+      
+      map.put(XACMLConstants.UNDERLYING_POLICY, policy); 
    }
    
+   public JBossXACMLPolicy(InputStream is, int type, PolicyFinder theFinder) throws Exception
+   {
+      AbstractPolicy policy = null;
+      XACMLPolicyUtil xpu = new XACMLPolicyUtil();
+      this.policyType = type;
+      if(type == XACMLPolicy.POLICYSET)
+      {
+         policy = xpu.createPolicySet(is, theFinder);  
+         map.put(XACMLConstants.POLICY_FINDER, theFinder);
+      }
+      else
+         if(type == XACMLPolicy.POLICY)
+         {
+            policy = xpu.createPolicy(is); 
+         }
+         else
+            throw new RuntimeException("Unknown type");
+      
+      map.put(XACMLConstants.UNDERLYING_POLICY, policy); 
+   }
+   
    public int getType()
    {
       return this.policyType;
@@ -85,4 +114,14 @@
    { 
       return enclosingPolicies;
    } 
+
+   public <T> T get(String key)
+   { 
+      return (T) map.get(key);
+   }
+
+   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/factories/PolicyFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -27,6 +27,8 @@
 import org.jboss.security.xacml.core.JBossXACMLPolicy;
 import org.jboss.security.xacml.interfaces.XACMLPolicy;
 
+import com.sun.xacml.finder.PolicyFinder;
+
 //$Id$
 
 /**
@@ -68,6 +70,15 @@
                                                              XACMLPolicy.POLICYSET});
    }
    
+   public static XACMLPolicy createPolicySet(InputStream policySetFile,
+         PolicyFinder theFinder)
+   throws Exception
+   { 
+      return (XACMLPolicy) getCtrWithFinder().newInstance(new Object[]{policySetFile, 
+                                                             XACMLPolicy.POLICYSET,
+                                                             theFinder});
+   }
+   
    public static XACMLPolicy createPolicy(InputStream policyFile)
    throws Exception
    { 
@@ -85,4 +96,12 @@
                                                           InputStream.class, 
                                                           Integer.TYPE });
    }
+   
+   private static Constructor<XACMLPolicy> getCtrWithFinder() throws  Exception 
+   {
+      return constructingClass.getConstructor(new Class[] {
+                                                          InputStream.class, 
+                                                          Integer.TYPE ,
+                                                          PolicyFinder.class});
+   }
 }

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/RequestResponseContextFactory.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,48 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.factories;
+
+import org.jboss.security.xacml.core.JBossRequestContext;
+import org.jboss.security.xacml.core.JBossResponseContext;
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+
+//$Id$
+
+/**
+ *  Factory to create the Request and ResponseContext objects
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public class RequestResponseContextFactory
+{ 
+   public static RequestContext createRequestCtx()
+   {
+      return new JBossRequestContext();
+   }
+   
+   public static ResponseContext createResponseContext()
+   {
+      return new JBossResponseContext();
+   } 
+}

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ContextMapOp.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,37 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.interfaces;
+
+//$Id$
+
+/**
+ *  Interface defining operations
+ *  on a context map
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public interface ContextMapOp
+{
+   <T> T get(String key);  
+   <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-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyDecisionPoint.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -31,8 +31,9 @@
  *  @since  Jul 5, 2007 
  *  @version $Revision$
  */
-public interface PolicyDecisionPoint
+public interface PolicyDecisionPoint 
 {
    void setPolicies(Set<XACMLPolicy> policies);
    void setLocators(Set<PolicyLocator> locators); 
+   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-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/PolicyLocator.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -21,6 +21,11 @@
   */
 package org.jboss.security.xacml.interfaces;
 
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.security.xacml.jaxb.Option;
+
 //$Id$
 
 /**
@@ -29,7 +34,8 @@
  *  @since  Jul 5, 2007 
  *  @version $Revision$
  */
-public interface PolicyLocator
+public interface PolicyLocator extends ContextMapOp
 {
-
+   void setOptions(List<Option> options);  
+   void setPolicies(Set<XACMLPolicy> policies);
 }

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/RequestContext.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,38 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.interfaces;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+//$Id$
+
+/**
+ *  Represents a Request
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public interface RequestContext extends ContextMapOp
+{ 
+   void readRequest(InputStream is) throws IOException;
+}

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/ResponseContext.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,35 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.interfaces;
+
+//$Id$
+
+/**
+ *  Represents a XACML Response
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public interface ResponseContext extends ContextMapOp
+{ 
+   int getDecision();
+}

Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLConstants.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLConstants.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLConstants.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,61 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.interfaces;
+
+//$Id$
+
+/**
+ *  Constants
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public interface XACMLConstants
+{
+   String UNDERLYING_POLICY = "underlying_policy";
+   String POLICY_FINDER = "policy_finder";
+   String POLICY_FINDER_MODULE = "policy_finder_module";
+   String REQUEST_CTX = "request_ctx";
+   String RESPONSE_CTX = "response_ctx";
+   
+   String contextSchema = "urn:oasis:names:tc:xacml:2.0:context:schema:os";
+   
+   /**
+    * The decision to permit the request
+    */
+   public static final int DECISION_PERMIT = 0;
+
+   /**
+    * The decision to deny the request
+    */
+   public static final int DECISION_DENY = 1;
+
+   /**
+    * The decision that a decision about the request cannot be made
+    */
+   public static final int DECISION_INDETERMINATE = 2;
+
+   /**
+    * The decision that nothing applied to us
+    */
+   public static final int DECISION_NOT_APPLICABLE = 3;
+}

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-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/interfaces/XACMLPolicy.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -31,12 +31,12 @@
  *  @since  Jul 5, 2007 
  *  @version $Revision$
  */
-public interface XACMLPolicy
+public interface XACMLPolicy extends ContextMapOp
 { 
    int POLICYSET = 0;
    int POLICY = 1;
    
    int getType();
    void setEnclosingPolicies(List<XACMLPolicy> policies);
-   List<XACMLPolicy> getEnclosingPolicies();
+   List<XACMLPolicy> getEnclosingPolicies(); 
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorType.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,12 +2,14 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 
 package org.jboss.security.xacml.jaxb;
 
+import java.util.ArrayList;
+import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -25,7 +27,7 @@
  *   &lt;complexContent>
  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  *       &lt;sequence>
- *         &lt;element ref="{urn:jboss:xacml:2.0}Option" minOccurs="0"/>
+ *         &lt;element ref="{urn:jboss:xacml:2.0}Option" maxOccurs="unbounded" minOccurs="0"/>
  *       &lt;/sequence>
  *       &lt;attribute name="Name" type="{http://www.w3.org/2001/XMLSchema}string" />
  *     &lt;/restriction>
@@ -42,32 +44,37 @@
 public class LocatorType {
 
     @XmlElement(name = "Option")
-    protected Option option;
+    protected List<Option> option;
     @XmlAttribute(name = "Name")
     protected String name;
 
     /**
      * Gets the value of the option property.
      * 
-     * @return
-     *     possible object is
-     *     {@link Option }
-     *     
-     */
-    public Option getOption() {
-        return option;
-    }
-
-    /**
-     * Sets the value of the option property.
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the option property.
      * 
-     * @param value
-     *     allowed object is
-     *     {@link Option }
-     *     
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getOption().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Option }
+     * 
+     * 
      */
-    public void setOption(Option value) {
-        this.option = value;
+    public List<Option> getOption() {
+        if (option == null) {
+            option = new ArrayList<Option>();
+        }
+        return this.option;
     }
 
     /**

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/LocatorsType.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,12 +2,14 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 
 package org.jboss.security.xacml.jaxb;
 
+import java.util.ArrayList;
+import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -24,7 +26,7 @@
  *   &lt;complexContent>
  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  *       &lt;sequence>
- *         &lt;element name="Locator" type="{urn:jboss:xacml:2.0}LocatorType" minOccurs="0"/>
+ *         &lt;element name="Locator" type="{urn:jboss:xacml:2.0}LocatorType" maxOccurs="unbounded" minOccurs="0"/>
  *       &lt;/sequence>
  *     &lt;/restriction>
  *   &lt;/complexContent>
@@ -40,30 +42,35 @@
 public class LocatorsType {
 
     @XmlElement(name = "Locator")
-    protected LocatorType locator;
+    protected List<LocatorType> locator;
 
     /**
      * Gets the value of the locator property.
      * 
-     * @return
-     *     possible object is
-     *     {@link LocatorType }
-     *     
-     */
-    public LocatorType getLocator() {
-        return locator;
-    }
-
-    /**
-     * Sets the value of the locator property.
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the locator property.
      * 
-     * @param value
-     *     allowed object is
-     *     {@link LocatorType }
-     *     
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getLocator().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link LocatorType }
+     * 
+     * 
      */
-    public void setLocator(LocatorType value) {
-        this.locator = value;
+    public List<LocatorType> getLocator() {
+        if (locator == null) {
+            locator = new ArrayList<LocatorType>();
+        }
+        return this.locator;
     }
 
 }

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/ObjectFactory.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 
@@ -43,30 +43,38 @@
     }
 
     /**
-     * Create an instance of {@link PoliciesType }
+     * Create an instance of {@link PDP }
      * 
      */
-    public PoliciesType createPoliciesType() {
-        return new PoliciesType();
+    public PDP createPDP() {
+        return new PDP();
     }
 
     /**
-     * Create an instance of {@link PolicySetType }
+     * Create an instance of {@link LocatorType }
      * 
      */
-    public PolicySetType createPolicySetType() {
-        return new PolicySetType();
+    public LocatorType createLocatorType() {
+        return new LocatorType();
     }
 
     /**
-     * Create an instance of {@link PDP }
+     * Create an instance of {@link PolicyType }
      * 
      */
-    public PDP createPDP() {
-        return new PDP();
+    public PolicyType createPolicyType() {
+        return new PolicyType();
     }
 
     /**
+     * Create an instance of {@link PolicySetType }
+     * 
+     */
+    public PolicySetType createPolicySetType() {
+        return new PolicySetType();
+    }
+
+    /**
      * Create an instance of {@link Option }
      * 
      */
@@ -75,11 +83,11 @@
     }
 
     /**
-     * Create an instance of {@link LocatorType }
+     * Create an instance of {@link PoliciesType }
      * 
      */
-    public LocatorType createLocatorType() {
-        return new LocatorType();
+    public PoliciesType createPoliciesType() {
+        return new PoliciesType();
     }
 
     /**
@@ -91,14 +99,6 @@
     }
 
     /**
-     * Create an instance of {@link PolicyType }
-     * 
-     */
-    public PolicyType createPolicyType() {
-        return new PolicyType();
-    }
-
-    /**
      * Create an instance of {@link JAXBElement }{@code <}{@link PoliciesType }{@code >}}
      * 
      */

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/Option.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PDP.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PoliciesType.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicySetType.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/PolicyType.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/jaxb/package-info.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2007.07.06 at 02:07:35 AM CDT 
+// Generated on: 2007.07.06 at 03:19:27 PM CDT 
 //
 
 @javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:xacml:2.0", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

Added: 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	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/AbstractJBossPolicyLocator.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,65 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.locators;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.security.xacml.interfaces.PolicyLocator;
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+import org.jboss.security.xacml.jaxb.Option;
+
+//$Id$
+
+/**
+ *  
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public abstract class AbstractJBossPolicyLocator implements PolicyLocator
+{
+   protected List<Option> options = null; 
+   protected Map<String,Object> map = new HashMap<String,Object>(); 
+   protected Set<XACMLPolicy> policies;
+   
+   
+   
+   public void setOptions(List<Option> theoptions)
+   { 
+      this.options = theoptions;
+   }
+
+   public <T> T get(String key)
+   { 
+      return (T)map.get(key);
+   }
+
+   public <T> void set(String key, T obj)
+   {
+      map.put(key, obj); 
+   }
+
+   public abstract void setPolicies(Set<XACMLPolicy> policies); 
+}

Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicyLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicyLocator.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicyLocator.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -0,0 +1,79 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.locators;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.security.xacml.bridge.WrapperPolicyFinderModule;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+
+import com.sun.xacml.Policy;
+import com.sun.xacml.finder.PolicyFinderModule;
+
+//$Id$
+
+/**
+ *  Policy Locator for plain XACML Policy instances
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jul 6, 2007 
+ *  @version $Revision$
+ */
+public class JBossPolicyLocator extends AbstractJBossPolicyLocator
+{
+   private XACMLPolicy policy = null; 
+   private List<PolicyFinderModule> pfml = new ArrayList<PolicyFinderModule>(); 
+   
+   public JBossPolicyLocator()
+   {   
+   }
+   
+   public JBossPolicyLocator(Set<XACMLPolicy> policies)
+   {
+      setPolicies(policies);
+   }
+/*
+   public void setPolicy(XACMLPolicy xacmlPolicy)
+   {
+      if(xacmlPolicy.getType() != XACMLPolicy.POLICY)
+         throw new IllegalArgumentException("xacmlPolicy arg is not of " +
+                "type Policy:"+xacmlPolicy);
+      this.policy = xacmlPolicy;
+   }*/
+
+   @Override
+   public void setPolicies(Set<XACMLPolicy> policies)
+   { 
+      for(XACMLPolicy xp:policies)
+      {
+         if(xp.getType() == XACMLPolicy.POLICY)
+         {
+            Policy p = xp.get(XACMLConstants.UNDERLYING_POLICY);
+            WrapperPolicyFinderModule wpfm = new WrapperPolicyFinderModule(p);
+            pfml.add(wpfm);
+         }
+      }
+      this.map.put(XACMLConstants.POLICY_FINDER_MODULE, pfml);
+   } 
+}

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java	2007-07-06 19:25:34 UTC (rev 63884)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/locators/JBossPolicySetLocator.java	2007-07-06 21:56:34 UTC (rev 63885)
@@ -21,8 +21,17 @@
   */
 package org.jboss.security.xacml.locators;
 
-import org.jboss.security.xacml.interfaces.PolicyLocator;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
+import org.jboss.security.xacml.bridge.PolicySetFinderModule;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XACMLPolicy;
+
+import com.sun.xacml.Policy;
+import com.sun.xacml.PolicySet;
+
 //$Id$
 
 /**
@@ -31,9 +40,68 @@
  *  @since  Jul 6, 2007 
  *  @version $Revision$
  */
-public class JBossPolicySetLocator implements PolicyLocator
+public class JBossPolicySetLocator extends AbstractJBossPolicyLocator
 {
+   private XACMLPolicy thePolicySet; 
+   
+   private List<PolicySetFinderModule> pfml = new ArrayList<PolicySetFinderModule>(); 
+   
    public JBossPolicySetLocator()
    {  
+   }
+   
+   public JBossPolicySetLocator(Set<XACMLPolicy> policies)
+   {
+      setPolicies(policies);
+   }
+   
+   /*public void setPolicySet(XACMLPolicy policySet)
+   {
+      if(policySet.getType() != XACMLPolicy.POLICYSET)
+         throw new IllegalArgumentException("policySet is not of type PolicySet:"+policySet);
+      this.thePolicySet = policySet; 
+      
+      //Check for enclosed policies
+      List<XACMLPolicy> policyList = thePolicySet.getEnclosingPolicies();
+      List<Policy> sunxacmlPolicies = new ArrayList<Policy>();
+      for(XACMLPolicy xp: policyList)
+      {
+         sunxacmlPolicies.add((Policy) xp.get(XACMLConstants.UNDERLYING_POLICY));
+      }
+      
+      thePolicyFinderModule.set((PolicySet) thePolicySet.get(XACMLConstants.UNDERLYING_POLICY), 
+                                sunxacmlPolicies);
+   }*/
+
+   @Override
+   public void setPolicies(Set<XACMLPolicy> policies)
+   { 
+      for(XACMLPolicy xp:policies)
+      {
+         if(xp.getType() == XACMLPolicy.POLICYSET)
+         {
+            pfml.add(getPopulatedPolicySetFinderModule(xp));
+         }
+      }
+      this.map.put(XACMLConstants.POLICY_FINDER_MODULE, pfml);
    } 
+   
+   private PolicySetFinderModule getPopulatedPolicySetFinderModule(XACMLPolicy xpolicy)
+   {
+      PolicySetFinderModule psfm = new PolicySetFinderModule();
+      //Check for enclosed policies
+      List<XACMLPolicy> policyList = xpolicy.getEnclosingPolicies();
+      List<Policy> sunxacmlPolicies = new ArrayList<Policy>();
+      for(XACMLPolicy xp: policyList)
+      {
+         sunxacmlPolicies.add((Policy) xp.get(XACMLConstants.UNDERLYING_POLICY));
+      }
+      
+      psfm.set((PolicySet) xpolicy.get(XACMLConstants.UNDERLYING_POLICY), 
+            sunxacmlPolicies);
+      
+      //Make this PolicySetFinderModule the module for this policy set
+      xpolicy.set(XACMLConstants.POLICY_FINDER_MODULE, psfm);
+      return psfm;
+   }
 }




More information about the jboss-cvs-commits mailing list