cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r807747 - in /cxf/trunk: api/src/main/java/org/apache/cxf/configuration/ common/common/src/main/java/org/apache/cxf/common/injection/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/resources/META-INF/c...
Date Tue, 25 Aug 2009 18:23:03 GMT
Author: dkulp
Date: Tue Aug 25 18:23:01 2009
New Revision: 807747

URL: http://svn.apache.org/viewvc?rev=807747&view=rev
Log:
Update loading of core things to be more lazy-init.  Reduces # objects
procressed in JSR250  Bus.init from ~55 to ~30.  More to go.

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java   (with props)
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java   (with props)
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java   (with props)
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.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/service/factory/FactoryBeanListenerManager.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java
    cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionTest.java
    cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
    cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/stax/StaxDatabindingTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java

Added: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java?rev=807747&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java Tue Aug 25 18:23:01 2009
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.configuration;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 
+ */
+public interface ConfiguredBeanLocator {
+    
+    List<String> getBeanNamesOfType(Class<?> type);
+    
+    <T> Collection<? extends T> getBeansOfType(Class<T> type);
+
+    <T> T getBeanOfType(String name, Class<T> type);
+    
+    <T> boolean loadBeansOfType(Class<T> type, BeanLoaderListener<T> listener);
+    
+    public interface BeanLoaderListener<T> {
+        /**
+         * Return true to have the loader go ahead and load the bean.  If false, 
+         * the loader will just skip to the next bean
+         * @param name
+         * @param type
+         * @return
+         */
+        boolean loadBean(String name, Class<? extends T> type);
+
+        /**
+         * Return true if the bean that was loaded meets the requirements at
+         * which point, the loader will stop loading additional beans of the
+         * given type
+         * @param bean
+         * @return
+         */
+        boolean beanLoaded(String name, T bean);
+    }
+}

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/ConfiguredBeanLocator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java Tue Aug 25 18:23:01 2009
@@ -64,7 +64,7 @@
     private final List<ResourceResolver> resourceResolvers;
 
     public ResourceInjector(ResourceManager resMgr) {
-        this(resMgr, resMgr.getResourceResolvers());
+        this(resMgr, resMgr == null ? null : resMgr.getResourceResolvers());
     }
 
     public ResourceInjector(ResourceManager resMgr, List<ResourceResolver> resolvers) {

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Tue Aug 25 18:23:01 2009
@@ -20,6 +20,9 @@
 package org.apache.cxf.binding.soap;
 
 import java.util.ArrayList;
+
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -36,6 +39,7 @@
 import javax.wsdl.extensions.mime.MIMEPart;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor;
@@ -60,6 +64,7 @@
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.common.WSDLConstants;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.endpoint.Endpoint;
@@ -95,8 +100,18 @@
 
 import static org.apache.cxf.helpers.CastUtils.cast;
 
-public class SoapBindingFactory extends AbstractBindingFactory {
 
+@NoJSR250Annotations(unlessNull = { "bus", "activationNamespaces" })
+public class SoapBindingFactory extends AbstractBindingFactory {
+    public static final Collection<String> DEFAULT_NAMESPACES = Arrays.asList(
+        "http://schemas.xmlsoap.org/soap/",
+        "http://schemas.xmlsoap.org/wsdl/soap/",
+        "http://schemas.xmlsoap.org/wsdl/soap12/",
+        "http://schemas.xmlsoap.org/wsdl/soap/http",
+        "http://www.w3.org/2003/05/soap/bindings/HTTP/"
+    );
+    
+    
     public static final String SOAP_11_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/";
     public static final String SOAP_12_BINDING = "http://schemas.xmlsoap.org/wsdl/soap12/";
 
@@ -105,6 +120,13 @@
 
     private boolean mtomEnabled = true;
 
+    public SoapBindingFactory() {
+    }
+    
+    public SoapBindingFactory(Bus b) {
+        super(b, DEFAULT_NAMESPACES);
+    }
+    
     public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object conf) {
         SoapBindingConfiguration config;
         if (conf instanceof SoapBindingConfiguration) {

Modified: cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml (original)
+++ cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml Tue Aug 25 18:23:01 2009
@@ -26,16 +26,7 @@
     
     <bean id="org.apache.cxf.binding.soap.SoapBindingFactory"
 	  class="org.apache.cxf.binding.soap.SoapBindingFactory" lazy-init="true">
-        <property name="activationNamespaces">
-            <set>
-                <value>http://schemas.xmlsoap.org/soap/</value>
-                <value>http://schemas.xmlsoap.org/wsdl/soap/</value>
-                <value>http://schemas.xmlsoap.org/wsdl/soap12/</value>
-                <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
-                <value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
-            </set>
-        </property>
-        <property name="bus" ref="cxf"/>
+        <constructor-arg ref="cxf"/>
     </bean>
     
     <bean class="org.apache.cxf.binding.soap.SoapTransportFactory"

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java Tue Aug 25 18:23:01 2009
@@ -21,7 +21,6 @@
 
 import java.util.Collection;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.wsdl.Binding;
 import javax.wsdl.BindingFault;
@@ -51,11 +50,29 @@
 
     protected Bus bus;
 
-    @PostConstruct
-    void registerWithBindingManager() {
-        BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
-        for (String ns : activationNamespaces) {
-            manager.registerBindingFactory(ns, this);
+    public AbstractBindingFactory() {
+    }
+    
+    public AbstractBindingFactory(Collection<String> ns) {
+        activationNamespaces = ns;
+    }
+    public AbstractBindingFactory(Bus b) {
+        bus = b;
+        registerWithBindingManager();
+    }
+    
+    public AbstractBindingFactory(Bus b, Collection<String> ns) {
+        activationNamespaces = ns;
+        bus = b;
+        registerWithBindingManager();
+    }
+    
+    private void registerWithBindingManager() {
+        if (bus != null && activationNamespaces != null) {
+            BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
+            for (String ns : activationNamespaces) {
+                manager.registerBindingFactory(ns, this);
+            }
         }
     }
 
@@ -171,6 +188,7 @@
     @Resource
     public void setBus(Bus bus) {
         this.bus = bus;
+        registerWithBindingManager();
     }
 
     public Collection<String> getActivationNamespaces() {
@@ -180,6 +198,7 @@
     @Resource(name = "activationNamespaces")
     public void setActivationNamespaces(Collection<String> activationNamespaces) {
         this.activationNamespaces = activationNamespaces;
+        registerWithBindingManager();
     }
 
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java Tue Aug 25 18:23:01 2009
@@ -19,29 +19,43 @@
 
 package org.apache.cxf.binding;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.Map;
 import java.util.ResourceBundle;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 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.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.spring.MapProvider;
+import org.apache.cxf.helpers.CastUtils;
 
+@NoJSR250Annotations(unlessNull = "bus")
 public final class BindingFactoryManagerImpl implements BindingFactoryManager {
     
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(BindingFactoryManagerImpl.class);
     
-    Map<String, BindingFactory> bindingFactories; 
+    Map<String, BindingFactory> bindingFactories;
+    Set<String> failed = new CopyOnWriteArraySet<String>();
+    Set<String> loaded = new CopyOnWriteArraySet<String>();
     Bus bus;
      
     public BindingFactoryManagerImpl() throws BusException {
         bindingFactories = new ConcurrentHashMap<String, BindingFactory>();
     }
+    public BindingFactoryManagerImpl(Bus b) throws BusException {
+        bindingFactories = new ConcurrentHashMap<String, BindingFactory>();
+        setBus(b);
+    }
     
     public BindingFactoryManagerImpl(Map<String, BindingFactory> bindingFactories) {
         super();
@@ -50,6 +64,14 @@
         }
         this.bindingFactories = bindingFactories;
     }
+    public BindingFactoryManagerImpl(Map<String, BindingFactory> bindingFactories, Bus b) {
+        super();
+        if (!(bindingFactories instanceof ConcurrentHashMap)) {
+            bindingFactories = new ConcurrentHashMap<String, BindingFactory>(bindingFactories);
+        }
+        this.bindingFactories = bindingFactories;
+        setBus(b);
+    }
     public BindingFactoryManagerImpl(MapProvider<String, BindingFactory> bindingFactories) {
         super();
         this.bindingFactories = bindingFactories.createMap();
@@ -67,10 +89,6 @@
     @Resource
     public void setBus(Bus b) {
         bus = b;
-    }
-    
-    @PostConstruct
-    public void register() {
         if (null != bus) {
             bus.setExtension(this, BindingFactoryManager.class);
         }
@@ -85,12 +103,124 @@
         bindingFactories.remove(name);
     }
     
-    public BindingFactory getBindingFactory(String namespace) throws BusException {
+    public BindingFactory getBindingFactory(final String namespace) throws BusException {
         BindingFactory factory = bindingFactories.get(namespace);
         if (null == factory) {
-            throw new BusException(new Message("NO_BINDING_FACTORY_EXC", BUNDLE, namespace));
+            if (!failed.contains(namespace)) {
+                factory = loadDefaultNamespace(namespace);
+                if (factory == null) {
+                    factory = loadNoDefaultNamespace(namespace);
+                }
+                if (factory == null) {
+                    factory = loadAll(namespace);
+                }
+            }
+            if (factory == null) {
+                failed.add(namespace);
+                throw new BusException(new Message("NO_BINDING_FACTORY_EXC", BUNDLE, namespace));
+            }
         }
         return factory;
     }
     
+    private BindingFactory loadAll(final String namespace) {
+        //Try old method of having activationNamespaces configured in. 
+        //It activates all the factories in the list until one matches, thus
+        //it activates stuff that really aren't needed.
+        ConfiguredBeanLocator.BeanLoaderListener<BindingFactory> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<BindingFactory>() {
+                public boolean beanLoaded(String name, BindingFactory bean) {
+                    loaded.add(name);
+                    if (!bindingFactories.containsKey(namespace)) {
+                        if (bean instanceof AbstractBindingFactory) {
+                            for (String ns 
+                                 : ((AbstractBindingFactory)bean).getActivationNamespaces()) {
+                                registerBindingFactory(ns, (BindingFactory)bean);
+                            }
+                        } else {
+                            try {
+                                Method m = bean.getClass().getMethod("getActivationNamespace", new Class[0]);
+                                Collection<String> c = CastUtils.cast((Collection<?>)m.invoke(bean));
+                                for (String s : c) {
+                                    registerBindingFactory(s, bean);
+                                }
+                            } catch (Exception ex) {
+                                //ignore
+                            }
+                        }
+                    } 
+                    return bindingFactories.containsKey(namespace);
+                }
+
+                public boolean loadBean(String name, Class<? extends BindingFactory> type) {
+                    return !bindingFactories.containsKey(namespace) && !loaded.contains(name);
+                }
+            };
+        bus.getExtension(ConfiguredBeanLocator.class)
+            .loadBeansOfType(BindingFactory.class,
+                             listener);
+        return bindingFactories.get(namespace);
+    }
+    private BindingFactory loadDefaultNamespace(final String namespace) {
+        //First attempt will be to examine the factory class
+        //for a DEFAULT_NAMESPACES field and use it
+        ConfiguredBeanLocator.BeanLoaderListener<BindingFactory> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<BindingFactory>() {
+                public boolean beanLoaded(String name, BindingFactory bean) {
+                    loaded.add(name);
+                    return bindingFactories.containsKey(namespace);
+                }
+
+                public boolean loadBean(String name, Class<? extends BindingFactory> type) {
+                    if (!loaded.contains(name)) {
+                        try {
+                            Field f = type.getField("DEFAULT_NAMESPACES");
+                            Object o = f.get(null);
+                            if (o instanceof Collection) {
+                                Collection<String> c = CastUtils.cast((Collection<?>)o);
+                                return c.contains(namespace);
+                            }
+                        } catch (Exception ex) {
+                            //ignore
+                        }
+                    }
+                    return false;
+                }
+            };                
+        bus.getExtension(ConfiguredBeanLocator.class)
+            .loadBeansOfType(BindingFactory.class,
+                             listener);
+        
+        return bindingFactories.get(namespace);
+    }
+    private BindingFactory loadNoDefaultNamespace(final String namespace) {
+        //Second attempt will be to examine the factory class
+        //for a DEFAULT_NAMESPACES field and if it doesn't exist, try 
+        //loading.  This will then load most of the "older" things
+        ConfiguredBeanLocator.BeanLoaderListener<BindingFactory> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<BindingFactory>() {
+                public boolean beanLoaded(String name, BindingFactory bean) {
+                    loaded.add(name);
+                    return bindingFactories.containsKey(namespace);
+                }
+
+                public boolean loadBean(String name, Class<? extends BindingFactory> type) {
+                    if (loaded.contains(name)) {
+                        return false;
+                    }
+                    try {
+                        type.getField("DEFAULT_NAMESPACES");
+                        return false;
+                    } catch (Exception ex) {
+                        //ignore
+                    }
+                    return true;
+                }
+            };                
+        bus.getExtension(ConfiguredBeanLocator.class)
+            .loadBeansOfType(BindingFactory.class,
+                             listener);
+        
+        return bindingFactories.get(namespace);
+    }
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Tue Aug 25 18:23:01 2009
@@ -27,6 +27,7 @@
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.buslifecycle.BusLifeCycleManager;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 
@@ -37,7 +38,6 @@
     private String id;
     private BusState state;      
     private Collection<AbstractFeature> features;
-    private ExtensionFinder finder;
     private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
     
     public CXFBusImpl() {
@@ -61,18 +61,24 @@
         this.state = state;
     }
     
-    public void setExtensionFinder(ExtensionFinder f) {
-        finder = f;
-    }
-    
     public void setId(String i) {
         id = i;
     }
 
     public final <T> T getExtension(Class<T> extensionType) {
         Object obj = extensions.get(extensionType);
-        if (obj == null && finder != null) {
-            obj = finder.findExtension(extensionType);
+        if (obj == null) {
+            ConfiguredBeanLocator loc = (ConfiguredBeanLocator)extensions.get(ConfiguredBeanLocator.class);
+            if (loc != null) {
+                //force loading
+                Collection<?> objs = loc.getBeansOfType(extensionType);
+                if (objs != null) {
+                    for (Object o : objs) {
+                        extensions.put(extensionType, o);
+                    }
+                }
+                obj = extensions.get(extensionType);
+            }
         }
         if (null != obj) {
             return extensionType.cast(obj);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java Tue Aug 25 18:23:01 2009
@@ -19,9 +19,12 @@
 
 package org.apache.cxf.bus.extension;
 
+import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.cxf.Bus;
+
 
 public class Extension {
 
@@ -79,10 +82,19 @@
         return namespaces;
     }
     
-    Object load(ClassLoader cl) {
+    Object load(ClassLoader cl, Bus b) {
         Object obj = null;
         try {
             Class<?> cls = cl.loadClass(className);
+            try {
+                //if there is a Bus constructor, use it.
+                if (b != null) {
+                    Constructor con = cls.getConstructor(Bus.class);
+                    return con.newInstance(b);
+                }
+            } catch (Exception ex) {
+                //ignore
+            }
             obj = cls.newInstance();
         } catch (ClassNotFoundException ex) {
             throw new ExtensionException(ex);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java Tue Aug 25 18:23:01 2009
@@ -91,7 +91,8 @@
         ExtensionManagerImpl em = new ExtensionManagerImpl(
                                  Thread.currentThread().getContextClassLoader(),
                                  extensions,
-                                 resourceManager);
+                                 resourceManager, 
+                                 this);
         
         setState(BusState.INITIAL);
         
@@ -103,21 +104,21 @@
 
         DestinationFactoryManager dfm = this.getExtension(DestinationFactoryManager.class);
         if (null == dfm) {
-            dfm = new DestinationFactoryManagerImpl(new DeferredMap<DestinationFactory>(em, 
-                DestinationFactory.class));
-            extensions.put(DestinationFactoryManager.class, dfm);
+            dfm = new DestinationFactoryManagerImpl(
+                new DeferredMap<DestinationFactory>(em, DestinationFactory.class),
+                this);
         }
 
         ConduitInitiatorManager cfm = this.getExtension(ConduitInitiatorManager.class);
         if (null == cfm) {
             cfm = new ConduitInitiatorManagerImpl(new DeferredMap<ConduitInitiator>(em, 
-                ConduitInitiator.class));
-            extensions.put(ConduitInitiatorManager.class, cfm);
+                ConduitInitiator.class), this);
         }
         
         BindingFactoryManager bfm = this.getExtension(BindingFactoryManager.class);
         if (null == bfm) {
-            bfm = new BindingFactoryManagerImpl(new DeferredMap<BindingFactory>(em, BindingFactory.class));
+            bfm = new BindingFactoryManagerImpl(new DeferredMap<BindingFactory>(em, BindingFactory.class),
+                                                this);
             extensions.put(BindingFactoryManager.class, bfm);
         }
         

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java Tue Aug 25 18:23:01 2009
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.resource.ObjectTypeResolver;
@@ -51,23 +52,28 @@
     private final Map<Class, Object> activated;
     private final Map<String, Collection<Object>> namespaced = 
         new ConcurrentHashMap<String, Collection<Object>>();
+    private final Bus bus;
 
     public ExtensionManagerImpl(ClassLoader cl, Map<Class, Object> initialExtensions, 
-                                ResourceManager rm) {
-        this(new String[] {BUS_EXTENSION_RESOURCE, BUS_EXTENSION_RESOURCE_COMPAT}, cl, initialExtensions, rm);
+                                ResourceManager rm, Bus b) {
+        this(new String[] {BUS_EXTENSION_RESOURCE, BUS_EXTENSION_RESOURCE_COMPAT},
+                 cl, initialExtensions, rm, b);
     }
     public ExtensionManagerImpl(String resource, 
                                 ClassLoader cl, 
                                 Map<Class, Object> initialExtensions, 
-                                ResourceManager rm) {
-        this(new String[] {resource}, cl, initialExtensions, rm);
+                                ResourceManager rm,
+                                Bus b) {
+        this(new String[] {resource}, cl, initialExtensions, rm, b);
     }    
     public ExtensionManagerImpl(String resources[], 
                                 ClassLoader cl, 
                                 Map<Class, Object> initialExtensions, 
-                                ResourceManager rm) {
+                                ResourceManager rm,
+                                Bus b) {
 
         loader = cl;
+        bus = b;
         activated = initialExtensions;
         resourceManager = rm;
 
@@ -150,7 +156,7 @@
             return;
         }
  
-        Object obj = e.load(loader);
+        Object obj = e.load(loader, bus);
         
         Configurer configurer = (Configurer)(activated.get(Configurer.class));
         if (null != configurer) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java Tue Aug 25 18:23:01 2009
@@ -20,12 +20,11 @@
 package org.apache.cxf.bus.spring;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.bus.CXFBusImpl;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
 
 import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -62,20 +61,7 @@
     private Bus getBus() {
         if (bus == null) {
             bus = (Bus)context.getBean(Bus.DEFAULT_BUS_ID);
-            
-            final ApplicationContext ctx = context;
-            if (bus instanceof CXFBusImpl) {
-                CXFBusImpl b = (CXFBusImpl)bus;
-                b.setExtensionFinder(new CXFBusImpl.ExtensionFinder() {
-                    public <T> T findExtension(Class<T> cls) {
-                        try {
-                            return cls.cast(ctx.getBean(cls.getName(), cls));
-                        } catch (NoSuchBeanDefinitionException ex) {
-                            return null;
-                        }
-                    }
-                });
-            }
+            bus.setExtension(new SpringBeanLocator(context), ConfiguredBeanLocator.class);
         }
         return bus;
     }

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=807747&r1=807746&r2=807747&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:23:01 2009
@@ -38,6 +38,7 @@
 
     private boolean isProcessing = true;
     //private int count;
+    //private int count2;
 
     Jsr250BeanPostProcessor() {
     }
@@ -88,8 +89,11 @@
         }
         if (bean != null 
             && injectable(bean, beanId)) {
-            //System.err.println(++count + ": " + bean.getClass().getName() + " " + 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);            
         }
         return bean;
     }

Added: 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=807747&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java Tue Aug 25 18:23:01 2009
@@ -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.bus.spring;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
+import org.springframework.context.ApplicationContext;
+
+/**
+ * 
+ */
+public class SpringBeanLocator implements ConfiguredBeanLocator {
+    ApplicationContext context;
+    public SpringBeanLocator(ApplicationContext ctx) {
+        context = ctx;
+    }
+
+    /** {@inheritDoc}*/
+    public List<String> getBeanNamesOfType(Class<?> type) {
+        return Arrays.asList(context.getBeanNamesForType(type));
+    }
+
+    /** {@inheritDoc}*/
+    public <T> T getBeanOfType(String name, Class<T> type) {
+        return type.cast(context.getBean(name, type));
+    }
+
+    /** {@inheritDoc}*/
+    @SuppressWarnings("unchecked")
+    public <T> Collection<? extends T> getBeansOfType(Class<T> type) {
+        return context.getBeansOfType(type).values();
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> boolean loadBeansOfType(Class<T> type,
+                                       BeanLoaderListener<T> listener) {
+        List<String> list = new ArrayList<String>(Arrays.asList(context.getBeanNamesForType(type)));
+        Collections.reverse(list);
+        for (String s : list) {
+            Class<? extends T> c = context.getType(s);
+            if (listener.loadBean(s, c)) {
+                Object o = context.getBean(s);
+                if (listener.beanLoaded(s, type.cast(o))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+}

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

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

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/FactoryBeanListenerManager.java Tue Aug 25 18:23:01 2009
@@ -32,6 +32,8 @@
  */
 @NoJSR250Annotations(unlessNull = "bus")
 public class FactoryBeanListenerManager {
+    Bus bus;
+    
     List<FactoryBeanListener> listeners
         = new CopyOnWriteArrayList<FactoryBeanListener>();
     
@@ -45,7 +47,8 @@
     
     @Resource
     public final void setBus(Bus bus) {
-        bus.setExtension(this, FactoryBeanListenerManager.class);
+        this.bus = bus;
+        this.bus.setExtension(this, FactoryBeanListenerManager.class);
     }
     
     public List<FactoryBeanListener> getListeners() {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java Tue Aug 25 18:23:01 2009
@@ -22,23 +22,102 @@
 import java.util.List;
 import java.util.Set;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
 import org.apache.cxf.helpers.CastUtils;
 
 /**
  * Helper methods for {@link DestinationFactory}s and {@link ConduitInitiator}s.
  */
 public abstract class AbstractTransportFactory {
+    protected Bus bus;
     private List<String> transportIds;
+    
+    public AbstractTransportFactory() {
+    }
+    public AbstractTransportFactory(List<String> ids, Bus b) {
+        transportIds = ids;
+        bus = b;
+        register();
+    }
+    
+    public Bus getBus() {
+        return bus;
+    }
+    public void setBus(Bus b) {
+        unregister();
+        bus = b;
+        register();
+    }
 
-    public List<String> getTransportIds() {
+    public final List<String> getTransportIds() {
         return transportIds;
     }
 
     public void setTransportIds(List<String> transportIds) {
+        unregister();
         this.transportIds = transportIds;
+        register();
     }
 
     public Set<String> getUriPrefixes() {
         return CastUtils.cast(Collections.EMPTY_SET);
     }
+    
+    public final void register() {
+        if (null == bus) {
+            return;
+        }
+        if (this instanceof DestinationFactory) {
+            DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+            if (null != dfm && getTransportIds() != null) {
+                for (String ns : getTransportIds()) {
+                    dfm.registerDestinationFactory(ns, (DestinationFactory)this);
+                }
+            }
+        }
+        if (this instanceof ConduitInitiator) {
+            ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
+            if (cim != null && getTransportIds() != null) {
+                for (String ns : getTransportIds()) {
+                    cim.registerConduitInitiator(ns, (ConduitInitiator)this);
+                }
+            }
+        }
+    }
+    public final void unregister() {
+        if (null == bus) {
+            return;
+        }
+        if (this instanceof DestinationFactory) {
+            DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+            if (null != dfm && getTransportIds() != null) {
+                for (String ns : getTransportIds()) {
+                    try {
+                        if (dfm.getDestinationFactory(ns) == this) {
+                            dfm.deregisterDestinationFactory(ns);
+                        }
+                    } catch (BusException e) {
+                        //ignore
+                    }
+                }
+            }
+        }
+        if (this instanceof ConduitInitiator) {
+            ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
+            if (cim != null && getTransportIds() != null) {
+                for (String ns : getTransportIds()) {
+                    try {
+                        if (cim.getConduitInitiator(ns) == this) {
+                            cim.deregisterConduitInitiator(ns);
+                        }
+                    } catch (BusException e) {
+                        //ignore
+                    }
+                }
+            }
+        }
+        
+    }
+    
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java Tue Aug 25 18:23:01 2009
@@ -20,10 +20,12 @@
 package org.apache.cxf.transport;
 
 import java.util.Map;
+
 import java.util.ResourceBundle;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
 
@@ -32,27 +34,44 @@
 import org.apache.cxf.bus.extension.DeferredMap;
 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.configuration.spring.MapProvider;
 
+@NoJSR250Annotations(unlessNull = "bus")
 public final class ConduitInitiatorManagerImpl implements ConduitInitiatorManager {
 
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ConduitInitiatorManager.class);
 
     Map<String, ConduitInitiator> conduitInitiators;
-    
+    Set<String> failed = new CopyOnWriteArraySet<String>();
+    Set<String> loaded = new CopyOnWriteArraySet<String>();
+
     private Bus bus;
     public ConduitInitiatorManagerImpl() {
         conduitInitiators = new ConcurrentHashMap<String, ConduitInitiator>();
     }
+    public ConduitInitiatorManagerImpl(Bus b) {
+        conduitInitiators = new ConcurrentHashMap<String, ConduitInitiator>();
+        setBus(b);
+    }
     
 
     public ConduitInitiatorManagerImpl(MapProvider<String, ConduitInitiator> conduitInitiators) {
         this.conduitInitiators = conduitInitiators.createMap();
     }
+    public ConduitInitiatorManagerImpl(MapProvider<String, ConduitInitiator> conduitInitiators,
+                                       Bus b) {
+        this.conduitInitiators = conduitInitiators.createMap();
+        setBus(b);
+    }
 
     public ConduitInitiatorManagerImpl(Map<String, ConduitInitiator> conduitInitiators) {
         this.conduitInitiators = conduitInitiators;
     }
+    public ConduitInitiatorManagerImpl(Map<String, ConduitInitiator> conduitInitiators, Bus b) {
+        this.conduitInitiators = conduitInitiators;
+        setBus(b);
+    }
     
     /**
      * Spring is slow to resolve constructors. This accessor allows
@@ -66,10 +85,6 @@
     @Resource
     public void setBus(Bus b) {
         bus = b;
-    }
-    
-    @PostConstruct
-    public void register() {
         if (null != bus) {
             bus.setExtension(this, ConduitInitiatorManager.class);
         }
@@ -108,7 +123,15 @@
      */
     public ConduitInitiator getConduitInitiator(String namespace) throws BusException {
         ConduitInitiator factory = conduitInitiators.get(namespace);
-        if (null == factory) {
+        if (factory == null && !failed.contains(namespace)) {
+            factory = new TransportFinder<ConduitInitiator>(bus,
+                    conduitInitiators,
+                    loaded,
+                    ConduitInitiator.class)
+                .findTransportForNamespace(namespace);
+        }
+        if (factory == null) {
+            failed.add(namespace);
             throw new BusException(new Message("NO_CONDUIT_INITIATOR", BUNDLE, namespace));
         }
         return factory;
@@ -120,15 +143,13 @@
     }
 
     public ConduitInitiator getConduitInitiatorForUri(String uri) {
-        for (ConduitInitiator ci : conduitInitiators.values()) {
-            for (String prefix : ci.getUriPrefixes()) {
-                if (uri.startsWith(prefix)) {
-                    return ci;
-                }
-            }
-        }
+        ConduitInitiator factory = new TransportFinder<ConduitInitiator>(bus,
+            conduitInitiators,
+            loaded,
+            ConduitInitiator.class).findTransportForURI(uri);
+        
         //looks like we'll need to undefer everything so we can try again.
-        if (conduitInitiators instanceof DeferredMap) {
+        if (factory == null && conduitInitiators instanceof DeferredMap) {
             ((DeferredMap)conduitInitiators).undefer();
             for (ConduitInitiator df : conduitInitiators.values()) {
                 for (String prefix : df.getUriPrefixes()) {
@@ -138,7 +159,6 @@
                 }
             }
         }
-        return null;
+        return factory;
     }
-    
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java Tue Aug 25 18:23:01 2009
@@ -22,10 +22,10 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.ResourceBundle;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
 
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
@@ -33,13 +33,17 @@
 import org.apache.cxf.bus.extension.DeferredMap;
 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.configuration.spring.MapProvider;
 
+@NoJSR250Annotations(unlessNull = "bus")
 public final class DestinationFactoryManagerImpl implements DestinationFactoryManager {
 
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(DestinationFactoryManager.class);
 
     Map<String, DestinationFactory> destinationFactories;
+    Set<String> failed = new CopyOnWriteArraySet<String>();
+    Set<String> loaded = new CopyOnWriteArraySet<String>();
     Properties factoryNamespaceMappings;
 
     private Bus bus;
@@ -47,19 +51,23 @@
     public DestinationFactoryManagerImpl() {
         destinationFactories = new ConcurrentHashMap<String, DestinationFactory>();
     }
+    public DestinationFactoryManagerImpl(Bus b) {
+        destinationFactories = new ConcurrentHashMap<String, DestinationFactory>();
+        setBus(b);
+    }
 
     public DestinationFactoryManagerImpl(Map<String, DestinationFactory> destinationFactories) {
         this.destinationFactories = destinationFactories;
     }
+    public DestinationFactoryManagerImpl(Map<String, DestinationFactory> destinationFactories,
+                                         Bus b) {
+        this.destinationFactories = destinationFactories;
+        setBus(b);
+    }
     public DestinationFactoryManagerImpl(MapProvider<String, DestinationFactory> destinationFactories) {
         this.destinationFactories = destinationFactories.createMap();
     }
 
-    /**
-     * Spring is slow for constructors with arguments. This
-     * accessor permits initialization via a property.
-     * @param mapProvider
-     */
     public void setMapProvider(MapProvider<String, DestinationFactory> mapProvider) {
         this.destinationFactories = mapProvider.createMap();
     }
@@ -67,10 +75,6 @@
     @Resource
     public void setBus(Bus b) {
         bus = b;
-    }
-
-    @PostConstruct
-    public void register() {
         if (null != bus) {
             bus.setExtension(this, DestinationFactoryManager.class);
         }
@@ -111,32 +115,28 @@
      */
     public DestinationFactory getDestinationFactory(String namespace) throws BusException {
         DestinationFactory factory = destinationFactories.get(namespace);
-        if (null == factory) {
+        if (factory == null && !failed.contains(namespace)) {
+            factory = new TransportFinder<DestinationFactory>(bus,
+                    destinationFactories,
+                    loaded,
+                    DestinationFactory.class)
+                .findTransportForNamespace(namespace);
+        }
+        if (factory == null) {
+            failed.add(namespace);
             throw new BusException(new Message("NO_DEST_FACTORY", BUNDLE, namespace));
         }
         return factory;
     }
 
-    @PreDestroy
-    public void shutdown() {
-        // nothing to do
-    }
-
-    public DestinationFactory getDestinationFactoryForUri(String uri) {
-        //If the uri is related path or has no protocol prefix , we will set it to be http
-        if (uri.startsWith("/") || uri.indexOf(":") < 0) {
-            uri = "http://" + uri;
-        }
-        //first attempt the ones already registered
-        for (Map.Entry<String, DestinationFactory> df : destinationFactories.entrySet()) {
-            for (String prefix : df.getValue().getUriPrefixes()) {
-                if (uri.startsWith(prefix)) {
-                    return df.getValue();
-                }
-            }
-        }
+    public DestinationFactory getDestinationFactoryForUri(String uri) {       
+        DestinationFactory factory = new TransportFinder<DestinationFactory>(bus,
+                destinationFactories,
+                loaded,
+                DestinationFactory.class).findTransportForURI(uri);
+        
         //looks like we'll need to undefer everything so we can try again.
-        if (destinationFactories instanceof DeferredMap) {
+        if (factory == null && destinationFactories instanceof DeferredMap) {
             ((DeferredMap)destinationFactories).undefer();
             for (DestinationFactory df : destinationFactories.values()) {
                 for (String prefix : df.getUriPrefixes()) {
@@ -146,8 +146,7 @@
                 }
             }
         }
-
-        return null;
+        return factory;
     }
-
+    
 }

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java?rev=807747&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java Tue Aug 25 18:23:01 2009
@@ -0,0 +1,298 @@
+/**
+ * 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.transport;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
+import org.apache.cxf.helpers.CastUtils;
+
+/**
+ * 
+ */
+public class TransportFinder<T> {
+    Map<String, T> map;
+    Set<String> loaded;
+    Class<T> cls;
+    ConfiguredBeanLocator locator;
+    
+    public TransportFinder(Bus b,
+                           Map<String, T> m,
+                           Set<String> l,
+                           Class<T> c) {
+        map = m;
+        cls = c;
+        locator = b.getExtension(ConfiguredBeanLocator.class);
+        loaded = l;
+    }
+    
+    public T findTransportForNamespace(final String namespace) {
+        if (locator == null) {
+            return null;
+        }
+        T factory = loadDefaultNamespace(namespace);
+        if (factory == null) {
+            factory = loadNoDefaultNamespace(namespace);
+        }
+        if (factory == null) {
+            factory = loadActivationNamespaces(namespace);
+        }
+        if (factory == null) {
+            loadAll();
+            factory = map.get(namespace);
+        }
+        return factory;
+    }
+    
+
+    public T findTransportForURI(String uri) {
+        if (locator == null) {
+            return null;
+        }
+        //If the uri is related path or has no protocol prefix , we will set it to be http
+        if (uri.startsWith("/") || uri.indexOf(":") < 0) {
+            uri = "http://" + uri;
+        }
+        T factory = checkForURI(uri);
+        if (factory == null) {
+            //didn't find, now well need to search
+            factory = loadDefaultURIs(uri);
+            
+            if (factory == null) {
+                loadAll();
+                factory = checkForURI(uri);
+            }
+        }
+        return factory;
+    }
+    
+    private static Set<String> getPrefixes(Object t) {
+        Set<String> prefixes = null;
+        if (t instanceof AbstractTransportFactory) {
+            AbstractTransportFactory atf = (AbstractTransportFactory)t;
+            prefixes = atf.getUriPrefixes();
+        } else if (t instanceof DestinationFactory) {
+            DestinationFactory atf = (DestinationFactory)t;
+            prefixes = atf.getUriPrefixes();                
+        } else if (t instanceof ConduitInitiator) {
+            ConduitInitiator atf = (ConduitInitiator)t;
+            prefixes = atf.getUriPrefixes();                
+        }
+        return prefixes;
+    }
+    private boolean hasPrefix(String uri, Collection<String> prefixes) {
+        if (prefixes == null) {
+            return false;
+        }
+        for (String prefix : prefixes) {
+            if (uri.startsWith(prefix)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    public T checkForURI(String uri) {
+        //first attempt the ones already registered
+        for (T t : map.values()) {
+            if (hasPrefix(uri, getPrefixes(t))) {
+                return t;
+            }
+        }
+        return null;
+    }
+    
+    private void loadAll() {
+        ConfiguredBeanLocator.BeanLoaderListener<T> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<T>() {
+                public boolean beanLoaded(String name, T bean) {
+                    loaded.add(name);
+                    registerBean(bean);
+                    return false;
+                }
+                public boolean loadBean(String name, Class<? extends T> type) {
+                    return !loaded.contains(name);
+                }
+            };
+        locator.loadBeansOfType(cls, listener);
+    }
+
+    private void registerBean(T bean) {
+        if (bean instanceof AbstractTransportFactory) {
+            for (String ns 
+                 : ((AbstractTransportFactory)bean).getTransportIds()) {
+                if (!map.containsKey(ns)) {
+                    map.put(ns, bean);
+                }
+            }
+        } else {
+            try {
+                Method m = bean.getClass().getMethod("getActivationNamespaces", new Class[0]);
+                Collection<String> c = CastUtils.cast((Collection<?>)m.invoke(bean));
+                for (String s : c) {
+                    if (!map.containsKey(s)) {
+                        map.put(s, bean);
+                    }
+                }
+            } catch (Exception ex) {
+                //ignore
+            }
+        }
+    }
+
+    
+    private T loadActivationNamespaces(final String namespace) {
+        //Try old method of having activationNamespaces configured in. 
+        //It activates all the factories in the list until one matches, thus
+        //it activates stuff that really aren't needed.
+        ConfiguredBeanLocator.BeanLoaderListener<T> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<T>() {
+                public boolean beanLoaded(String name, T bean) {
+                    loaded.add(name);
+                    if (!map.containsKey(namespace)) {
+                        registerBean(bean);
+                    } 
+                    return map.containsKey(namespace);
+                }
+
+                public boolean loadBean(String name, Class<? extends T> type) {
+                    return !map.containsKey(namespace) && !loaded.contains(name);
+                }
+            };
+        locator.loadBeansOfType(cls, listener);
+        return map.get(namespace);
+    }
+    
+    
+
+
+    private T loadDefaultURIs(final String uri) {
+        //First attempt will be to examine the factory class
+        //for a DEFAULT_NAMESPACES field and use it
+        URIBeanLoaderListener listener 
+            = new URIBeanLoaderListener(uri) {
+
+                public boolean loadBean(String name, Class<? extends T> type) {
+                    try {
+                        Field f = type.getField("DEFAULT_URIS");
+                        Object o = f.get(null);
+                        if (o instanceof Collection) {
+                            Collection<String> c = CastUtils.cast((Collection<?>)o);
+                            return hasPrefix(uri, c);
+                        }
+                    } catch (Exception ex) {
+                        //ignore
+                    }
+                    return false;
+                }
+            };                
+        locator.loadBeansOfType(cls, listener);
+        return listener.getFactory();
+    }
+    
+    abstract class URIBeanLoaderListener implements ConfiguredBeanLocator.BeanLoaderListener<T> {
+        T factory;
+        String uri;
+        
+        URIBeanLoaderListener(String u) {
+            uri = u;
+        }
+        
+        public T getFactory() {
+            return factory;
+        }
+        public boolean beanLoaded(String name, T bean) {
+            registerBean(bean);
+            if (hasPrefix(uri, getPrefixes(bean))) {
+                factory = bean;
+                return true;
+            }
+            return false;
+        }
+        
+    }
+    
+    private T loadDefaultNamespace(final String namespace) {
+        //First attempt will be to examine the factory class
+        //for a DEFAULT_NAMESPACES field and use it
+        ConfiguredBeanLocator.BeanLoaderListener<T> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<T>() {
+                public boolean beanLoaded(String name, T bean) {
+                    loaded.add(name);
+                    return map.containsKey(namespace);
+                }
+
+                public boolean loadBean(String name, Class<? extends T> type) {
+                    if (loaded.contains(name)) {
+                        return false;
+                    }
+                    try {
+                        Field f = type.getField("DEFAULT_NAMESPACES");
+                        Object o = f.get(null);
+                        if (o instanceof Collection) {
+                            Collection<String> c = CastUtils.cast((Collection<?>)o);
+                            return c.contains(namespace);
+                        }
+                    } catch (Exception ex) {
+                        //ignore
+                    }
+                    return false;
+                }
+            };                
+        locator.loadBeansOfType(cls, listener);
+        
+        return map.get(namespace);
+    }
+    private T loadNoDefaultNamespace(final String namespace) {
+        //Second attempt will be to examine the factory class
+        //for a DEFAULT_NAMESPACES field and if it doesn't exist, try 
+        //loading.  This will then load most of the "older" things
+        ConfiguredBeanLocator.BeanLoaderListener<T> listener 
+            = new ConfiguredBeanLocator.BeanLoaderListener<T>() {
+                public boolean beanLoaded(String name, T bean) {
+                    loaded.add(name);
+                    registerBean(bean);
+                    return map.containsKey(namespace);
+                }
+
+                public boolean loadBean(String name, Class<? extends T> type) {
+                    if (loaded.contains(name)) {
+                        return false;
+                    }
+                    try {
+                        type.getField("DEFAULT_NAMESPACES");
+                        return false;
+                    } catch (Exception ex) {
+                        //ignore
+                    }
+                    return true;
+                }
+            };                
+        locator.loadBeansOfType(cls, listener);
+        
+        return map.get(namespace);
+    }
+
+
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/TransportFinder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=807747&r1=807746&r2=807747&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:23:01 2009
@@ -29,10 +29,14 @@
 	<context:annotation-config/>
 	-->
     <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
-    <bean id="org.apache.cxf.bus.spring.BusApplicationListener" class="org.apache.cxf.bus.spring.BusApplicationListener"/>
-    <bean id="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor" class="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor"/>
-    <bean id="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor" class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>    
-    <bean id="org.apache.cxf.bus.spring.BusExtensionPostProcessor" class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/>
+    <bean id="org.apache.cxf.bus.spring.BusApplicationListener" 
+    	class="org.apache.cxf.bus.spring.BusApplicationListener"/>
+    <bean id="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor" 
+    	class="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor"/>
+    <bean id="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor" 
+    	class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>    
+    <bean id="org.apache.cxf.bus.spring.BusExtensionPostProcessor" 
+    	class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/>
     
     <bean id="org.apache.cxf.resource.ResourceManager" 
     	class="org.apache.cxf.bus.resource.ResourceManagerImpl" 
@@ -54,37 +58,19 @@
     <bean id="org.apache.cxf.binding.BindingFactoryManager"
      	class="org.apache.cxf.binding.BindingFactoryManagerImpl"
      	lazy-init="true">
-        <property name="mapProvider">
-            <bean class="org.apache.cxf.configuration.spring.SpringBeanMap">
-              <property name="type" value="org.apache.cxf.binding.BindingFactory"/>
-              <property name="idsProperty" value="activationNamespaces"/>
-            </bean>
-        </property>
-        <property name="bus" ref="cxf"/>
+        <constructor-arg ref="cxf"/>
     </bean>
     
     <bean id="org.apache.cxf.transport.DestinationFactoryManager"
     	class="org.apache.cxf.transport.DestinationFactoryManagerImpl"
     	lazy-init="true">
-        <property name="mapProvider">
-            <bean class="org.apache.cxf.configuration.spring.SpringBeanMap">
-              <property name="type" value="org.apache.cxf.transport.DestinationFactory"/>
-              <property name="idsProperty" value="transportIds"/>
-            </bean>
-        </property>
-        <property name="bus" ref="cxf"/>
+        <constructor-arg ref="cxf"/>
     </bean>
     
     <bean id="org.apache.cxf.transport.ConduitInitiatorManager" 
     	class="org.apache.cxf.transport.ConduitInitiatorManagerImpl"
     	lazy-init="true">
-        <property name="mapProvider">
-            <bean class="org.apache.cxf.configuration.spring.SpringBeanMap">
-              <property name="type" value="org.apache.cxf.transport.ConduitInitiator"/>
-              <property name="idsProperty" value="transportIds"/>
-            </bean>
-        </property>
-        <property name="bus" ref="cxf"/>
+        <constructor-arg ref="cxf"/>
     </bean>
     
     <bean id="org.apache.cxf.wsdl.WSDLManager" 

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java (original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionManagerTest.java Tue Aug 25 18:23:01 2009
@@ -46,7 +46,7 @@
         extensions.put(Integer.class, new Integer(0));
         
         manager = new ExtensionManagerImpl("test-extension.xml", 
-            Thread.currentThread().getContextClassLoader(), extensions, rm); 
+            Thread.currentThread().getContextClassLoader(), extensions, rm, null); 
         myService = null;
     }
     

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionTest.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionTest.java (original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/extension/ExtensionTest.java Tue Aug 25 18:23:01 2009
@@ -50,7 +50,7 @@
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         e.setClassname("no.such.Extension");        
         try {
-            e.load(cl);                  
+            e.load(cl, null);                  
         } catch (ExtensionException ex) {
             assertTrue("ExtensionException does not wrap ClassNotFoundException",
                        ex.getCause() instanceof ClassNotFoundException);
@@ -58,20 +58,20 @@
 
         e.setClassname("java.lang.System");
         try {
-            e.load(cl);                  
+            e.load(cl, null);                  
         } catch (ExtensionException ex) {
             assertTrue("ExtensionException does not wrap IllegalAccessException",
                        ex.getCause() instanceof IllegalAccessException);
         } 
         e.setClassname(MyServiceConstructorThrowsException.class.getName());
         try {
-            e.load(cl);                  
+            e.load(cl, null);                  
         } catch (ExtensionException ex) {
             assertTrue("ExtensionException does not wrap InstantiationException",
                        ex.getCause() instanceof InstantiationException);
         } 
         e.setClassname("java.lang.String");
-        Object obj = e.load(cl);
+        Object obj = e.load(cl, null);
         assertTrue("Object is not type String", obj instanceof String);        
     }
     

Modified: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java (original)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java Tue Aug 25 18:23:01 2009
@@ -19,11 +19,11 @@
 package org.apache.cxf.service.factory;
 
 import java.io.IOException;
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -48,7 +48,7 @@
         svrBean.setServiceClass(HelloService.class);
         svrBean.setServiceBean(new HelloServiceImpl());
         svrBean.setBus(getBus());
-        svrBean.setDestinationFactory(new CustomDestinationFactory());
+        svrBean.setDestinationFactory(new CustomDestinationFactory(getBus()));
 
         ServerImpl server = (ServerImpl)svrBean.create();
         assertTrue(server.getDestination() instanceof CustomDestination);
@@ -78,18 +78,13 @@
     }
 
     public class CustomDestinationFactory extends AbstractTransportFactory implements DestinationFactory {
-
+        public CustomDestinationFactory(Bus b) {
+            super(Arrays.asList("id"), b);
+        }
         public Destination getDestination(EndpointInfo ei) throws IOException {
             return new CustomDestination();
         }
 
-        @Override
-        public List<String> getTransportIds() {
-            List<String> ids = new ArrayList<String>();
-            ids.add("id");
-            return ids;
-        }
-
     }
 
     public static class CustomDestination implements Destination {

Modified: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/stax/StaxDatabindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/stax/StaxDatabindingTest.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/stax/StaxDatabindingTest.java (original)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/stax/StaxDatabindingTest.java Tue Aug 25 18:23:01 2009
@@ -42,6 +42,7 @@
         
         ServerFactoryBean sf = new ServerFactoryBean();
         sf.setServiceBean(new CallbackService());
+        sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
         sf.setAddress(address);
         sf.setDataBinding(new StaxDataBinding());
         sf.getFeatures().add(new StaxDataBindingFeature());
@@ -59,6 +60,7 @@
         
         ServerFactoryBean sf = new ServerFactoryBean();
         sf.setServiceBean(new CopyService());
+        sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
         sf.setAddress(address);
         sf.setDataBinding(new StaxDataBinding());
         sf.getFeatures().add(new StaxDataBindingFeature());

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Tue Aug 25 18:23:01 2009
@@ -29,7 +29,6 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
@@ -72,10 +71,6 @@
     @Resource(name = "cxf")
     public void setBus(Bus b) {
         super.setBus(b);
-    }
-    
-    @PostConstruct
-    public void register() {
         if (null == bus) {
             return;
         }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java?rev=807747&r1=807746&r2=807747&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/CountersClientServerTest.java Tue Aug 25 18:23:01 2009
@@ -36,6 +36,7 @@
 import org.apache.cxf.management.jmx.InstrumentationManagerImpl;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.workqueue.WorkQueueManager;
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.GreeterImpl;
 import org.apache.hello_world_soap_http.SOAPService;
@@ -87,6 +88,7 @@
     public void testCountersWithInstrumentationManager() throws Exception {
         // create Client with other bus
         Bus bus = BusFactory.getDefaultBus();
+        bus.getExtension(WorkQueueManager.class);
                                 
         CounterRepository cr = bus.getExtension(CounterRepository.class);
         InstrumentationManager im = bus.getExtension(InstrumentationManager.class);



Mime
View raw message