cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1071879 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ api/src/test/java/org/apache/cxf/ws/policy/ api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/ rt...
Date Fri, 18 Feb 2011 04:20:07 GMT
Author: dkulp
Date: Fri Feb 18 04:20:06 2011
New Revision: 1071879

URL: http://svn.apache.org/viewvc?rev=1071879&view=rev
Log:
Push more stuff to Neethi
Cleanup some policy API's

Removed:
    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/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java
    cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.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/AssertionInfoMapTest.java
    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/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
    cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
    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/PolicyUtils.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.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/PolicyEngineTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java

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=1071879&r1=1071878&r2=1071879&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 Fri Feb 18
04:20:06 2011
@@ -95,9 +95,8 @@ public class AssertionInfoMap extends Ha
             Assertion ass = (Assertion)assertion;
             Collection<AssertionInfo> ail = getAssertionInfo(ass.getName());
             for (AssertionInfo ai : ail) {
-                if (ai.isAsserted() && ai.getAssertion() == ass) {
-                    return true;
-                } else if (!ass.isOptional()) {
+                if (ai.getAssertion().equal(ass)
+                    && !ai.isAsserted() && !ass.isOptional()) {
                     errors.add(ass.getName());
                     pass = false;                    
                 }
@@ -106,10 +105,10 @@ public class AssertionInfoMap extends Ha
         if (assertion instanceof PolicyContainingAssertion) {
             Policy p = ((PolicyContainingAssertion)assertion).getPolicy();
             if (p != null) {
-                Iterator it = p.getAlternatives();
-                while (it.hasNext()) {
-                    List<PolicyAssertion> lst = CastUtils.cast((List<?>)it.next());
-                    for (PolicyAssertion p2 : lst) {
+                Iterator<List<Assertion>> alternatives = p.getAlternatives();
+                while (alternatives.hasNext()) {
+                    List<Assertion> pc = alternatives.next();
+                    for (Assertion p2 : pc) {
                         pass &= supportsAlternative(p2, errors);
                     }
                 }
@@ -128,9 +127,9 @@ public class AssertionInfoMap extends Ha
     
     public void checkEffectivePolicy(Policy policy) {
         List<QName> errors = new ArrayList<QName>();
-        Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
+        Iterator<List<Assertion>> alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {
-            List<PolicyComponent> pc = alternatives.next();
+            List<Assertion> pc = alternatives.next();
             if (supportsAlternative(pc, errors)) {
                 return;
             }
@@ -150,7 +149,7 @@ public class AssertionInfoMap extends Ha
                 }
             }
         }
-        StringBuilder error = new StringBuilder("\n");
+        StringBuilder error = new StringBuilder();
         for (String msg : msgs) {
             error.append("\n").append(msg);
         }

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -19,25 +19,18 @@
 
 package org.apache.cxf.ws.policy.builder.primitive;
 
-import java.util.Collection;
-
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.ws.policy.AssertionInfo;
-import org.apache.cxf.ws.policy.AssertionInfoMap;
-import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.neethi.Assertion;
-import org.apache.neethi.Constants;
-import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
 
 /**
  * 
  */
 public class PrimitiveAssertion 
-    extends org.apache.neethi.builders.PrimitiveAssertion implements PolicyAssertion {
+    extends org.apache.neethi.builders.PrimitiveAssertion {
 
     public PrimitiveAssertion() {
         super();
@@ -65,22 +58,4 @@ public class PrimitiveAssertion 
         return new PrimitiveAssertion(name, opt, ignorable);
     }
 
-    public boolean equal(PolicyComponent policyComponent) {
-        if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
-            return false;
-        }
-        return getName().equals(((PolicyAssertion)policyComponent).getName());
-    }
-
-
-    public boolean isAsserted(AssertionInfoMap aim) {
-        Collection<AssertionInfo> ail = aim.getAssertionInfo(name);
-        for (AssertionInfo ai : ail) {
-            if (ai.isAsserted() && ai.getAssertion().equal(this)) {
-                return true;
-            }
-        }
-        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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -25,14 +25,12 @@ import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.Bus;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.AssertionBuilderFactory;
 import org.apache.neethi.builders.AssertionBuilder;
 
 public class PrimitiveAssertionBuilder implements AssertionBuilder<Element> {
 
-    protected Bus bus;
     private QName knownElements[] = {};
     
     public PrimitiveAssertionBuilder() {
@@ -44,9 +42,6 @@ public class PrimitiveAssertionBuilder i
         knownElements = els;
     }
     
-    public void setBus(Bus b) {
-        bus = b;
-    }
     
     public Assertion build(Element element, AssertionBuilderFactory fact) { 
         return new PrimitiveAssertion(element);

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java Fri Feb
18 04:20:06 2011
@@ -27,12 +27,12 @@ import java.util.List;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.All;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
+import org.apache.neethi.builders.PolicyContainingPrimitiveAssertion;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.Assert;
@@ -107,11 +107,11 @@ public class AssertionInfoMapTest extend
     public void testCheckEffectivePolicy() { 
         Policy p = new Policy();
         QName aqn = new QName("http://x.y.z", "a");
-        PolicyAssertion a = new PrimitiveAssertion(aqn);
+        Assertion a = new PrimitiveAssertion(aqn);
         QName bqn = new QName("http://x.y.z", "b");
-        PolicyAssertion b = new PrimitiveAssertion(bqn);
+        Assertion b = new PrimitiveAssertion(bqn);
         QName cqn = new QName("http://x.y.z", "c");
-        PolicyAssertion c = new PrimitiveAssertion(cqn);
+        Assertion c = new PrimitiveAssertion(cqn);
         All alt1 = new All();
         alt1.addAssertion(a);
         alt1.addAssertion(b);
@@ -146,8 +146,8 @@ public class AssertionInfoMapTest extend
     @Test
     public void testCheck() throws PolicyException {
         QName aqn = new QName("http://x.y.z", "a");
-        PolicyAssertion a = new PrimitiveAssertion(aqn);
-        Collection<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>();
+        Assertion a = new PrimitiveAssertion(aqn);
+        Collection<Assertion> assertions = new ArrayList<Assertion>();
         assertions.add(a);
         AssertionInfoMap aim = new AssertionInfoMap(assertions);
         try {
@@ -164,20 +164,19 @@ public class AssertionInfoMapTest extend
     public void testAllAssertionsIn() { 
         
         Policy nested = new Policy();
-        PolicyAssertion nb = new PrimitiveAssertion(
+        Assertion nb = new PrimitiveAssertion(
             new QName("http://x.y.z", "b"));
         nested.addAssertion(nb);
         
         Policy p = new Policy();
-        PolicyAssertion a1 = new PrimitiveAssertion(
+        Assertion a1 = new PrimitiveAssertion(
                                 new QName("http://x.y.z", "a"));
-        PolicyAssertion a2 = new PrimitiveAssertion(
+        Assertion a2 = new PrimitiveAssertion(
                                  new QName("http://x.y.z", "a"));
-        PolicyAssertion b = new PrimitiveAssertion(
+        Assertion b = new PrimitiveAssertion(
                                 new QName("http://x.y.z", "b"));
-        PolicyAssertion c = new NestedPrimitiveAssertion(
-                               new QName("http://x.y.z", "c"), false, nested, true,
-                               null);
+        Assertion c = new PolicyContainingPrimitiveAssertion(
+                               new QName("http://x.y.z", "c"), false, false, nested);
         
         All alt1 = new All();
         alt1.addAssertion(a1);

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
-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;
@@ -58,11 +57,14 @@ public class HTTPClientAssertionBuilder 
 
         @Override
         public boolean equal(PolicyComponent policyComponent) {
+            if (policyComponent == this) {
+                return true;
+            }
             if (policyComponent.getType() != Constants.TYPE_ASSERTION
-                || !getName().equals(((PolicyAssertion)policyComponent).getName())) {
+                || !getName().equals(((Assertion)policyComponent).getName())) {
                 return false;
             }
-            JaxbAssertion<HTTPClientPolicy> other = JaxbAssertion.cast((PolicyAssertion)policyComponent);
+            JaxbAssertion<HTTPClientPolicy> other = JaxbAssertion.cast((Assertion)policyComponent);
             return PolicyUtils.equals(this.getData(), other.getData());  
         }
         

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
-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;
@@ -58,11 +57,14 @@ public class HTTPServerAssertionBuilder 
 
         @Override
         public boolean equal(PolicyComponent policyComponent) {
+            if (policyComponent == this) {
+                return true;
+            }
             if (policyComponent.getType() != Constants.TYPE_ASSERTION
-                || !getName().equals(((PolicyAssertion)policyComponent).getName())) {
+                || !getName().equals(((Assertion)policyComponent).getName())) {
                 return false;
             }
-            JaxbAssertion<HTTPServerPolicy> other = JaxbAssertion.cast((PolicyAssertion)policyComponent);
+            JaxbAssertion<HTTPServerPolicy> other = JaxbAssertion.cast((Assertion)policyComponent);
             return PolicyUtils.equals(this.getData(), other.getData());  
         }
         

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java
Fri Feb 18 04:20:06 2011
@@ -30,8 +30,8 @@ import org.apache.cxf.ws.policy.Abstract
 /**
  * This no-op PolicyInterceptorProvider prevents the policy enforcement
  * logic making it impossible to assert the HTTPClientPolicy upfront
- * before the HTTPConduit becomes invoved (e.g. via a WSPolicyFeature
- * applied to the <jawx:client> bean).
+ * before the HTTPConduit becomes involved (e.g. via a WSPolicyFeature
+ * applied to the <jaxws:client> bean).
  */
 @NoJSR250Annotations
 public class NoOpPolicyInterceptorProvider

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -25,14 +25,14 @@ import javax.xml.namespace.QName;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 
-import org.apache.cxf.Bus;
-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.PrimitiveAssertion;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.AssertionBuilderFactory;
+import org.apache.neethi.Policy;
 import org.apache.neethi.builders.AssertionBuilder;
+import org.apache.neethi.builders.PolicyContainingPrimitiveAssertion;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
 
 /**
  * 
@@ -47,10 +47,8 @@ public class AddressingAssertionBuilder 
         MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705,
         MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705
     };
-    private Bus bus;
     
-    public AddressingAssertionBuilder(Bus b) {
-        bus = b;
+    public AddressingAssertionBuilder() {
     }
     
     
@@ -67,9 +65,18 @@ public class AddressingAssertionBuilder 
         }
         if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn)
             || MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705.equals(qn)) {
-            PolicyBuilder builder = bus.getExtension(PolicyBuilder.class);
-            NestedPrimitiveAssertion nap = new NestedPrimitiveAssertion(elem, builder);
-            nap.setName(MetadataConstants.ADDRESSING_ASSERTION_QNAME);
+            Assertion nap = new XMLPrimitiveAssertionBuilder() {
+                public Assertion newPrimitiveAssertion(Element element) {
+                    return new PrimitiveAssertion(MetadataConstants.ADDRESSING_ASSERTION_QNAME,
+                                                  isOptional(element), isIgnorable(element));
       
+                }
+                public Assertion newPolicyContainingAssertion(Element element, Policy policy)
{
+                    return new PolicyContainingPrimitiveAssertion(
+                                                  MetadataConstants.ADDRESSING_ASSERTION_QNAME,
+                                                  isOptional(element), isIgnorable(element),
+                                                  policy);
+                }
+            } .build(elem, factory); 
             return nap;
         } else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn)
             || MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705.equals(qn)) {

Modified: cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml (original)
+++ cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml Fri Feb 18
04:20:06 2011
@@ -24,9 +24,7 @@ http://www.springframework.org/schema/be
     
     <bean class="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder"
 	  id="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder" 
-	  lazy-init="true">
-        <constructor-arg ref="cxf"/>
-    </bean>
+	  lazy-init="true"/>
     <bean class="org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder"
       id="org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder" 
       lazy-init="true"/>

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -35,10 +35,10 @@ import org.apache.cxf.common.injection.N
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
-import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertionBuilder;
 import org.apache.neethi.AssertionBuilderFactoryImpl;
-import org.apache.neethi.PolicyEngine;
+import org.apache.neethi.PolicyBuilder;
 import org.apache.neethi.builders.AssertionBuilder;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
 
 /**
  * 
@@ -68,9 +68,10 @@ public class AssertionBuilderRegistryImp
         bus = b;
         if (b != null) {
             b.setExtension(this, AssertionBuilderRegistry.class);
-            PolicyBuilder builder = b.getExtension(PolicyBuilder.class);
-            if (builder instanceof PolicyEngine) {
-                engine = (PolicyEngine)builder;
+            org.apache.cxf.ws.policy.PolicyBuilder builder 
+                = b.getExtension(org.apache.cxf.ws.policy.PolicyBuilder.class);
+            if (builder instanceof PolicyBuilder) {
+                engine = (PolicyBuilder)builder;
             }
         }
     }
@@ -107,7 +108,7 @@ public class AssertionBuilderRegistryImp
                 Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
                 LOG.warning(m.toString());
             }
-            return new NestedPrimitiveAssertionBuilder(bus.getExtension(PolicyBuilder.class));
+            return new XMLPrimitiveAssertionBuilder();
         } else {
             Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
             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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -34,7 +34,6 @@ import javax.xml.namespace.QName;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
@@ -44,7 +43,6 @@ import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.PolicyContainingAssertion;
 
 /**
@@ -177,13 +175,11 @@ public class EffectivePolicyImpl impleme
     protected Collection<Assertion> getSupportedAlternatives(PolicyEngineImpl engine,
                                                                    Policy p) {
         Collection<Assertion> alternatives = new ArrayList<Assertion>();
-        
-        
-        for (Iterator<List<PolicyComponent>> it = p.getAlternatives(); it.hasNext();)
{
-            List<PolicyComponent> alternative = it.next();
+
+        for (Iterator<List<Assertion>> it = p.getAlternatives(); it.hasNext();)
{
+            List<Assertion> alternative = it.next();
             if (engine.supportsAlternative(alternative, null)) {
-                List<Assertion> asserts = CastUtils.cast(alternative);
-                alternatives.addAll(asserts);
+                alternatives.addAll(alternative);
             }
         }
         return alternatives;

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -30,7 +30,6 @@ import java.util.Set;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingFaultInfo;
@@ -41,7 +40,6 @@ import org.apache.cxf.transport.Destinat
 import org.apache.neethi.Assertion;
 import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.PolicyContainingAssertion;
 
 /**
@@ -175,11 +173,10 @@ public class EndpointPolicyImpl implemen
     protected Collection<Assertion> getSupportedAlternatives() {
         Collection<Assertion> alternatives = new ArrayList<Assertion>();
 
-        for (Iterator<List<PolicyComponent>> it = policy.getAlternatives(); it.hasNext();)
{
-            List<PolicyComponent> alternative = it.next();
+        for (Iterator<List<Assertion>> it = policy.getAlternatives(); it.hasNext();)
{
+            List<Assertion> alternative = it.next();
             if (engine.supportsAlternative(alternative, assertor)) {
-                List<Assertion> asserts = CastUtils.cast(alternative);
-                alternatives.addAll(asserts);
+                alternatives.addAll(alternative);
             }
         }
         return alternatives;
@@ -256,11 +253,10 @@ public class EndpointPolicyImpl implemen
 
     Collection<Assertion> getSupportedAlternatives(Policy p) {
         Collection<Assertion> alternatives = new ArrayList<Assertion>();
-        for (Iterator<List<PolicyComponent>> it = p.getAlternatives(); it.hasNext();)
{
-            List<PolicyComponent> alternative = it.next();
+        for (Iterator<List<Assertion>> it = p.getAlternatives(); it.hasNext();)
{
+            List<Assertion> alternative = it.next();
             if (engine.supportsAlternative(alternative, null)) {
-                List<Assertion> asserts = CastUtils.cast(alternative);
-                alternatives.addAll(asserts);
+                alternatives.addAll(alternative);
             }
         }
         return alternatives;

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=1071879&r1=1071878&r2=1071879&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 Fri
Feb 18 04:20:06 2011
@@ -22,7 +22,6 @@ package org.apache.cxf.ws.policy;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.extension.BusExtension;
-import org.apache.neethi.PolicyEngine;
 
 
 /**
@@ -31,7 +30,8 @@ import org.apache.neethi.PolicyEngine;
  * from DOM elements, but also from an input stream etc.
  */
 @NoJSR250Annotations
-public class PolicyBuilderImpl extends PolicyEngine implements PolicyBuilder, BusExtension
{
+public class PolicyBuilderImpl extends org.apache.neethi.PolicyBuilder 
+    implements PolicyBuilder, BusExtension {
     private Bus bus;
    
     public PolicyBuilderImpl() {
@@ -53,6 +53,7 @@ public class PolicyBuilderImpl extends P
     public final void setBus(Bus theBus) {
         bus = theBus;
         if (bus != null) {
+            theBus.setExtension(this, PolicyBuilder.class);
             AssertionBuilderRegistry reg = theBus.getExtension(AssertionBuilderRegistry.class);
             if (reg != null) {
                 factory = reg;

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java Fri Feb
18 04:20:06 2011
@@ -25,11 +25,11 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
 import org.apache.neethi.PolicyOperator;
 
 /**
@@ -154,8 +154,8 @@ public final class PolicyUtils {
             buf.append((Assertion)pc);
             buf.append(")");
             nl(buf);
-            if (pc instanceof NestedPrimitiveAssertion) {
-                PolicyComponent nested = ((NestedPrimitiveAssertion)pc).getPolicy();
+            if (pc instanceof PolicyContainingAssertion) {
+                PolicyComponent nested = ((PolicyContainingAssertion)pc).getPolicy();
                 level++;
                 printPolicyComponent(nested, buf, level);
                 level--;                

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
Fri Feb 18 04:20:06 2011
@@ -23,13 +23,11 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.ws.policy.AlternativeSelector;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
 
 /**
  * 
@@ -38,11 +36,11 @@ public class FirstAlternativeSelector im
     
     public Collection<Assertion> selectAlternative(
         Policy policy, PolicyEngine engine, Assertor assertor) {
-        Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
+        Iterator<List<Assertion>> alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {
-            List<PolicyComponent> alternative = alternatives.next();
+            List<Assertion> alternative = alternatives.next();
             if (engine.supportsAlternative(alternative, assertor)) {
-                return CastUtils.cast(alternative);
+                return alternative;
             }
         }        
         return null;

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
Fri Feb 18 04:20:06 2011
@@ -23,13 +23,11 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.ws.policy.AlternativeSelector;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
 
 /**
  * 
@@ -39,12 +37,12 @@ public class MaximalAlternativeSelector 
     public Collection<Assertion> selectAlternative(
         Policy policy, PolicyEngine engine, Assertor assertor) {
         Collection<Assertion> choice = null;
-        Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
+        Iterator<List<Assertion>> alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {
-            List<PolicyComponent> alternative = alternatives.next();
+            List<Assertion> alternative = alternatives.next();
             if (engine.supportsAlternative(alternative, assertor) 
                 && (null == choice || alternative.size() > choice.size())) {
-                choice = CastUtils.cast(alternative);
+                choice = alternative;
             }
         }
         return choice;

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
Fri Feb 18 04:20:06 2011
@@ -23,13 +23,11 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.ws.policy.AlternativeSelector;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
 
 /**
  * 
@@ -39,13 +37,13 @@ public class MinimalAlternativeSelector 
     public Collection<Assertion> selectAlternative(
         Policy policy, PolicyEngine engine, Assertor assertor) {
         Collection<Assertion> choice = null;
-        Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
+        Iterator<List<Assertion>> alternatives = policy.getAlternatives();
         while (alternatives.hasNext()) {
-            List<PolicyComponent> alternative = alternatives.next();
+            List<Assertion> alternative = alternatives.next();
             
             if (engine.supportsAlternative(alternative, assertor) 
                 && (null == choice || alternative.size() < choice.size())) {
-                choice = CastUtils.cast(alternative);
+                choice = alternative;
             }
         }
         return choice;

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=1071879&r1=1071878&r2=1071879&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
Fri Feb 18 04:20:06 2011
@@ -24,8 +24,8 @@ import javax.xml.namespace.QName;
 import org.w3c.dom.Element;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.builders.PrimitiveAssertion;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.After;

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=1071879&r1=1071878&r2=1071879&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 Fri Feb
18 04:20:06 2011
@@ -79,7 +79,6 @@ public class NormalizeTest extends Asser
         AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder.setAssertionBuilderRegistry(abr);
         PrimitiveAssertionBuilder ab = new PrimitiveAssertionBuilder();
-        ab.setBus(bus);
        
         abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityToken"),
ab);
         abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityHeader"),
ab);

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java Fri
Feb 18 04:20:06 2011
@@ -621,7 +621,7 @@ public class PolicyEngineTest extends As
         engine = new PolicyEngineImpl();
         Collection<Assertion> assertions = new ArrayList<Assertion>();
         
-        PolicyAssertion a = control.createMock(PolicyAssertion.class);
+        Assertion a = control.createMock(Assertion.class);
         EasyMock.expect(a.getType()).andReturn(Constants.TYPE_ASSERTION);
         EasyMock.expect(a.isOptional()).andReturn(true);
         

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java?rev=1071879&r1=1071878&r2=1071879&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java
Fri Feb 18 04:20:06 2011
@@ -35,10 +35,10 @@ import org.apache.cxf.service.model.Bind
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -59,7 +59,7 @@ public class ExternalAttachmentProviderT
     
     private IMocksControl control;
     private Policy policy;
-    private PolicyAssertion assertion;
+    private Assertion assertion;
     private PolicyAttachment attachment;
     private Collection<PolicyAttachment> attachments = new ArrayList<PolicyAttachment>();
     



Mime
View raw message