Author: dkulp
Date: Fri Feb 18 04:11:47 2011
New Revision: 1071877

URL: http://svn.apache.org/viewvc?rev=1071877&view=rev
Log:
Rename PolicyEngine to PolicyBuilder (since that is what it really is)
Reinstate original PolicyEngine as static wrapper to PolicyBuilder.
(Makes porting from neethi 2 to 3 MUCH easier)
Change return type of getAlternatives to match javadoc and make it
easier for porting.

Added:
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyBuilder.java
      - copied, changed from r1071722, 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Modified:
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactoryImpl.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PolicyContainingPrimitiveAssertion.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java
    
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/util/PolicyIntersector.java
    
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/NormalizeTest.java
    
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/PolicyTestCase.java

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
 Fri Feb 18 04:11:47 2011
@@ -36,7 +36,7 @@ public interface AssertionBuilderFactory
      * Returns the PolicyEngine associated with this factory
      * @return
      */
-    PolicyEngine getPolicyEngine();
+    PolicyBuilder getPolicyEngine();
 
     /**
      * Returns the ConverterRegistry that the builder 

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactoryImpl.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactoryImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactoryImpl.java
 Fri Feb 18 04:11:47 2011
@@ -43,9 +43,9 @@ public class AssertionBuilderFactoryImpl
     
     protected AssertionBuilder defaultBuilder;
     protected ConverterRegistry converters = new ConverterRegistry();
-    protected PolicyEngine engine;
+    protected PolicyBuilder engine;
     
-    public AssertionBuilderFactoryImpl(PolicyEngine eng) {
+    public AssertionBuilderFactoryImpl(PolicyBuilder eng) {
         engine = eng;
 
         for (AssertionBuilder builder : 
Service.providers(AssertionBuilder.class)) {
@@ -61,7 +61,7 @@ public class AssertionBuilderFactoryImpl
         return converters;
     }
     
-    public PolicyEngine getPolicyEngine() {
+    public PolicyBuilder getPolicyEngine() {
         return engine;
     }
     

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
 Fri Feb 18 04:11:47 2011
@@ -19,6 +19,7 @@
 
 package org.apache.neethi;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -223,14 +224,14 @@ public class Policy extends All {
      * 
      * @return
      */
-    public Iterator<List<PolicyComponent>> getAlternatives() {
+    public Iterator<List<Assertion>> getAlternatives() {
         return new PolicyIterator(this, registry);
     }
-    public Iterator<List<PolicyComponent>> getAlternatives(PolicyRegistry reg) 
{
+    public Iterator<List<Assertion>> getAlternatives(PolicyRegistry reg) {
         return new PolicyIterator(this, reg);
     }
 
-    private class PolicyIterator implements Iterator<List<PolicyComponent>> {
+    private class PolicyIterator implements Iterator<List<Assertion>> {
         Iterator<PolicyComponent> alternatives;
 
         public PolicyIterator(Policy policy, PolicyRegistry reg) {
@@ -244,8 +245,15 @@ public class Policy extends All {
             return alternatives.hasNext();
         }
 
-        public List<PolicyComponent> next() {
-            return ((All) alternatives.next()).getPolicyComponents();
+        public List<Assertion> next() {
+            List<PolicyComponent> pcs = ((All) 
alternatives.next()).getPolicyComponents();
+            List<Assertion> asserts = new ArrayList<Assertion>(pcs.size());
+            for (PolicyComponent pc : pcs) {
+                if (pc instanceof Assertion) {
+                    asserts.add((Assertion)pc);
+                }
+            }
+            return asserts;
         }
 
         public void remove() {

Copied: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyBuilder.java
 (from r1071722, 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java)
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyBuilder.java?p2=webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyBuilder.java&p1=webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java&r1=1071722&r2=1071877&rev=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyBuilder.java
 Fri Feb 18 04:11:47 2011
@@ -34,24 +34,24 @@ import org.apache.neethi.builders.Assert
 import org.apache.neethi.builders.converters.ConverterRegistry;
 
 /**
- * PolicyEngine provides set of methods to create a Policy object from an
+ * PolicyBuilder provides set of methods to create a Policy object from an
  * InputStream, Element, XMLStreamReader, OMElement, etc.. It maintains an 
instance of
  * AssertionBuilderFactory that can return AssertionBuilders that can create a
  * Domain Assertion out of an element. These AssertionBuilders are used when
  * constructing a Policy object.
  */
-public class PolicyEngine {
+public class PolicyBuilder {
 
-    private static final Log LOG = LogFactory.getLog(PolicyEngine.class);
+    private static final Log LOG = LogFactory.getLog(PolicyBuilder.class);
 
     protected AssertionBuilderFactory factory = new 
AssertionBuilderFactoryImpl(this);
     protected PolicyRegistry defaultPolicyRegistry;
     
-    public PolicyEngine() {
+    public PolicyBuilder() {
         factory = new AssertionBuilderFactoryImpl(this);
     }
     
-    public PolicyEngine(AssertionBuilderFactory factory) {
+    public PolicyBuilder(AssertionBuilderFactory factory) {
         this.factory = factory;
     }
     

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
 Fri Feb 18 04:11:47 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
@@ -19,48 +19,45 @@
 
 package org.apache.neethi;
 
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.Map;
+import org.apache.axiom.om.OMElement;
+import org.apache.neethi.builders.AssertionBuilder;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.w3c.dom.Element;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.neethi.builders.AssertionBuilder;
-import org.apache.neethi.builders.converters.ConverterRegistry;
+import java.io.InputStream;
+import java.util.Iterator;
 
 /**
- * PolicyEngine provides set of methods to create a Policy object from an
- * InputStream, Element, XMLStreamReader, OMElement, etc.. It maintains an 
instance of
- * AssertionBuilderFactory that can return AssertionBuilders that can create a
- * Domain Assertion out of an element. These AssertionBuilders are used when
- * constructing a Policy object.
+ * PolicyEngine provides set of static methods to create a Policy object from 
an
+ * InputStream, OMElement, .. etc.  It wrappers a static PolicyBuilder to 
actually
+ * do the building.   This class is provided to ease transition from Neethi 
2.x to 
+ * Neethi 3.x  
  */
 public class PolicyEngine {
 
-    private static final Log LOG = LogFactory.getLog(PolicyEngine.class);
+    public static final String POLICY_NAMESPACE = 
"http://schemas.xmlsoap.org/ws/2004/09/policy";;
 
-    protected AssertionBuilderFactory factory = new 
AssertionBuilderFactoryImpl(this);
-    protected PolicyRegistry defaultPolicyRegistry;
-    
-    public PolicyEngine() {
-        factory = new AssertionBuilderFactoryImpl(this);
-    }
+    public static final String POLICY = "Policy";
+
+    public static final String EXACTLY_ONE = "ExactlyOne";
+
+    public static final String ALL = "All";
+
+    public static final String POLICY_REF = "PolicyReference";
+
+    private static PolicyBuilder builder;
     
-    public PolicyEngine(AssertionBuilderFactory factory) {
-        this.factory = factory;
+    private static synchronized PolicyBuilder getBuilder() {
+        if (builder == null) {
+            builder = new PolicyBuilder();
+        }
+        return builder;
     }
-    
-    
+
     /**
      * Registers an AssertionBuilder instances and associates it with a QName.
      * PolicyManager or other AssertionBuilders instances can use this
      * AssertionBuilder instance to process and build an Assertion from a
-     * element with the specified QName.
+     * OMElement with the specified QName.
      * 
      * @param qname
      *            the QName of the Assertion that the Builder can build
@@ -68,27 +65,8 @@ public class PolicyEngine {
      *            the AssertionBuilder that can build assertions that of 
'qname'
      *            type
      */
-    public void registerBuilder(QName qname, AssertionBuilder builder) {
-        factory.registerBuilder(qname, builder);
-    }
-    
-    
-    /**
-     * The PolicyEngine can have a default PolicyRegistry that the Policy 
objects
-     * that it creates are setup to use when normalize is called without the 
-     * PolicyRegistry.   
-     * @return the default PolicyRegistry
-     */
-    public PolicyRegistry getPolicyRegistry() {
-        return defaultPolicyRegistry;
-    }
-
-    public void setPolicyRegistry(PolicyRegistry reg) {
-        defaultPolicyRegistry = reg;
-    }
-    
-    public AssertionBuilderFactory getAssertionBuilderFactory() {
-        return factory;
+    public static void registerBuilder(QName qname, AssertionBuilder builder) {
+        getBuilder().getAssertionBuilderFactory().registerBuilder(qname, 
builder);
     }
 
     /**
@@ -98,133 +76,62 @@ public class PolicyEngine {
      *            the InputStream of the Policy
      * @return a Policy object of the Policy that is fed as a InputStream
      */
-    public Policy getPolicy(InputStream inputStream) {
-        try {
-            XMLStreamReader reader = 
XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
-            return getPolicy(reader);
-        } catch (RuntimeException ex) {
-            throw ex;
-        } catch (Exception ex) {
-            throw new RuntimeException("Could not load policy.", ex); 
-        }
+    public static Policy getPolicy(InputStream inputStream) {
+        return getBuilder().getPolicy(inputStream);
     }
 
-    public Policy getPolicy(Element el) {
-        return getPolicyOperator(el);
-    }
-    
-    
-    public Policy getPolicy(XMLStreamReader reader) {
-        return getPolicyOperator(reader);
+    /**
+     * Creates a PolicyReference object.
+     * 
+     * @param inputStream
+     *            the InputStream of the PolicyReference
+     * @return a PolicyReference object of the PolicyReference
+     */
+    public static PolicyReference getPolicyReferene(InputStream inputStream) {
+        return getBuilder().getPolicyReference(inputStream);
     }
 
     /**
-     * Creates a Policy object from an element.
+     * Creates a Policy object from an OMElement.
      * 
      * @param element
      *            the Policy element
-     * @return a Policy object of the Policy element
+     * @retun a Policy object of the Policy element
      */
-    public Policy getPolicy(Object element) {
-        return getPolicyOperator(element);
+    public static Policy getPolicy(OMElement element) {
+        return getBuilder().getPolicy(element);
     }
 
     /**
-     * Creates a PolicyReference object.
+     * Creates a Policy object from an Element.
      * 
-     * @param inputStream
-     *            the InputStream of the PolicyReference
-     * @return a PolicyReference object of the PolicyReference
+     * @param element
+     *            the Policy element
+     * @retun a Policy object of the Policy element
      */
-    public PolicyReference getPolicyReference(InputStream inputStream) {
-        try {
-            XMLStreamReader reader = 
XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
-            return getPolicyReference(reader);
-        } catch (RuntimeException ex) {
-            throw ex;
-        } catch (Exception ex) {
-            throw new RuntimeException("Could not load policy reference.", 
ex); 
-        }
+    public static Policy getPolicy(Object element) {
+        return getBuilder().getPolicy(element);
     }
-
+    
     /**
-     * Creates a PolicyReference object from an element.
+     * Creates a PolicyReference object from an OMElement.
      * 
      * @param element
      *            the PolicyReference element
      * @return a PolicyReference object of the PolicyReference element
      */
-    public PolicyReference getPolicyReference(Object element) {
-        QName qn = factory.getConverterRegistry().findQName(element);
-
-        if (!Constants.isPolicyRef(qn)) {
-            throw new RuntimeException(
-                    "Specified element is not a <wsp:PolicyReference .. />  
element");
-        }
-
-        PolicyReference reference = new PolicyReference(this);
-
-        Map<QName, String> attributes = 
factory.getConverterRegistry().getAttributes(element);
-
-        // setting the URI value
-        reference.setURI(attributes.get(new QName("URI")));
-        return reference;
+    public static PolicyReference getPolicyReference(OMElement element) {
+        return getBuilder().getPolicyReference(element);
     }
 
-    private Policy getPolicyOperator(Object element) {
-        String ns = 
factory.getConverterRegistry().findQName(element).getNamespaceURI();
-        return (Policy) processOperationElement(element, new 
Policy(defaultPolicyRegistry, ns));
-    }
-
-    private ExactlyOne getExactlyOneOperator(Object element) {
-        return (ExactlyOne) processOperationElement(element, new ExactlyOne());
-    }
-
-    private All getAllOperator(Object element) {
-        return (All) processOperationElement(element, new All());
-    }
-
-    private PolicyOperator processOperationElement(Object operationElement,
-                                                          PolicyOperator 
operator) {
-
-        if (Constants.TYPE_POLICY == operator.getType()) {
-            Policy policyOperator = (Policy) operator;
-
-            Map<QName, String> attributes = 
factory.getConverterRegistry().getAttributes(operationElement);
-            
-            for (Map.Entry<QName, String> ent : attributes.entrySet()) {
-                policyOperator.addAttribute(ent.getKey(), ent.getValue());
-            }
-        }
-
-
-        for (Iterator iterator = 
factory.getConverterRegistry().getChildElements(operationElement); 
-            iterator.hasNext();) {
-            
-            Object childElement = iterator.next();
-            QName qn = factory.getConverterRegistry().findQName(childElement);
-            
-            if (childElement == null || qn == null 
-                || qn.getNamespaceURI() == null) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Skipping bad policy element " + childElement);
-                }
-            } else if (Constants.isInPolicyNS(qn)) {
-                if (Constants.ELEM_POLICY.equals(qn.getLocalPart())) {
-                    
operator.addPolicyComponent(getPolicyOperator(childElement));
-                } else if 
(Constants.ELEM_EXACTLYONE.equals(qn.getLocalPart())) {
-                    
operator.addPolicyComponent(getExactlyOneOperator(childElement));
-                } else if (Constants.ELEM_ALL.equals(qn.getLocalPart())) {
-                    operator.addPolicyComponent(getAllOperator(childElement));
-                } else if 
(Constants.ELEM_POLICY_REF.equals(qn.getLocalPart())) {
-                    
operator.addPolicyComponent(getPolicyReference(childElement));
-                } else {
-                    operator.addPolicyComponent(factory.build(childElement));
-                }
-            } else {
-                operator.addPolicyComponent(factory.build(childElement));
-            }
-        }
-        return operator;
+    /**
+     * Creates a PolicyReference object from an Element.
+     * 
+     * @param element
+     *            the PolicyReference element
+     * @return a PolicyReference object of the PolicyReference element
+     */
+    public static PolicyReference getPolicyReference(Object element) {
+        return getBuilder().getPolicyReference(element);
     }
 }

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
 Fri Feb 18 04:11:47 2011
@@ -34,12 +34,12 @@ import javax.xml.stream.XMLStreamWriter;
 public class PolicyReference implements PolicyComponent {
 
     private String uri;
-    private PolicyEngine engine;
+    private PolicyBuilder engine;
 
     public PolicyReference() {
     }
     
-    public PolicyReference(PolicyEngine p) {
+    public PolicyReference(PolicyBuilder p) {
         engine = p;
     }
     
@@ -143,9 +143,9 @@ public class PolicyReference implements 
 
             InputStream in = connection.getInputStream();
             try {
-                PolicyEngine pe = engine;
+                PolicyBuilder pe = engine;
                 if (pe == null) {
-                    pe = new PolicyEngine();
+                    pe = new PolicyBuilder();
                 }
                 return pe.getPolicy(connection.getInputStream());
             } finally {

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PolicyContainingPrimitiveAssertion.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PolicyContainingPrimitiveAssertion.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PolicyContainingPrimitiveAssertion.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PolicyContainingPrimitiveAssertion.java
 Fri Feb 18 04:11:47 2011
@@ -65,10 +65,10 @@ public class PolicyContainingPrimitiveAs
             ea.addPolicyComponent(new All());
         }
         // for all alternatives in normalized nested policy
-        Iterator<List<PolicyComponent>> alternatives = 
normalisedNested.getAlternatives();
+        Iterator<List<Assertion>> alternatives = 
normalisedNested.getAlternatives();
         while (alternatives.hasNext()) {
             All all = new All();
-            List<PolicyComponent> alternative = alternatives.next();
+            List<Assertion> alternative = alternatives.next();
             Policy n = new Policy(nested.getPolicyRegistry(), 
nested.getNamespace());
             Assertion a = clone(false, n);
             ExactlyOne nea = new ExactlyOne();
@@ -86,6 +86,9 @@ public class PolicyContainingPrimitiveAs
     }
 
     public boolean equal(PolicyComponent policyComponent) {
+        if (this == policyComponent) {
+            return true;
+        }
         if (!super.equal(policyComponent)) {
             return false;
         }

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java
 Fri Feb 18 04:11:47 2011
@@ -60,6 +60,9 @@ public class PrimitiveAssertion implemen
         return name.toString();
     }
     public boolean equal(PolicyComponent policyComponent) {
+        if (this == policyComponent) {
+            return true;
+        }
         if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
             return false;
         }

Modified: 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/util/PolicyIntersector.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/util/PolicyIntersector.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/util/PolicyIntersector.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/util/PolicyIntersector.java
 Fri Feb 18 04:11:47 2011
@@ -162,15 +162,15 @@ public class PolicyIntersector {
     }
     
     public boolean compatiblePolicies(Policy p1, Policy p2) {       
-        Iterator<List<PolicyComponent>> i1 = p1.getAlternatives();
+        Iterator<List<Assertion>> i1 = p1.getAlternatives();
         while (i1.hasNext()) {
-            List<PolicyComponent> alt1 = i1.next();
-            Iterator<List<PolicyComponent>> i2 = p2.getAlternatives();
+            List<Assertion> alt1 = i1.next();
+            Iterator<List<Assertion>> i2 = p2.getAlternatives();
             if (!i2.hasNext() && alt1.isEmpty()) {
                 return true;
             }
             while (i2.hasNext()) {                
-                List<PolicyComponent> alt2 = i2.next();
+                List<Assertion> alt2 = i2.next();
                 if (compatibleAlternatives(alt1, alt2)) {
                     return true;                    
                 }
@@ -189,12 +189,12 @@ public class PolicyIntersector {
         if (!compatiblePolicies(p1, p2)) {
             return compatible;
         }
-        Iterator<List<PolicyComponent>> i1 = p1.getAlternatives();
+        Iterator<List<Assertion>> i1 = p1.getAlternatives();
         while (i1.hasNext()) {
-            List<PolicyComponent> alt1 = i1.next();
-            Iterator<List<PolicyComponent>> i2 = p2.getAlternatives();
+            List<Assertion> alt1 = i1.next();
+            Iterator<List<Assertion>> i2 = p2.getAlternatives();
             while (i2.hasNext()) {                
-                List<PolicyComponent> alt2 = i2.next();
+                List<Assertion> alt2 = i2.next();
                 All all = createCompatibleAlternatives(alt1, alt2, !allowDups);
                 if (all != null) {
                     eo.addPolicyComponent(all);

Modified: 
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/NormalizeTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/NormalizeTest.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/NormalizeTest.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/NormalizeTest.java
 Fri Feb 18 04:11:47 2011
@@ -31,7 +31,7 @@ import org.apache.neethi.util.PolicyComp
 
 public class NormalizeTest extends PolicyTestCase {
     
-    PolicyEngine mgr;
+    PolicyBuilder mgr;
 
     public NormalizeTest() {
         super("NormalizeTest");

Modified: 
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/PolicyTestCase.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/PolicyTestCase.java?rev=1071877&r1=1071876&r2=1071877&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/PolicyTestCase.java
 (original)
+++ 
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/neethi/PolicyTestCase.java
 Fri Feb 18 04:11:47 2011
@@ -48,7 +48,7 @@ public abstract class PolicyTestCase ext
     
     protected String baseDir = System.getProperty("basedir");
     protected String testResourceDir = "src" + File.separator + "test" + 
File.separator + "test-resources";
-    protected PolicyEngine policyEngine = new PolicyEngine();
+    protected PolicyBuilder policyEngine = new PolicyBuilder();
     protected PolicyRegistry registry = new PolicyRegistryImpl();
     
     public PolicyTestCase(String name) {


Reply via email to