cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1070696 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ api/src/main/java/org/apache/cxf/ws/policy/builder/...
Date Mon, 14 Feb 2011 23:35:23 GMT
Author: dkulp
Date: Mon Feb 14 23:35:21 2011
New Revision: 1070696

URL: http://svn.apache.org/viewvc?rev=1070696&view=rev
Log:
Start updating trunk to use/leverage Neethi 3.0 changes

Removed:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/Intersector.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/util/PolicyComparator.java
    cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/IntersectorTest.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyAssertion.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
    cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
    cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractSecurityAssertion.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -55,10 +55,4 @@ public interface AssertionBuilder {
      */
     Collection<QName> getKnownElements();
 
-
-    /**
-     * Returns a new assertion that is compatible with the two specified
-     * assertions or null if no compatible assertion can be built.
-     */ 
-    PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b);
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java Mon Feb 14 23:35:21 2011
@@ -23,12 +23,14 @@ import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 import org.apache.cxf.extension.Registry;
+import org.apache.neethi.Assertion;
 
 /**
  * AssertionBuilderRegistry is used to manage AssertionBuilders and
  * create Assertion objects from given xml elements.
  */
-public interface AssertionBuilderRegistry extends Registry<QName, AssertionBuilder> {
+public interface AssertionBuilderRegistry 
+    extends Registry<QName, AssertionBuilder> {
     
     
     /**
@@ -44,7 +46,7 @@ public interface AssertionBuilderRegistr
      * @param element the element from which to build an Assertion.
      * @return an Assertion that is built using the specified element.
      */
-    PolicyAssertion build(Element element);
+    Assertion build(Element element);
     
     /**
      * Indicates if unknown assertions should simply be ignored.

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java Mon Feb 14 23:35:21 2011
@@ -36,6 +36,7 @@ import org.apache.cxf.common.i18n.Messag
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
 import org.apache.neethi.PolicyOperator;
 
 public class AssertionInfoMap extends HashMap<QName, Collection<AssertionInfo>> {
@@ -54,12 +55,14 @@ public class AssertionInfoMap extends Ha
     }
 
     private void putAssertionInfo(PolicyAssertion a) {
-        Policy p = a.getPolicy();
-        if (p != null) {
-            List<PolicyAssertion> pcs = new ArrayList<PolicyAssertion>();
-            getAssertions(p, pcs);
-            for (PolicyAssertion na : pcs) {
-                putAssertionInfo(na);
+        if (a instanceof PolicyContainingAssertion) {
+            Policy p = ((PolicyContainingAssertion)a).getPolicy();
+            if (p != null) {
+                List<PolicyAssertion> pcs = new ArrayList<PolicyAssertion>();
+                getAssertions(p, pcs);
+                for (PolicyAssertion na : pcs) {
+                    putAssertionInfo(na);
+                }
             }
         }
         AssertionInfo ai = new AssertionInfo(a);
@@ -86,13 +89,15 @@ public class AssertionInfoMap extends Ha
             errors.add(a.getName());
             pass = false;
         }
-        Policy p = a.getPolicy();
-        if (p != null) {
-            Iterator it = p.getAlternatives();
-            while (it.hasNext()) {
-                List<PolicyAssertion> lst = CastUtils.cast((List<?>)it.next());
-                for (PolicyAssertion p2 : lst) {
-                    pass &= supportsAlternative(p2, errors);
+        if (a instanceof PolicyContainingAssertion) {
+            Policy p = ((PolicyContainingAssertion)a).getPolicy();
+            if (p != null) {
+                Iterator it = p.getAlternatives();
+                while (it.hasNext()) {
+                    List<PolicyAssertion> lst = CastUtils.cast((List<?>)it.next());
+                    for (PolicyAssertion p2 : lst) {
+                        pass &= supportsAlternative(p2, errors);
+                    }
                 }
             }
         }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyAssertion.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyAssertion.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyAssertion.java Mon Feb 14 23:35:21 2011
@@ -20,9 +20,14 @@
 package org.apache.cxf.ws.policy;
 
 import org.apache.neethi.Assertion;
-import org.apache.neethi.Policy;
 
+/**
+ * Interface to mark Assertions that can participate in CXF's 
+ * assertion mechanism to make sure the policies have been
+ * applied. 
+ */
 public interface PolicyAssertion extends Assertion {
+    
     boolean isAsserted(AssertionInfoMap aim);
-    Policy getPolicy();
+    
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java Mon Feb 14 23:35:21 2011
@@ -29,6 +29,7 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.PolicyComponent;
 
 
@@ -45,6 +46,10 @@ public class JaxbAssertion<T> extends Pr
     public JaxbAssertion(QName qn, boolean optional) {
         super(qn, optional);
     }
+    
+    public JaxbAssertion(QName qn, boolean optional, boolean ignorable) {
+        super(qn, optional, ignorable);
+    }
       
     @Override
     @SuppressWarnings("unchecked")
@@ -64,8 +69,8 @@ public class JaxbAssertion<T> extends Pr
         return data;
     }
 
-    protected PolicyAssertion cloneMandatory() {
-        JaxbAssertion<T> a = new JaxbAssertion<T>(getName(), false);
+    protected Assertion clone(boolean optional) {
+        JaxbAssertion<T> a = new JaxbAssertion<T>(getName(), optional, ignorable);
         a.setData(data);
         return a;        
     } 

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -39,6 +39,7 @@ import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.neethi.Constants;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
 
 public class JaxbAssertionBuilder<T> implements AssertionBuilder {
 
@@ -108,7 +109,8 @@ public class JaxbAssertionBuilder<T> imp
         QName name = new QName(element.getNamespaceURI(), element.getLocalName());
         JaxbAssertion<T> assertion = buildAssertion();
         assertion.setName(name);
-        assertion.setOptional(getOptionality(element));
+        assertion.setOptional(XMLPrimitiveAssertionBuilder.isOptional(element));
+        assertion.setIgnorable(XMLPrimitiveAssertionBuilder.isIgnorable(element));
         assertion.setData(getData(element));
         return assertion;
     }
@@ -117,19 +119,6 @@ public class JaxbAssertionBuilder<T> imp
         return supportedTypes;
     }
 
-    @SuppressWarnings("unchecked")
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        if (a.equal(b)) {
-            JaxbAssertion<T> ja = (JaxbAssertion<T>)a;
-            JaxbAssertion<T> compatible = buildAssertion();
-            compatible.setName(a.getName());
-            compatible.setOptional(a.isOptional() && b.isOptional());
-            compatible.setData(ja.getData());
-            return compatible;
-        }
-        return null;
-    }
-    
     protected JaxbAssertion<T> buildAssertion() {
         return new JaxbAssertion<T>();
     }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java Mon Feb 14 23:35:21 2011
@@ -21,7 +21,6 @@ package org.apache.cxf.ws.policy.builder
 
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ResourceBundle;
 
@@ -39,39 +38,55 @@ import org.apache.cxf.ws.policy.PolicyAs
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyException;
-import org.apache.neethi.All;
-import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.PolicyOperator;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
 
 /**
  * Implementation of an assertion that required exactly one (possibly empty) child element
  * of type Policy (as does for examples the wsam:Addressing assertion).
  * 
  */
-public class NestedPrimitiveAssertion extends PrimitiveAssertion {
+public class NestedPrimitiveAssertion 
+    extends org.apache.neethi.builders.PolicyContainingPrimitiveAssertion implements PolicyAssertion {
 
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(NestedPrimitiveAssertion.class);    
-    private Policy nested;
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(NestedPrimitiveAssertion.class);
+    
+    
     private boolean assertionRequired = true;
     private PolicyBuilder builder;
+
+    public NestedPrimitiveAssertion(QName name, 
+                                    boolean optional,
+                                    PolicyBuilder b) {
+        this(name, optional, false, null, true, b);
+    }
     
-    @Deprecated
-    public NestedPrimitiveAssertion(QName name, boolean optional) {
-        this(name, optional, null, true, null);
+    public NestedPrimitiveAssertion(QName name, 
+                                    boolean optional,
+                                    boolean ignorable,
+                                    PolicyBuilder b) {
+        this(name, optional, ignorable, null, true, b);
     }
     
-    public NestedPrimitiveAssertion(QName name, boolean optional, PolicyBuilder b) {
-        this(name, optional, null, true, b);
+    public NestedPrimitiveAssertion(QName name, 
+                                    boolean optional,
+                                    Policy p, 
+                                    boolean assertionRequired,
+                                    PolicyBuilder b) {
+        this(name, optional, false, p, assertionRequired, b);
     }
     
-    public NestedPrimitiveAssertion(QName name, boolean optional, 
-                                    Policy p, boolean assertionRequired,
+    public NestedPrimitiveAssertion(QName name, 
+                                    boolean optional,
+                                    boolean ignorable, 
+                                    Policy p, 
+                                    boolean assertionRequired,
                                     PolicyBuilder b) {
-        super(name, optional);
+        super(name, optional, ignorable, p);
         this.assertionRequired = assertionRequired;
-        this.nested = p;
         builder = b;
     }
 
@@ -80,12 +95,13 @@ public class NestedPrimitiveAssertion ex
     }
     
     public NestedPrimitiveAssertion(Element elem, PolicyBuilder builder, boolean assertionRequired) {
-        super(elem);
+        super(new QName(elem.getNamespaceURI(), elem.getLocalName()),
+              XMLPrimitiveAssertionBuilder.isOptional(elem), 
+              XMLPrimitiveAssertionBuilder.isIgnorable(elem), null);
         this.builder = builder;
         this.assertionRequired = assertionRequired;
         
         // expect exactly one child element of type Policy
-       
         Element policyElem = null;
         for (Node nd = elem.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
             if (Node.ELEMENT_NODE == nd.getNodeType()) {
@@ -103,40 +119,12 @@ public class NestedPrimitiveAssertion ex
             throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
                                                   PolicyConstants.POLICY_ELEM_NAME));
         }
-        
         nested = builder.getPolicy(policyElem);  
     }
-    
-    public PolicyComponent normalize() {
-        Policy normalisedNested 
-            = (Policy)nested.normalize(builder == null ? null : builder.getPolicyRegistry(),
-                                       true);
-        
-        Policy p = new Policy();
-        ExactlyOne ea = new ExactlyOne();
-        p.addPolicyComponent(ea);
-        if (isOptional()) {
-            ea.addPolicyComponent(new All());
-        }
-        // for all alternatives in normalised nested policy
-        Iterator alternatives = normalisedNested.getAlternatives();
-        while (alternatives.hasNext()) {
-            All all = new All();
-            List<PolicyAssertion> alternative = 
-                CastUtils.cast((List)alternatives.next(), PolicyAssertion.class);
-            NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(getName(), false, builder);
-            a.nested = new Policy();
-            ExactlyOne nea = new ExactlyOne();
-            a.nested.addPolicyComponent(nea);
-            All na = new All();
-            nea.addPolicyComponent(na);
-            na.addPolicyComponents(alternative);
-            all.addPolicyComponent(a);
-            ea.addPolicyComponent(all);            
-        } 
-        return p;      
-    } 
-    
+    protected Assertion clone(boolean opt, Policy n) {
+        return new NestedPrimitiveAssertion(name, opt, ignorable, n, assertionRequired, builder);
+    }
+
     @Override
     public boolean equal(PolicyComponent policyComponent) {
         
@@ -147,18 +135,8 @@ public class NestedPrimitiveAssertion ex
         return getPolicy().equal(other.getPolicy());
     }
     
-    protected void setPolicy(Policy n) {
-        nested = n;
-    }
-    
-    @Override
-    public Policy getPolicy() {
-        return nested;
-    }
-
     @Override
     public boolean isAsserted(AssertionInfoMap aim) {
-        
         if (assertionRequired) {
             Collection<AssertionInfo> ail = aim.getAssertionInfo(name);
             for (AssertionInfo ai : ail) {

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -20,64 +20,50 @@
 package org.apache.cxf.ws.policy.builder.primitive;
 
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
-import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
-import org.apache.cxf.ws.policy.Intersector;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.neethi.Policy;
+import org.apache.neethi.Constants;
 
 public class NestedPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {
     
     private PolicyBuilder builder;    
-    private AssertionBuilderRegistry assertionBuilderRegistry;
     
-    public void setPolicyBuilder(PolicyBuilder b) {
-        builder = b;
+    public NestedPrimitiveAssertionBuilder() {
     }
-        
-    public void setAssertionBuilderRegistry(AssertionBuilderRegistry abr) {
-        assertionBuilderRegistry = abr;
+    public NestedPrimitiveAssertionBuilder(PolicyBuilder b) {
+        builder = b;
     }
     
-    @Override
-    public PolicyAssertion build(Element elem) {
-        return new NestedPrimitiveAssertion(elem, builder); 
+    public void setPolicyBuilder(PolicyBuilder b) {
+        builder = b;
     }
+        
 
+    
     @Override
-    /**
-     * If the nested policies in both assertions are empty, the compatible policy
-     * . 
-     * The compatible policy is optional if both assertions are optional.
-     */
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        if (!getKnownElements().contains(a.getName()) || !a.getName().equals(b.getName())) {
-            return null;
+    public PolicyAssertion build(Element element) {
+        Node nd = element.getFirstChild();
+        int count = 0;
+        int policyCount = 0;
+        while (nd != null) {
+            if (nd instanceof Element) {
+                count++;
+                Element el = (Element)nd;
+                if (Constants.isPolicyElement(el.getNamespaceURI(), el.getLocalName())) {
+                    policyCount++;
+                }
+            }
+            nd = nd.getNextSibling();
         }
-        
-        if (null == assertionBuilderRegistry) {
-            return null;
-        }
-                
-       
-        NestedPrimitiveAssertion na = (NestedPrimitiveAssertion)a;
-        NestedPrimitiveAssertion nb = (NestedPrimitiveAssertion)b;        
-        
-        Intersector intersector = new Intersector(assertionBuilderRegistry);
-        
-        Policy nested = intersector.intersect(na.getPolicy(), nb.getPolicy());        
-        if (null == nested) {
-            return  null;
+        if (count == 0) {
+            return new PrimitiveAssertion(element);
+        } else if (policyCount == 1 && count == 1) {
+            return new NestedPrimitiveAssertion(element, builder); 
         }
-        
-        NestedPrimitiveAssertion compatible = 
-            new NestedPrimitiveAssertion(a.getName(), a.isOptional() && b.isOptional(),
-                                         null, true, builder);
-        compatible.setPolicy(nested);
-        
-        return compatible;
+        return new PrimitiveAssertion(element);
     }
-    
+
     
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java Mon Feb 14 23:35:21 2011
@@ -22,62 +22,49 @@ package org.apache.cxf.ws.policy.builder
 import java.util.Collection;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 
-import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
 
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.policy.PolicyAssertion;
-import org.apache.cxf.ws.policy.PolicyConstants;
-import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
-import org.apache.neethi.ExactlyOne;
-import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
 
 /**
  * 
  */
-public class PrimitiveAssertion implements PolicyAssertion {
-    
-    protected QName name;
-    protected boolean optional;
-    protected boolean ignorable;
+public class PrimitiveAssertion 
+    extends org.apache.neethi.builders.PrimitiveAssertion implements PolicyAssertion {
 
     public PrimitiveAssertion() {
-        this((QName)null);
+        super();
     }
     
     public PrimitiveAssertion(QName n) {
-        this(n, false);
+        super(n, false);
     }
     
     public PrimitiveAssertion(QName n, boolean o) {
-        name = n;
-        optional = o;
+        super(n, o);
+    }
+    public PrimitiveAssertion(QName n, boolean o, boolean i) {
+        super(n, o, i);
     }
     
     public PrimitiveAssertion(Element element) {
-        name = new QName(element.getNamespaceURI(), element.getLocalName());
-        NamedNodeMap atts = element.getAttributes();
-        if (atts != null) {
-            for (int x = 0; x < atts.getLength(); x++) {
-                Attr att = (Attr)atts.item(x);
-                QName qn = new QName(att.getNamespaceURI(), att.getLocalName());
-                if (PolicyConstants.isOptionalAttribute(qn)) {
-                    optional = Boolean.valueOf(att.getValue());                
-                }
-            }
-        }
+        super(new QName(element.getNamespaceURI(), element.getLocalName()),
+              XMLPrimitiveAssertionBuilder.isOptional(element),
+              XMLPrimitiveAssertionBuilder.isIgnorable(element));
     }
-
-    public String toString() {
-        return name.toString();
+    
+    @Override
+    protected Assertion clone(boolean opt) {
+        return new PrimitiveAssertion(name, opt, ignorable);
     }
+
     public boolean equal(PolicyComponent policyComponent) {
         if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
             return false;
@@ -85,60 +72,6 @@ public class PrimitiveAssertion implemen
         return getName().equals(((PolicyAssertion)policyComponent).getName());
     }
 
-    public short getType() {
-        return Constants.TYPE_ASSERTION;
-    }
-
-    public QName getName() {
-        return name;
-    }
-    
-    public void setName(QName n) {
-        name = n;
-    }
-
-    public boolean isOptional() {
-        return optional;
-    }
-
-    public void setOptional(boolean o) {
-        optional = o;        
-    }
-    public boolean isIgnorable() {
-        return ignorable;
-    }
-
-    public void setIgnorable(boolean o) {
-        ignorable = o;        
-    }
-    
-    public PolicyComponent normalize() {
-        if (isOptional()) {
-            Policy policy = new Policy();
-            ExactlyOne exactlyOne = new ExactlyOne();
-
-            All all = new All();
-            all.addPolicyComponent(cloneMandatory());
-            exactlyOne.addPolicyComponent(all);
-            exactlyOne.addPolicyComponent(new All());
-            policy.addPolicyComponent(exactlyOne);
-
-            return policy;
-        }
-
-        return cloneMandatory();
-    }
-
-    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-    }
-    
-    protected PolicyAssertion cloneMandatory() {
-        return new PrimitiveAssertion(name, false);
-    }
-
-    public Policy getPolicy() {
-        return null;
-    }
 
     public boolean isAsserted(AssertionInfoMap aim) {
         Collection<AssertionInfo> ail = aim.getAssertionInfo(name);
@@ -149,4 +82,5 @@ public class PrimitiveAssertion implemen
         }
         return false;
     }
+    
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -46,10 +46,10 @@ public class PrimitiveAssertionBuilder i
         bus = b;
     }
     
-    public PolicyAssertion build(Element element) {  
+    public PolicyAssertion build(Element element) { 
         return new PrimitiveAssertion(element);
     }
-
+    
     public Collection<QName> getKnownElements() {
         return knownElements;
     }
@@ -58,15 +58,4 @@ public class PrimitiveAssertionBuilder i
         knownElements = k;
     }
 
-    /**
-     * If the two assertions are equal, they are also compatible. 
-     * The compatible policy is optional if both assertions are optional.
-     */
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        if (knownElements.contains(a.getName()) && a.getName().equals(b.getName())) {
-            return new PrimitiveAssertion(a.getName(), a.isOptional() && b.isOptional());
-        }
-        return  null;
-    }   
-
 }

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java Mon Feb 14 23:35:21 2011
@@ -26,7 +26,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.test.assertions.foo.FooType;
-import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.All;
 import org.apache.neethi.Constants;
 import org.apache.neethi.ExactlyOne;
@@ -80,7 +80,7 @@ public class JaxbAssertionTest extends A
         assertTrue(!assertion.equal(pc));
         
         IMocksControl ctrl = EasyMock.createNiceControl();
-        XmlPrimitiveAssertion xpa = ctrl.createMock(XmlPrimitiveAssertion.class);
+        PrimitiveAssertion xpa = ctrl.createMock(PrimitiveAssertion.class);
         QName oqn = new QName("http://cxf.apache.org/test/assertions/blah", "OtherType");
         EasyMock.expect(xpa.getName()).andReturn(oqn);
         EasyMock.expect(xpa.getType()).andReturn(Constants.TYPE_ASSERTION);

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java Mon Feb 14 23:35:21 2011
@@ -29,10 +29,7 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
-import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -48,13 +45,10 @@ public class NestedPrimitiveAssertionBui
 
     private static final String TEST_NAMESPACE = "http://www.w3.org/2007/01/addressing/metadata";
     private static final QName TEST_NAME1 = new QName(TEST_NAMESPACE, "Addressing");
-    private static final QName TEST_NAME2 = new QName(TEST_NAMESPACE, "AnonymousResponses");
-    private static final QName TEST_NAME3 = new QName(TEST_NAMESPACE, "NonAnonymousResponses");
 
     private NestedPrimitiveAssertionBuilder npab;
     private IMocksControl control;
     private PolicyBuilder builder;
-    private AssertionBuilderRegistry reg;
     
     @Before
     public void setUp() {
@@ -63,23 +57,16 @@ public class NestedPrimitiveAssertionBui
         npab.setKnownElements(Collections.singletonList(TEST_NAME1));
         builder = control.createMock(PolicyBuilder.class);
         npab.setPolicyBuilder(builder);  
-        reg = control.createMock(AssertionBuilderRegistry.class);
-        npab.setAssertionBuilderRegistry(reg);
     }
     
     @Test
-    public void testBuildFailOlderNs() throws Exception {
+    public void testSimpleBuildOlderNs() throws Exception {
         String data = 
             "<wsam:Addressing wsp:Optional=\"true\""
             + " xmlns:wsp=\"http://www.w3.org/2006/07/ws-policy\""
             + " xmlns:wsam=\"http://www.w3.org/2007/01/addressing/metadata\" />";
         
-        try {
-            npab.build(getElement(data));
-            fail("Expected PolicyException not thrown.");
-        } catch (PolicyException ex) {
-            // expected
-        }
+        npab.build(getElement(data));
     }
     
     @Test
@@ -122,75 +109,6 @@ public class NestedPrimitiveAssertionBui
         control.verify();
     }
     
-    @Test
-    public void testBuildCompatibleNoRegistry() {
-        npab.setAssertionBuilderRegistry(null);
-        Policy[] policies = NestedPrimitiveAssertionTest.buildTestPolicies(); 
-        PolicyAssertion a = 
-            (PolicyAssertion)policies[4].getFirstPolicyComponent();   
-        assertNull("Should not have been able to build compatible policy.", npab.buildCompatible(a, a));
-    }
-    
-    @Test
-    public void testCompatibleWithSelf() {
-        Policy[] policies = NestedPrimitiveAssertionTest.buildTestPolicies();
-        EasyMock.expect(reg.get(TEST_NAME1)).andReturn(npab).anyTimes();
-        PrimitiveAssertionBuilder ab1 = new PrimitiveAssertionBuilder();
-        ab1.setKnownElements(Collections.singleton(TEST_NAME2));
-        PrimitiveAssertionBuilder ab2 = new PrimitiveAssertionBuilder();
-        ab2.setKnownElements(Collections.singleton(TEST_NAME3));
-        EasyMock.expect(reg.get(TEST_NAME2)).andReturn(ab1).anyTimes();
-        EasyMock.expect(reg.get(TEST_NAME3)).andReturn(ab2).anyTimes();
-        
-        control.replay();
-        PolicyAssertion a = 
-            (PolicyAssertion)policies[2].getFirstPolicyComponent();          
-        PolicyAssertion compatible = npab.buildCompatible(a, a);
-        assertNotNull("assertion in policy 2 should be compatible with itself.", compatible);
-        control.verify();
-    }
-        
-    @Test
-    public void testBuildCompatible() {
-        Policy[] policies = NestedPrimitiveAssertionTest.buildTestPolicies();
-        EasyMock.expect(reg.get(TEST_NAME1)).andReturn(npab).anyTimes();
-        PrimitiveAssertionBuilder ab1 = new PrimitiveAssertionBuilder();
-        ab1.setKnownElements(Collections.singleton(TEST_NAME2));
-        PrimitiveAssertionBuilder ab2 = new PrimitiveAssertionBuilder();
-        ab2.setKnownElements(Collections.singleton(TEST_NAME3));
-        EasyMock.expect(reg.get(TEST_NAME2)).andReturn(ab1).anyTimes();
-        EasyMock.expect(reg.get(TEST_NAME3)).andReturn(ab2).anyTimes();
-        
-        control.replay();
-        for (int i = 0; i < policies.length; i++) {
-            PolicyAssertion a = 
-                (PolicyAssertion)policies[i].getFirstPolicyComponent();          
-            PolicyAssertion compatible = npab.buildCompatible(a, a);
-            assertNotNull("assertion in policy " + i + " should be compatible with itself.", compatible);
-        }
-        
-        for (int i = 1; i < 5; i++) {
-            PolicyAssertion a = 
-                (PolicyAssertion)policies[0].getFirstPolicyComponent();
-            PolicyAssertion b = (PolicyAssertion)policies[i].getFirstPolicyComponent();
-            PolicyAssertion compatible = npab.buildCompatible(a, b);
-            assertNotNull("assertion in policy 0 should be compatible with assertion in policy " + i + ".",
-                          compatible);
-        }
-        
-        for (int i = 2; i < 5; i++) {
-            PolicyAssertion a = 
-                (PolicyAssertion)policies[1].getFirstPolicyComponent();
-            PolicyAssertion b = 
-                (PolicyAssertion)policies[i].getFirstPolicyComponent();
-            PolicyAssertion compatible = npab.buildCompatible(a, b);
-            assertNotNull("assertion in policy " + 1 + " should be compatible with assertion in policy i.",
-                          compatible);
-        }
-        control.verify();
-        
-    }
-    
     Element getElement(String data) throws Exception {
         InputStream is = new ByteArrayInputStream(data.getBytes());
         return DOMUtils.readXml(is).getDocumentElement();

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Mon Feb 14 23:35:21 2011
@@ -480,7 +480,7 @@
             <dependency>
                 <groupId>org.apache.neethi</groupId>
                 <artifactId>neethi</artifactId>
-                <version>2.0.4</version>
+                <version>3.0.0-SNAPSHOT</version>
                 <exclusions>
                     <exclusion>
                         <groupId>log4j</groupId>

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -30,6 +30,7 @@ import org.apache.cxf.transports.http.co
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
@@ -46,26 +47,6 @@ public class HTTPClientAssertionBuilder 
     }
 
     @Override
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        if (PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())
-            && PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(b.getName())) {
-            
-            HTTPClientPolicy compatible = PolicyUtils.intersect(
-                JaxbAssertion.cast(a, HTTPClientPolicy.class).getData(),
-                JaxbAssertion.cast(b, HTTPClientPolicy.class).getData());
-            if (null == compatible) {
-                return null;
-            }
-            JaxbAssertion<HTTPClientPolicy> ca = 
-                new JaxbAssertion<HTTPClientPolicy>(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME, 
-                    a.isOptional() && b.isOptional());
-            ca.setData(compatible);
-            return ca;
-        }
-        return null;
-    }
-
-    @Override
     protected JaxbAssertion<HTTPClientPolicy> buildAssertion() {
         return new HTTPClientPolicyAssertion();
     }
@@ -86,7 +67,7 @@ public class HTTPClientAssertionBuilder 
         }
         
         @Override
-        protected PolicyAssertion cloneMandatory() {
+        protected Assertion clone(boolean optional) {
             HTTPClientPolicyAssertion a = new HTTPClientPolicyAssertion();
             a.setData(getData());
             return a;        

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -30,6 +30,7 @@ import org.apache.cxf.transports.http.co
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
@@ -44,26 +45,6 @@ public class HTTPServerAssertionBuilder 
     public HTTPServerAssertionBuilder() throws JAXBException {
         super(HTTPServerPolicy.class, PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME);        
     }
-
-    @Override
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        if (PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())
-            && PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME.equals(b.getName())) {
-            
-            HTTPServerPolicy compatible = PolicyUtils.intersect(
-                JaxbAssertion.cast(a, HTTPServerPolicy.class).getData(),
-                JaxbAssertion.cast(b, HTTPServerPolicy.class).getData());
-            if (null == compatible) {
-                return null;
-            }
-            
-            JaxbAssertion<HTTPServerPolicy> ca = buildAssertion();
-            ca.setOptional(a.isOptional() && b.isOptional());
-            ca.setData(compatible);
-            return ca;
-        }
-        return null;
-    }
     
     @Override
     protected JaxbAssertion<HTTPServerPolicy> buildAssertion() {
@@ -86,7 +67,7 @@ public class HTTPServerAssertionBuilder 
         }
         
         @Override
-        protected PolicyAssertion cloneMandatory() {
+        protected Assertion clone(boolean optional) {
             HTTPServerPolicyAssertion a = new HTTPServerPolicyAssertion();
             a.setData(getData());
             return a;        

Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java (original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilderTest.java Mon Feb 14 23:35:21 2011
@@ -30,19 +30,6 @@ import org.junit.Test;
  */
 public class HTTPClientAssertionBuilderTest extends Assert {
 
-    @Test
-    public void testBuildCompatible() throws Exception {
-        HTTPClientAssertionBuilder ab = new HTTPClientAssertionBuilder();
-        JaxbAssertion<HTTPClientPolicy>  a = ab.buildAssertion();
-        HTTPClientPolicy pa = new HTTPClientPolicy();
-        a.setData(pa);
-        JaxbAssertion<HTTPClientPolicy> b = ab.buildAssertion();
-        HTTPClientPolicy pb = new HTTPClientPolicy();
-        b.setData(pb);
-        JaxbAssertion<HTTPClientPolicy> c = 
-            JaxbAssertion.cast(ab.buildCompatible(a, b), HTTPClientPolicy.class);
-        assertNotNull(c);        
-    }
     
     @Test
     public void testBuildAssertion() throws Exception {

Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java (original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilderTest.java Mon Feb 14 23:35:21 2011
@@ -30,19 +30,6 @@ import org.junit.Test;
  */
 public class HTTPServerAssertionBuilderTest extends Assert {
 
-    @Test
-    public void testBuildCompatible() throws Exception {
-        HTTPServerAssertionBuilder ab = new HTTPServerAssertionBuilder();
-        JaxbAssertion<HTTPServerPolicy>  a = ab.buildAssertion();
-        HTTPServerPolicy pa = new HTTPServerPolicy();
-        a.setData(pa);
-        JaxbAssertion<HTTPServerPolicy> b = ab.buildAssertion();
-        HTTPServerPolicy pb = new HTTPServerPolicy();
-        b.setData(pb);
-        JaxbAssertion<HTTPServerPolicy> c = 
-            JaxbAssertion.cast(ab.buildCompatible(a, b), HTTPServerPolicy.class);
-        assertNotNull(c);        
-    }
     
     @Test
     public void testBuildAssertion() throws Exception {

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -21,7 +21,6 @@ package org.apache.cxf.ws.addressing.pol
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 
 import javax.xml.namespace.QName;
 
@@ -30,14 +29,11 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.AssertionBuilder;
-import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
-import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertionBuilder;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 
 /**
  * 
@@ -94,22 +90,5 @@ public class AddressingAssertionBuilder 
     public Collection<QName> getKnownElements() {
         return KNOWN_ELEMENTS;
     }
-
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        QName qn = a.getName();
-        if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn)) {
-            NestedPrimitiveAssertionBuilder npab = new NestedPrimitiveAssertionBuilder();
-            npab.setKnownElements(Collections.singleton(MetadataConstants.ADDRESSING_ASSERTION_QNAME));
-            npab.setAssertionBuilderRegistry(bus.getExtension(AssertionBuilderRegistry.class));
-            return npab.buildCompatible(a, b);
-        } else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn)
-            || MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME.equals(qn)) {
-              
-            PrimitiveAssertionBuilder pab = new PrimitiveAssertionBuilder();
-            pab.setKnownElements(Collections.singleton(qn));
-            return pab.buildCompatible(a, b); 
-        }
-        return null;
-    }   
     
 }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java Mon Feb 14 23:35:21 2011
@@ -40,7 +40,8 @@ import org.apache.cxf.configuration.Conf
 import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
-import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertionBuilder;
+import org.apache.neethi.Assertion;
 
 /**
  * 
@@ -103,7 +104,7 @@ public class AssertionBuilderRegistryImp
         ignoreUnknownAssertions = ignore;
     }
 
-    private synchronized void loadDynamic() {
+    protected synchronized void loadDynamic() {
         if (!dynamicLoaded && bus != null) {
             dynamicLoaded = true;
             ConfiguredBeanLocator c = bus.getExtension(ConfiguredBeanLocator.class);
@@ -112,7 +113,7 @@ public class AssertionBuilderRegistryImp
             }
         }
     }
-    public PolicyAssertion build(Element element) {
+    public Assertion build(Element element) {
         loadDynamic();
         
         AssertionBuilder builder;
@@ -133,7 +134,8 @@ public class AssertionBuilderRegistryImp
                 if (!alreadyWarned) {
                     LOG.warning(m.toString());
                 }
-                return new XmlPrimitiveAssertion(element);
+                
+                builder = new NestedPrimitiveAssertionBuilder(bus.getExtension(PolicyBuilder.class));
             } else {
                 throw new PolicyException(m);
             }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java Mon Feb 14 23:35:21 2011
@@ -43,6 +43,7 @@ import org.apache.cxf.service.model.Endp
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyContainingAssertion;
 
 /**
  * 
@@ -193,10 +194,12 @@ public class EffectivePolicyImpl impleme
         if (null != pp) {
             out.addAll(usIn ? pp.getInInterceptors() : pp.getOutInterceptors());
         }
-        Policy p = a.getPolicy();
-        if (p != null) {
-            for (PolicyAssertion a2 : getSupportedAlternatives(engine, p)) {
-                initialiseInterceptors(reg, engine, out, a2, usIn);
+        if (a instanceof PolicyContainingAssertion) {
+            Policy p = ((PolicyContainingAssertion)a).getPolicy();
+            if (p != null) {
+                for (PolicyAssertion a2 : getSupportedAlternatives(engine, p)) {
+                    initialiseInterceptors(reg, engine, out, a2, usIn);
+                }
             }
         }
     }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java Mon Feb 14 23:35:21 2011
@@ -40,6 +40,7 @@ import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyContainingAssertion;
 
 /**
  * 
@@ -269,10 +270,12 @@ public class EndpointPolicyImpl implemen
         if (null != pp) {
             out.addAll(fault ? pp.getInFaultInterceptors() : pp.getInInterceptors());
         }
-        Policy p = a.getPolicy();
-        if (p != null) {
-            for (PolicyAssertion a2 : getSupportedAlternatives(p)) {
-                initializeInterceptors(reg, out, a2, fault);
+        if (a instanceof PolicyContainingAssertion) {
+            Policy p = ((PolicyContainingAssertion)a).getPolicy();
+            if (p != null) {
+                for (PolicyAssertion a2 : getSupportedAlternatives(p)) {
+                    initializeInterceptors(reg, out, a2, fault);
+                }
             }
         }
     }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java Mon Feb 14 23:35:21 2011
@@ -39,6 +39,7 @@ import org.apache.cxf.common.injection.N
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
@@ -190,7 +191,7 @@ public class PolicyBuilderImpl implement
                 } else if (PolicyConstants.isPolicyRefElem(qn)) {
                     operator.addPolicyComponent(getPolicyReference(childElement));                
                 } else if (null != assertionBuilderRegistry) {
-                    PolicyAssertion a = assertionBuilderRegistry.build(childElement);
+                    Assertion a = assertionBuilderRegistry.build(childElement);
                     if (null != a) {
                         operator.addPolicyComponent(a);
                     }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -21,7 +21,6 @@ package org.apache.cxf.ws.policy.mtom;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 
 import javax.xml.namespace.QName;
 
@@ -32,7 +31,6 @@ import org.apache.cxf.ws.policy.Assertio
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 
 public class MTOMAssertionBuilder implements AssertionBuilder {
     private static final Collection<QName> KNOWN_ELEMENTS = new ArrayList<QName>();
@@ -61,14 +59,4 @@ public class MTOMAssertionBuilder implem
         return KNOWN_ELEMENTS;
     }
 
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        QName qn = a.getName();
-        if (MetadataConstants.MTOM_ASSERTION_QNAME.equals(qn)) {
-            PrimitiveAssertionBuilder pab = new PrimitiveAssertionBuilder();
-            pab.setKnownElements(Collections.singleton(qn));
-            return pab.buildCompatible(a, b);
-        }
-
-        return null;
-    }
 }

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java Mon Feb 14 23:35:21 2011
@@ -23,7 +23,9 @@ import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
+import org.apache.cxf.Bus;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.neethi.Assertion;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.After;
@@ -50,7 +52,16 @@ public class AssertionBuilderRegistryImp
     
     @Test
     public void testBuildUnknownAssertion() {
-        AssertionBuilderRegistry reg = new AssertionBuilderRegistryImpl();
+        Bus bus = control.createMock(Bus.class);
+
+        PolicyBuilder builder = control.createMock(PolicyBuilder.class);
+        EasyMock.expect(bus.getExtension(PolicyBuilder.class)).andReturn(builder).anyTimes();
+
+        AssertionBuilderRegistryImpl reg = new AssertionBuilderRegistryImpl() {
+            protected void loadDynamic() {
+                //nothing
+            }
+        };
         reg.setIgnoreUnknownAssertions(false);
         Element[] elems = new Element[11];
         QName[] qnames = new QName[11];
@@ -62,6 +73,7 @@ public class AssertionBuilderRegistryImp
         }
         
         control.replay();
+        reg.setBus(bus);
         
         assertTrue(!reg.isIgnoreUnknownAssertions());
         try {
@@ -73,11 +85,13 @@ public class AssertionBuilderRegistryImp
         reg.setIgnoreUnknownAssertions(true);
         assertTrue(reg.isIgnoreUnknownAssertions());
         for (int i = 0; i < 10; i++) {
-            assertTrue(reg.build(elems[i]) instanceof XmlPrimitiveAssertion);
+            Assertion assertion = reg.build(elems[i]);
+            assertTrue("Not a PrimitiveAsertion: " + assertion.getClass().getName(), 
+                       assertion instanceof PrimitiveAssertion);
         }
         for (int i = 9; i >= 0; i--) {
-            assertTrue(reg.build(elems[i]) instanceof XmlPrimitiveAssertion);
+            assertTrue(reg.build(elems[i]) instanceof PrimitiveAssertion);
         }
-        assertTrue(reg.build(elems[10]) instanceof XmlPrimitiveAssertion);
+        assertTrue(reg.build(elems[10]) instanceof PrimitiveAssertion);
     }
 }

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java Mon Feb 14 23:35:21 2011
@@ -24,7 +24,7 @@ import java.io.InputStream;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.ws.policy.builder.xml.XMLPrimitiveAssertionBuilder;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 import org.apache.neethi.Policy;
 import org.apache.neethi.util.PolicyComparator;
 import org.easymock.classextension.EasyMock;
@@ -77,7 +77,7 @@ public class NormalizeTest extends Asser
         builder.setBus(bus);
         AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder.setAssertionBuilderRegistry(abr);
-        XMLPrimitiveAssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
+        PrimitiveAssertionBuilder ab = new PrimitiveAssertionBuilder();
         ab.setBus(bus);
        
         abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityToken"), ab);

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java Mon Feb 14 23:35:21 2011
@@ -25,7 +25,7 @@ import java.util.List;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.ws.policy.builder.xml.XMLPrimitiveAssertionBuilder;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
@@ -43,7 +43,7 @@ public class PolicyBuilderTest extends A
         builder = new PolicyBuilderImpl();
         AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder.setAssertionBuilderRegistry(abr);
-        AssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
+        AssertionBuilder ab = new PrimitiveAssertionBuilder();
         abr.register(new QName("http://sample.org/Assertions", "A"), ab);
         abr.register(new QName("http://sample.org/Assertions", "B"), ab);
         abr.register(new QName("http://sample.org/Assertions", "C"), ab);

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java Mon Feb 14 23:35:21 2011
@@ -24,7 +24,6 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.neethi.Constants;
-import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 
 /**
@@ -66,11 +65,6 @@ public class TestAssertion implements Po
         return Constants.TYPE_ASSERTION;
     }
 
-    public Policy getPolicy() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
     public boolean isAsserted(AssertionInfoMap aim) {
         // TODO Auto-generated method stub
         return false;

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java Mon Feb 14 23:35:21 2011
@@ -41,7 +41,7 @@ import org.apache.cxf.ws.policy.PolicyBu
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.cxf.ws.policy.PolicyRegistryImpl;
-import org.apache.cxf.ws.policy.builder.xml.XMLPrimitiveAssertionBuilder;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.WSDLManagerImpl;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
@@ -124,8 +124,9 @@ public class Wsdl11AttachmentPolicyProvi
         EasyMock.expectLastCall().andReturn(null).anyTimes();
         AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         abr.setIgnoreUnknownAssertions(false);
-        XMLPrimitiveAssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
-        ab.setBus(bus);
+        
+        
+        PrimitiveAssertionBuilder ab = new PrimitiveAssertionBuilder();
         abr.register(new QName("http://cxf.apache.org/test/assertions", "A"), ab);
         abr.register(new QName("http://cxf.apache.org/test/assertions", "B"), ab);
         abr.register(new QName("http://cxf.apache.org/test/assertions", "C"), ab);

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java Mon Feb 14 23:35:21 2011
@@ -29,6 +29,7 @@ import org.apache.cxf.ws.policy.PolicyAs
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
 import org.apache.cxf.ws.rm.RMConstants;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
@@ -44,26 +45,6 @@ public class RMAssertionBuilder extends 
     }
 
     @Override
-    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
-        if (RMConstants.getRMAssertionQName().equals(a.getName())
-            && RMConstants.getRMAssertionQName().equals(b.getName())) {
-            
-            RMAssertion compatible = PolicyUtils.intersect(
-                JaxbAssertion.cast(a, RMAssertion.class).getData(),
-                JaxbAssertion.cast(b, RMAssertion.class).getData());
-            if (null == compatible) {
-                return null;
-            }
-            JaxbAssertion<RMAssertion> ca = 
-                new JaxbAssertion<RMAssertion>(RMConstants.getRMAssertionQName(), 
-                    a.isOptional() && b.isOptional());
-            ca.setData(compatible);
-            return ca;
-        }
-        return null;
-    }
-
-    @Override
     protected JaxbAssertion<RMAssertion> buildAssertion() {
         return new RMPolicyAssertion();
     }
@@ -72,6 +53,12 @@ public class RMAssertionBuilder extends 
         RMPolicyAssertion() {
             super(RMConstants.getRMAssertionQName(), false);
         }
+        RMPolicyAssertion(boolean opt) {
+            super(RMConstants.getRMAssertionQName(), opt);
+        }
+        RMPolicyAssertion(boolean opt, boolean ignore) {
+            super(RMConstants.getRMAssertionQName(), opt, ignore);
+        }
 
         @Override
         public boolean equal(PolicyComponent policyComponent) {
@@ -85,7 +72,7 @@ public class RMAssertionBuilder extends 
         }
         
         @Override
-        protected PolicyAssertion cloneMandatory() {
+        protected Assertion clone(boolean b) {
             RMPolicyAssertion a = new RMPolicyAssertion();
             a.setData(getData());
             return a;        

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java Mon Feb 14 23:35:21 2011
@@ -31,7 +31,7 @@ import org.apache.cxf.ws.policy.Assertio
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyInterceptorProviderLoader;
 import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
-import org.apache.cxf.ws.policy.builder.xml.XMLPrimitiveAssertionBuilder;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 import org.apache.cxf.ws.security.policy.builders.AlgorithmSuiteBuilder;
 import org.apache.cxf.ws.security.policy.builders.AsymmetricBindingBuilder;
 import org.apache.cxf.ws.security.policy.builders.ContentEncryptedElementsBuilder;
@@ -145,7 +145,7 @@ public final class WSSecurityPolicyLoade
             new QName(SP12Constants.SP_NS, SP12Constants.ENCRYPT_BEFORE_SIGNING),
             new QName(SP11Constants.SP_NS, SP11Constants.ENCRYPT_BEFORE_SIGNING),
         });
-        reg.register(new XMLPrimitiveAssertionBuilder(others));
+        reg.register(new PrimitiveAssertionBuilder(others));
     }
     
     public void registerProviders() {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractSecurityAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractSecurityAssertion.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractSecurityAssertion.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractSecurityAssertion.java Mon Feb 14 23:35:21 2011
@@ -24,7 +24,6 @@ import org.apache.cxf.ws.policy.Assertio
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 
 public abstract class AbstractSecurityAssertion implements PolicyAssertion {
@@ -34,7 +33,6 @@ public abstract class AbstractSecurityAs
     private boolean ignorable;
     private boolean normalized;
 
-    
     public AbstractSecurityAssertion(SPConstants version) {
         constants = version;
     }
@@ -76,11 +74,6 @@ public abstract class AbstractSecurityAs
     public PolicyComponent normalize() {
         return this;
     }
-
-    
-    public Policy getPolicy() {
-        return null;
-    }
     
     public boolean isAsserted(AssertionInfoMap aim) {
         Collection<AssertionInfo> ail = aim.getAssertionInfo(getName());

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java Mon Feb 14 23:35:21 2011
@@ -31,8 +31,10 @@ import org.apache.neethi.All;
 import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
 
-public class AsymmetricBinding extends SymmetricAsymmetricBindingBase {
+public class AsymmetricBinding extends SymmetricAsymmetricBindingBase 
+    implements PolicyContainingAssertion {
 
     private InitiatorToken initiatorToken;
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java Mon Feb 14 23:35:21 2011
@@ -20,8 +20,10 @@ package org.apache.cxf.ws.security.polic
 
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.neethi.PolicyContainingAssertion;
 
-public abstract class Binding extends AbstractSecurityAssertion implements AlgorithmWrapper {
+public abstract class Binding extends AbstractSecurityAssertion 
+    implements AlgorithmWrapper, PolicyContainingAssertion  {
     protected PolicyBuilder builder;
     
     private AlgorithmSuite algorithmSuite;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java?rev=1070696&r1=1070695&r2=1070696&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java Mon Feb 14 23:35:21 2011
@@ -26,8 +26,10 @@ import org.apache.neethi.All;
 import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
 
-public abstract class TokenWrapper extends AbstractSecurityAssertion implements PolicyAssertion {
+public abstract class TokenWrapper extends AbstractSecurityAssertion 
+    implements PolicyAssertion, PolicyContainingAssertion {
     protected PolicyBuilder builder;
     protected Token token;
 



Mime
View raw message