You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/01/05 18:50:01 UTC

svn commit: r1055556 - in /cxf/branches/2.3.x-fixes: ./ 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/bui...

Author: dkulp
Date: Wed Jan  5 17:50:00 2011
New Revision: 1055556

URL: http://svn.apache.org/viewvc?rev=1055556&view=rev
Log:
Merged revisions 1055554 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1055554 | dkulp | 2011-01-05 12:47:53 -0500 (Wed, 05 Jan 2011) | 2 lines
  
  [CXF-3037] Pass the builder and registry around throughout the policies
  so that the normalize calls can all have the registry passed in.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
    cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
    cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
    cxf/branches/2.3.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ProtectionTokenBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RecipientTokenBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokens12Builder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokensBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SymmetricBindingBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan  5 17:50:00 2011
@@ -1 +1 @@
-/cxf/trunk:1055184
+/cxf/trunk:1055184,1055554

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java Wed Jan  5 17:50:00 2011
@@ -30,6 +30,7 @@ import org.xml.sax.SAXException;
 
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyReference;
+import org.apache.neethi.PolicyRegistry;
 
 
 /**
@@ -62,4 +63,12 @@ public interface PolicyBuilder {
      */
     Policy getPolicy(InputStream stream)
         throws IOException, ParserConfigurationException, SAXException;
+    
+    
+    /**
+     * Return the PolicyRegistry associated with the builder
+     * @return
+     */
+    PolicyRegistry getPolicyRegistry();
+    
 }

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java Wed Jan  5 17:50:00 2011
@@ -55,15 +55,24 @@ public class NestedPrimitiveAssertion ex
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(NestedPrimitiveAssertion.class);    
     private Policy nested;
     private boolean assertionRequired = true;
+    private PolicyBuilder builder;
+    
+    @Deprecated
     public NestedPrimitiveAssertion(QName name, boolean optional) {
-        this(name, optional, null, true);
+        this(name, optional, null, true, null);
+    }
+    
+    public NestedPrimitiveAssertion(QName name, boolean optional, PolicyBuilder b) {
+        this(name, optional, null, true, b);
     }
     
     public NestedPrimitiveAssertion(QName name, boolean optional, 
-                                    Policy p, boolean assertionRequired) {
+                                    Policy p, boolean assertionRequired,
+                                    PolicyBuilder b) {
         super(name, optional);
         this.assertionRequired = assertionRequired;
         this.nested = p;
+        builder = b;
     }
 
     public NestedPrimitiveAssertion(Element elem, PolicyBuilder builder) {
@@ -72,6 +81,7 @@ public class NestedPrimitiveAssertion ex
     
     public NestedPrimitiveAssertion(Element elem, PolicyBuilder builder, boolean assertionRequired) {
         super(elem);
+        this.builder = builder;
         this.assertionRequired = assertionRequired;
         
         // expect exactly one child element of type Policy
@@ -98,7 +108,9 @@ public class NestedPrimitiveAssertion ex
     }
     
     public PolicyComponent normalize() {
-        Policy normalisedNested = (Policy)nested.normalize(true);
+        Policy normalisedNested 
+            = (Policy)nested.normalize(builder == null ? null : builder.getPolicyRegistry(),
+                                       true);
         
         Policy p = new Policy();
         ExactlyOne ea = new ExactlyOne();
@@ -112,7 +124,7 @@ public class NestedPrimitiveAssertion ex
             All all = new All();
             List<PolicyAssertion> alternative = 
                 CastUtils.cast((List)alternatives.next(), PolicyAssertion.class);
-            NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(getName(), false);
+            NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(getName(), false, builder);
             a.nested = new Policy();
             ExactlyOne nea = new ExactlyOne();
             a.nested.addPolicyComponent(nea);

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java Wed Jan  5 17:50:00 2011
@@ -72,7 +72,8 @@ public class NestedPrimitiveAssertionBui
         }
         
         NestedPrimitiveAssertion compatible = 
-            new NestedPrimitiveAssertion(a.getName(), a.isOptional() && b.isOptional());
+            new NestedPrimitiveAssertion(a.getName(), a.isOptional() && b.isOptional(),
+                                         null, true, builder);
         compatible.setPolicy(nested);
         
         return compatible;

Modified: cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java Wed Jan  5 17:50:00 2011
@@ -175,7 +175,8 @@ public class AssertionInfoMapTest extend
         PolicyAssertion b = new PrimitiveAssertion(
                                 new QName("http://x.y.z", "b"));
         PolicyAssertion c = new NestedPrimitiveAssertion(
-                               new QName("http://x.y.z", "c"), false, nested, true);
+                               new QName("http://x.y.z", "c"), false, nested, true,
+                               null);
         
         All alt1 = new All();
         alt1.addAssertion(a1);

Modified: cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java Wed Jan  5 17:50:00 2011
@@ -77,14 +77,16 @@ public class NestedPrimitiveAssertionTes
     @Test
     public void testNoNeedToAssertWithEmptyPolicy() {
         PolicyAssertion a = new NestedPrimitiveAssertion(
-                                new QName("abc"), false, null, false);
+                                new QName("abc"), false, null, false,
+                                null);
         AssertionInfoMap aim = new AssertionInfoMap(
                                 Collections.singletonList(a));
         assertTrue("No need to assert", a.isAsserted(aim));
         a = new NestedPrimitiveAssertion(new QName("abc"), 
                                          false, 
                                          null, 
-                                         false);
+                                         false,
+                                         null);
         assertTrue("No need to assert", a.isAsserted(aim));
     }
     
@@ -92,7 +94,8 @@ public class NestedPrimitiveAssertionTes
     @Test
     public void testNoNeedToAssertWithNonEmptyPolicy() {
         PolicyAssertion a = new NestedPrimitiveAssertion(
-                                new QName("abc"), false, null, false);
+                                new QName("abc"), false, null, false,
+                                null);
         AssertionInfoMap aim = new AssertionInfoMap(
                                 Collections.singletonList(a));
         assertTrue("No need to assert", a.isAsserted(aim));
@@ -101,7 +104,8 @@ public class NestedPrimitiveAssertionTes
         a = new NestedPrimitiveAssertion(new QName("abc"), 
                                          false, 
                                          p, 
-                                         false);
+                                         false,
+                                         null);
         assertFalse("Primitive Assertions need to be asserted", 
                     a.isAsserted(aim));
         
@@ -109,11 +113,13 @@ public class NestedPrimitiveAssertionTes
         p.addAssertion(new NestedPrimitiveAssertion(new QName("abc"), 
                                          false, 
                                          null, 
-                                         false));
+                                         false,
+                                         null));
         a = new NestedPrimitiveAssertion(new QName("abc"), 
                                          false, 
                                          p, 
-                                         false);
+                                         false,
+                                         null);
         assertTrue("No need to assert", a.isAsserted(aim));
     }
     
@@ -132,7 +138,8 @@ public class NestedPrimitiveAssertionTes
         NestedPrimitiveAssertion na = new NestedPrimitiveAssertion(new QName("nested"), 
                                          false, 
                                          nested,
-                                         true);
+                                         true,
+                                         null);
         List<PolicyAssertion> ais = 
             new ArrayList<PolicyAssertion>();
         
@@ -211,19 +218,22 @@ public class NestedPrimitiveAssertionTes
         int i = 0;
         
         p[i] = new Policy();
-        NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(TEST_NAME1, true);
+        NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(TEST_NAME1, true,
+                                                                  null);
         Policy nested = new Policy();
         a.setPolicy(nested);
         p[i++].addPolicyComponent(a);
         
         p[i] = new Policy();
-        a = new NestedPrimitiveAssertion(TEST_NAME1, false);
+        a = new NestedPrimitiveAssertion(TEST_NAME1, false,
+                                         null);
         nested = new Policy();
         a.setPolicy(nested);
         p[i++].addPolicyComponent(a);
         
         p[i] = new Policy();
-        a = new NestedPrimitiveAssertion(TEST_NAME1, false);
+        a = new NestedPrimitiveAssertion(TEST_NAME1, false,
+                                         null);
         nested = new Policy();
         a.setPolicy(nested);
         nested.addPolicyComponent(new PrimitiveAssertion(TEST_NAME2, true));
@@ -231,7 +241,8 @@ public class NestedPrimitiveAssertionTes
         p[i++].addPolicyComponent(a);
         
         p[i] = new Policy();
-        a = new NestedPrimitiveAssertion(TEST_NAME1, false);
+        a = new NestedPrimitiveAssertion(TEST_NAME1, false,
+                                         null);
         nested = new Policy();
         a.setPolicy(nested);
         ExactlyOne eo = new ExactlyOne();
@@ -241,7 +252,8 @@ public class NestedPrimitiveAssertionTes
         p[i++].addPolicyComponent(a);
         
         p[i] = new Policy();
-        a = new NestedPrimitiveAssertion(TEST_NAME1, false);
+        a = new NestedPrimitiveAssertion(TEST_NAME1, false,
+                                         null);
         nested = new Policy();
         a.setPolicy(nested);
         nested.addPolicyComponent(new PrimitiveAssertion(TEST_NAME3));  

Modified: cxf/branches/2.3.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java Wed Jan  5 17:50:00 2011
@@ -44,6 +44,7 @@ import org.apache.neethi.ExactlyOne;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyOperator;
 import org.apache.neethi.PolicyReference;
+import org.apache.neethi.PolicyRegistry;
 
 
 /**
@@ -198,5 +199,10 @@ public class PolicyBuilderImpl implement
             return operator;
         }
     }
+
+    public PolicyRegistry getPolicyRegistry() {
+        PolicyEngine e = bus.getExtension(PolicyEngine.class);
+        return e == null ? null : e.getRegistry();
+    }
     
 }

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java Wed Jan  5 17:50:00 2011
@@ -60,10 +60,10 @@ public class AsymmetricBindingBuilder im
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
         
-        AsymmetricBinding asymmetricBinding = new AsymmetricBinding(consts);
+        AsymmetricBinding asymmetricBinding = new AsymmetricBinding(consts, builder);
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternative((List)iterator.next(), asymmetricBinding, consts);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java Wed Jan  5 17:50:00 2011
@@ -58,11 +58,11 @@ public class InitiatorTokenBuilder imple
         SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
-        InitiatorToken initiatorToken = new InitiatorToken(consts);
+        InitiatorToken initiatorToken = new InitiatorToken(consts, builder);
         initiatorToken.setOptional(PolicyConstants.isOptional(element));
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternative((List)iterator.next(), initiatorToken);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java Wed Jan  5 17:50:00 2011
@@ -104,7 +104,7 @@ public class IssuedTokenBuilder implemen
                 issuedToken.setRstTemplate(child);
             } else if (org.apache.neethi.Constants.ELEM_POLICY.equals(ln)) {
                 Policy policy = builder.getPolicy(child);
-                policy = (Policy)policy.normalize(false);
+                policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
                 for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
                     processAlternative((List)iterator.next(), issuedToken);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ProtectionTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ProtectionTokenBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ProtectionTokenBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ProtectionTokenBuilder.java Wed Jan  5 17:50:00 2011
@@ -57,10 +57,10 @@ public class ProtectionTokenBuilder impl
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
         
         
-        ProtectionToken protectionToken = new ProtectionToken(consts);
+        ProtectionToken protectionToken = new ProtectionToken(consts, builder);
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternative((List)iterator.next(), protectionToken);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RecipientTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RecipientTokenBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RecipientTokenBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RecipientTokenBuilder.java Wed Jan  5 17:50:00 2011
@@ -58,10 +58,10 @@ public class RecipientTokenBuilder imple
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
     
 
-        RecipientToken recipientToken = new RecipientToken(consts);
+        RecipientToken recipientToken = new RecipientToken(consts, builder);
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternative((List)iterator.next(), recipientToken);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokens12Builder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokens12Builder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokens12Builder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokens12Builder.java Wed Jan  5 17:50:00 2011
@@ -69,32 +69,48 @@ public class SupportingTokens12Builder i
 
         if (SP12Constants.SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_SUPPORTING, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_SUPPORTING,
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.SIGNED_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_SIGNED, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_SIGNED, 
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.ENDORSING_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_ENDORSING, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_ENDORSING, 
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.SIGNED_ENDORSING_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENDORSING, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENDORSING, 
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.ENCRYPTED_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_ENCRYPTED, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_ENCRYPTED, 
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.SIGNED_ENCRYPTED_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENCRYPTED, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENCRYPTED, 
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.ENDORSING_ENCRYPTED_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_ENDORSING_ENCRYPTED, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_ENDORSING_ENCRYPTED, 
+                    SP12Constants.INSTANCE,
+                    builder);
         } else if (SP12Constants.SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(
-                    SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED, SP12Constants.INSTANCE);
+                    SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED, 
+                    SP12Constants.INSTANCE,
+                    builder);
         }
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy) policy.normalize(false);
+        policy = (Policy) policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternative((List) iterator.next(), supportingToken);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokensBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokensBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokensBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokensBuilder.java Wed Jan  5 17:50:00 2011
@@ -67,20 +67,24 @@ public class SupportingTokensBuilder imp
 
         if (SP11Constants.SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(SupportTokenType.SUPPORTING_TOKEN_SUPPORTING,
-                                                  SP11Constants.INSTANCE);
+                                                  SP11Constants.INSTANCE,
+                                                  builder);
         } else if (SP11Constants.SIGNED_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(SupportTokenType.SUPPORTING_TOKEN_SIGNED, 
-                                                  SP11Constants.INSTANCE);
+                                                  SP11Constants.INSTANCE,
+                                                  builder);
         } else if (SP11Constants.ENDORSING_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(SupportTokenType.SUPPORTING_TOKEN_ENDORSING, 
-                                                  SP11Constants.INSTANCE);
+                                                  SP11Constants.INSTANCE,
+                                                  builder);
         } else if (SP11Constants.SIGNED_ENDORSING_SUPPORTING_TOKENS.equals(name)) {
             supportingToken = new SupportingToken(SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENDORSING,
-                                                  SP11Constants.INSTANCE);
+                                                  SP11Constants.INSTANCE,
+                                                  builder);
         }
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternative((List)iterator.next(), supportingToken);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SymmetricBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SymmetricBindingBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SymmetricBindingBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SymmetricBindingBuilder.java Wed Jan  5 17:50:00 2011
@@ -59,10 +59,10 @@ public class SymmetricBindingBuilder imp
         SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
-        SymmetricBinding symmetricBinding = new SymmetricBinding(consts);
+        SymmetricBinding symmetricBinding = new SymmetricBinding(consts, builder);
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             processAlternatives((List)iterator.next(), symmetricBinding, consts);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java Wed Jan  5 17:50:00 2011
@@ -55,7 +55,7 @@ public class TransportBindingBuilder imp
         SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
-        TransportBinding transportBinding = new TransportBinding(consts);
+        TransportBinding transportBinding = new TransportBinding(consts, builder);
         processAlternative(element, transportBinding, consts);
 
         return transportBinding;

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportTokenBuilder.java Wed Jan  5 17:50:00 2011
@@ -56,10 +56,10 @@ public class TransportTokenBuilder imple
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
         
-        TransportToken transportToken = new TransportToken(consts);
+        TransportToken transportToken = new TransportToken(consts, builder);
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-        policy = (Policy)policy.normalize(false);
+        policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
             transportToken.setToken((Token)(((List)iterator.next()).get(0)));

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java Wed Jan  5 17:50:00 2011
@@ -81,7 +81,7 @@ public class X509TokenBuilder implements
 
 
             Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
-            policy = (Policy)policy.normalize(false);
+            policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);
 
             for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
                 processAlternative((List)iterator.next(), x509Token, consts);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java Wed Jan  5 17:50:00 2011
@@ -58,6 +58,7 @@ import org.apache.cxf.ws.policy.Assertio
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.policy.EndpointPolicy;
 import org.apache.cxf.ws.policy.PolicyAssertion;
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
@@ -160,9 +161,11 @@ class SecureConversationInInterceptor ex
                         .getAddressingPolicy(aim, false);
                     all.addPolicyComponent(ass);
                     ea.addPolicyComponent(all);
-                    SymmetricBinding binding = new SymmetricBinding(SP12Constants.INSTANCE);
+                    PolicyBuilder pbuilder = message.getExchange().getBus()
+                        .getExtension(PolicyBuilder.class);
+                    SymmetricBinding binding = new SymmetricBinding(SP12Constants.INSTANCE, pbuilder);
                     binding.setIncludeTimestamp(true);
-                    ProtectionToken token = new ProtectionToken(SP12Constants.INSTANCE);
+                    ProtectionToken token = new ProtectionToken(SP12Constants.INSTANCE, pbuilder);
                     token.setToken(new SecureConversationToken(SP12Constants.INSTANCE));
                     binding.setProtectionToken(token);
                     binding.setEntireHeadersAndBodySignatures(true);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java Wed Jan  5 17:50:00 2011
@@ -43,6 +43,7 @@ import org.apache.cxf.ws.policy.Abstract
 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.PolicyBuilder;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.policy.SP11Constants;
@@ -158,7 +159,9 @@ public class SecureConversationTokenInte
         
         if (endorse) {
             SupportingToken st = new SupportingToken(SupportTokenType.SUPPORTING_TOKEN_ENDORSING,
-                                                     SP12Constants.INSTANCE);
+                                                     SP12Constants.INSTANCE,
+                                                     message.getExchange()
+                                                         .getBus().getExtension(PolicyBuilder.class));
             st.addToken(itok);
             all.addPolicyComponent(st);
         }

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java Wed Jan  5 17:50:00 2011
@@ -23,6 +23,7 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
@@ -37,8 +38,8 @@ public class AsymmetricBinding extends S
 
     private RecipientToken recipientToken;
 
-    public AsymmetricBinding(SPConstants version) {
-        super(version);
+    public AsymmetricBinding(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**
@@ -109,7 +110,7 @@ public class AsymmetricBinding extends S
             all.addPolicyComponent(getLayout());
         }
         ea.addPolicyComponent(all);
-        PolicyComponent pc = p.normalize(true);
+        PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
         if (pc instanceof Policy) {
             return (Policy)pc;
         } else {

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java Wed Jan  5 17:50:00 2011
@@ -18,20 +18,24 @@
  */
 package org.apache.cxf.ws.security.policy.model;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public abstract class Binding extends AbstractSecurityAssertion implements AlgorithmWrapper {
-
+    protected PolicyBuilder builder;
+    
     private AlgorithmSuite algorithmSuite;
     private boolean includeTimestamp;
     private Layout layout;
     private SupportingToken signedSupportingToken;
     private SupportingToken signedEndorsingSupportingTokens;
     private boolean tokenProtection;
+    
 
-    public Binding(SPConstants version) {
+    public Binding(SPConstants version, PolicyBuilder b) {
         super(version);
         layout = new Layout(version);
+        builder = b;
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java Wed Jan  5 17:50:00 2011
@@ -22,13 +22,14 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class EncryptionToken extends TokenWrapper {
 
-    public EncryptionToken(SPConstants version) {
-        super(version);
+    public EncryptionToken(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java Wed Jan  5 17:50:00 2011
@@ -22,13 +22,14 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class InitiatorToken extends TokenWrapper {
 
-    public InitiatorToken(SPConstants version) {
-        super(version);
+    public InitiatorToken(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java Wed Jan  5 17:50:00 2011
@@ -22,16 +22,17 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class ProtectionToken extends TokenWrapper {
 
-    public ProtectionToken() {
-        super(SP12Constants.INSTANCE);
+    public ProtectionToken(PolicyBuilder b) {
+        super(SP12Constants.INSTANCE, b);
     }
-    public ProtectionToken(SPConstants version) {
-        super(version);
+    public ProtectionToken(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java Wed Jan  5 17:50:00 2011
@@ -22,13 +22,14 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class RecipientToken extends TokenWrapper {
 
-    public RecipientToken(SPConstants version) {
-        super(version);
+    public RecipientToken(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java Wed Jan  5 17:50:00 2011
@@ -22,13 +22,14 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class SignatureToken extends TokenWrapper {
 
-    public SignatureToken(SPConstants version) {
-        super(version);
+    public SignatureToken(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java Wed Jan  5 17:50:00 2011
@@ -25,6 +25,7 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.SPConstants.SupportTokenType;
@@ -57,8 +58,8 @@ public class SupportingToken extends Tok
 
     private SignedEncryptedParts encryptedParts;
 
-    public SupportingToken(SupportTokenType type, SPConstants version) {
-        super(version);
+    public SupportingToken(SupportTokenType type, SPConstants version, PolicyBuilder b) {
+        super(version, b);
         this.type = type;
     }
 
@@ -327,7 +328,7 @@ public class SupportingToken extends Tok
         }        
         
         ea.addPolicyComponent(all);
-        PolicyComponent pc = p.normalize(true);
+        PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
         if (pc instanceof Policy) {
             return (Policy)pc;
         } else {

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java Wed Jan  5 17:50:00 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.ws.security.policy.model;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public abstract class SymmetricAsymmetricBindingBase extends Binding {
@@ -28,8 +29,8 @@ public abstract class SymmetricAsymmetri
 
     private boolean entireHeadersAndBodySignatures;
 
-    public SymmetricAsymmetricBindingBase(SPConstants version) {
-        super(version);
+    public SymmetricAsymmetricBindingBase(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java Wed Jan  5 17:50:00 2011
@@ -22,6 +22,7 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
@@ -36,11 +37,11 @@ public class SymmetricBinding extends Sy
     private SignatureToken signatureToken;
     private ProtectionToken protectionToken;
 
-    public SymmetricBinding() {
-        super(SP12Constants.INSTANCE);
+    public SymmetricBinding(PolicyBuilder b) {
+        super(SP12Constants.INSTANCE, b);
     }
-    public SymmetricBinding(SPConstants version) {
-        super(version);
+    public SymmetricBinding(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**
@@ -135,7 +136,7 @@ public class SymmetricBinding extends Sy
 
         
         ea.addPolicyComponent(all);
-        PolicyComponent pc = p.normalize(true);
+        PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
         if (pc instanceof Policy) {
             return (Policy)pc;
         } else {

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java Wed Jan  5 17:50:00 2011
@@ -20,6 +20,7 @@ package org.apache.cxf.ws.security.polic
 
 
 import org.apache.cxf.ws.policy.PolicyAssertion;
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
 import org.apache.neethi.ExactlyOne;
@@ -27,10 +28,12 @@ import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 
 public abstract class TokenWrapper extends AbstractSecurityAssertion implements PolicyAssertion {
+    protected PolicyBuilder builder;
     protected Token token;
 
-    public TokenWrapper(SPConstants version) {
+    public TokenWrapper(SPConstants version, PolicyBuilder b) {
         super(version);
+        builder = b;
     }
     
     public void setToken(Token tok) {
@@ -58,7 +61,7 @@ public abstract class TokenWrapper exten
             All all = new All();
             all.addPolicyComponent(token);
             ea.addPolicyComponent(all);
-            PolicyComponent pc = p.normalize(true);
+            PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
             if (pc instanceof Policy) {
                 return (Policy)pc;
             } else {

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java Wed Jan  5 17:50:00 2011
@@ -22,6 +22,7 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
@@ -34,8 +35,8 @@ public class TransportBinding extends Bi
 
     private TransportToken transportToken;
 
-    public TransportBinding(SPConstants version) {
-        super(version);
+    public TransportBinding(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**
@@ -147,7 +148,7 @@ public class TransportBinding extends Bi
             all.addPolicyComponent(getLayout());
         }
         ea.addPolicyComponent(all);
-        PolicyComponent pc = p.normalize(true);
+        PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
         if (pc instanceof Policy) {
             return (Policy)pc;
         } else {

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java Wed Jan  5 17:50:00 2011
@@ -22,13 +22,14 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class TransportToken extends TokenWrapper {
 
-    public TransportToken(SPConstants version) {
-        super(version);
+    public TransportToken(SPConstants version, PolicyBuilder b) {
+        super(version, b);
     }
 
     /**

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Wed Jan  5 17:50:00 2011
@@ -589,11 +589,12 @@ public class STSClient implements Config
         ExactlyOne one = new ExactlyOne();
         validatePolicy.addPolicyComponent(one);
         All all = new All();
-        SymmetricBinding binding = new SymmetricBinding();
+        PolicyBuilder pbuilder = bus.getExtension(PolicyBuilder.class);
+        SymmetricBinding binding = new SymmetricBinding(pbuilder);
         all.addAssertion(binding);
         one.addPolicyComponent(all);
         all.addAssertion(getAddressingAssertion());
-        ProtectionToken ptoken = new ProtectionToken();
+        ProtectionToken ptoken = new ProtectionToken(pbuilder);
         binding.setProtectionToken(ptoken);
         binding.setIncludeTimestamp(true);
         binding.setEntireHeadersAndBodySignatures(true);
@@ -656,11 +657,12 @@ public class STSClient implements Config
         ExactlyOne one = new ExactlyOne();
         cancelPolicy.addPolicyComponent(one);
         All all = new All();
-        one.addPolicyComponent(all);
-        SymmetricBinding binding = new SymmetricBinding();
+        one.addPolicyComponent(all); 
+        PolicyBuilder pbuilder = bus.getExtension(PolicyBuilder.class);
+        SymmetricBinding binding = new SymmetricBinding(pbuilder);
         all.addAssertion(binding);
         all.addAssertion(getAddressingAssertion());
-        ProtectionToken ptoken = new ProtectionToken();
+        ProtectionToken ptoken = new ProtectionToken(pbuilder);
         binding.setProtectionToken(ptoken);
         binding.setIncludeTimestamp(true);
         binding.setEntireHeadersAndBodySignatures(true);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java?rev=1055556&r1=1055555&r2=1055556&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java Wed Jan  5 17:50:00 2011
@@ -35,6 +35,7 @@ import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
+import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.model.AsymmetricBinding;
 import org.apache.cxf.ws.security.policy.model.Binding;
@@ -114,7 +115,9 @@ public class PolicyBasedWSS4JOutIntercep
                     }                    
                 }
                 if (transport == null && isRequestor(message)) {
-                    transport = new TransportBinding(SP12Constants.INSTANCE);
+                    transport = new TransportBinding(SP12Constants.INSTANCE,
+                                                     message.getExchange().getBus()
+                                                         .getExtension(PolicyBuilder.class));
                 }
                 
                 if (transport != null) {