cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r505397 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/extension/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/ws/policy/ rt/core/src/main/java/o...
Date Fri, 09 Feb 2007 18:13:17 GMT
Author: andreasmyth
Date: Fri Feb  9 10:13:13 2007
New Revision: 505397

URL: http://svn.apache.org/viewvc?view=rev&rev=505397
Log:
[JIRA CXF-383] Parametrisable implementation for simple nested assertion types such as the Addressing assertion.
AssertionBuilder for the three types of addressing metadata assertions.
New implementation of PolicyComparator to replace the one provided by neethi.
Provided implementation of the PolicyRegistry interface and used it in PolicyBuilder so as to be able to normalise policy components of type PolicyReference.


Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/Registry.java
      - copied, changed from r505241, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java
      - copied, changed from r505241, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java   (with props)
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java   (with props)
    incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/
    incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml   (with props)
    incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/
    incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyRegistryImpl.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/Messages.properties   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertion.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertion.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimitiveAssertion.java
      - copied, changed from r504813, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/util/
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/util/PolicyComparator.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertionTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/compact0.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/compact1.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/compact2.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/compact3.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/compact4.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/compact5.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/normalised1.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/normalised2.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/normalised3.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/normalised4.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/primitive/resources/normalised5.xml   (with props)
Removed:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtensionRegistrar.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    incubator/cxf/trunk/rt/ws/addr/pom.xml
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
    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/PolicyBuilder.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
    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/PolicyInterceptorProviderRegistryImpl.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/wsdl11/Wsdl11AttachmentPolicyProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.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/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/builders/jaxb/JaxbAssertionTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,25 @@
+/**
+ * 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.extension;
+
+public interface BusExtension {
+       
+    Class getRegistrationType();
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtension.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/Registry.java (from r505241, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/Registry.java?view=diff&rev=505397&p1=incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java&r1=505241&p2=incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/Registry.java&r2=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/Registry.java Fri Feb  9 10:13:13 2007
@@ -22,7 +22,7 @@
 /**
  * 
  */
-public interface RegistryExtension<K, T> {
+public interface Registry<K, T> {
     
     /**
      * Registers an object of type T with this registry. 

Copied: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java (from r505241, incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java?view=diff&rev=505397&p1=incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java&r1=505241&p2=incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java&r2=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java Fri Feb  9 10:13:13 2007
@@ -25,15 +25,15 @@
 /**
  * 
  */
-public class RegistryExtensionImpl<K, T> implements RegistryExtension<K, T> {
+public class RegistryImpl<K, T> implements Registry<K, T> {
     
     protected final Map<K, T> entries;
     
-    protected RegistryExtensionImpl() {
+    protected RegistryImpl() {
         this(null);
     }
     
-    protected RegistryExtensionImpl(Map<K, T> e) {
+    protected RegistryImpl(Map<K, T> e) {
         if (null == e) {
             e = new ConcurrentHashMap<K, T>();
         } else if (!(e instanceof ConcurrentHashMap)) {

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Fri Feb  9 10:13:13 2007
@@ -179,7 +179,6 @@
                     faultOccured = true;
                     if (LOG.isLoggable(Level.FINE)) {
                         LogUtils.log(LOG, Level.FINE, "Interceptor has thrown exception, unwinding now", ex);
-                        ex.printStackTrace();
                     }
                     message.setContent(Exception.class, ex);
                     if (message.getExchange() != null) {

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java Fri Feb  9 10:13:13 2007
@@ -39,6 +39,14 @@
     public QName getName() {
         return name;
     }
+    
+    public void setBaseURI(String u) {
+        uri = u;
+    }
+    
+    public String getBaseURI() {
+        return uri;
+    }
    
     public List<AbstractDescriptionElement> getDescribed() {
         return described;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java Fri Feb  9 10:13:13 2007
@@ -23,7 +23,7 @@
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.extension.RegistryExtension;
+import org.apache.cxf.extension.Registry;
 import org.apache.neethi.Assertion;
 
 
@@ -31,7 +31,7 @@
  * AssertionBuilderRegistry is used to manage AssertionBuilders and
  * create Assertion objects from given xml elements.
  */
-public interface AssertionBuilderRegistry extends RegistryExtension<QName, AssertionBuilder> {
+public interface AssertionBuilderRegistry extends Registry<QName, AssertionBuilder> {
     
     /**
      * Returns an assertion that is built using the specified xml element.

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java Fri Feb  9 10:13:13 2007
@@ -21,7 +21,7 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.extension.RegistryExtension;
+import org.apache.cxf.extension.Registry;
 
 
 /**
@@ -29,5 +29,5 @@
  * assertion domain specific interceptors.
  */
 public interface PolicyInterceptorProviderRegistry 
-    extends RegistryExtension<QName, PolicyInterceptorProvider> {
+    extends Registry<QName, PolicyInterceptorProvider> {
 }

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,57 @@
+/**
+ * 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.bus.spring;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.extension.BusExtension;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.core.Ordered;
+
+public class BusExtensionPostProcessor implements BeanPostProcessor, ApplicationContextAware, Ordered {
+
+    private Bus bus;
+
+    public void setApplicationContext(ApplicationContext ctx) {
+        bus = (Bus)ctx.getBean("cxf");
+    }
+
+    public int getOrder() {
+        return 1001;
+    }
+    
+        
+    public Object postProcessAfterInitialization(Object bean, String beanId) throws BeansException {
+        return bean;
+    }
+
+    @SuppressWarnings("unchecked")
+    public Object postProcessBeforeInitialization(Object bean, String beanId) throws BeansException {
+        if (null != bus && bean instanceof BusExtension) {
+            Class cls = ((BusExtension)bean).getRegistrationType();
+            bus.setExtension(bean, cls);
+        }
+        return bean;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java Fri Feb  9 10:13:13 2007
@@ -22,15 +22,19 @@
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.core.Ordered;
 
-public class Jsr250BeanPostProcessor implements BeanPostProcessor {
+public class Jsr250BeanPostProcessor implements BeanPostProcessor, Ordered {
 
     private ResourceInjector injector;
     
     Jsr250BeanPostProcessor() {
         injector = new ResourceInjector(null, null); 
     }
-    
+
+    public int getOrder() {
+        return 1002;
+    }
         
     public Object postProcessAfterInitialization(Object bean, String beanId) throws BeansException {
         return bean;

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Fri Feb  9 10:13:13 2007
@@ -118,6 +118,7 @@
         DescriptionInfo description = new DescriptionInfo();
         description.setProperty(WSDL_DEFINITION, d);
         description.setName(d.getQName());
+        description.setBaseURI(d.getDocumentBaseURI());
         copyExtensors(description, d.getExtensibilityElements());
 
         List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
@@ -147,6 +148,7 @@
             description = new DescriptionInfo();
             description.setProperty(WSDL_DEFINITION, def);
             description.setName(def.getQName());
+            description.setBaseURI(def.getDocumentBaseURI());
             copyExtensors(description, def.getExtensibilityElements());
         }
         ServiceInfo service = new ServiceInfo();

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Fri Feb  9 10:13:13 2007
@@ -26,6 +26,7 @@
     <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
     
     <bean class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>
+    <bean class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/>
     
     <bean id="org.apache.cxf.resource.ResourceManager" class="org.apache.cxf.bus.resource.ResourceManagerImpl">
        <constructor-arg>

Modified: incubator/cxf/trunk/rt/ws/addr/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/pom.xml?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/addr/pom.xml Fri Feb  9 10:13:13 2007
@@ -65,6 +65,11 @@
             <artifactId>cxf-rt-bindings-soap</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-policy</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.cxf</groupId>

Added: 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=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,87 @@
+/**
+ * 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.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.builders.primitive.NestedPrimitiveAssertion;
+import org.apache.cxf.ws.policy.builders.primitive.PrimitiveAssertion;
+import org.apache.neethi.Assertion;
+
+/**
+ * 
+ */
+public class AddressingAssertionBuilder implements AssertionBuilder {
+
+    private static final Collection<QName> KNOWN = new ArrayList<QName>();
+    private PolicyEngine engine;
+    
+    public AddressingAssertionBuilder(PolicyEngine e) {
+        engine = e;
+    }
+    
+    static {
+        KNOWN.add(MetadataConstants.getAddressingAssertionQName());
+        KNOWN.add(MetadataConstants.getAnonymousResponsesAssertionQName());
+        KNOWN.add(MetadataConstants.getNonAnonymousResponsesAssertionQName());
+    }
+    
+    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);
+        
+        boolean optional = false;
+        Attr attribute = elem.getAttributeNodeNS(PolicyConstants.getNamespaceURI(), 
+                                              PolicyConstants.getOptionalAttrLocalName());
+        if (attribute != null) {
+            optional = Boolean.valueOf(attribute.getValue());
+        }
+        if (MetadataConstants.getAddressingAssertionQName().getLocalPart().equals(localName)) {
+            return new NestedPrimitiveAssertion(elem, engine.getBuilder());
+        } else if (MetadataConstants.getAnonymousResponsesAssertionQName().getLocalPart()
+            .equals(localName)) {
+            return new PrimitiveAssertion(MetadataConstants.getAnonymousResponsesAssertionQName(), 
+                                          optional);
+        } else if (MetadataConstants.getNonAnonymousResponsesAssertionQName().getLocalPart()
+            .equals(localName)) {
+            return new PrimitiveAssertion(MetadataConstants.getNonAnonymousResponsesAssertionQName(), 
+                                          optional);
+        }
+        return null;
+    }
+
+    public Collection<QName> getKnownElements() {
+        return KNOWN;
+    }
+
+    
+    
+}

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

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

Added: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/Messages.properties?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/Messages.properties Fri Feb  9 10:13:13 2007
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+UNEXPECTED_CHILD_ELEMENT_EXC = Expected exaclty one child element of type {0}.
\ No newline at end of file

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

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

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

Added: 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=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java (added)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/MetadataConstants.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,57 @@
+/**
+ * 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 javax.xml.namespace.QName;
+
+/**
+ * 
+ */
+public final class MetadataConstants {
+    
+    private 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";
+       
+    private static final QName ADDRESSING_ASSERTION_QNAME
+        = new QName(NAMESPACE_URI, ADDESSING_ELEM_NAME);
+    private static final QName ANON_RESPONSES_ASSERTION_QNAME
+        = new QName(NAMESPACE_URI, ANON_RESPONSES_ELEM_NAME);
+    private 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;
+    }
+}

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

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

Added: 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=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml (added)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml Fri Feb  9 10:13:13 2007
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean class="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder">
+        <constructor-arg ref="org.apache.cxf.ws.policy.PolicyEngine"/>
+    </bean>
+    
+    
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd (added)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd Fri Feb  9 10:13:13 2007
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+
+<!-- prelimary version extracted from http://lists.w3.org/Archives/Public/public-ws-addressing/2007Jan/0053.html -->
+
+<xs:schema
+    targetNamespace="http://www.w3.org/2007/01/addressing/metadata" 
+    xmlns:tns="http://www.w3.org/2007/01/addressing/metadata"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified" >
+
+    <xs:element name="Addressing">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="ref:Policy" />
+	    </xs:sequence>
+            <xs:anyAttribute namespace="##other" processContents="lax"/>
+        </xs:complexType>
+    </xs:element>
+    
+    <xs:element name="AnonymousResponses">
+        <xs:complexType>
+            <xs:anyAttribute namespace="##other" processContents="lax"/>
+        </xs:complexType>
+    </xs:element>
+    
+    <xs:element name="NonAnonymousResponses">
+        <xs:complexType>
+            <xs:anyAttribute namespace="##other" processContents="lax"/>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/ws/addr/src/main/resources/schemas/ws-addr-metadata.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java Fri Feb  9 10:13:13 2007
@@ -28,46 +28,43 @@
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.extension.BusExtensionRegistrar;
-import org.apache.cxf.extension.RegistryExtensionImpl;
+import org.apache.cxf.extension.BusExtension;
+import org.apache.cxf.extension.RegistryImpl;
 import org.apache.neethi.Assertion;
 
 /**
  * 
  */
-public class AssertionBuilderRegistryImpl extends RegistryExtensionImpl<QName, AssertionBuilder> 
-    implements AssertionBuilderRegistry {
-    
+public class AssertionBuilderRegistryImpl extends RegistryImpl<QName, AssertionBuilder> implements
+    AssertionBuilderRegistry, BusExtension {
+
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AssertionBuilderRegistry.class);
-  
+
     public AssertionBuilderRegistryImpl() {
         this(null);
     }
 
-    public AssertionBuilderRegistryImpl(BusExtensionRegistrar registrar) {
-        this(registrar, null);
-    }
-    
-    public AssertionBuilderRegistryImpl(BusExtensionRegistrar registrar, 
-                                        Map<QName, AssertionBuilder> builders) {
+    public AssertionBuilderRegistryImpl(Map<QName, AssertionBuilder> builders) {
         super(builders);
-        if (null != registrar) {
-            registrar.registerExtension(this, AssertionBuilderRegistry.class);
-        }
     }
 
+    public Class getRegistrationType() {
+        return AssertionBuilderRegistry.class;
+    }
+    
+
     public Assertion build(Element element) {
 
         AssertionBuilder builder;
 
         QName qname = new QName(element.getNamespaceURI(), element.getLocalName());
         builder = get(qname);
-        
+
         if (null == builder) {
             throw new PolicyException(new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString()));
         }
 
         return builder.build(element);
-        
+
     }
 }

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=505397&r1=505396&r2=505397
==============================================================================
--- 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 Fri Feb  9 10:13:13 2007
@@ -22,4 +22,6 @@
 NO_ASSERTIONBUILDER_EXC = No assertion builder for type {0} registered.
 NOT_A_POLICY_ELEMENT_EXC = Specified element is not a Policy element.
 NOT_A_POLICYREF_ELEMENT_EXC = Specified element is not a PolicyReference element.
-CLIENT_OUT_NO_ALTERNATIVE_EXC = None of the policy alternatives can be satisfied.
\ No newline at end of file
+CLIENT_OUT_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.
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilder.java Fri Feb  9 10:13:13 2007
@@ -61,6 +61,10 @@
         assertionBuilderRegistry = abr;        
     }
     
+    public AssertionBuilderRegistry getAssertionBuilderRegistry() {
+        return assertionBuilderRegistry;        
+    }
+    
     /**
      * Creates a PolicyReference object from an InputStream.
      * 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java Fri Feb  9 10:13:13 2007
@@ -33,12 +33,17 @@
     
     private static final String POLICYREF_ELEM_NAME = "PolicyReference";
     
+    private static final String OPTIONAL_ATTR_NAME = "Optional";
+    
     private static final QName POLICY_ELEM_QNAME = 
         new QName(NAMESPACE_URI, POLICY_ELEM_NAME);
     
     private static final QName POLICYREF_QNAME = 
         new QName(NAMESPACE_URI, POLICYREF_ELEM_NAME);
     
+    private static final QName OPTIONAL_ATTR_QNAME = 
+        new QName(NAMESPACE_URI, OPTIONAL_ATTR_NAME);
+    
     
     /**
      * Prevents instantiation.
@@ -57,15 +62,33 @@
     /**
      * @return the QName of the Policy element
      */
-    public static QName getPolicyQName() {
+    public static QName getPolicyElementQName() {
         return POLICY_ELEM_QNAME;
     }
     
+    public static String getPolicyElementLocalName() {
+        return POLICY_ELEM_NAME;
+    }
+    
     /**
      * @return the QName of the PolicyReference element
      */
-    public static QName getPolicyReferenceQName() {
+    public static QName getPolicyReferenceElementQName() {
         return POLICYREF_QNAME;
     }
+    
+    public static String getPolicyReferenceElementLocalName() {
+        return POLICYREF_ELEM_NAME;
+    }
+    
+    public static QName getOptionalAttributeQName() {
+        return OPTIONAL_ATTR_QNAME;
+    }
+    
+    public static String getOptionalAttrLocalName() {
+        return OPTIONAL_ATTR_NAME;
+    }
+    
+    
     
 }

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=505397&r1=505396&r2=505397
==============================================================================
--- 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 Fri Feb  9 10:13:13 2007
@@ -27,7 +27,7 @@
 import javax.annotation.PostConstruct;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.extension.BusExtensionRegistrar;
+import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
@@ -38,27 +38,23 @@
 import org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyRegistry;
 
 /**
  * 
  */
-public class PolicyEngine {
+public class PolicyEngine implements BusExtension {
     
     private Bus bus;
     private PolicyBuilder builder;
+    private PolicyRegistry registry;
     private List<PolicyProvider> policyProviders;
 
     private Map<BindingOperationInfo, ClientPolicyInfo> clientInfo 
         = new ConcurrentHashMap<BindingOperationInfo, ClientPolicyInfo>();
 
-    public PolicyEngine() {
-        this(null);
-    }
-    public PolicyEngine(BusExtensionRegistrar registrar) {
-        if (null != registrar) {
-            registrar.registerExtension(this, PolicyEngine.class);
-            bus = registrar.getBus();
-        }
+    public Class getRegistrationType() {
+        return PolicyEngine.class;
     }
     
     public void setBus(Bus b) {
@@ -84,9 +80,21 @@
     public PolicyBuilder getBuilder() {
         return builder;
     }
+    
+    public void setRegistry(PolicyRegistry r) {
+        registry = r;
+    }
+    
+    public PolicyRegistry getRegistry() {
+        return registry;
+    }
         
     @PostConstruct
     void init() {
+        if (null == registry) {
+            registry = new PolicyRegistryImpl();
+        }
+        
         if (null == builder && null != bus) {
             builder = new PolicyBuilder();
             builder.setAssertionBuilderRegistry(bus.getExtension(AssertionBuilderRegistry.class));
@@ -98,8 +106,9 @@
             // for external attachments
             Wsdl11AttachmentPolicyProvider wpp = new Wsdl11AttachmentPolicyProvider();
             wpp.setBuilder(builder);
+            wpp.setRegistry(registry);
             policyProviders = Collections.singletonList((PolicyProvider)wpp);
-        }    
+        } 
     }
     
     @PostConstruct

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Fri Feb  9 10:13:13 2007
@@ -23,29 +23,25 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.extension.BusExtensionRegistrar;
-import org.apache.cxf.extension.RegistryExtensionImpl;
+import org.apache.cxf.extension.BusExtension;
+import org.apache.cxf.extension.RegistryImpl;
 
 /**
  * 
  */
 public class PolicyInterceptorProviderRegistryImpl 
-    extends RegistryExtensionImpl<QName, PolicyInterceptorProvider> 
-    implements PolicyInterceptorProviderRegistry {
+    extends RegistryImpl<QName, PolicyInterceptorProvider> 
+    implements PolicyInterceptorProviderRegistry, BusExtension {
 
     public PolicyInterceptorProviderRegistryImpl() {
         this(null);
     }
 
-    public PolicyInterceptorProviderRegistryImpl(BusExtensionRegistrar registrar) {
-        this(registrar, null);
-    }
-    
-    public PolicyInterceptorProviderRegistryImpl(BusExtensionRegistrar registrar, 
-                                        Map<QName, PolicyInterceptorProvider> interceptors) {
+    public PolicyInterceptorProviderRegistryImpl(Map<QName, PolicyInterceptorProvider> interceptors) {
         super(interceptors);
-        if (null != registrar) {
-            registrar.registerExtension(this, PolicyInterceptorProviderRegistry.class);
-        }
     }    
+
+    public Class getRegistrationType() {
+        return PolicyInterceptorProviderRegistry.class;
+    }
 }

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyRegistryImpl.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyRegistryImpl.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyRegistryImpl.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,47 @@
+/**
+ * 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.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyRegistry;
+
+/**
+ * 
+ */
+public class PolicyRegistryImpl implements PolicyRegistry {
+
+    private Map<String, Policy> reg = new ConcurrentHashMap<String, Policy>();
+    
+    public Policy lookup(String key) {
+        return reg.get(key);
+    }
+
+    public void register(String key, Policy policy) {
+        reg.put(key, policy);        
+    }
+
+    public void remove(String key) {
+        reg.remove(key);
+    }
+
+}

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

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

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=505397&r1=505396&r2=505397
==============================================================================
--- 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 Fri Feb  9 10:13:13 2007
@@ -19,13 +19,23 @@
 
 package org.apache.cxf.ws.policy;
 
+import java.util.List;
+
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.ws.policy.builders.primitive.NestedPrimitiveAssertion;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyOperator;
 
 /**
  * 
  */
 public final class PolicyUtils {
 
+    private static final String INDENT = "  ";
+    
     private PolicyUtils() {
     }
 
@@ -38,5 +48,68 @@
     public static boolean isRequestor(Message message) {
         Boolean requestor = (Boolean)message.get(Message.REQUESTOR_ROLE);
         return requestor != null && requestor.booleanValue();
+    }
+    
+    public static void printPolicyComponent(PolicyComponent pc) {
+        StringBuffer buf = new StringBuffer();
+        printPolicyComponent(pc, buf, 0);
+        System.out.println(buf.toString());
+    }
+    
+    private static void printPolicyComponent(PolicyComponent pc, StringBuffer buf, int level) {
+        indent(buf, level);
+        buf.append("type: ");
+        buf.append(typeToString(pc.getType()));
+        if (Constants.TYPE_ASSERTION == pc.getType()) {
+            buf.append(" ");
+            buf.append(((Assertion)pc).getName());
+            if (((Assertion)pc).isOptional()) {
+                buf.append(" (optional)");
+            }
+            nl(buf);
+            if (pc instanceof NestedPrimitiveAssertion) {
+                PolicyComponent nested = ((NestedPrimitiveAssertion)pc).getNested();
+                level++;
+                printPolicyComponent(nested, buf, level);
+                level--;                
+            }
+        } else {
+            level++;
+            List<PolicyComponent> children = CastUtils.cast(((PolicyOperator)pc).getPolicyComponents(),
+                PolicyComponent.class);
+            nl(buf);
+            for (PolicyComponent child : children) {
+                printPolicyComponent(child, buf, level);
+            }
+            level--;
+        }
+    }
+    
+    private static void indent(StringBuffer buf, int level) {
+        for (int i = 0; i < level; i++) {
+            buf.append(INDENT);
+        }
+    }
+    
+    private static void nl(StringBuffer buf) {
+        buf.append(System.getProperty("line.separator"));
+    }
+    
+    private static String typeToString(short type) {
+        switch(type) {
+        case Constants.TYPE_ASSERTION:
+            return "Assertion";
+        case Constants.TYPE_ALL:
+            return "All";
+        case Constants.TYPE_EXACTLYONE:
+            return "ExactlyOne";
+        case Constants.TYPE_POLICY:
+            return "Policy";
+        case Constants.TYPE_POLICY_REF:
+            return "PolicyReference";
+        default:
+            break;
+        }
+        return "";
     }
 }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Fri Feb  9 10:13:13 2007
@@ -50,6 +50,7 @@
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyReference;
+import org.apache.neethi.PolicyRegistry;
 
 /**
  * PolicyAttachmentManager provides methods to retrieve element policies and
@@ -60,6 +61,7 @@
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(Wsdl11AttachmentPolicyProvider.class);
     
     private PolicyBuilder builder;
+    private PolicyRegistry registry;
     private Map<DescriptionInfo, Map<String, Policy>> resolved = 
         new HashMap<DescriptionInfo, Map<String, Policy>>();
     
@@ -68,6 +70,10 @@
         builder = b;
     }
     
+    public void setRegistry(PolicyRegistry r) {
+        registry = r;
+    }
+    
     public Policy getEffectivePolicy(ServiceInfo si) {
         return getElementPolicy(si);
     }
@@ -166,15 +172,15 @@
         
         for (UnknownExtensibilityElement e : extensions) {
             Policy p = null;
-            if (PolicyConstants.getPolicyQName().equals(e.getElementType())) {
+            if (PolicyConstants.getPolicyElementQName().equals(e.getElementType())) {
                 p = builder.getPolicy(e.getElement());
 
-            } else if (PolicyConstants.getPolicyReferenceQName().equals(e.getElementType())) {
+            } else if (PolicyConstants.getPolicyReferenceElementQName().equals(e.getElementType())) {
                 PolicyReference ref = builder.getPolicyReference(e.getElement());
                 if (null != ref) {
                     p = resolveReference(ref, di);
                     if (null == p) {
-                        throw new PolicyException(new Message("REMOTE_POLICY_RESOLUTION_NOT_SUPPORTED_EXC", 
+                        throw new PolicyException(new Message("UNRESOLVED_POLICY_REEFERENCE_EXC", 
                                                               BUNDLE, ref.getURI()));
                     }
                 }
@@ -193,8 +199,19 @@
         if (isExternal(ref)) {
             return resolveExternal(ref);
         }
-  
-        return resolveLocal(uri.substring(1), di);
+
+        // Resolve the reference now that we have access to the wsdl and
+        // store the referenced policy in the registry using a *qualified* key
+        // so that later on the policy reference can be normalised with the help
+        // of the registry. 
+        
+        Policy p = resolveLocal(uri.substring(1), di);
+        if (null != p) {
+            ref.setURI(di.getBaseURI() + uri);
+            registry.register(ref.getURI(), p);
+        }
+        
+        return p;
     }
 
     Policy resolveLocal(String uri, DescriptionInfo description) {
@@ -213,7 +230,7 @@
         List<UnknownExtensibilityElement> extensions = 
             description.getExtensors(UnknownExtensibilityElement.class);
         for (UnknownExtensibilityElement e : extensions) {
-            if (PolicyConstants.getPolicyQName().equals(e.getElementType())) {
+            if (PolicyConstants.getPolicyElementQName().equals(e.getElementType())) {
                 Policy p = builder.getPolicy(e.getElement());
                 policyMap.put(p.getId(), p);
                 if (uri.equals(p.getId())) {

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/Messages.properties?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/Messages.properties Fri Feb  9 10:13:13 2007
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+UNEXPECTED_CHILD_ELEMENT_EXC = Expected exactly one child element of type {0}.
\ No newline at end of file

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

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

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

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertion.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertion.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertion.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,109 @@
+/**
+ * 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.builders.primitive;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.PolicyException;
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+
+/**
+ * Implementation of an assertion that required exactly one (possibly empty) child element
+ * of type Policy (as does for examples the wsam:Addressing assertion).
+ * 
+ */
+public class NestedPrimitiveAssertion extends PrimitiveAssertion {
+
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(NestedPrimitiveAssertion.class);    
+    private Policy nested;
+    
+    protected NestedPrimitiveAssertion(QName name, boolean optional) {
+        super(name, optional);
+    }
+    
+    public NestedPrimitiveAssertion(Element elem, PolicyBuilder builder) {
+        super(elem);
+        
+        // expect exactly one child element of type Policy
+       
+        Element policyElem = null;
+        for (Node nd = elem.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
+            if (Node.ELEMENT_NODE == nd.getNodeType()) {
+                QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
+                if (PolicyConstants.getPolicyElementQName().equals(qn)
+                    && null == policyElem) {
+                    policyElem = (Element)nd;
+                } else {
+                    throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
+                                                          PolicyConstants.getPolicyElementQName()));
+                }                
+            }
+        }
+        if (null == policyElem) {
+            throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
+                                                  PolicyConstants.getPolicyElementQName()));
+        }
+        
+        nested = builder.getPolicy(policyElem);  
+    }
+    
+    public PolicyComponent normalize() {
+        Policy normalisedNested = (Policy)nested.normalize(true);
+        
+        Policy p = new Policy();
+        ExactlyOne ea = new ExactlyOne();
+        p.addPolicyComponent(ea);
+        if (isOptional()) {
+            ea.addPolicyComponent(new All());
+        }
+        // for all alternatives in normalised nested policy
+        Iterator alternatives = normalisedNested.getAlternatives();
+        while (alternatives.hasNext()) {
+            All all = new All();
+            all.addPolicyComponent(super.cloneMandatory());
+            List<Assertion> alternative = CastUtils.cast((List)alternatives.next(), Assertion.class);
+            NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(getName(), false);
+            a.nested = new Policy();
+            a.nested.addPolicyComponents(alternative);
+            ea.addPolicyComponent(all);            
+        } 
+        return p;      
+    } 
+    
+    public Policy getNested() {
+        return nested;
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertionBuilder.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/NestedPrimitiveAssertionBuilder.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,42 @@
+/**
+ * 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.builders.primitive;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.neethi.Assertion;
+
+public class NestedPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {
+
+    private PolicyEngine engine;
+    
+    public void setPolicyEngine(PolicyEngine e) {
+        engine = e;
+    }
+    
+    @Override
+    public Assertion build(Element elem) {
+        return new NestedPrimitiveAssertion(elem, engine.getBuilder());      
+    }
+    
+    
+
+}

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

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

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertion.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertion.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertion.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,109 @@
+/**
+ * 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.builders.primitive;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+
+/**
+ * 
+ */
+public class PrimitiveAssertion implements Assertion {
+    
+    protected QName name;
+    protected boolean optional;
+    
+    public PrimitiveAssertion() {
+        this((QName)null);
+    }
+    
+    public PrimitiveAssertion(QName n) {
+        this(n, false);
+    }
+    
+    public PrimitiveAssertion(QName n, boolean o) {
+        name = n;
+        optional = o;
+    }
+    
+    public PrimitiveAssertion(Element element) {
+        name = new QName(element.getNamespaceURI(), element.getLocalName());
+        Attr attribute = element.getAttributeNodeNS(PolicyConstants.getNamespaceURI(), 
+                                              PolicyConstants.getOptionalAttrLocalName());
+        if (attribute != null) {
+            optional = Boolean.valueOf(attribute.getValue());
+        }
+    }
+
+    public boolean equal(PolicyComponent policyComponent) {
+        if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
+            return false;
+        }
+        return getName().equals(((Assertion)policyComponent).getName());
+    }
+
+    public short getType() {
+        return Constants.TYPE_ASSERTION;
+    }
+
+    public QName getName() {
+        return name;
+    }
+
+    public boolean isOptional() {
+        return optional;
+    }
+
+    public PolicyComponent normalize() {
+        if (isOptional()) {
+            Policy policy = new Policy();
+            ExactlyOne exactlyOne = new ExactlyOne();
+
+            All all = new All();
+            all.addPolicyComponent(cloneMandatory());
+            exactlyOne.addPolicyComponent(all);
+            exactlyOne.addPolicyComponent(new All());
+            policy.addPolicyComponent(exactlyOne);
+
+            return policy;
+        }
+
+        return cloneMandatory();
+    }
+
+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+    }
+    
+    protected Assertion cloneMandatory() {
+        return new PrimitiveAssertion(name, false);
+    }
+}

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

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

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertionBuilder.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/primitive/PrimitiveAssertionBuilder.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,47 @@
+/**
+ * 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.builders.primitive;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.neethi.Assertion;
+
+public class PrimitiveAssertionBuilder implements AssertionBuilder {
+
+    private Collection<QName> knownElements = new ArrayList<QName>();
+    
+    public Assertion build(Element element) {
+        return new PrimitiveAssertion(element);
+    }
+
+    public Collection<QName> getKnownElements() {
+        return knownElements;
+    }
+    
+    public void setKnownElements(Collection<QName> k) {
+        knownElements = k;
+    }
+}

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

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

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java?view=diff&rev=505397&r1=505396&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XMLPrimitiveAssertionBuilder.java Fri Feb  9 10:13:13 2007
@@ -19,25 +19,14 @@
 
 package org.apache.cxf.ws.policy.builders.xml;
 
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.namespace.QName;
-
 import org.w3c.dom.Element;
 
-import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.builders.primitive.PrimitiveAssertionBuilder;
 import org.apache.neethi.Assertion;
 
-public class XMLPrimitiveAssertionBuilder implements AssertionBuilder {
-
-    private Collection<QName> knownElements = new ArrayList<QName>();
-    
+public class XMLPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {
+ 
     public Assertion build(Element element) {
-        return new XmlPrimtiveAssertion(element);
-    }
-
-    public Collection<QName> getKnownElements() {
-        return knownElements;
+        return new XmlPrimitiveAssertion(element);
     }
 }

Copied: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimitiveAssertion.java (from r504813, incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimitiveAssertion.java?view=diff&rev=505397&p1=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java&r1=504813&p2=incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimitiveAssertion.java&r2=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimtiveAssertion.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builders/xml/XmlPrimitiveAssertion.java Fri Feb  9 10:13:13 2007
@@ -19,18 +19,11 @@
 
 package org.apache.cxf.ws.policy.builders.xml;
 
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 
-import org.apache.neethi.All;
+import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.builders.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;
 
 
@@ -39,35 +32,17 @@
  * that simply wraps the underlying xml element.
  * 
  */
-public class XmlPrimtiveAssertion implements Assertion {
-
-    Element element;
+public class XmlPrimitiveAssertion extends PrimitiveAssertion {
 
-    boolean isOptional;
+    private Element element;
 
     /**
      * Constructs a XmlPrimitiveAssertion from an xml element.
      * 
      * @param element the xml element
      */
-    public XmlPrimtiveAssertion(Element e) {
-        setValue(e);
-        setOptionality(e);
-    }
-
-    /**
-     * Returns the QName of the wrapped Element.
-     */
-    public QName getName() {
-        return (element != null) ? new QName(element.getNamespaceURI(), element.getLocalName()) : null;
-    }
-
-    /**
-     * Sets the wrapped xml element.
-     * 
-     * @param element the element to be wrapped
-     */
-    public final void setValue(Element e) {
+    public XmlPrimitiveAssertion(Element e) {
+        super(e);
         element = e;
     }
 
@@ -80,39 +55,6 @@
         return element;
     }
 
-    /**
-     * Returns <tt>true</tt> if the wrapped element that is assumed to be an
-     * assertion, is optional.
-     */
-    public boolean isOptional() {
-        return isOptional;
-    }
-
-    /**
-     * Returns the partial normalized version of the wrapped element, that is
-     * assumed to be an assertion.
-     */
-    public PolicyComponent normalize() {
-        if (isOptional) {
-            Policy policy = new Policy();
-            ExactlyOne exactlyOne = new ExactlyOne();
-
-            All all = new All();
-            Element e = (Element)element.cloneNode(true);
-
-            e.removeAttributeNode(e.getAttributeNodeNS(Constants.Q_ELEM_OPTIONAL_ATTR.getNamespaceURI(),
-                                                       Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart()));
-            all.addPolicyComponent(new XmlPrimtiveAssertion(e));
-            exactlyOne.addPolicyComponent(all);
-
-            exactlyOne.addPolicyComponent(new All());
-            policy.addPolicyComponent(exactlyOne);
-
-            return policy;
-        }
-
-        return this;
-    }
 
     /**
      * Throws an UnsupportedOperationException since an assertion of an unknown
@@ -121,42 +63,13 @@
     public PolicyComponent normalize(boolean isDeep) {
         throw new UnsupportedOperationException();
     }
-
-    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        // TODO
-        /*
-        if (element != null) {
-            element.serialize(writer);
-
-        } else {
-            throw new RuntimeException("Wrapped Element is not set");
+    
+    protected Assertion cloneMandatory() {
+        Element e = (Element)element.cloneNode(true);
+        if (isOptional()) {
+            e.removeAttributeNode(e.getAttributeNodeNS(PolicyConstants.getNamespaceURI(), 
+                                                   PolicyConstants.getOptionalAttrLocalName()));
         }
-        */
-    }
-
-    /**
-     * Returns Constants.TYPE_ASSERTION
-     */
-    public short getType() {
-        return Constants.TYPE_ASSERTION;
-    }
-
-    private void setOptionality(Element e) {
-        Attr attribute = e.getAttributeNodeNS(Constants.Q_ELEM_OPTIONAL_ATTR.getNamespaceURI(), 
-                                                    Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart());
-        if (attribute != null) {
-            this.isOptional = Boolean.valueOf(attribute.getValue());
-            
-        } else {
-            this.isOptional = false;
-        }
-    }
-
-    public boolean equal(PolicyComponent policyComponent) {
-        if (policyComponent.getType() != Constants.TYPE_ASSERTION) {
-            return false;
-        }
-
-        return getName().equals(((Assertion)policyComponent).getName());
+        return new XmlPrimitiveAssertion(e);        
     }
 }

Added: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/util/PolicyComparator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/util/PolicyComparator.java?view=auto&rev=505397
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/util/PolicyComparator.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/util/PolicyComparator.java Fri Feb  9 10:13:13 2007
@@ -0,0 +1,134 @@
+/**
+ * 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.util;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+
+public final class PolicyComparator {
+    
+    private PolicyComparator() {
+    }
+    
+    /**
+     * Returns <tt>true</tt> if the two policies have the same semantics
+     * 
+     * @param arg1 a Policy
+     * @param arg2 another Policy
+     * @return <tt>true</tt> iff both policies have the same semantics
+     */
+    public static boolean compare(Policy arg1, Policy arg2) {   
+        boolean result = compare(arg1.getPolicyComponents(), arg2.getPolicyComponents());
+        
+        return result;
+    }
+
+    /**
+     * Returns <tt>true</tt> if the two PolicyComponents have the same
+     * semantics.
+     * 
+     * @param arg1 a PolicyComponent
+     * @param arg2 another PolicyComponent
+     * @return <tt>true</tt> iff both PolicyComponents have the same semantics
+     */
+    public static boolean compare(PolicyComponent arg1, PolicyComponent arg2) {
+        
+        // support parameterised assertion implementations
+        /*
+        if (!arg1.getClass().equals(arg2.getClass())) {
+            return false;
+        }
+        */
+
+        if (arg1 instanceof Policy) {
+            return compare((Policy) arg1, (Policy) arg2);
+
+        } else if (arg1 instanceof All) {
+            return compare((All) arg1, (All) arg2);
+
+        } else if (arg1 instanceof ExactlyOne) {
+            return compare((ExactlyOne) arg1, (ExactlyOne) arg2);
+
+        } else if (arg1 instanceof Assertion) {
+            return compare((Assertion) arg1, (Assertion) arg2);
+
+        } else {
+            // TODO should I throw an exception ..
+        }
+        
+        return false;
+        
+    }
+
+    public static boolean compare(All arg1, All arg2) {
+        return compare(arg1.getPolicyComponents(), arg2.getPolicyComponents());
+    }
+
+    public static boolean compare(ExactlyOne arg1, ExactlyOne arg2) {
+        return compare(arg1.getPolicyComponents(), arg2.getPolicyComponents());
+    }
+
+    public static boolean compare(Assertion arg1, Assertion arg2) {
+        // we have equal in the assertion interface so use it
+        return arg1.equal(arg2);
+        /*
+        if (!(arg1.getName().equals(arg2.getName()))) {
+            return false;
+        }
+        return true;
+        */
+    }
+
+    private static boolean compare(List arg1, List arg2) {
+        if (arg1.size() != arg2.size()) {
+            return false;
+        }
+
+        Iterator iterator = arg1.iterator();
+        PolicyComponent assertion1;
+
+        while (iterator.hasNext()) {
+            assertion1 = (PolicyComponent) iterator.next();
+
+            Iterator iterator2 = arg2.iterator();
+            boolean match = false;
+            PolicyComponent assertion2;
+
+            while (iterator2.hasNext()) {
+                assertion2 = (PolicyComponent) iterator2.next();
+                if (compare(assertion1, assertion2)) {
+                    match = true;
+                    break;
+                }
+            }
+
+            if (!match) {
+                return false;
+            }
+        }
+        return true;
+    }
+}



Mime
View raw message