cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r502587 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/extension/ api/src/main/java/org/apache/cxf/ws/policy/ common/common/src/main/java/org/apache/cxf/configuration/spring/ common/common/src/test/java/org/apache/cxf/configura...
Date Fri, 02 Feb 2007 12:18:26 GMT
Author: andreasmyth
Date: Fri Feb  2 04:18:25 2007
New Revision: 502587

URL: http://svn.apache.org/viewvc?view=rev&rev=502587
Log:
[JIRA CXF-375] WS-Policy framework APIs. 
AssertionBuilders and PolicyInterceptorProviders managed by a variant of SpringBeanMap in which entries are keyed by QName. 
Replaced Bus type data member in AssertionBuilderRegistry and @Resource annotated getters/setters by use of BusExtensionRegistrar as constructor parameter.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtensionRegistrar.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/Assertor.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProvider.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java   (with props)
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java   (with props)
    incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java   (with props)
    incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java   (with props)
    incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java   (with props)
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistry.java
    incubator/cxf/trunk/rt/pom.xml
    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/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/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtensionRegistrar.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtensionRegistrar.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtensionRegistrar.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/BusExtensionRegistrar.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,49 @@
+/**
+ * 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;
+
+import org.apache.cxf.Bus;
+
+
+
+/**
+ * Helper class to be used as constructor argument for classes that want to be
+ * registered as bus extensions. It avoids a @Resource annotated data member of type Bus
+ * in the extension class and a @PostConstruct annotated method in which the extension
+ * registration takes place.
+ */
+public class BusExtensionRegistrar {
+   
+    private Bus bus;    
+    
+    public void setBus(Bus b) {
+        bus = b;
+    }
+
+    public Bus getBus() {
+        return bus;
+    }
+
+    public <T> void registerExtension(T extension, Class<T> extensionType) {
+        if (null != bus) {
+            bus.setExtension(extension, extensionType);
+        }
+    }
+}

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

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

Added: 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/RegistryExtension.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtension.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,48 @@
+/**
+ * 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 RegistryExtension<K, T> {
+    
+    /**
+     * Registers an object of type T with this registry. 
+     *  
+     * @param k the key under which rto register the object
+     * @param t the object to register
+     */
+    void register(K k, T t);
+
+    /**
+     * Unregisters the object stored under the given key from this registry.
+     *  
+     * @param k the key 
+     */
+    void unregister(K k);
+
+    /**
+     * Returns the object stored under the given key.
+     * @param k the  key
+     * @return the object stored under the key
+     */
+    T get(K k);
+}

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

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

Added: 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/RegistryExtensionImpl.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryExtensionImpl.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,61 @@
+/**
+ * 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;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 
+ */
+public class RegistryExtensionImpl<K, T> implements RegistryExtension<K, T> {
+    
+    protected final Map<K, T> entries;
+    
+    protected RegistryExtensionImpl() {
+        this(null);
+    }
+    
+    protected RegistryExtensionImpl(Map<K, T> e) {
+        if (null == e) {
+            e = new ConcurrentHashMap<K, T>();
+        } else if (!(e instanceof ConcurrentHashMap)) {
+            e = new ConcurrentHashMap<K, T>(e);
+        }
+        entries = e;
+    }
+    
+
+    public void register(K k, T t) {
+        entries.put(k, t);
+    }
+
+    public void unregister(K k) {
+        entries.remove(k);
+    }
+
+    public T get(K k) {
+        return  entries.get(k);
+    }
+
+    
+    
+    
+}

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

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

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=502587&r1=502586&r2=502587
==============================================================================
--- 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  2 04:18:25 2007
@@ -19,19 +19,11 @@
 
 package org.apache.cxf.ws.policy;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.extension.RegistryExtension;
 import org.apache.neethi.Assertion;
 
 
@@ -39,73 +31,13 @@
  * AssertionBuilderRegistry is used to manage AssertionBuilders and
  * create Assertion objects from given xml elements.
  */
-public class AssertionBuilderRegistry {
-
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AssertionBuilderRegistry.class);
-
-    private Bus bus;
-    private Map<QName, AssertionBuilder> builders 
-        = new HashMap<QName, AssertionBuilder>();
+public interface AssertionBuilderRegistry extends RegistryExtension<QName, AssertionBuilder> {
     
-    public AssertionBuilderRegistry() {
-    }
-
-    public Bus getBus() {
-        return bus;
-    }
-
-    @Resource
-    public void setBus(Bus b) {
-        bus = b;
-    }
-    
-    @PostConstruct
-    public void register() {
-        if (null != bus) {
-            bus.setExtension(this, AssertionBuilderRegistry.class);
-        }
-    }
-
-    /**
-     * Registers an AssertionBuilder with a specified QName. 
-     *  
-     * @param key the QName that the AssertionBuilder understands.
-     * @param builder the AssertionBuilder that can build an Assertion from
-     * an element of the type specified by the QName.
-     */
-    public void registerBuilder(QName key, AssertionBuilder builder) {
-        builders.put(key, builder);
-    }
-
     /**
      * Returns an assertion that is built using the specified xml element.
      * 
      * @param element the element from which to build an Assertion.
      * @return an Assertion that is built using the specified element.
      */
-    public Assertion build(Element element) {
-
-        AssertionBuilder builder;
-
-        QName qname = new QName(element.getNamespaceURI(), element.getLocalName());
-        builder = (AssertionBuilder) builders.get(qname);
-        
-        if (null == builder) {
-            throw new PolicyException(new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString()));
-        }
-
-        return builder.build(element);
-        
-    }
-    
-    /**
-     * Returns an AssertionBuilder that can build an Assertion for an xml element with
-     * the specified type.
-     * 
-     * @param qname the type for which an assertion builder is requested
-     * @return an AssertionBuilder that understands the type
-     */
-    public AssertionBuilder getBuilder(QName qname) {
-        return builders.get(qname);
-    }
+    Assertion build(Element element);
 }

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/Assertor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/Assertor.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/Assertor.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/Assertor.java Fri Feb  2 04:18:25 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;
+
+import org.apache.neethi.Assertion;
+
+/**
+ * API used in the WS-Policy framework to check if the condition specified by the given
+ * Assertion object is met.
+ */
+public interface Assertor {
+    
+    boolean asserts(Assertion a);
+}

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

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

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProvider.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProvider.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProvider.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,39 @@
+/**
+ * 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.InterceptorProvider;
+
+/**
+ * 
+ */
+public interface PolicyInterceptorProvider extends InterceptorProvider {
+    /**
+     * Returns a collection of QNames describing the xml schema types of the assertions that
+     * this interceptor implements.
+     * 
+     * @return collection of QNames of known assertion types
+     */
+    Collection<QName> getAssertionTypes();
+}

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

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

Added: 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=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,33 @@
+/**
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.cxf.extension.RegistryExtension;
+
+
+/**
+ * InterceptorProviderRegistry is used to manage InterceptorProviders that provide
+ * assertion domain specific interceptors.
+ */
+public interface PolicyInterceptorProviderRegistry 
+    extends RegistryExtension<QName, PolicyInterceptorProvider> {
+}

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

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

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,278 @@
+/**
+ * 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.configuration.spring;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.Mergeable;
+import org.springframework.beans.PropertyValue;
+import org.springframework.beans.factory.BeanInitializationException;
+import org.springframework.beans.factory.BeanIsAbstractException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanReference;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ConfigurableApplicationContext;
+
+public class SpringBeanQNameMap<V> implements ApplicationContextAware, InitializingBean, Map<QName, V> {
+    private ApplicationContext context;
+    private Class<?> type;
+    private String idsProperty;
+    private Map<QName, String> idToBeanName = new ConcurrentHashMap<QName, String>();
+    private Map<QName, V> putStore = new ConcurrentHashMap<QName, V>();
+
+    public void setApplicationContext(ApplicationContext ctx) throws BeansException {
+        this.context = ctx;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        processBeans(context);
+    }
+
+    private void processBeans(ApplicationContext beanFactory) {
+        if (beanFactory == null) {
+            return;
+        }
+
+        String[] beanNames = beanFactory.getBeanNamesForType(type);
+
+        ConfigurableApplicationContext ctxt = (ConfigurableApplicationContext)beanFactory;
+
+        // Take any bean name or alias that has a web service annotation
+        for (int i = 0; i < beanNames.length; i++) {
+
+            BeanDefinition def = ctxt.getBeanFactory().getBeanDefinition(beanNames[i]);
+
+            if (!def.isSingleton() || def.isAbstract()) {
+                continue;
+            }
+
+            try {
+                Collection<?> ids = null;
+                PropertyValue pv = def.getPropertyValues().getPropertyValue(idsProperty);
+                
+                if (pv != null) {
+                    Object value = pv.getValue();
+                    if (!(value instanceof Collection)) {
+                        throw new RuntimeException("The property " + idsProperty + " must be a collection!");
+                    }
+
+                    if (value instanceof Mergeable) {
+                        if (!((Mergeable)value).isMergeEnabled()) {
+                            ids = (Collection<?>)value;
+                        }
+                    } else {
+                        ids = (Collection<?>)value;
+                    }
+                } 
+              
+                // if values are not legal keys (for lazy-init bean definitions id values may be
+                // BeanDefinitionHolders), load the bean and get its id values instead
+                // for BeanReference type values, simply resolve reference
+                //  
+                if (null != ids) {
+                    Collection<Object> checked = new ArrayList<Object>(ids.size());
+                    for (Object id : ids) {
+                        if (id instanceof QName) {
+                            checked.add(id);
+                        } else if (id instanceof BeanReference) {
+                            BeanReference br = (BeanReference)id;
+                            Object refId = context.getBean(br.getBeanName());
+                            checked.add(refId);
+                        } else {
+                            break;
+                        }
+                    }
+                    if (checked.size() < ids.size()) {
+                        ids = null;
+                    } else {
+                        ids = checked;
+                    }
+                } 
+                if (ids == null) {
+                    ids = getIds(ctxt.getBean(beanNames[i]));
+                    if (ids == null) {
+                        continue;
+                    }
+                }
+                
+                for (Object id : ids) {
+                    QName key = (QName)id;
+                    idToBeanName.put(key, beanNames[i]);
+                }
+            } catch (BeanIsAbstractException e) {
+                // The bean is abstract, we won't be doing anything with it.
+                continue;
+            }
+        }
+
+        processBeans(ctxt.getParent());
+    }
+
+    private Collection<QName> getIds(Object bean) {
+        try {
+            PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(bean.getClass(), idsProperty);
+            Method method = pd.getReadMethod();
+            Collection<QName> c = CastUtils.cast((Collection<?>)method.invoke(bean, new Object[0]),
+                QName.class);
+
+            return c;
+        } catch (IllegalArgumentException e) {
+            throw new BeanInitializationException("Could not retrieve ids.", e);
+        } catch (IllegalAccessException e) {
+            throw new BeanInitializationException("Could not access id getter.", e);
+        } catch (InvocationTargetException e) {
+            throw new BeanInitializationException("Could not invoke id getter.", e);
+        } catch (SecurityException e) {
+            throw new BeanInitializationException("Could not invoke id getter.", e);
+        }
+    }
+
+    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
+        return bean;
+    }
+
+    public Class<?> getType() {
+        return type;
+    }
+
+    public void setType(Class<?> type) {
+        this.type = type;
+    }
+
+    public String getIdsProperty() {
+        return idsProperty;
+    }
+
+    public void setIdsProperty(String idsProperty) {
+        this.idsProperty = idsProperty;
+    }
+
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean containsKey(Object key) {
+        return idToBeanName.containsKey(key) || putStore.containsKey(key);
+    }
+
+    public boolean containsValue(Object arg0) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Set<java.util.Map.Entry<QName, V>> entrySet() {
+        Set<Map.Entry<QName, V>> entries = new HashSet<Map.Entry<QName, V>>();
+        for (QName k : keySet()) {
+            entries.add(new Entry<V>(this, k));
+        }
+        return entries;
+    }
+
+    @SuppressWarnings("unchecked")
+    public V get(Object key) {
+        String name = idToBeanName.get(key);
+        if (name != null) {
+            return (V)(context.getBean(name));
+        } else {
+            return putStore.get(key);
+        }
+    }
+
+    public boolean isEmpty() {
+        return idToBeanName.isEmpty() && putStore.isEmpty();
+    }
+
+    public Set<QName> keySet() {
+        Set<QName> keys = new HashSet<QName>();
+        keys.addAll(idToBeanName.keySet());
+        keys.addAll(putStore.keySet());
+        return keys;
+    }
+
+    public V put(QName key, V value) {
+        // Make sure we don't take the key from Spring any more
+        idToBeanName.remove(key);
+        return putStore.put(key, value);
+    }
+
+    public void putAll(Map<? extends QName, ? extends V> m) {
+        putStore.putAll(m);
+    }
+
+    public V remove(Object key) {
+        V v = get(key);
+        if (v != null) {
+            idToBeanName.remove(key);
+        } else {
+            v = putStore.get(key);
+        }
+
+        return v;
+    }
+
+    public int size() {
+        return idToBeanName.size() + putStore.size();
+    }
+
+    public Collection<V> values() {
+        List<V> values = new ArrayList<V>();
+        values.addAll(putStore.values());
+        for (QName id : idToBeanName.keySet()) {
+            values.add(get(id));
+        }
+        return values;
+    }
+    
+    public static class Entry<V> implements Map.Entry<QName, V> {
+        private SpringBeanQNameMap<V> map;
+        private QName key;
+
+        public Entry(SpringBeanQNameMap<V> map, QName key) {
+            this.map = map;
+            this.key = key;
+        }
+        
+        public QName getKey() {
+            return key;
+        }
+
+        public V getValue() {
+            return map.get(key);
+        }
+
+        public V setValue(V value) {
+            return map.put(key, value);
+        }
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java (added)
+++ incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,69 @@
+/**
+ * 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.configuration.spring;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+public class PersonQNameImpl implements Person {
+    private static int loadCount;
+    private static List<Person> loaded = new ArrayList<Person>();
+    private Collection<QName> ids;
+    private String id;
+    
+    public PersonQNameImpl() {
+        ids = new ArrayList<QName>();
+        ids.add(new QName("http://cxf.apache.org", "anonymous"));
+        loadCount++;
+        loaded.add(this);
+        id = "Person " + loadCount;
+    }
+    
+    public Collection<QName> getIds() {
+        return ids;
+    }
+
+    public void setIds(Collection<QName> ids) {
+        this.ids = ids;
+    }
+
+    public static int getLoadCount() {
+        return loadCount;
+    }
+
+    public static List<Person> getLoaded() {
+        return loaded;
+    }
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        buf.append(id);
+        buf.append(" [");
+        for (QName qn : ids) {
+            buf.append(qn);
+            buf.append(",");
+        }
+        buf.setLength(buf.length() - 1);
+        buf.append("]");
+        return buf.toString();
+    }
+}

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/PersonQNameImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java (added)
+++ incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,80 @@
+/**
+ * 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.configuration.spring;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringBeanQNameMapTest extends TestCase {
+
+    @SuppressWarnings("unchecked")
+    public void testPersons() {
+        ClassPathXmlApplicationContext context = 
+            new ClassPathXmlApplicationContext("org/apache/cxf/configuration/spring/beanQNameMap.xml");
+
+        Map<QName, Person> beans = (Map<QName, Person>)context.getBean("committers");
+        assertNotNull(beans);
+
+        assertEquals(2, PersonQNameImpl.getLoadCount());
+        assertEquals(4, beans.keySet().size());
+
+        QName qn1 = new QName("http://cxf.apache.org", "anonymous");
+        Person p1 = beans.get(qn1);
+        assertNotNull(p1);
+        assertEquals(2, PersonQNameImpl.getLoadCount());
+
+        QName qn2 = new QName("http://cxf.apache.org", "myself");
+        Person p2 = beans.get(qn2);
+        assertNotNull(p2);
+        assertEquals(3, PersonQNameImpl.getLoadCount());
+
+        QName qn3 = new QName("http://cxf.apache.org", "other");
+        Person p3 = beans.get(qn3);
+        assertNotNull(p3);
+        assertEquals(3, PersonQNameImpl.getLoadCount());
+         
+        QName qn4 = new QName("http://x.y.z", "other");
+        Person p = beans.get(qn4);
+        assertNotNull(p);
+        assertSame(p3, p);
+        assertEquals(3, PersonQNameImpl.getLoadCount());
+        
+        Collection<Person> values = beans.values();
+        assertEquals(4, values.size());
+
+        Set<Entry<QName, Person>> entries = beans.entrySet();
+        assertEquals(4, entries.size());
+        
+        QName qn5 = new QName("http://a.b.c", "foo");
+        Person p4 = new PersonQNameImpl();
+        beans.put(qn5, p4);
+       
+        p = beans.get(qn5);
+        assertEquals(p1, beans.get(qn1));
+    }
+
+}

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml (added)
+++ incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml Fri Feb  2 04:18:25 2007
@@ -0,0 +1,60 @@
+<?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 id="committers" class="org.apache.cxf.configuration.spring.SpringBeanQNameMap">
+      <property name="idsProperty" value="ids"/>
+      <property name="type" value="org.apache.cxf.configuration.spring.Person"/>
+    </bean>
+    
+    <bean id="anonymous" class="org.apache.cxf.configuration.spring.PersonQNameImpl"/>
+
+    <bean id="myKey" class="javax.xml.namespace.QName">
+      <constructor-arg value="http://cxf.apache.org"/>
+      <constructor-arg value="myself"/>
+    </bean>
+
+    <bean id="myself" class="org.apache.cxf.configuration.spring.PersonQNameImpl" lazy-init="true">
+      <property name="ids">
+        <list>
+          <ref bean="myKey"/> 
+        </list>
+      </property>
+    </bean>
+
+    <bean id="multi" class="org.apache.cxf.configuration.spring.PersonQNameImpl" lazy-init="true">
+      <property name="ids">
+        <list>
+          <bean class="javax.xml.namespace.QName">
+              <constructor-arg value="http://cxf.apache.org"/>
+              <constructor-arg value="other"/>
+          </bean>
+          <bean class="javax.xml.namespace.QName">
+              <constructor-arg value="http://x.y.z"/>
+              <constructor-arg value="other"/>
+          </bean>
+        </list>
+      </property>
+    </bean>
+
+</beans>

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/beanQNameMap.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/pom.xml?view=diff&rev=502587&r1=502586&r2=502587
==============================================================================
--- incubator/cxf/trunk/rt/pom.xml (original)
+++ incubator/cxf/trunk/rt/pom.xml Fri Feb  2 04:18:25 2007
@@ -47,8 +47,8 @@
         <module>transports/http</module>
         <module>transports/http2</module>
         <module>transports/jms</module>
-        <module>ws/addr</module>
         <module>ws/policy</module>
+        <module>ws/addr</module>
         <module>ws/rm</module>
     </modules>
 </project>

Added: 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=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,73 @@
+/**
+ * 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.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.BusExtensionRegistrar;
+import org.apache.cxf.extension.RegistryExtensionImpl;
+import org.apache.neethi.Assertion;
+
+/**
+ * 
+ */
+public class AssertionBuilderRegistryImpl extends RegistryExtensionImpl<QName, AssertionBuilder> 
+    implements AssertionBuilderRegistry {
+    
+    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) {
+        super(builders);
+        if (null != registrar) {
+            registrar.registerExtension(this, 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);
+        
+    }
+}

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

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

Added: 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=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Fri Feb  2 04:18:25 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.policy;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.extension.BusExtensionRegistrar;
+import org.apache.cxf.extension.RegistryExtensionImpl;
+
+/**
+ * 
+ */
+public class PolicyInterceptorProviderRegistryImpl 
+    extends RegistryExtensionImpl<QName, PolicyInterceptorProvider> 
+    implements PolicyInterceptorProviderRegistry {
+
+    public PolicyInterceptorProviderRegistryImpl() {
+        this(null);
+    }
+
+    public PolicyInterceptorProviderRegistryImpl(BusExtensionRegistrar registrar) {
+        this(registrar, null);
+    }
+    
+    public PolicyInterceptorProviderRegistryImpl(BusExtensionRegistrar registrar, 
+                                        Map<QName, PolicyInterceptorProvider> interceptors) {
+        super(interceptors);
+        if (null != registrar) {
+            registrar.registerExtension(this, PolicyInterceptorProviderRegistry.class);
+        }
+    }    
+}

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

Propchange: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.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=502587&r1=502586&r2=502587
==============================================================================
--- 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  2 04:18:25 2007
@@ -31,15 +31,13 @@
 
 public class XMLPrimitiveAssertionBuilder implements AssertionBuilder {
 
-    private Collection<QName> known = new ArrayList<QName>();
+    private Collection<QName> knownElements = new ArrayList<QName>();
     
     public Assertion build(Element element) {
         return new XmlPrimtiveAssertion(element);
     }
 
     public Collection<QName> getKnownElements() {
-        return known;
+        return knownElements;
     }
-    
-    
 }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml?view=diff&rev=502587&r1=502586&r2=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml Fri Feb  2 04:18:25 2007
@@ -22,8 +22,32 @@
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
-    <bean id="org.apache.cxf.ws.policy.AssertionBuilderRegistry" class="org.apache.cxf.ws.policy.AssertionBuilderRegistry">
-        <property name="bus" ref="cxf"/>
+    <bean id="org.apache.cxf.ws.policy.AssertionBuilderRegistry" class="org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl">
+        <constructor-arg>
+            <bean class="org.apache.cxf.extension.BusExtensionRegistrar">
+              <property name="bus" ref="cxf"/>
+            </bean>
+        </constructor-arg>
+        <constructor-arg>
+            <bean class="org.apache.cxf.configuration.spring.SpringBeanQNameMap">
+              <property name="type" value="org.apache.cxf.ws.policy.AssertionBuilder"/>
+              <property name="idsProperty" value="knownElements"/>
+            </bean>
+        </constructor-arg>
+    </bean>
+    
+    <bean id="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry" class="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistryImpl">
+        <constructor-arg>
+            <bean class="org.apache.cxf.extension.BusExtensionRegistrar">
+              <property name="bus" ref="cxf"/>
+            </bean>
+        </constructor-arg>
+        <constructor-arg>
+            <bean class="org.apache.cxf.configuration.spring.SpringBeanQNameMap">
+              <property name="type" value="org.apache.cxf.ws.policy.PolicyInterceptorProvider"/>
+              <property name="idsProperty" value="assertionTypes"/>
+            </bean>
+        </constructor-arg>
     </bean>
     
 </beans>

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java?view=diff&rev=502587&r1=502586&r2=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java Fri Feb  2 04:18:25 2007
@@ -34,15 +34,15 @@
     public void testNormalise() throws Exception {
         
         PolicyBuilder builder = new PolicyBuilder();
-        AssertionBuilderRegistry abr = new AssertionBuilderRegistry();
+        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder.setAssertionBuilderRegistry(abr);
         AssertionBuilder ab = new XMLPrimitiveAssertionBuilder(); 
-        abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityToken"), ab);
-        abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityHeader"), ab);
-        abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Integrity"), ab);
-        abr.registerBuilder(new QName("http://sample.org/Assertions", "A"), ab);
-        abr.registerBuilder(new QName("http://sample.org/Assertions", "B"), ab);
-        abr.registerBuilder(new QName("http://sample.org/Assertions", "C"), ab);
+        abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityToken"), ab);
+        abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityHeader"), ab);
+        abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Integrity"), ab);
+        abr.register(new QName("http://sample.org/Assertions", "A"), ab);
+        abr.register(new QName("http://sample.org/Assertions", "B"), ab);
+        abr.register(new QName("http://sample.org/Assertions", "C"), ab);
         
         int n = 26;
         for (int i = 1; i < n; i++) {

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java?view=diff&rev=502587&r1=502586&r2=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyBuilderTest.java Fri Feb  2 04:18:25 2007
@@ -39,12 +39,12 @@
     
     public void setUp() {
         builder = new PolicyBuilder();
-        AssertionBuilderRegistry abr = new AssertionBuilderRegistry();
+        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder.setAssertionBuilderRegistry(abr);
         AssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
-        abr.registerBuilder(new QName("http://sample.org/Assertions", "A"), ab);
-        abr.registerBuilder(new QName("http://sample.org/Assertions", "B"), ab);
-        abr.registerBuilder(new QName("http://sample.org/Assertions", "C"), ab);
+        abr.register(new QName("http://sample.org/Assertions", "A"), ab);
+        abr.register(new QName("http://sample.org/Assertions", "B"), ab);
+        abr.register(new QName("http://sample.org/Assertions", "C"), ab);
     }
     public void testGetPolicy() throws Exception {
         String name = "/samples/test25.xml";

Added: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyExtensionsTest.java Fri Feb  2 04:18:25 2007
@@ -0,0 +1,100 @@
+/**
+ * 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.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
+import org.apache.neethi.Assertion;
+
+/**
+ * 
+ */
+public class PolicyExtensionsTest extends TestCase {
+
+    private static final QName KNOWN = new QName("http://cxf.apache.org/test/policy", "known");
+    private static final QName UNKNOWN = new QName("http://cxf.apache.org/test/policy", "unknown");
+    
+    public void testExtensions() {
+        Bus bus = null;
+        try {
+            bus = new SpringBusFactory().createBus("/org/apache/cxf/ws/policy/policy-bus.xml", false);
+
+            AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
+            assertNotNull(abr);
+            AssertionBuilder ab = abr.get(KNOWN);
+            assertNotNull(ab);
+            ab = abr.get(UNKNOWN);
+            assertNull(ab);
+
+            PolicyInterceptorProviderRegistry pipr = bus
+                .getExtension(PolicyInterceptorProviderRegistry.class);
+            assertNotNull(pipr);
+            PolicyInterceptorProvider pip = pipr.get(KNOWN);
+            assertNotNull(pip);
+            pip = pipr.get(UNKNOWN);
+            assertNull(pip);
+        } finally {
+            if (null != bus) {
+                bus.shutdown(true);
+                BusFactory.setDefaultBus(null);
+            }
+        }
+    }
+    
+    public static class TestAssertionBuilder implements AssertionBuilder {
+        
+        Collection<QName> knownElements = new ArrayList<QName>();
+
+        public TestAssertionBuilder() {
+            knownElements.add(KNOWN);
+        }
+        public Assertion build(Element arg0) {
+            return null;
+        }
+
+        public Collection<QName> getKnownElements() {
+            return knownElements;
+        }        
+    }
+    
+    public static class TestPolicyInterceptorProvider extends AbstractAttributedInterceptorProvider 
+        implements PolicyInterceptorProvider {
+        Collection<QName> assertionTypes = new ArrayList<QName>();
+
+        public TestPolicyInterceptorProvider() {
+            assertionTypes.add(KNOWN);
+        }
+
+        public Collection<QName> getAssertionTypes() {
+            return assertionTypes;
+        } 
+    }
+}

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

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

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java?view=diff&rev=502587&r1=502586&r2=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java Fri Feb  2 04:18:25 2007
@@ -31,24 +31,28 @@
 import junit.framework.TestSuite;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.binding.BindingFactoryManager;
 import org.apache.cxf.helpers.CastUtils;
 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.transport.DestinationFactoryManager;
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
+import org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl;
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.cxf.ws.policy.builders.xml.XMLPrimitiveAssertionBuilder;
 import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.WSDLManagerImpl;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.util.PolicyComparator;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 
 /**
  * 
@@ -57,17 +61,22 @@
 
     private static final String NAMESPACE_URI = "http://apache.org/cxf/calculator";
     private static final QName OPERATION_NAME = new QName(NAMESPACE_URI, "add");
-    private static Bus bus;
+    // private static Bus bus;
     private static ServiceInfo[] services;
     private static EndpointInfo[] endpoints;
     private Wsdl11AttachmentPolicyProvider app; 
     
+    
     public static Test suite() {
         TestSuite suite = new TestSuite(Wsdl11AttachmentPolicyProviderTest.class);
         TestSetup wrapper = new TestSetup(suite) {
 
             protected void setUp() {
-                oneTimeSetUp();
+                try {
+                    oneTimeSetUp();
+                } catch (Exception ex) {
+                    ex.printStackTrace();
+                }
             }
 
             protected void tearDown() {
@@ -78,7 +87,40 @@
         return wrapper;
     }
     
-    public static void oneTimeSetUp() {
+    public static void oneTimeSetUp() throws Exception {
+        
+        IMocksControl control = EasyMock.createNiceControl();
+        Bus bus = control.createMock(Bus.class);
+        WSDLManager manager = new WSDLManagerImpl();       
+        WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
+        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
+        EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(dfm).anyTimes();
+        EasyMock.expect(dfm.getDestinationFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
+        BindingFactoryManager bfm = control.createMock(BindingFactoryManager.class);
+        EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bfm).anyTimes();
+        EasyMock.expect(bfm.getBindingFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
+        control.replay();
+        
+        int n = 17;
+        services = new ServiceInfo[n];
+        endpoints = new EndpointInfo[n];
+        for (int i = 0; i < n; i++) {
+            String resourceName = "/attachment/wsdl11/test" + i + ".wsdl";
+            URL url = Wsdl11AttachmentPolicyProviderTest.class.getResource(resourceName);       
+            try {
+                services[i] = builder.buildService(manager.getDefinition(url)).get(0);
+            } catch (WSDLException ex) {
+                ex.printStackTrace();
+                fail("Failed to build service from resource " + resourceName);
+            }
+            assertNotNull(services[i]);
+            endpoints[i] = services[i].getEndpoints().iterator().next();
+            assertNotNull(endpoints[i]);
+        }
+        
+        control.verify();
+        
+        /*
         BusFactory.setDefaultBus(null);
         bus = new SpringBusFactory().createBus();
         WSDLManager manager = bus.getExtension(WSDLManager.class);
@@ -99,23 +141,27 @@
             endpoints[i] = services[i].getEndpoints().iterator().next();
             assertNotNull(endpoints[i]);
         }
+        */
     }
     
     public static void oneTimeTearDown() {
+        /*
         bus.shutdown(true);
         BusFactory.setDefaultBus(null);
+        */
         endpoints = null;
         services = null;
         
     }
     
     public void setUp() {
-        AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
-        assertNotNull(abr);
+        // AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
+        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
+        // assertNotNull(abr);
         AssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
-        abr.registerBuilder(new QName("http://cxf.apache.org/test/assertions", "A"), ab);
-        abr.registerBuilder(new QName("http://cxf.apache.org/test/assertions", "B"), ab);
-        abr.registerBuilder(new QName("http://cxf.apache.org/test/assertions", "C"), ab);
+        abr.register(new QName("http://cxf.apache.org/test/assertions", "A"), ab);
+        abr.register(new QName("http://cxf.apache.org/test/assertions", "B"), ab);
+        abr.register(new QName("http://cxf.apache.org/test/assertions", "C"), ab);
         
         PolicyBuilder pb = new PolicyBuilder(); 
         pb.setAssertionBuilderRegistry(abr);

Added: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml?view=auto&rev=502587
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml (added)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml Fri Feb  2 04:18:25 2007
@@ -0,0 +1,35 @@
+<?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"
+       xmlns:wsrm-mgmt="http://cxf.apache.org/ws/rm/manager"
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean class="org.apache.cxf.ws.policy.PolicyExtensionsTest$TestAssertionBuilder"/>
+    <bean class="org.apache.cxf.ws.policy.PolicyExtensionsTest$TestPolicyInterceptorProvider"/>
+
+    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
+    <import resource="../../../../../META-INF/cxf/cxf-extension-policy.xml"/>  
+
+</beans>
\ No newline at end of file

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

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

Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message