cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r509980 [1/3] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/ api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ api/src/main/java/org/apache/cxf/ws/policy/bui...
Date Wed, 21 Feb 2007 12:02:08 GMT
Author: andreasmyth
Date: Wed Feb 21 04:02:05 2007
New Revision: 509980

URL: http://svn.apache.org/viewvc?view=rev&rev=509980
Log:
[JIRA CXF-376] Enabled resolution of external policy references.
[JIRA CXF-378] Support for external attachments - framework, APIs and basic EPR based implementation of DomainExpression.
Changed some package names to use singular.
Added policy interceptor provider for WS-Addressing, removed addressing interceptors from RM policy interceptor provider.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/
      - copied from r507849, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/
      - copied from r509965, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builders/jaxb/
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/
      - copied from r509965, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builders/primitive/
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/
      - copied from r509965, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builders/xml/
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/
      - copied from r507849, incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/
      - copied from r509965, incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/
      - copied from r509965, incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builders/primitive/
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/PolicyAttachment.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Wsdl11XPointerDomainExpression.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/
      - copied from r507867, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/references/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalDocumentReferenceResolver.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolver.java
      - copied, changed from r509965, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/references/ReferenceResolver.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/InitializingPolicyEngine.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistryTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/PolicyAttachmentTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments1.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments2.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments3.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/resources/attachments4.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/referred.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/referring.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/
      - copied from r507849, incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/
      - copied from r509965, incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl   (with props)
Removed:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/references/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Messages.properties
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java
    incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml
    incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test16.wsdl
    incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java Wed Feb 21 04:02:05 2007
@@ -26,23 +26,11 @@
  */
 public final class PolicyConstants {
     
-    public static final String NAMESPACE_URI = 
-        "http://schemas.xmlsoap.org/ws/2004/09/policy";
+    public static final String NAMESPACE_XMLSOAP_200409
+        = "http://schemas.xmlsoap.org/ws/2004/09/policy";
     
-    public static final String POLICY_ELEM_NAME = "Policy";
-    
-    public static final String POLICYREF_ELEM_NAME = "PolicyReference";
-    
-    public static final String OPTIONAL_ATTR_NAME = "Optional"; 
-    
-    public static final QName POLICY_ELEM_QNAME = 
-        new QName(NAMESPACE_URI, POLICY_ELEM_NAME);
-    
-    public static final QName POLICYREF_ELEM_QNAME = 
-        new QName(NAMESPACE_URI, POLICYREF_ELEM_NAME);
-    
-    public static final QName OPTIONAL_ATTR_QNAME = 
-        new QName(NAMESPACE_URI, OPTIONAL_ATTR_NAME);
+    public static final String NAMESPACE_W3_200607
+        = "http://www.w3.org/2006/07/ws-policy";
     
     public static final String CLIENT_POLICY_OUT_INTERCEPTOR_ID
         = "org.apache.cxf.ws.policy.ClientPolicyOutInterceptor";
@@ -50,7 +38,7 @@
         = "org.apache.cxf.ws.policy.ClientPolicyInInterceptor";
     public static final String CLIENT_POLICY_IN_FAULT_INTERCEPTOR_ID
         = "org.apache.cxf.ws.policy.ClientPolicyInFaultInterceptor";
-    
+
     public static final String SERVER_POLICY_IN_INTERCEPTOR_ID
         = "org.apache.cxf.ws.policy.ServerPolicyInInterceptor";
     public static final String SERVER_POLICY_OUT_INTERCEPTOR_ID
@@ -58,6 +46,49 @@
     public static final String SERVER_POLICY_OUT_FAULT_INTERCEPTOR_ID
         = "org.apache.cxf.ws.policy.ServerPolicyOutFaultInterceptor";
     
+    
+    private static String namespaceURI; 
+    
+    private static final String POLICY_ELEM_NAME = "Policy";
+    
+    private static final String ALL_ELEM_NAME = "All";
+    
+    private static final String EXACTLYONE_ELEM_NAME = "ExactlyOne";
+    
+    private static final String POLICYREFERENCE_ELEM_NAME = "PolicyReference";
+    
+    private static final String POLICYATTACHMENT_ELEM_NAME = "PolicyAttachment";
+    
+    private static final String APPLIESTO_ELEM_NAME = "AppliesTo";
+    
+    private static final String OPTIONAL_ATTR_NAME = "Optional"; 
+    
+    private static QName policyElemQName;
+    
+    private static QName allElemQName;
+    
+    private static QName exactlyOneElemQName;
+    
+    private static QName policyReferenceElemQName;
+    
+    private static QName policyAttachmentElemQName;
+    
+    private static QName appliesToElemQName;
+    
+    private static QName optionalAttrQName;
+    
+    private static final String WSU_NAMESPACE_URI = 
+        "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+    
+    private static final String WSU_ID_ATTR_NAME = "Id";
+    
+    private static final QName WSU_ID_ATTR_QNAME =
+        new QName(WSU_NAMESPACE_URI, WSU_ID_ATTR_NAME);
+    
+    static {
+        setNamespace(NAMESPACE_W3_200607);
+    }
+    
     /**
      * Prevents instantiation.
      */
@@ -65,4 +96,93 @@
     private PolicyConstants() {
     }
     
+    
+    
+    public static String getNamespace() {
+        return namespaceURI;
+    } 
+    
+    public static String getWSUNamespace() {
+        return WSU_NAMESPACE_URI;
+    }
+    
+    public static String getPolicyElemName() {
+        return POLICY_ELEM_NAME;
+    }
+    
+    public static String getAllElemName() {
+        return ALL_ELEM_NAME;
+    }
+    
+    public static String getExactlyOneElemName() {
+        return EXACTLYONE_ELEM_NAME;
+    }
+    
+    public static String getPolicyReferenceElemName() {
+        return POLICYREFERENCE_ELEM_NAME;
+    }
+    
+    public static String getPolicyAttachmentElemName() {
+        return POLICYATTACHMENT_ELEM_NAME;
+    }
+    
+    public static String getAppliesToElemName() {
+        return APPLIESTO_ELEM_NAME;
+    }
+    
+    public static String getOptionalAttrName() {
+        return OPTIONAL_ATTR_NAME;
+    }
+    
+    public static String getIdAttrName() {
+        return WSU_ID_ATTR_NAME;
+    }
+    
+    public static QName getPolicyElemQName() {
+        return policyElemQName;
+    }
+    
+    public static QName getAllElemQName() {
+        return allElemQName;
+    }
+    
+    public static QName getExactlyOneElemQName() {
+        return exactlyOneElemQName;
+    }
+    
+    public static QName getPolicyReferenceElemQName() {
+        return policyReferenceElemQName;
+    }
+    
+    public static QName getPolicyAttachmentElemQName() {
+        return policyAttachmentElemQName;
+    }
+    
+    public static QName getAppliesToElemQName() {
+        return appliesToElemQName;
+    }
+    
+    public static QName getOptionalAttrQName() {
+        return optionalAttrQName;
+    }
+    
+    public static QName getIdAttrQName() {
+        return WSU_ID_ATTR_QNAME;
+    } 
+    
+    
+    public static void setNamespace(String uri) {
+        namespaceURI = uri;
+        
+        // update qnames
+        
+        policyElemQName = new QName(namespaceURI, POLICY_ELEM_NAME);
+        allElemQName = new QName(namespaceURI, ALL_ELEM_NAME);
+        exactlyOneElemQName = new QName(namespaceURI, EXACTLYONE_ELEM_NAME);
+        policyReferenceElemQName = new QName(namespaceURI, POLICYREFERENCE_ELEM_NAME);
+        policyAttachmentElemQName = new QName(namespaceURI, POLICYATTACHMENT_ELEM_NAME);
+        appliesToElemQName = new QName(namespaceURI, APPLIESTO_ELEM_NAME);
+        optionalAttrQName = new QName(namespaceURI, OPTIONAL_ATTR_NAME);
+        
+    }
 }

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
+
+/**
+ * 
+ */
+public class PolicyInterceptorProviderImpl extends AbstractAttributedInterceptorProvider 
+    implements PolicyInterceptorProvider {
+    
+    private Collection<QName> assertionTypes;
+    
+    PolicyInterceptorProviderImpl(Collection<QName> at) {
+        assertionTypes = at;
+    }
+
+    public Collection<QName> getAssertionTypes() {
+        return assertionTypes;
+    } 
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java Wed Feb 21 04:02:05 2007
@@ -17,95 +17,41 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.jaxb;
+package org.apache.cxf.ws.policy.builder.jaxb;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.neethi.All;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+
 import org.apache.neethi.Assertion;
-import org.apache.neethi.Constants;
-import org.apache.neethi.ExactlyOne;
-import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyComponent;
 
 
 /**
  * 
  */
-public class JaxbAssertion<T> implements Assertion {
+public class JaxbAssertion<T> extends PrimitiveAssertion {
     
     private T data;
-    private QName name;
-    private boolean optional;
-    
-    void setData(T d) {
-        data = d;
+
+    public JaxbAssertion() {
     }
 
-    void setName(QName n) {
-        name = n;
+    public JaxbAssertion(QName qn, boolean optional) {
+        super(qn, optional);
     }
     
-    void setOptional(boolean o) {
-        optional = o;
+    public void setData(T d) {
+        data = d;
     }
-    
+
     public T getData() {
         return data;
     }
     
-    public QName getName() {
-        return name;
-    }
-
-    public boolean isOptional() {
-        return optional;
-    }
-
-    /**
-     * Returns the partial normalized version of the wrapped element, that
-     * is assumed to be an assertion.
-     */
-    public PolicyComponent normalize() {
-        if (optional) {
-            Policy policy = new Policy();
-            ExactlyOne exactlyOne = new ExactlyOne();
-            All all = new All();
-            JaxbAssertion<T> a = new JaxbAssertion<T>();
-            a.setData(getData());
-            a.setName(getName());
-            all.addPolicyComponent(this);
-            exactlyOne.addPolicyComponent(all);
-            exactlyOne.addPolicyComponent(new All());
-            policy.addPolicyComponent(exactlyOne);
-            return policy;
-        }
+    protected Assertion cloneMandatory() {
+        JaxbAssertion<T> a = new JaxbAssertion<T>(getName(), false);
+        a.setData(data);
+        return a;        
+    } 
 
-        return this;
-    }
-
-    public boolean equal(PolicyComponent policyComponent) {
-        if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
-            return false;
-        }
-
-        if (!getName().equals(((Assertion)policyComponent).getName())) {
-            return false;
-        }
-        
-        return getData().equals(((JaxbAssertion)policyComponent).getData());
-    }
-
-    public short getType() {
-        return Constants.TYPE_ASSERTION;
-    }
-    
-    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        // TODO
-    }
-    
-
-    
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilder.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.jaxb;
+package org.apache.cxf.ws.policy.builder.jaxb;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -100,15 +100,16 @@
                 LOG.fine("Unmarshaled element into object of type: " + obj.getClass().getName()
                      + "    value: " + obj);
             }
-            JaxbAssertion<T> a = new JaxbAssertion<T>();
-            a.setData((T)obj);
-            a.setName(new QName(element.getNamespaceURI(), element.getLocalName()));
+            QName name = new QName(element.getNamespaceURI(), element.getLocalName());
+            boolean optional = false;
             String value = element.getAttributeNS(
                                Constants.Q_ELEM_OPTIONAL_ATTR.getNamespaceURI(), 
                                Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart());
             if (Boolean.valueOf(value)) {
-                a.setOptional(true);
+                optional = true;
             }
+            JaxbAssertion<T> a = new JaxbAssertion<T>(name, optional);
+            a.setData((T)obj);
             return a;
         }
         return null;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.primitive;
+package org.apache.cxf.ws.policy.builder.primitive;
 
 import java.util.Iterator;
 import java.util.List;
@@ -63,18 +63,18 @@
         for (Node nd = elem.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
             if (Node.ELEMENT_NODE == nd.getNodeType()) {
                 QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
-                if (PolicyConstants.POLICY_ELEM_QNAME.equals(qn)
+                if (PolicyConstants.getPolicyElemQName().equals(qn)
                     && null == policyElem) {
                     policyElem = (Element)nd;
                 } else {
                     throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
-                                                          PolicyConstants.POLICY_ELEM_QNAME));
+                                                          PolicyConstants.getPolicyElemQName()));
                 }                
             }
         }
         if (null == policyElem) {
             throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
-                                                  PolicyConstants.POLICY_ELEM_QNAME));
+                                                  PolicyConstants.getPolicyElemQName()));
         }
         
         nested = builder.getPolicy(policyElem);  

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.primitive;
+package org.apache.cxf.ws.policy.builder.primitive;
 
 import org.w3c.dom.Element;
 

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.primitive;
+package org.apache.cxf.ws.policy.builder.primitive;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -57,8 +57,8 @@
     
     public PrimitiveAssertion(Element element) {
         name = new QName(element.getNamespaceURI(), element.getLocalName());
-        Attr attribute = element.getAttributeNodeNS(PolicyConstants.NAMESPACE_URI, 
-                                              PolicyConstants.OPTIONAL_ATTR_NAME);
+        Attr attribute = element.getAttributeNodeNS(PolicyConstants.getNamespace(), 
+                                              PolicyConstants.getOptionalAttrName());
         if (attribute != null) {
             optional = Boolean.valueOf(attribute.getValue());
         }
@@ -78,11 +78,19 @@
     public QName getName() {
         return name;
     }
+    
+    public void setName(QName n) {
+        name = n;
+    }
 
     public boolean isOptional() {
         return optional;
     }
 
+    public void setOptional(boolean o) {
+        optional = o;        
+    }
+    
     public PolicyComponent normalize() {
         if (isOptional()) {
             Policy policy = new Policy();

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.primitive;
+package org.apache.cxf.ws.policy.builder.primitive;
 
 import java.util.ArrayList;
 import java.util.Collection;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java Wed Feb 21 04:02:05 2007
@@ -17,11 +17,11 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.xml;
+package org.apache.cxf.ws.policy.builder.xml;
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.ws.policy.builders.primitive.PrimitiveAssertionBuilder;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 import org.apache.neethi.Assertion;
 
 public class XMLPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java Wed Feb 21 04:02:05 2007
@@ -17,16 +17,15 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.xml;
+package org.apache.cxf.ws.policy.builder.xml;
 
 import org.w3c.dom.Element;
 
 import org.apache.cxf.ws.policy.PolicyConstants;
-import org.apache.cxf.ws.policy.builders.primitive.PrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.PolicyComponent;
 
-
 /**
  * XmlPrimitiveAssertion is a primitive implementation of an AssertionBuilder
  * that simply wraps the underlying xml element.
@@ -67,8 +66,8 @@
     protected Assertion cloneMandatory() {
         Element e = (Element)element.cloneNode(true);
         if (isOptional()) {
-            e.removeAttributeNode(e.getAttributeNodeNS(PolicyConstants.NAMESPACE_URI, 
-                                                   PolicyConstants.OPTIONAL_ATTR_NAME));
+            e.removeAttributeNode(e.getAttributeNodeNS(PolicyConstants.getNamespace(), 
+                                                   PolicyConstants.getOptionalAttrName()));
         }
         return new XmlPrimitiveAssertion(e);        
     }

Modified: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java (original)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.jaxb;
+package org.apache.cxf.ws.policy.builder.jaxb;
 
 import java.io.InputStream;
 

Modified: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java (original)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionTest.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.jaxb;
+package org.apache.cxf.ws.policy.builder.jaxb;
 
 import java.util.Iterator;
 import java.util.List;
@@ -28,7 +28,7 @@
 
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.test.assertions.foo.FooType;
-import org.apache.cxf.ws.policy.builders.xml.XmlPrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
 import org.apache.neethi.All;
 import org.apache.neethi.Constants;
 import org.apache.neethi.ExactlyOne;
@@ -109,8 +109,10 @@
         QName qn = new QName("http://cxf.apache.org/test/assertions/foo", "FooType");
         assertion.setName(qn);
         assertion.setData(data);
-        
-        assertSame(assertion, assertion.normalize()); 
+
+        JaxbAssertion normalised = (JaxbAssertion)assertion.normalize();
+        assertTrue(normalised.equal(assertion));       
+        assertSame(assertion.getData(), normalised.getData()); 
         
         assertion.setOptional(true);        
         PolicyComponent pc = assertion.normalize();

Modified: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java?view=diff&rev=509980&r1=509965&r2=509980
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java (original)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java Wed Feb 21 04:02:05 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.ws.policy.builders.primitive;
+package org.apache.cxf.ws.policy.builder.primitive;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -63,7 +63,7 @@
     public void testBuildFail() throws Exception {
         String data = 
             "<wsam:Addressing wsp:Optional=\"true\""
-            + " xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\""
+            + " xmlns:wsp=\"http://www.w3.org/2006/07/ws-policy\""
             + " xmlns:wsam=\"http://www.w3.org/2007/01/addressing/metadata\" />";
         
         try {
@@ -77,7 +77,7 @@
     public void testBuild() throws Exception {
         String data = 
             "<wsam:Addressing wsp:Optional=\"true\""
-            + " xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\""
+            + " xmlns:wsp=\"http://www.w3.org/2006/07/ws-policy\""
             + " xmlns:wsam=\"http://www.w3.org/2007/01/addressing/metadata\">"
             + "<wsp:Policy/></wsam:Addressing>";
  

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java Wed Feb 21 04:02:05 2007
@@ -31,8 +31,8 @@
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
-import org.apache.cxf.ws.policy.builders.primitive.NestedPrimitiveAssertion;
-import org.apache.cxf.ws.policy.builders.primitive.PrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.neethi.Assertion;
 
 /**
@@ -48,33 +48,31 @@
     }
     
     static {
-        KNOWN.add(MetadataConstants.getAddressingAssertionQName());
-        KNOWN.add(MetadataConstants.getAnonymousResponsesAssertionQName());
-        KNOWN.add(MetadataConstants.getNonAnonymousResponsesAssertionQName());
+        KNOWN.add(MetadataConstants.ADDRESSING_ASSERTION_QNAME);
+        KNOWN.add(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
+        KNOWN.add(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
     }
     
     public Assertion build(Element elem) {
         
         String localName = elem.getLocalName();
-        QName n = new QName(elem.getNamespaceURI(), localName);
-        System.out.println("Using AddressingAssertionBuilder to build assertion for " + n);
+        QName qn = new QName(elem.getNamespaceURI(), localName);
         
         boolean optional = false;
-        Attr attribute = elem.getAttributeNodeNS(PolicyConstants.NAMESPACE_URI, 
-                                              PolicyConstants.OPTIONAL_ATTR_NAME);
+        Attr attribute = elem.getAttributeNodeNS(PolicyConstants.getNamespace(), 
+                                              PolicyConstants.getOptionalAttrName());
         if (attribute != null) {
             optional = Boolean.valueOf(attribute.getValue());
         }
-        if (MetadataConstants.getAddressingAssertionQName().getLocalPart().equals(localName)) {
+        if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn)) {
             PolicyBuilder builder = bus.getExtension(PolicyBuilder.class);
             return new NestedPrimitiveAssertion(elem, builder);
-        } else if (MetadataConstants.getAnonymousResponsesAssertionQName().getLocalPart()
-            .equals(localName)) {
-            return new PrimitiveAssertion(MetadataConstants.getAnonymousResponsesAssertionQName(), 
+        } else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn)) {
+            return new PrimitiveAssertion(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME, 
                                           optional);
-        } else if (MetadataConstants.getNonAnonymousResponsesAssertionQName().getLocalPart()
+        } else if (MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME.getLocalPart()
             .equals(localName)) {
-            return new PrimitiveAssertion(MetadataConstants.getNonAnonymousResponsesAssertionQName(), 
+            return new PrimitiveAssertion(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME,
                                           optional);
         }
         return null;

Added: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java (added)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.addressing.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
+import org.apache.cxf.ws.policy.PolicyInterceptorProvider;
+
+/**
+ * Instead of parametrising an instance of org.apache.cxf.policy.PolicyInterceptorProviderImpl
+ * we use this class to reduce the impact of changes to the addressing metadata namespace
+ * (only need to update Metadataconstants, otherwise cfg file fragement also).
+ */
+public class AddressingPolicyInterceptorProvider  extends AbstractAttributedInterceptorProvider 
+    implements PolicyInterceptorProvider {
+
+    private static final Collection<QName> ASSERTION_TYPES;
+    
+    static {
+        Collection<QName> types = new ArrayList<QName>();
+        types.add(MetadataConstants.ADDRESSING_ASSERTION_QNAME);
+        types.add(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
+        types.add(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
+        ASSERTION_TYPES = types;
+    }
+    
+    public Collection<QName> getAssertionTypes() {
+        return ASSERTION_TYPES;
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingPolicyInterceptorProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java Wed Feb 21 04:02:05 2007
@@ -26,32 +26,20 @@
  */
 public final class MetadataConstants {
     
-    private static final String NAMESPACE_URI = 
+    public static final String NAMESPACE_URI = 
         "http://www.w3.org/2007/01/addressing/metadata";
-    
-    private static final String ADDESSING_ELEM_NAME = "Addressing";
-    private static final String ANON_RESPONSES_ELEM_NAME = "AnonymousResponses";
-    private static final String NON_ANON_RESPONSES_ELEM_NAME = "NonAnonymousResponses";
+    public static final String ADDRESSING_ELEM_NAME = "Addressing";
+    public static final String ANON_RESPONSES_ELEM_NAME = "AnonymousResponses";
+    public static final String NON_ANON_RESPONSES_ELEM_NAME = "NonAnonymousResponses";
        
-    private static final QName ADDRESSING_ASSERTION_QNAME
-        = new QName(NAMESPACE_URI, ADDESSING_ELEM_NAME);
-    private static final QName ANON_RESPONSES_ASSERTION_QNAME
+    public static final QName ADDRESSING_ASSERTION_QNAME
+        = new QName(NAMESPACE_URI, ADDRESSING_ELEM_NAME);
+    public static final QName ANON_RESPONSES_ASSERTION_QNAME
         = new QName(NAMESPACE_URI, ANON_RESPONSES_ELEM_NAME);
-    private static final QName NON_ANON_RESPONSES_ASSERTION_QNAME
+    public static final QName NON_ANON_RESPONSES_ASSERTION_QNAME
         = new QName(NAMESPACE_URI, NON_ANON_RESPONSES_ELEM_NAME);
     
     private MetadataConstants() {        
     }
     
-    public static QName getAddressingAssertionQName() {
-        return ADDRESSING_ASSERTION_QNAME;
-    }
-    
-    public static QName getAnonymousResponsesAssertionQName() {
-        return ANON_RESPONSES_ASSERTION_QNAME;
-    }
-    
-    public static QName getNonAnonymousResponsesAssertionQName() {
-        return NON_ANON_RESPONSES_ASSERTION_QNAME;
-    }
 }

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml Wed Feb 21 04:02:05 2007
@@ -25,6 +25,34 @@
     <bean class="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder">
         <constructor-arg ref="cxf"/>
     </bean>
+
+    <bean class="org.apache.cxf.ws.addressing.MAPAggregator"/>
+    <bean class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
     
-    
+    <bean class="org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
+                <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+            </list>
+        </property>
+        <property name="inFaultInterceptors">
+            <list>
+                <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
+                <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="org.apache.cxf.ws.addressing.MAPAggregator"/>
+                <ref bean="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+            </list>
+        </property>
+    </bean>
+ 
 </beans>

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/Messages.properties Wed Feb 21 04:02:05 2007
@@ -23,5 +23,4 @@
 NOT_A_POLICY_ELEMENT_EXC = Specified element is not a Policy element.
 NOT_A_POLICYREF_ELEMENT_EXC = Specified element is not a PolicyReference element.
 NO_ALTERNATIVE_EXC = None of the policy alternatives can be satisfied.
-REMOTE_POLICY_RESOLUTION_NOT_SUPPORTED_EXC = Resolution of remote policy references is not supported.
 UNRESOLVED_POLICY_REEFERENCE_EXC = Policy reference {0} could not be resolved.

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java Wed Feb 21 04:02:05 2007
@@ -42,7 +42,6 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
-import org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
@@ -58,7 +57,7 @@
     
     private Bus bus;
     private PolicyRegistry registry;
-    private List<PolicyProvider> policyProviders;
+    private Collection<PolicyProvider> policyProviders;
     private boolean registerInterceptors;
 
     private Map<BindingOperationInfo, ClientRequestPolicyInfo> clientRequestInfo 
@@ -68,6 +67,10 @@
     private Map<BindingOperationInfo, ServerResponsePolicyInfo> serverResponseInfo 
         = new ConcurrentHashMap<BindingOperationInfo, ServerResponsePolicyInfo>();
 
+    public PolicyEngine() {
+        registry = new PolicyRegistryImpl();
+    }
+    
     public Class getRegistrationType() {
         return PolicyEngine.class;
     }
@@ -80,11 +83,11 @@
         return bus;
     }
     
-    public void setPolicyProviders(List<PolicyProvider> p) {
+    public void setPolicyProviders(Collection<PolicyProvider> p) {
         policyProviders = p;
     }
    
-    public List<PolicyProvider> getPolicyProviders() {
+    public Collection<PolicyProvider> getPolicyProviders() {
         return policyProviders;
     }
     
@@ -102,23 +105,6 @@
 
     public void setRegisterInterceptors(boolean ri) {
         registerInterceptors = ri;
-    }
-
-    @PostConstruct
-    void init() {
-        if (null == registry) {
-            registry = new PolicyRegistryImpl();
-        }
-      
-        if (null == policyProviders && null != bus) {
-            // TODO:
-            // include attachment provider for wsdl 2.0 and
-            // for external attachments
-            Wsdl11AttachmentPolicyProvider wpp = new Wsdl11AttachmentPolicyProvider();
-            wpp.setBuilder(bus.getExtension(PolicyBuilder.class));
-            wpp.setRegistry(registry);
-            policyProviders = Collections.singletonList((PolicyProvider)wpp);
-        } 
     }
     
     @PostConstruct

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java Wed Feb 21 04:02:05 2007
@@ -23,7 +23,7 @@
 
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.ws.policy.builders.primitive.NestedPrimitiveAssertion;
+import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy.attachment;
+
+import java.util.ResourceBundle;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.PolicyException;
+import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
+import org.apache.cxf.ws.policy.attachment.reference.RemoteReferenceResolver;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyReference;
+import org.apache.neethi.PolicyRegistry;
+
+/**
+ * 
+ */
+public class AbstractPolicyProvider {
+    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AbstractPolicyProvider.class);
+    
+    protected PolicyBuilder builder;
+    protected PolicyRegistry registry; 
+    protected Bus bus;
+    
+    protected AbstractPolicyProvider() {
+        this(null);
+    }
+    
+    protected AbstractPolicyProvider(Bus b) {
+        bus = b;
+    }
+    
+    public void setBuilder(PolicyBuilder b) {
+        builder = b;
+    }
+    
+    public void setRegistry(PolicyRegistry r) {
+        registry = r;
+    }  
+    
+    @PostConstruct
+    void init() {
+        if (null != bus) {
+            setBuilder(bus.getExtension(PolicyBuilder.class));
+            PolicyEngine pe = bus.getExtension(PolicyEngine.class);
+            setRegistry(pe.getRegistry());
+        }
+    }
+    
+    protected Policy resolveExternal(PolicyReference ref,  String baseURI) {
+        ReferenceResolver resolver = new RemoteReferenceResolver(baseURI, builder);
+        Policy resolved = registry.lookup(ref.getURI());
+        if (null != resolved) {
+            return resolved;
+        }
+        return resolver.resolveReference(ref.getURI());
+    }
+    
+    protected boolean isExternal(PolicyReference ref) {
+        return !ref.getURI().startsWith("#");
+    }
+    
+    protected void checkResolved(PolicyReference ref, Policy p) {
+        if (null == p) {
+            throw new PolicyException(new Message("UNRESOLVED_POLICY_REEFERENCE_EXC", BUNDLE, ref.getURI()));
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties Wed Feb 21 04:02:05 2007
@@ -0,0 +1,22 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+
+UNRESOLVED_POLICY_REEFERENCE_EXC = Reference to policy {0} could not be resolved.
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy.attachment.external;
+
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+
+/**
+ * 
+ */
+public interface DomainExpression {
+    boolean appliesTo(BindingFaultInfo bfi);
+    boolean appliesTo(BindingMessageInfo bmi);
+    boolean appliesTo(BindingOperationInfo boi);
+    boolean appliesTo(EndpointInfo ei);
+    boolean appliesTo(ServiceInfo si);
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpression.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy.attachment.external;
+
+import org.w3c.dom.Element;
+
+/**
+ * 
+ */
+public interface DomainExpressionBuilder {
+    
+    DomainExpression build(Element e);
+   
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy.attachment.external;
+
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.extension.BusExtension;
+import org.apache.cxf.extension.RegistryImpl;
+import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
+import org.apache.cxf.ws.policy.PolicyException;
+
+/**
+ * 
+ */
+public class DomainExpressionBuilderRegistry extends RegistryImpl<QName, DomainExpressionBuilder> 
+    implements BusExtension {
+    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AssertionBuilderRegistry.class);
+    
+    public DomainExpressionBuilderRegistry() {
+        this(null);
+    }
+
+    public DomainExpressionBuilderRegistry(Map<QName, DomainExpressionBuilder> builders) {
+        super(builders);
+    }
+    
+    public Class getRegistrationType() {
+        return DomainExpressionBuilderRegistry.class;
+    }
+    
+    public DomainExpression build(Element element) {
+        
+        DomainExpressionBuilder builder;
+
+        QName qname = new QName(element.getNamespaceURI(), element.getLocalName());
+        builder = get(qname);
+
+        if (null == builder) {
+            throw new PolicyException(new Message("NO_DOMAINEXPRESSIONBUILDER_EXC", 
+                                                  BUNDLE, qname.toString()));
+        }
+
+        return builder.build(element);
+
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/DomainExpressionBuilderRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy.attachment.external;
+
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+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.addressing.EndpointReferenceType;
+
+/**
+ * 
+ */
+public class EndpointReferenceDomainExpression implements DomainExpression {
+
+    private EndpointReferenceType epr;    
+    
+    public EndpointReferenceType getEndpointReference() {
+        return epr;
+    }
+
+    public void setEndpointReference(EndpointReferenceType e) {
+        epr = e;
+    }
+
+    public boolean appliesTo(BindingFaultInfo bfi) {
+        return false;
+    }
+
+    public boolean appliesTo(BindingMessageInfo bmi) {
+        return false;
+    }
+
+    public boolean appliesTo(BindingOperationInfo boi) {
+        return false;
+    }
+
+    public boolean appliesTo(EndpointInfo ei) {
+        // TODO what if no address is specified for the EndpointInfo object ...
+        return epr.getAddress().getValue().equals(ei.getAddress());
+    }
+
+    public boolean appliesTo(ServiceInfo si) {
+        return false;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpression.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java Wed Feb 21 04:02:05 2007
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy.attachment.external;
+
+import java.util.ResourceBundle;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.policy.PolicyException;
+
+/**
+ * 
+ */
+public class EndpointReferenceDomainExpressionBuilder implements DomainExpressionBuilder {
+
+    private static final ResourceBundle BUNDLE 
+        = BundleUtils.getBundle(EndpointReferenceDomainExpressionBuilder.class);
+    
+    private Unmarshaller unmarshaller;
+    
+    EndpointReferenceDomainExpressionBuilder() {
+        try {
+            JAXBContext context = JAXBContext.newInstance(EndpointReferenceType.class.getPackage().getName());
+            unmarshaller = context.createUnmarshaller();
+        } catch (JAXBException ex) {
+            throw new PolicyException(new Message("EPR_DOMAIN_EXPRESSION_BUILDER_INIT_EXC", BUNDLE, 
+                                                  (Object[])null), ex);
+        }
+    }
+    
+    public DomainExpression build(Element e) {
+        Object obj = null;
+        try {
+            obj = unmarshaller.unmarshal(e);
+        } catch (JAXBException ex) {
+            throw new PolicyException(new Message("EPR_DOMAIN_EXPRESSION_BUILD_EXC", BUNDLE, 
+                                                  (Object[])null), ex);
+        }
+        if (obj instanceof JAXBElement<?>) {
+            JAXBElement<?> el = (JAXBElement<?>)obj;
+            obj = el.getValue();
+        } 
+
+        EndpointReferenceDomainExpression eprde = new EndpointReferenceDomainExpression();
+        eprde.setEndpointReference((EndpointReferenceType)obj);
+        return eprde;
+    }
+
+    
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/EndpointReferenceDomainExpressionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java?view=diff&rev=509980&r1=509979&r2=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java Wed Feb 21 04:02:05 2007
@@ -19,9 +19,229 @@
 
 package org.apache.cxf.ws.policy.attachment.external;
 
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.resource.URIResolver;
+import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+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.PolicyConstants;
+import org.apache.cxf.ws.policy.PolicyException;
+import org.apache.cxf.ws.policy.attachment.AbstractPolicyProvider;
+import org.apache.cxf.ws.policy.attachment.reference.LocalDocumentReferenceResolver;
+import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyReference;
+
 /**
  * 
  */
-public class ExternalAttachmentProvider {
+public class ExternalAttachmentProvider extends AbstractPolicyProvider {
+    
+    private String uri;
+    private Collection<PolicyAttachment> attachments;
+    
+    ExternalAttachmentProvider() {        
+    }
+    
+    ExternalAttachmentProvider(Bus b) {
+        super(b);
+    }
+    
+    public void setURI(String u) {
+        uri = u;
+    }
+    
+    public String getURI() {
+        return uri;
+    }
+
+    public Policy getEffectivePolicy(BindingFaultInfo bfi) {
+        readDocument();
+        Policy p = new Policy();
+        for (PolicyAttachment pa : attachments) {
+            if (pa.appliesTo(bfi)) {
+                p = p.merge(pa.getPolicy());
+            }
+        }
+                
+        return p;
+    }
+
+    public Policy getEffectivePolicy(BindingMessageInfo bmi) {
+        readDocument();
+        Policy p = new Policy();
+        for (PolicyAttachment pa : attachments) {
+            if (pa.appliesTo(bmi)) {
+                p = p.merge(pa.getPolicy());
+            }
+        }
+                
+        return p;
+    }
+
+    public Policy getEffectivePolicy(BindingOperationInfo boi) {
+        readDocument();
+        Policy p = new Policy();
+        for (PolicyAttachment pa : attachments) {
+            if (pa.appliesTo(boi)) {
+                p = p.merge(pa.getPolicy());
+            }
+        }
+                
+        return p;
+    }
+
+    public Policy getEffectivePolicy(EndpointInfo ei) {
+        readDocument();
+        Policy p = new Policy();
+        for (PolicyAttachment pa : attachments) {
+            if (pa.appliesTo(ei)) {
+                p = p.merge(pa.getPolicy());
+            }
+        }
+                
+        return p;
+    }
 
+    public Policy getEffectivePolicy(ServiceInfo si) {
+        readDocument();
+        Policy p = new Policy();
+        for (PolicyAttachment pa : attachments) {
+            if (pa.appliesTo(si)) {
+                p = p.merge(pa.getPolicy());
+            }
+        }
+                
+        return p;
+    } 
+    
+    void readDocument() {
+        if (null != attachments) {
+            return;
+        }
+        
+        // read the document and build the attachments
+        attachments = new ArrayList<PolicyAttachment>();
+        Document doc = null;
+        try {
+            InputStream is = new URIResolver(uri).getInputStream();
+            try {
+                doc = DOMUtils.readXml(is);
+            } catch (Exception ex) {
+                throw new PolicyException(ex);
+            }
+        } catch (Exception ex) {
+            throw new PolicyException(ex);
+        }
+        NodeList nl = doc.getElementsByTagNameNS(PolicyConstants.getNamespace(), 
+                                                 PolicyConstants.getPolicyAttachmentElemName());
+        for (int i = 0; i < nl.getLength(); i++) {
+            
+            PolicyAttachment attachment = new PolicyAttachment();
+            
+            Element ae = (Element)nl.item(i);
+            
+            for (Node nd = ae.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
+                if (Node.ELEMENT_NODE != nd.getNodeType()) {
+                    continue;
+                }
+                QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
+                if (PolicyConstants.getAppliesToElemQName().equals(qn)) {
+                    Collection<DomainExpression> des = readDomainExpressions((Element)nd);
+                    if (des.isEmpty()) {
+                        // forget about this attachment
+                        continue;
+                    }
+                    attachment.setDomainExpressions(des);                    
+                } else if (PolicyConstants.getPolicyElemQName().equals(qn)) {
+                    Policy p = builder.getPolicy((Element)nd);
+                    if (null != attachment.getPolicy()) {
+                        p = p.merge(attachment.getPolicy());
+                    }
+                    attachment.setPolicy(p);
+                } else if (PolicyConstants.getPolicyReferenceElemQName().equals(qn)) {
+                    PolicyReference ref = builder.getPolicyReference((Element)nd);
+                    if (null != ref) {   
+                        Policy p = resolveReference(ref, doc);
+                        if (null != attachment.getPolicy()) {
+                            p = p.merge(attachment.getPolicy());
+                        }
+                        attachment.setPolicy(p);
+                    }                    
+                } // TODO: wsse:Security child element
+            }
+            
+            if (null == attachment.getPolicy() || null == attachment.getDomainExpressions()) {                
+                continue;
+            }
+            
+            attachments.add(attachment);
+        }
+    }
+    
+    Policy resolveReference(PolicyReference ref, Document doc) {
+        Policy p = null;
+        if (isExternal(ref)) {
+            p = resolveExternal(ref, doc.getBaseURI());
+        } else {
+            p = resolveLocal(ref, doc);
+        }
+        checkResolved(ref, p);
+        return p;
+    }
+    
+    Policy resolveLocal(PolicyReference ref, Document doc) {
+        String relativeURI = ref.getURI().substring(1);
+        String absoluteURI = doc.getBaseURI() + ref.getURI();
+        Policy resolved = registry.lookup(absoluteURI);
+        if (null != resolved) {
+            return resolved;
+        }
+        ReferenceResolver resolver = new LocalDocumentReferenceResolver(doc, builder);
+        resolved = resolver.resolveReference(relativeURI);
+        if (null != resolved) {
+            ref.setURI(absoluteURI);
+            registry.register(absoluteURI, resolved);
+        }
+        return resolved;
+    }  
+    
+    Collection<DomainExpression> readDomainExpressions(Element appliesToElem) {
+        Collection<DomainExpression> des = new ArrayList<DomainExpression>();
+        for (Node nd = appliesToElem.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
+            if (Node.ELEMENT_NODE == nd.getNodeType()) {
+                DomainExpressionBuilderRegistry debr 
+                    = bus.getExtension(DomainExpressionBuilderRegistry.class);
+                assert null != debr;
+                DomainExpression de = debr.build((Element)nd);
+                des.add(de);
+            }
+        }
+        return des;
+    }
+    
+    // for test
+    
+    void setAttachments(Collection<PolicyAttachment> a) {
+        attachments = a;    
+    }
+    
+    Collection<PolicyAttachment> getAttachments() {
+        return attachments;
+    }
+    
 }

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties?view=auto&rev=509980
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties Wed Feb 21 04:02:05 2007
@@ -0,0 +1,23 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+NO_DOMAINEXPRESSIONBUILDER_EXC = No domain expresssion builder for type {0} registered.
+EPR_DOMAIN_EXPRESSION_BUILD_EXC = Failed to build endpoint reference type domain expression.  
+EPR_DOMAIN_EXPRESSION_BUILDER_INIT_EXC = Failed to initialise endpoint reference type domain expression builder.
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message