cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r807750 [1/2] - in /cxf/trunk: api/src/main/java/org/apache/cxf/extension/ api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/wsdl/ common/common/src/main/java/org/apache/cxf/common/injection/ common/common/src/mai...
Date Tue, 25 Aug 2009 18:24:37 GMT
Author: dkulp
Date: Tue Aug 25 18:24:33 2009
New Revision: 807750

URL: http://svn.apache.org/viewvc?rev=807750&view=rev
Log:
Start performance increase phase 1: make as much as possible
lazy-init=true, reduce JSR250 processing

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderLoader.java
      - copied, changed from r807748, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderLoader.java
      - copied, changed from r807748, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
    cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSDLExtensionLoader.java
      - copied, changed from r807748, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java
    cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractSpringBeanMap.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java
    cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java
    cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java
    cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/cxf-extension-xerces-xsd-validation.xml
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java
    cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientLifeCycleManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/phase/PhaseManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
    cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextResourceResolver.java
    cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-extension-jaxws.xml
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java
    cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
    cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/ServiceModelPolicyProvider.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptorProvider.java
    cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProviderTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java
    cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/rmmanager.xml
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java
    cxf/trunk/rt/ws/security/src/main/resources/META-INF/cxf/cxf-extension-ws-security.xml

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/extension/RegistryImpl.java Tue Aug 25 18:24:33 2009
@@ -52,7 +52,7 @@
     }
 
     public T get(K k) {
-        return  entries.get(k);
+        return entries.get(k);
     }
 
     

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderLoader.java (from r807748, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderLoader.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderLoader.java&p1=cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java&r1=807748&r2=807750&rev=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderLoader.java Tue Aug 25 18:24:33 2009
@@ -17,25 +17,13 @@
  * under the License.
  */
 
-package org.apache.cxf.common.injection;
+package org.apache.cxf.ws.policy;
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
 
 /**
- * Marker annotation to let our JSR250 Processor know
- * not to bother examining the class for annotations
- * as it's know not to have any 
+ * Marker interface for objects that would load and register
+ * additional AssertionBuilders when loaded.
  */
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NoJSR250Annotations {
-    
-    /**
-     * If these fields are null, it will go ahead and do JSR250 processing
-     * as it assumes the values were not set via a constructor
-     */
-    String[] unlessNull() default { };
+public interface AssertionBuilderLoader {
+
 }

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderLoader.java (from r807748, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderLoader.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderLoader.java&p1=cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java&r1=807748&r2=807750&rev=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderLoader.java Tue Aug 25 18:24:33 2009
@@ -17,25 +17,12 @@
  * under the License.
  */
 
-package org.apache.cxf.common.injection;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+package org.apache.cxf.ws.policy;
 
 /**
- * Marker annotation to let our JSR250 Processor know
- * not to bother examining the class for annotations
- * as it's know not to have any 
+ * Marker interface for objects that would load and register
+ * additional PolicyInterceptorProviders when loaded.
  */
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NoJSR250Annotations {
-    
-    /**
-     * If these fields are null, it will go ahead and do JSR250 processing
-     * as it assumes the values were not set via a constructor
-     */
-    String[] unlessNull() default { };
+public interface PolicyInterceptorProviderLoader {
+
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java Tue Aug 25 18:24:33 2009
@@ -164,8 +164,7 @@
                     registry.registerDeserializer(parentType, elementType, helper); 
                     registry.registerSerializer(parentType, elementType, helper);                         
                     registry.mapExtensionTypes(parentType, elementType, cls);
-                    
-                    helper.getJAXBContext();
+
                     found = true;
                 }
             }

Copied: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSDLExtensionLoader.java (from r807748, cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSDLExtensionLoader.java?p2=cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSDLExtensionLoader.java&p1=cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java&r1=807748&r2=807750&rev=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSDLExtensionLoader.java Tue Aug 25 18:24:33 2009
@@ -17,25 +17,13 @@
  * under the License.
  */
 
-package org.apache.cxf.common.injection;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+package org.apache.cxf.wsdl;
 
 /**
- * Marker annotation to let our JSR250 Processor know
- * not to bother examining the class for annotations
- * as it's know not to have any 
+ * Marker interface to mark beans in the config that register
+ * addition WSDLExtensors so the WSDLManager can load the 
+ * additional extensors on demand
  */
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NoJSR250Annotations {
-    
-    /**
-     * If these fields are null, it will go ahead and do JSR250 processing
-     * as it assumes the values were not set via a constructor
-     */
-    String[] unlessNull() default { };
+public interface WSDLExtensionLoader {
+
 }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java Tue Aug 25 18:24:33 2009
@@ -35,7 +35,12 @@
     
     /**
      * If these fields are null, it will go ahead and do JSR250 processing
-     * as it assumes the values were not set via a constructor
+     * as it assumes the values were not set via a constructor.
+     * 
+     * Be careful with this.  If the field is injected with a value via @Resource,
+     * when the other annotations are processed (@PostConstruct), the field is then
+     * not-null so they won't be run.   The best bet is to make sure the @Resource
+     * setter methods handle any registration or similar
      */
     String[] unlessNull() default { };
 }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractSpringBeanMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractSpringBeanMap.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractSpringBeanMap.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractSpringBeanMap.java Tue Aug 25 18:24:33 2009
@@ -43,6 +43,7 @@
     protected ApplicationContext context;
     protected Class<?> type;
     protected String idsProperty;
+    protected String staticFieldName;
     protected Map<X, List<String>> idToBeanName = new ConcurrentHashMap<X, List<String>>();
     protected Map<X, V> putStore = new ConcurrentHashMap<X, V>();
 
@@ -107,6 +108,14 @@
         this.idsProperty = idsProperty;
     }
 
+    public String getStaticFieldName() {
+        return staticFieldName;
+    }
+
+    public void setStaticFieldName(String staticFieldName) {
+        this.staticFieldName = staticFieldName;
+    }
+
     public void clear() {
         throw new UnsupportedOperationException();
     }
@@ -214,7 +223,7 @@
         }
     }
     
-    private class SpringBeanMapWrapper implements Map<X, V> {
+    private class SpringBeanMapWrapper extends ConcurrentHashMap<X, V> implements Map<X, V> {
 
         public void clear() {
             AbstractSpringBeanMap.this.clear();

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java Tue Aug 25 18:24:33 2009
@@ -18,19 +18,26 @@
  */
 package org.apache.cxf.configuration.spring;
 
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.helpers.CastUtils;
 import org.springframework.beans.Mergeable;
 import org.springframework.beans.PropertyValue;
 import org.springframework.beans.factory.BeanIsAbstractException;
 import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
 import org.springframework.beans.factory.config.BeanReference;
+import org.springframework.beans.factory.config.ConstructorArgumentValues;
+import org.springframework.beans.factory.config.TypedStringValue;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
 
+@NoJSR250Annotations
 public class SpringBeanQNameMap<V> 
     extends AbstractSpringBeanMap<QName, V> {
 
@@ -70,7 +77,20 @@
                         ids = (Collection<?>)value;
                     }
                 } 
-              
+                if (ids == null && staticFieldName != null) {
+                    Class<?> cls = context.getType(beanNames[i]);
+                    try {
+                        Field f = cls.getDeclaredField(staticFieldName);
+                        f.setAccessible(true);
+                        Collection<QName> sids = CastUtils.cast((Collection<?>)f.get(null));
+                        if (sids != null) {
+                            ids = new ArrayList<QName>(sids);
+                        }
+                    } catch (Exception ex) {
+                        //ignore, fall through
+                    }
+                }
+
                 // 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
@@ -84,7 +104,29 @@
                             BeanReference br = (BeanReference)id;
                             Object refId = context.getBean(br.getBeanName());
                             checked.add(refId);
+                        } else if (id instanceof BeanDefinitionHolder) {
+                            BeanDefinitionHolder bdh = (BeanDefinitionHolder)id;
+                            if (QName.class.getName().equals(bdh.getBeanDefinition().getBeanClassName())) {
+                                try {
+                                    java.util.List l = bdh.getBeanDefinition().getConstructorArgumentValues()
+                                        .getGenericArgumentValues();
+                                    
+                                    ConstructorArgumentValues.ValueHolder v 
+                                        = (ConstructorArgumentValues.ValueHolder)l.get(0);
+                                    
+                                    TypedStringValue nss = (TypedStringValue)v.getValue();
+                                    v = (ConstructorArgumentValues.ValueHolder)l.get(1);
+                                    TypedStringValue ln = (TypedStringValue)v.getValue();
+                                    checked.add(new QName(nss.getValue(), ln.getValue()));
+                                } catch (Exception ex) {
+                                    //ignore
+                                    break;
+                                }
+                            } else {
+                                break;
+                            }
                         } else {
+                            
                             break;
                         }
                     }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java Tue Aug 25 18:24:33 2009
@@ -20,6 +20,7 @@
 package org.apache.cxf.resource;
 
 import java.io.InputStream;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -43,8 +44,8 @@
         addResourceResolver(resolver);
     }
     
-    public DefaultResourceManager(List<ResourceResolver> resolvers) {
-        registeredResolvers.addAll(resolvers);
+    public DefaultResourceManager(List<? extends ResourceResolver> resolvers) {
+        addResourceResolvers(resolvers);
     }
  
     public final <T> T resolveResource(String name, Class<T> type) { 
@@ -60,12 +61,16 @@
         return findResource(name, InputStream.class, true, registeredResolvers);
     } 
 
-
     public final void addResourceResolver(ResourceResolver resolver) { 
         if (!registeredResolvers.contains(resolver)) { 
             registeredResolvers.add(0, resolver);
         }
     } 
+    public final void addResourceResolvers(Collection<? extends ResourceResolver> resolvers) { 
+        for (ResourceResolver r : resolvers) {
+            addResourceResolver(r);
+        }
+    } 
 
     public final void removeResourceResolver(ResourceResolver resolver) { 
         if (registeredResolvers.contains(resolver)) { 

Modified: cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java (original)
+++ cxf/trunk/common/common/src/test/java/org/apache/cxf/configuration/spring/SpringBeanQNameMapTest.java Tue Aug 25 18:24:33 2009
@@ -42,18 +42,18 @@
                                                    .createMap());
         assertNotNull(beans);
 
-        assertEquals(2, PersonQNameImpl.getLoadCount());
+        assertEquals(1, 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());
+        assertEquals(1, PersonQNameImpl.getLoadCount());
 
         QName qn2 = new QName("http://cxf.apache.org", "myself");
         Person p2 = beans.get(qn2);
         assertNotNull(p2);
-        assertEquals(3, PersonQNameImpl.getLoadCount());
+        assertEquals(2, PersonQNameImpl.getLoadCount());
 
         QName qn3 = new QName("http://cxf.apache.org", "other");
         Person p3 = beans.get(qn3);

Modified: cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java (original)
+++ cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java Tue Aug 25 18:24:33 2009
@@ -22,13 +22,13 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.xml.transform.TransformerException;
 
 import org.w3c.dom.DOMErrorHandler;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.xmlschema.XmlSchemaValidationManager;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
@@ -37,19 +37,23 @@
 /**
  * 
  */
+@NoJSR250Annotations(unlessNull = "bus")
 public class XercesXsdValidationImpl implements XmlSchemaValidationManager {
     private static final Logger LOG = LogUtils.getL7dLogger(XercesXsdValidationImpl.class);
 
     private Bus bus;
     private XercesSchemaValidationUtils utils;
 
+    public XercesXsdValidationImpl() {
+    }
+    
+    public XercesXsdValidationImpl(Bus b) {
+        setBus(b);
+    }
+    
     @Resource
-    public void setBus(Bus b) {
+    public final void setBus(Bus b) {
         bus = b;
-    }
-
-    @PostConstruct
-    public void register() {
 
         try {
             utils = new XercesSchemaValidationUtils();

Modified: cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/cxf-extension-xerces-xsd-validation.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/cxf-extension-xerces-xsd-validation.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/cxf-extension-xerces-xsd-validation.xml (original)
+++ cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/cxf-extension-xerces-xsd-validation.xml Tue Aug 25 18:24:33 2009
@@ -23,8 +23,8 @@
 
 	<bean id="org.apache.cxf.xsdvalidation.XercesXsdValidationImpl"
 		class="org.apache.cxf.xsdvalidation.XercesXsdValidationImpl"
-		>
-		<property name="bus" ref="cxf"/>
+		lazy-init="true">
+		<constructor-arg ref="cxf"/>
 	</bean>
 
 </beans>

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java Tue Aug 25 18:24:33 2009
@@ -19,30 +19,27 @@
 
 package org.apache.cxf.binding.corba.wsdl;
 
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
 import javax.xml.bind.JAXBException;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.wsdl.JAXBExtensionHelper;
 import org.apache.cxf.wsdl.TExtensibilityElementImpl;
+import org.apache.cxf.wsdl.WSDLExtensionLoader;
 import org.apache.cxf.wsdl.WSDLManager;
 
 /**
  * 
  */
-public final class WSDLExtensionRegister {
+@NoJSR250Annotations
+public final class WSDLExtensionRegister implements WSDLExtensionLoader { 
     private static final String YOKO_NAMESPACE = "http://schemas.apache.org/yoko/bindings/corba";
-
-    Bus bus;
     
-    @Resource
-    public void setBus(Bus b) {
-        bus = b;
+    public WSDLExtensionRegister(Bus b) {
+        registerYokoCompatibleExtensors(b);
     }
     
-    @PostConstruct
-    void registerYokoCompatibleExtensors() {
+    void registerYokoCompatibleExtensors(Bus bus) {
         WSDLManager manager = bus.getExtension(WSDLManager.class);
         createCompatExtensor(manager, javax.wsdl.Binding.class,
                              org.apache.cxf.binding.corba.wsdl.BindingType.class);

Modified: cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml (original)
+++ cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml Tue Aug 25 18:24:33 2009
@@ -35,12 +35,13 @@
         </property>
         <property name="transportIds">
             <list>
-		<value>http://cxf.apache.org/bindings/corba</value>
-	        <value>http://schemas.apache.org/yoko/bindings/corba</value>
+				<value>http://cxf.apache.org/bindings/corba</value>
+	        	<value>http://schemas.apache.org/yoko/bindings/corba</value>
             </list>
         </property>
     </bean>
     
-    <bean class="org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister" lazy-init="false"/>
-
+    <bean class="org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister" lazy-init="true">
+    	<constructor-arg ref="cxf"/>
+	</bean>
 </beans>

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java Tue Aug 25 18:24:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.bus.resource;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -26,6 +27,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.resource.DefaultResourceManager;
 import org.apache.cxf.resource.ObjectTypeResolver;
@@ -41,10 +43,14 @@
     public ResourceManagerImpl() {
     }
 
-    public ResourceManagerImpl(List<ResourceResolver> r) {
+    public ResourceManagerImpl(List<? extends ResourceResolver> r) {
         super(r);
     }
-    public ResourceManagerImpl(Bus b, List<ResourceResolver> r) {
+    public ResourceManagerImpl(Bus b) {
+        super();
+        setBus(b);
+    }
+    public ResourceManagerImpl(Bus b, List<? extends ResourceResolver> r) {
         super(r);
         setBus(b);
     }
@@ -60,17 +66,30 @@
      * Set the list of resolvers for this resource manager.
      * @param resolvers
      */
-    public void setResolvers(List<ResourceResolver> resolvers) {
+    public final void setResolvers(List<? extends ResourceResolver> resolvers) {
         registeredResolvers.clear();
         registeredResolvers.addAll(resolvers);
     }
     
+    public final void addResolvers(Collection<? extends ResourceResolver> resolvers) {
+        super.addResourceResolvers(resolvers);
+    }
+    public final void addResolver(ResourceResolver resolver) {
+        super.addResourceResolver(resolver);
+    }
+    
     @Resource
     public final void setBus(Bus b) {
-        bus = b;
-        super.addResourceResolver(new ObjectTypeResolver(bus));
-        if (null != bus) {
-            bus.setExtension(this, ResourceManager.class);
+        if (bus != b) {
+            bus = b;
+            super.addResourceResolver(new ObjectTypeResolver(bus));
+            if (null != bus) {
+                bus.setExtension(this, ResourceManager.class);
+            }
+            ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
+            if (locator != null) {
+                this.addResolvers(locator.getBeansOfType(ResourceResolver.class));
+            }
         }
     }
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java Tue Aug 25 18:24:33 2009
@@ -39,6 +39,9 @@
     
     public BusApplicationContextResourceResolver() {
     }
+    public BusApplicationContextResourceResolver(ApplicationContext c) {
+        context = c;
+    }
     
 
     public InputStream getAsStream(String name) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java Tue Aug 25 18:24:33 2009
@@ -65,9 +65,14 @@
         if (resourceManager == null) {
             if (bean instanceof ResourceManager) {
                 resourceManager = (ResourceManager)bean;
+                resourceManager.addResourceResolver(new BusApplicationContextResourceResolver(context));
             } else {
                 Bus b = (Bus)context.getBean("cxf");
-                resourceManager = b.getExtension(ResourceManager.class);
+                ResourceManager m = b.getExtension(ResourceManager.class);
+                if (resourceManager == null && m != null) {
+                    resourceManager = m;
+                    resourceManager.addResourceResolver(new BusApplicationContextResourceResolver(context));
+                }
             }
         }
         return resourceManager;
@@ -89,11 +94,13 @@
         }
         if (bean != null 
             && injectable(bean, beanId)) {
-            //System.err.println("p :" + (++count) + ": " + bean.getClass().getName() + " " + beanId);
             new ResourceInjector(getResourceManager(bean)).inject(bean);
-        //} else if (bean != null) {
-            //System.err.println("np: " + (++count2) 
-            //                   + ": " + bean.getClass().getName() + " " + beanId);            
+            /*
+            System.err.println("p :" + (++count) + ": " + bean.getClass().getName() + " " + beanId);
+        } else if (bean != null) {
+            System.err.println("np: " + (++count2) 
+                               + ": " + bean.getClass().getName() + " " + beanId);
+            */
         }
         return bean;
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java Tue Aug 25 18:24:33 2009
@@ -39,7 +39,7 @@
 
     /** {@inheritDoc}*/
     public List<String> getBeanNamesOfType(Class<?> type) {
-        return Arrays.asList(context.getBeanNamesForType(type));
+        return Arrays.asList(context.getBeanNamesForType(type, false, true));
     }
 
     /** {@inheritDoc}*/
@@ -50,13 +50,15 @@
     /** {@inheritDoc}*/
     @SuppressWarnings("unchecked")
     public <T> Collection<? extends T> getBeansOfType(Class<T> type) {
-        return context.getBeansOfType(type).values();
+        return context.getBeansOfType(type, false, true).values();
     }
 
     @SuppressWarnings("unchecked")
     public <T> boolean loadBeansOfType(Class<T> type,
                                        BeanLoaderListener<T> listener) {
-        List<String> list = new ArrayList<String>(Arrays.asList(context.getBeanNamesForType(type)));
+        List<String> list = new ArrayList<String>(Arrays.asList(context.getBeanNamesForType(type, 
+                                                                                            false, 
+                                                                                            true)));
         Collections.reverse(list);
         for (String s : list) {
             Class<? extends T> c = context.getType(s);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientLifeCycleManagerImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientLifeCycleManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientLifeCycleManagerImpl.java Tue Aug 25 18:24:33 2009
@@ -22,8 +22,10 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.extension.BusExtension;
 
+@NoJSR250Annotations
 public class ClientLifeCycleManagerImpl implements ClientLifeCycleManager, BusExtension {
     
     private List<ClientLifeCycleListener> listeners = new ArrayList<ClientLifeCycleListener>(); 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java Tue Aug 25 18:24:33 2009
@@ -20,10 +20,13 @@
 package org.apache.cxf.endpoint;
 
 import java.util.List;
+
 import java.util.concurrent.CopyOnWriteArrayList;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.extension.BusExtension;
 
+@NoJSR250Annotations
 public class ServerLifeCycleManagerImpl implements ServerLifeCycleManager, BusExtension {
     
     private List<ServerLifeCycleListener> listeners = 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/phase/PhaseManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/phase/PhaseManagerImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/phase/PhaseManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/phase/PhaseManagerImpl.java Tue Aug 25 18:24:33 2009
@@ -21,9 +21,11 @@
 
 import java.util.SortedSet;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.util.SortedArraySet;
 import org.apache.cxf.extension.BusExtension;
 
+@NoJSR250Annotations
 public class PhaseManagerImpl implements PhaseManager, BusExtension {
 
     private SortedSet<Phase> inPhases;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java Tue Aug 25 18:24:33 2009
@@ -178,8 +178,8 @@
     }
     
     @Resource(name = "org.apache.cxf.workqueue.WorkQueueManager")
-    public void setManager(WorkQueueManagerImpl mgr) {
-        manager = mgr;
+    public void setManager(WorkQueueManager mgr) {
+        manager = (WorkQueueManagerImpl)mgr;
     }
     public WorkQueueManager getManager() {
         return manager;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Tue Aug 25 18:24:33 2009
@@ -55,8 +55,10 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.CacheMap;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.service.model.ServiceSchemaInfo;
 import org.apache.cxf.wsdl.JAXBExtensionHelper;
+import org.apache.cxf.wsdl.WSDLExtensionLoader;
 import org.apache.cxf.wsdl.WSDLManager;
 
 /**
@@ -111,14 +113,18 @@
     }
     public WSDLManagerImpl(Bus b) throws BusException {
         this();
-        bus = b;
+        setBus(b);
     }
     
     @Resource
-    public void setBus(Bus b) {
+    public final void setBus(Bus b) {
         bus = b;
         if (null != bus) {
             bus.setExtension(this, WSDLManager.class);
+            ConfiguredBeanLocator loc = bus.getExtension(ConfiguredBeanLocator.class);
+            if (loc != null) {
+                loc.getBeansOfType(WSDLExtensionLoader.class);
+            }
         }
     }
 

Modified: cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Tue Aug 25 18:24:33 2009
@@ -42,13 +42,6 @@
     	class="org.apache.cxf.bus.resource.ResourceManagerImpl" 
     	lazy-init="true">
     	<constructor-arg ref="cxf"/>
-       	<constructor-arg>
-            <list>
-                <bean class="org.apache.cxf.resource.ClasspathResolver"/>
-                <bean class="org.apache.cxf.resource.ClassLoaderResolver"/>
-                <bean class="org.apache.cxf.bus.spring.BusApplicationContextResourceResolver"/>
-            </list>
-       </constructor-arg>
     </bean>
 
     <bean id="org.apache.cxf.configuration.Configurer" 

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextResourceResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextResourceResolver.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextResourceResolver.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextResourceResolver.java Tue Aug 25 18:24:33 2009
@@ -21,22 +21,29 @@
 
 import java.io.InputStream;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.resource.ResourceResolver;
 
-
+@NoJSR250Annotations(unlessNull = "bus")
 public class WebServiceContextResourceResolver implements ResourceResolver {
     
-    @Resource
     Bus bus;
+
+    public WebServiceContextResourceResolver() {
+    }
     
-    @PostConstruct
-    public void register() {
+    public WebServiceContextResourceResolver(Bus b) {
+        setBus(b);
+    }
+    
+    @Resource
+    public final void setBus(Bus b) {
+        bus = b;
         if (bus != null
             && bus.getExtension(ResourceManager.class) != null) {
             bus.getExtension(ResourceManager.class).addResourceResolver(this);

Modified: cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-extension-jaxws.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-extension-jaxws.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-extension-jaxws.xml (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/cxf/cxf-extension-jaxws.xml Tue Aug 25 18:24:33 2009
@@ -25,7 +25,9 @@
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
     <bean class="org.apache.cxf.jaxws.context.WebServiceContextResourceResolver" 
-	  id="org.apache.cxf.jaxws.context.WebServiceContextResourceResolver" lazy-init="false"/>
+	  id="org.apache.cxf.jaxws.context.WebServiceContextResourceResolver" lazy-init="true">
+	  <constructor-arg ref="cxf"/>
+	</bean>
     <bean class="org.apache.cxf.jaxws.context.WebServiceContextImpl" 
 	  id="org.apache.cxf.jaxws.context.WebServiceContextImpl" lazy-init="true"/>
     <alias name="org.apache.cxf.jaxws.context.WebServiceContextImpl" 

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java Tue Aug 25 18:24:33 2009
@@ -19,8 +19,13 @@
 
 package org.apache.cxf.transport.http.policy;
 
+import java.util.Collections;
+import java.util.List;
+
 import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
@@ -31,8 +36,11 @@
 /**
  * 
  */
+@NoJSR250Annotations
 public class HTTPClientAssertionBuilder extends JaxbAssertionBuilder<HTTPClientPolicy> {
- 
+    public static final List<QName> KNOWN_ELEMENTS 
+        = Collections.singletonList(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME);
+
     public HTTPClientAssertionBuilder() throws JAXBException {
         super(HTTPClientPolicy.class, PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME);     
     }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java Tue Aug 25 18:24:33 2009
@@ -19,8 +19,13 @@
 
 package org.apache.cxf.transport.http.policy;
 
+import java.util.Collections;
+import java.util.List;
+
 import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
@@ -31,8 +36,11 @@
 /**
  * 
  */
+@NoJSR250Annotations
 public class HTTPServerAssertionBuilder extends JaxbAssertionBuilder<HTTPServerPolicy> {
- 
+    public static final List<QName> KNOWN_ELEMENTS 
+        = Collections.singletonList(PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME);
+
     public HTTPServerAssertionBuilder() throws JAXBException {
         super(HTTPServerPolicy.class, PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME);        
     }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/NoOpPolicyInterceptorProvider.java Tue Aug 25 18:24:33 2009
@@ -24,6 +24,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
 
 /**
@@ -32,6 +33,7 @@
  * before the HTTPConduit becomes invoved (e.g. via a WSPolicyFeature
  * applied to the <jawx:client> bean).
  */
+@NoJSR250Annotations
 public class NoOpPolicyInterceptorProvider
     extends AbstractPolicyInterceptorProvider {
 

Modified: cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml (original)
+++ cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml Tue Aug 25 18:24:33 2009
@@ -24,11 +24,11 @@
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
     <bean class="org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder"
-	  id="org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder"/>
+	  id="org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder" lazy-init="true"/>
     <bean class="org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder"
-	  id="org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder"/>
+	  id="org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder" lazy-init="true"/>
     <bean class="org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider"
-          id="org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider"/>
+          id="org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider" lazy-init="true"/>
  
     
     

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java Tue Aug 25 18:24:33 2009
@@ -44,7 +44,7 @@
  */
 public class AddressingAssertionBuilder implements AssertionBuilder {
 
-    private static final Collection<QName> KNOWN = new ArrayList<QName>();
+    private static final Collection<QName> KNOWN_ELEMENTS = new ArrayList<QName>();
     private Bus bus;
     
     public AddressingAssertionBuilder(Bus b) {
@@ -52,12 +52,12 @@
     }
     
     static {
-        KNOWN.add(MetadataConstants.ADDRESSING_ASSERTION_QNAME);
-        KNOWN.add(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
-        KNOWN.add(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
-        KNOWN.add(MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705);
-        KNOWN.add(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
-        KNOWN.add(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
+        KNOWN_ELEMENTS.add(MetadataConstants.ADDRESSING_ASSERTION_QNAME);
+        KNOWN_ELEMENTS.add(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
+        KNOWN_ELEMENTS.add(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
+        KNOWN_ELEMENTS.add(MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705);
+        KNOWN_ELEMENTS.add(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
+        KNOWN_ELEMENTS.add(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
     }
     
     public PolicyAssertion build(Element elem) {
@@ -92,7 +92,7 @@
     }
 
     public Collection<QName> getKnownElements() {
-        return KNOWN;
+        return KNOWN_ELEMENTS;
     }
 
     public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {

Modified: cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml (original)
+++ cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/cxf-extension-addr.xml Tue Aug 25 18:24:33 2009
@@ -23,15 +23,18 @@
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
     <bean class="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder"
-	  id="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder">
+	  id="org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder" 
+	  lazy-init="true">
         <constructor-arg ref="cxf"/>
     </bean>
 
     <bean class="org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider"
-	  id="org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider"/>
+	  id="org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider"
+	  lazy-init="true"/>
  
     <bean id="org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder"
-        class="org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder">
+        class="org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder"
+        lazy-init="true">
         <property name="knownElements">
             <set>
                 <bean class="javax.xml.namespace.QName">

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java Tue Aug 25 18:24:33 2009
@@ -26,13 +26,17 @@
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
+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.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
@@ -41,6 +45,7 @@
 /**
  * 
  */
+@NoJSR250Annotations(unlessNull = "bus")
 public class AssertionBuilderRegistryImpl extends RegistryImpl<QName, AssertionBuilder> implements
     AssertionBuilderRegistry, BusExtension {
 
@@ -50,10 +55,16 @@
     private static final int IGNORED_CACHE_SIZE = 10;
     private boolean ignoreUnknownAssertions = true; 
     private List<QName> ignored = new ArrayList<QName>(IGNORED_CACHE_SIZE);
+    private Bus bus;
+    private boolean dynamicLoaded;
     
     public AssertionBuilderRegistryImpl() {
         super(null);
     }
+    public AssertionBuilderRegistryImpl(Bus b) {
+        super(null);
+        setBus(b);
+    }
 
     public AssertionBuilderRegistryImpl(Map<QName, AssertionBuilder> builders) {
         super(builders);
@@ -61,6 +72,17 @@
     public AssertionBuilderRegistryImpl(MapProvider<QName, AssertionBuilder> builders) {
         super(builders.createMap());
     }
+    public AssertionBuilderRegistryImpl(Bus b, MapProvider<QName, AssertionBuilder> builders) {
+        super(builders.createMap());
+        setBus(b);
+    }
+    @Resource
+    public final void setBus(Bus b) {
+        bus = b;
+        if (b != null) {
+            b.setExtension(this, AssertionBuilderRegistry.class);
+        }
+    }
 
     public Class<?> getRegistrationType() {
         return AssertionBuilderRegistry.class;
@@ -81,8 +103,18 @@
         ignoreUnknownAssertions = ignore;
     }
 
+    private synchronized void loadDynamic() {
+        if (!dynamicLoaded && bus != null) {
+            dynamicLoaded = true;
+            ConfiguredBeanLocator c = bus.getExtension(ConfiguredBeanLocator.class);
+            if (c != null) {
+                c.getBeansOfType(AssertionBuilderLoader.class);
+            }
+        }
+    }
     public PolicyAssertion build(Element element) {
-
+        loadDynamic();
+        
         AssertionBuilder builder;
 
         QName qname = new QName(element.getNamespaceURI(), element.getLocalName());

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyBuilderImpl.java Tue Aug 25 18:24:33 2009
@@ -35,6 +35,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.neethi.All;
@@ -50,6 +51,7 @@
  * provides methods to create Policy and PolicyReferenceObjects
  * from DOM elements, but also from an input stream etc.
  */
+@NoJSR250Annotations
 public class PolicyBuilderImpl implements PolicyBuilder, BusExtension {
     
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(PolicyBuilderImpl.class);

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Tue Aug 25 18:24:33 2009
@@ -23,11 +23,13 @@
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
-import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.factory.FactoryBeanListenerManager;
@@ -49,6 +51,7 @@
 /**
  * 
  */
+@NoJSR250Annotations(unlessNull = "bus")
 public class PolicyEngineImpl implements PolicyEngine, BusExtension {
     private static final Logger LOG = LogUtils.getL7dLogger(PolicyEngineImpl.class);
     
@@ -65,9 +68,9 @@
     
     private Bus bus;
     private PolicyRegistry registry;
-    private Collection<PolicyProvider> policyProviders = new CopyOnWriteArrayList<PolicyProvider>();
+    private Collection<PolicyProvider> policyProviders;
     private boolean enabled = true;
-    private boolean ignoreUnknownAssertions = true;
+    private Boolean ignoreUnknownAssertions;
     private boolean addedBusInterceptors;
     private AlternativeSelector alternativeSelector;
 
@@ -79,6 +82,10 @@
         enabled = en;
         init();
     }
+    public PolicyEngineImpl(Bus b) {
+        init();
+        setBus(b);        
+    }
 
     // configuration
 
@@ -86,8 +93,14 @@
         return enabled;
     }
 
-    public void setBus(Bus b) {
+    @Resource
+    public final void setBus(Bus b) {
         bus = b;
+        addBusInterceptors();
+        FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class);
+        if (fblm != null) {
+            fblm.addListener(new PolicyAnnotationListener());
+        }
     }
 
     public Bus getBus() {
@@ -98,7 +111,16 @@
         policyProviders = new CopyOnWriteArrayList<PolicyProvider>(p);
     }
    
-    public Collection<PolicyProvider> getPolicyProviders() {
+    public synchronized Collection<PolicyProvider> getPolicyProviders() {
+        if (policyProviders == null) {
+            policyProviders = new CopyOnWriteArrayList<PolicyProvider>();
+            if (bus != null) {
+                ConfiguredBeanLocator loc = bus.getExtension(ConfiguredBeanLocator.class);
+                if (loc != null) {
+                    loc.getBeansOfType(PolicyProvider.class);
+                }
+            }
+        }
         return policyProviders;
     }
 
@@ -119,7 +141,10 @@
         }
     }
 
-    public AlternativeSelector getAlternativeSelector() {    
+    public synchronized AlternativeSelector getAlternativeSelector() {  
+        if (alternativeSelector == null && enabled) {
+            alternativeSelector = new MinimalAlternativeSelector();
+        }
         return alternativeSelector;
     }
 
@@ -128,7 +153,7 @@
     }
 
     public boolean isIgnoreUnknownAssertions() {
-        return ignoreUnknownAssertions;
+        return ignoreUnknownAssertions == null ? true : ignoreUnknownAssertions;
     }
 
     public void setIgnoreUnknownAssertions(boolean ignore) {
@@ -292,14 +317,6 @@
         registry = new PolicyRegistryImpl();
     }
     
-    @PostConstruct
-    public synchronized void postConsruct() {
-        addBusInterceptors();
-        FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class);
-        if (fblm != null) {
-            fblm.addListener(new PolicyAnnotationListener());
-        }
-    }
 
 
     public synchronized void removeBusInterceptors() {
@@ -311,19 +328,16 @@
         addedBusInterceptors = false;
     }
 
-    public synchronized void addBusInterceptors() {
-    
-        if (null == alternativeSelector) {
-            alternativeSelector = new MinimalAlternativeSelector();
-        }
-    
+    public final synchronized void addBusInterceptors() {
         if (null == bus || !enabled) {
             return;
         }
     
-        AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
-        if (null != abr) {
-            abr.setIgnoreUnknownAssertions(ignoreUnknownAssertions);
+        if (ignoreUnknownAssertions != null) {
+            AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
+            if (null != abr) {
+                abr.setIgnoreUnknownAssertions(ignoreUnknownAssertions);
+            }
         }
 
         bus.getInInterceptors().add(PolicyInInterceptor.INSTANCE);

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Tue Aug 25 18:24:33 2009
@@ -24,8 +24,12 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
@@ -34,13 +38,21 @@
 /**
  * 
  */
+@NoJSR250Annotations(unlessNull = "bus")
 public class PolicyInterceptorProviderRegistryImpl 
     extends RegistryImpl<QName, PolicyInterceptorProvider> 
     implements PolicyInterceptorProviderRegistry, BusExtension {
 
+    private Bus bus;
+    private boolean dynamicLoaded;
+
     public PolicyInterceptorProviderRegistryImpl() {
         super(null);
     }
+    public PolicyInterceptorProviderRegistryImpl(Bus b) {
+        super(null);
+        setBus(b);
+    }
 
     public PolicyInterceptorProviderRegistryImpl(Map<QName, PolicyInterceptorProvider> interceptors) {
         super(interceptors);
@@ -48,7 +60,18 @@
     public PolicyInterceptorProviderRegistryImpl(MapProvider<QName, PolicyInterceptorProvider> interceptors) {
         super(interceptors.createMap());
     }    
-
+    public PolicyInterceptorProviderRegistryImpl(Bus b, 
+                                                 MapProvider<QName, PolicyInterceptorProvider> interceptors) {
+        super(interceptors.createMap());
+        setBus(b);
+    }    
+    @Resource
+    public final void setBus(Bus b) {
+        bus = b;
+        if (b != null) {
+            b.setExtension(this, PolicyInterceptorProviderRegistry.class);
+        }
+    }
     public void register(PolicyInterceptorProvider provider) {
         for (QName qn : provider.getAssertionTypes()) {
             super.register(qn, provider);
@@ -58,9 +81,18 @@
     public Class<?> getRegistrationType() {
         return PolicyInterceptorProviderRegistry.class;
     }
-    
+    private synchronized void loadDynamic() {
+        if (!dynamicLoaded && bus != null) {
+            dynamicLoaded = true;
+            ConfiguredBeanLocator c = bus.getExtension(ConfiguredBeanLocator.class);
+            if (c != null) {
+                c.getBeansOfType(PolicyInterceptorProviderLoader.class);
+            }
+        }
+    }
     public List<Interceptor> getInterceptors(Collection<PolicyAssertion> alternative, 
                                              boolean out, boolean fault) {
+        loadDynamic();
         List<Interceptor> interceptors = new ArrayList<Interceptor>();
         for (PolicyAssertion a : alternative) {
             if (a.isOptional()) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java Tue Aug 25 18:24:33 2009
@@ -21,8 +21,6 @@
 
 import java.util.ResourceBundle;
 
-import javax.annotation.PostConstruct;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
@@ -53,31 +51,29 @@
     }
     
     protected AbstractPolicyProvider(Bus b) {
-        bus = b;
+        setBus(b);
     }
     
-    public void setBus(Bus b) {
+    public final void setBus(Bus b) {
         bus = b;
+        if (null != bus) {
+            setBuilder(bus.getExtension(PolicyBuilder.class));
+            PolicyEngine pe = (PolicyEngine)bus.getExtension(PolicyEngine.class);
+            if (pe != null) {
+                setRegistry(pe.getRegistry());
+                ((PolicyEngineImpl)pe).getPolicyProviders().add(this);
+            }
+        }
     }
     
-    public void setBuilder(PolicyBuilder b) {
+    public final void setBuilder(PolicyBuilder b) {
         builder = b;
     }
     
-    public void setRegistry(PolicyRegistry r) {
+    public final void setRegistry(PolicyRegistry r) {
         registry = r;
     }  
     
-    @PostConstruct
-    public void init() {
-        if (null != bus) {
-            setBuilder(bus.getExtension(PolicyBuilder.class));
-            PolicyEngine pe = (PolicyEngine)bus.getExtension(PolicyEngine.class);
-            setRegistry(pe.getRegistry());
-            
-            ((PolicyEngineImpl)pe).getPolicyProviders().add(this);
-        }
-    }
     
     protected Policy resolveExternal(PolicyReference ref,  String baseURI) {
         Policy resolved = registry.lookup(ref.getURI());

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/ServiceModelPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/ServiceModelPolicyProvider.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/ServiceModelPolicyProvider.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/ServiceModelPolicyProvider.java Tue Aug 25 18:24:33 2009
@@ -20,6 +20,7 @@
 package org.apache.cxf.ws.policy.attachment;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -27,6 +28,7 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.neethi.Policy;
 
+@NoJSR250Annotations
 public class ServiceModelPolicyProvider extends AbstractPolicyProvider {
 
     public ServiceModelPolicyProvider(Bus b) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java Tue Aug 25 18:24:33 2009
@@ -33,6 +33,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
@@ -52,6 +53,7 @@
 /**
  * 
  */
+@NoJSR250Annotations
 public class ExternalAttachmentProvider extends AbstractPolicyProvider
     implements PolicyProvider {
     

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Tue Aug 25 18:24:33 2009
@@ -30,6 +30,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.AbstractDescriptionElement;
 import org.apache.cxf.service.model.BindingFaultInfo;
@@ -55,6 +56,7 @@
  * calculate effective policies based on the policy subject's scope.
  * 
  */
+@NoJSR250Annotations
 public class Wsdl11AttachmentPolicyProvider extends AbstractPolicyProvider 
     implements PolicyProvider {
 

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java Tue Aug 25 18:24:33 2009
@@ -35,9 +35,9 @@
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
 
 public class MTOMAssertionBuilder implements AssertionBuilder {
-    private static final Collection<QName> KNOWN = new ArrayList<QName>();
+    private static final Collection<QName> KNOWN_ELEMENTS = new ArrayList<QName>();
     static {
-        KNOWN.add(MetadataConstants.MTOM_ASSERTION_QNAME);
+        KNOWN_ELEMENTS.add(MetadataConstants.MTOM_ASSERTION_QNAME);
     }
     
     public PolicyAssertion build(Element elem) {
@@ -58,7 +58,7 @@
     }
 
     public Collection<QName> getKnownElements() {
-        return KNOWN;
+        return KNOWN_ELEMENTS;
     }
 
     public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptorProvider.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptorProvider.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptorProvider.java Tue Aug 25 18:24:33 2009
@@ -24,8 +24,10 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
 
+@NoJSR250Annotations
 public class MTOMPolicyInterceptorProvider extends AbstractPolicyInterceptorProvider {
 
     private static final Collection<QName> ASSERTION_TYPES;
@@ -39,6 +41,8 @@
     
     public MTOMPolicyInterceptorProvider() {
         super(ASSERTION_TYPES);
+        Thread.dumpStack();
+
         getInInterceptors().add(INTERCEPTOR);
         
         getOutInterceptors().add(INTERCEPTOR);

Modified: cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml (original)
+++ cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml Tue Aug 25 18:24:33 2009
@@ -22,26 +22,34 @@
        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.AssertionBuilderRegistryImpl">
+    <bean id="org.apache.cxf.ws.policy.AssertionBuilderRegistry" 
+    	class="org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl" lazy-init="true">
+    	<constructor-arg ref="cxf"/>
         <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"/>
+              <property name="staticFieldName"  value="KNOWN_ELEMENTS"/>
             </bean>
         </constructor-arg>
     </bean>
     
-    <bean id="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry" class="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistryImpl">
+    <bean id="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry"
+    	class="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistryImpl"
+    	lazy-init="true">
+    	<constructor-arg ref="cxf"/>
         <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"/>
+              <property name="staticFieldName"  value="ASSERTION_TYPES"/>
             </bean>
         </constructor-arg>
     </bean>   
     
     <bean id="org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry" 
-          class="org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry">
+          class="org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry"
+          lazy-init="true">
         <constructor-arg>
             <bean class="org.apache.cxf.configuration.spring.SpringBeanQNameMap">
               <property name="type" value="org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilder"/>
@@ -51,30 +59,44 @@
     </bean>   
     
     <bean class="org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder"
-	  id="org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder"/> 
+	  id="org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder"
+	  lazy-init="true"/> 
     
-    <bean id="org.apache.cxf.ws.policy.PolicyBuilder" class="org.apache.cxf.ws.policy.PolicyBuilderImpl">
+    <bean id="org.apache.cxf.ws.policy.PolicyBuilder" 
+    	class="org.apache.cxf.ws.policy.PolicyBuilderImpl"
+    	lazy-init="true">
         <property name="bus" ref="cxf"/>
         <property name="assertionBuilderRegistry" ref="org.apache.cxf.ws.policy.AssertionBuilderRegistry"/>
     </bean>
   
-    <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.PolicyEngineImpl">
-       <property name="bus" ref="cxf"/>
+    <bean id="org.apache.cxf.ws.policy.PolicyEngine" 
+    	class="org.apache.cxf.ws.policy.PolicyEngineImpl"
+    	lazy-init="false">
+    	<!--
+    		cannot be lazy init as it needs to add functionality to the bus
+    		that would query the above beans as needed if policies are 
+    		found
+    	 -->
+       <constructor-arg ref="cxf"/>
     </bean>
     
     <bean class="org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider"
-	  id="org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider">
+	  id="org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider"
+	  lazy-init="true">
         <constructor-arg ref="cxf"/>
     </bean>
         
     <bean class="org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider"
-	  id="org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider">
+	  id="org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider"
+	  lazy-init="true">
         <constructor-arg ref="cxf"/>
     </bean>
     
     <!-- MTOM Policy Support -->
     <bean class="org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder"
-	  id="org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder"/>
+	  id="org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder"
+	  lazy-init="true"/>
     <bean class="org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider"
-	  id="org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider"/>
+	  id="org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider"
+	  lazy-init="true"/>
 </beans>

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java?rev=807750&r1=807749&r2=807750&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java Tue Aug 25 18:24:33 2009
@@ -370,7 +370,6 @@
         engine = new PolicyEngineImpl(enabled);
     
         Bus bus = control.createMock(Bus.class);
-        engine.setBus(bus);
         List<Interceptor> out = new ArrayList<Interceptor>();
         List<Interceptor> in = new ArrayList<Interceptor>();
         List<Interceptor> inFault = new ArrayList<Interceptor>();
@@ -382,8 +381,7 @@
             EasyMock.expect(bus.getOutFaultInterceptors()).andReturn(outFault);
             control.replay();
         }
-        
-        engine.addBusInterceptors();
+        engine.setBus(bus);
         
         if (enabled) {
             Set<String> idsOut = getInterceptorIds(out);
@@ -407,8 +405,8 @@
         }
         if (enabled) {
             control.verify();
+            assertNotNull(engine.getAlternativeSelector());
         }
-        assertNotNull(engine.getAlternativeSelector());
     }
     
     @Test



Mime
View raw message