cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r641658 - in /incubator/cxf/trunk/rt/core/src/main: java/org/apache/cxf/binding/ java/org/apache/cxf/bus/resource/ java/org/apache/cxf/bus/spring/ java/org/apache/cxf/transport/ java/org/apache/cxf/transport/http/ resources/META-INF/cxf/
Date Thu, 27 Mar 2008 00:27:46 GMT
Author: bimargulies
Date: Wed Mar 26 17:27:41 2008
New Revision: 641658

URL: http://svn.apache.org/viewvc?rev=641658&view=rev
Log:
Reduce use of spring constructor-arg elements in favor of properties. 
This speeds up startup, but perhaps not as much as I had expected.

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingFactoryManagerImpl.java
Wed Mar 26 17:27:41 2008
@@ -36,7 +36,7 @@
     
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(BindingFactoryManagerImpl.class);
     
-    final Map<String, BindingFactory> bindingFactories; 
+    Map<String, BindingFactory> bindingFactories; 
     Bus bus;
      
     public BindingFactoryManagerImpl() throws BusException {
@@ -53,6 +53,15 @@
     public BindingFactoryManagerImpl(MapProvider<String, BindingFactory> bindingFactories)
{
         super();
         this.bindingFactories = bindingFactories.createMap();
+    }
+
+    /**
+     * Spring configuration via constructor is slow.
+     * This accessor allows initialization via a property.
+     * @param bindingFactoriesMapProvider
+     */
+    public void setMapProvider(MapProvider<String, BindingFactory> bindingFactoriesMapProvider)
{
+        this.bindingFactories = bindingFactoriesMapProvider.createMap();
     }
 
     @Resource

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
Wed Mar 26 17:27:41 2008
@@ -50,7 +50,16 @@
         registeredResolvers.clear();
         
         registeredResolvers.add(new PropertiesResolver(properties));
-    } 
+    }
+
+    /**
+     * Set the list of resolvers for this resource manager.
+     * @param resolvers
+     */
+    public void setResolvers(List<ResourceResolver> resolvers) {
+        registeredResolvers.clear();
+        registeredResolvers.addAll(resolvers);
+    }
     
     @Resource
     public void setBus(Bus b) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
Wed Mar 26 17:27:41 2008
@@ -75,8 +75,8 @@
     }
 
 
-    public void setApplicationContext(ApplicationContext arg0) throws BeansException {
-        context = arg0;        
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
+        context = applicationContext;        
     }
 
 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ConduitInitiatorManagerImpl.java
Wed Mar 26 17:27:41 2008
@@ -37,7 +37,7 @@
 
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ConduitInitiatorManager.class);
 
-    final Map<String, ConduitInitiator> conduitInitiators;
+    Map<String, ConduitInitiator> conduitInitiators;
     
     private Bus bus;
     public ConduitInitiatorManagerImpl() {
@@ -48,9 +48,18 @@
     public ConduitInitiatorManagerImpl(MapProvider<String, ConduitInitiator> conduitInitiators)
{
         this.conduitInitiators = conduitInitiators.createMap();
     }
-    
+
     public ConduitInitiatorManagerImpl(Map<String, ConduitInitiator> conduitInitiators)
{
         this.conduitInitiators = conduitInitiators;
+    }
+    
+    /**
+     * Spring is slow to resolve constructors. This accessor allows
+     * for initialization via a property.
+     * @param mapProvider
+     */
+    public void setMapProvider(MapProvider<String, ConduitInitiator> mapProvider) {
+        this.conduitInitiators = mapProvider.createMap();
     }
     
     @Resource

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/DestinationFactoryManagerImpl.java
Wed Mar 26 17:27:41 2008
@@ -39,7 +39,7 @@
 
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(DestinationFactoryManager.class);
 
-    final Map<String, DestinationFactory> destinationFactories;
+    Map<String, DestinationFactory> destinationFactories;
     Properties factoryNamespaceMappings;
 
     private Bus bus;
@@ -53,6 +53,15 @@
     }
     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();
     }
 
     @Resource

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
Wed Mar 26 17:27:41 2008
@@ -37,18 +37,24 @@
     
     public QueryHandlerRegistryImpl() {
     }
+    
     public QueryHandlerRegistryImpl(Bus b, List<QueryHandler> handlers) {
         bus = b;
         queryHandlers = new CopyOnWriteArrayList<QueryHandler>(handlers);
     }
     
-    
+    public void setQueryHandlers(List<QueryHandler> handlers) {
+        this.queryHandlers = new CopyOnWriteArrayList<QueryHandler>(handlers);
+    }
+
     @PostConstruct
     public void register() {
         if (queryHandlers == null) {
             queryHandlers = new CopyOnWriteArrayList<QueryHandler>();
             if (bus != null) {
-                queryHandlers.add(new WSDLQueryHandler(bus));
+                WSDLQueryHandler wsdlQueryHandler = new WSDLQueryHandler();
+                wsdlQueryHandler.setBus(bus);
+                queryHandlers.add(wsdlQueryHandler);
             }
         }
         if (null != bus) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Wed Mar 26 17:27:41 2008
@@ -69,9 +69,8 @@
 public class WSDLQueryHandler implements StemMatchingQueryHandler {
     private static final Logger LOG = LogUtils.getL7dLogger(WSDLQueryHandler.class, "QueryMessages");
     private Bus bus;
-
-    public WSDLQueryHandler(Bus b) {
-        bus = b;
+    
+    public WSDLQueryHandler() {
     }
 
     public String getResponseContentType(String baseUri, String ctx) {
@@ -382,5 +381,9 @@
     
     public boolean isRecognizedQuery(String baseUri, String ctx, EndpointInfo endpointInfo)
{
         return isRecognizedQuery(baseUri, ctx, endpointInfo, false);
+    }
+
+    public void setBus(Bus bus) {
+        this.bus = bus;
     }
 }

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?rev=641658&r1=641657&r2=641658&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Wed Mar 26 17:27:41
2008
@@ -28,13 +28,13 @@
     <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">
-       <constructor-arg>
+       <property name="resolvers">
             <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>
+       </property>
        <property name="bus" ref="cxf"/>
     </bean>
     <bean id="org.apache.cxf.configuration.Configurer" 
@@ -42,32 +42,32 @@
     </bean>    
         
     <bean id="org.apache.cxf.binding.BindingFactoryManager" class="org.apache.cxf.binding.BindingFactoryManagerImpl">
-        <constructor-arg>
+        <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>
-        </constructor-arg>
+        </property>
         <property name="bus" ref="cxf"/>
     </bean>
     
     <bean id="org.apache.cxf.transport.DestinationFactoryManager" class="org.apache.cxf.transport.DestinationFactoryManagerImpl">
-        <constructor-arg>
+        <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>
-        </constructor-arg>
+        </property>
         <property name="bus" ref="cxf"/>
     </bean>
     
     <bean id="org.apache.cxf.transport.ConduitInitiatorManager" class="org.apache.cxf.transport.ConduitInitiatorManagerImpl">
-        <constructor-arg>
+        <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>
-        </constructor-arg>
+        </property>
         <property name="bus" ref="cxf"/>
     </bean>
     
@@ -96,14 +96,14 @@
         
 
     <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry" class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
-        <constructor-arg ref="cxf"/>
-        <constructor-arg>
+        <property name="bus" ref="cxf"/>
+        <property name="queryHandlers">
         	<list>
         		<bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
-			        <constructor-arg ref="cxf"/>
+			        <property name="bus" ref="cxf"/>
         		</bean>	
         	</list>
-        </constructor-arg>
+        </property>
     </bean>
 
     <bean id="org.apache.cxf.endpoint.EndpointResolverRegistry" class="org.apache.cxf.endpoint.EndpointResolverRegistryImpl">



Mime
View raw message