cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r808614 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/bus/spring/ core/src/main/java/org/apache/cxf/transport/http/ javascript/src/main/java/org/apache/cxf/javascript/ javascript/src/main/resources/META-INF/cxf/
Date Thu, 27 Aug 2009 20:42:39 GMT
Author: dkulp
Date: Thu Aug 27 20:42:39 2009
New Revision: 808614

URL: http://svn.apache.org/viewvc?rev=808614&view=rev
Log:
Delay loading JavascriptQueryHandler

Removed:
    cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandlerRegistry.java
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
    cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
    cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml

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=808614&r1=808613&r2=808614&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
Thu Aug 27 20:42:39 2009
@@ -37,8 +37,8 @@
     private ApplicationContext context;
 
     private boolean isProcessing = true;
-    //private int count;
-    //private int count2;
+    private int count;
+    private int count2;
 
     Jsr250BeanPostProcessor() {
     }
@@ -95,12 +95,10 @@
         if (bean != null 
             && injectable(bean, beanId)) {
             new ResourceInjector(getResourceManager(bean)).inject(bean);
-            /*
             System.out.println("p :" + (++count) + ": " + bean.getClass().getName() + " "
+ beanId);
         } else if (bean != null) {
             System.out.println("np: " + (++count2) 
                                + ": " + bean.getClass().getName() + " " + beanId);
-            */
         }
         return bean;
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java?rev=808614&r1=808613&r2=808614&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
Thu Aug 27 20:42:39 2009
@@ -26,6 +26,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 
@@ -56,14 +57,22 @@
         bus = b;
         if (queryHandlers == null) {
             queryHandlers = new CopyOnWriteArrayList<QueryHandler>();
-            if (bus != null) {
-                WSDLQueryHandler wsdlQueryHandler = new WSDLQueryHandler();
-                wsdlQueryHandler.setBus(bus);
-                queryHandlers.add(wsdlQueryHandler);
-            }
         }
         if (null != bus) {
             bus.setExtension(this, QueryHandlerRegistry.class);
+            
+            WSDLQueryHandler wsdlQueryHandler = new WSDLQueryHandler();
+            wsdlQueryHandler.setBus(bus);
+            queryHandlers.add(wsdlQueryHandler);
+            
+            ConfiguredBeanLocator c = bus.getExtension(ConfiguredBeanLocator.class);
+            if (c != null) {
+                for (WSDLQueryHandler handler : c.getBeansOfType(WSDLQueryHandler.class))
{
+                    if (!queryHandlers.contains(handler)) {
+                        queryHandlers.add(handler);
+                    }
+                }
+            }
         }
     }
 

Modified: cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java?rev=808614&r1=808613&r2=808614&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
(original)
+++ cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
Thu Aug 27 20:42:39 2009
@@ -27,11 +27,12 @@
 import java.nio.charset.Charset;
 import java.util.Collection;
 import java.util.Map;
-import java.util.logging.Logger;
+
+import javax.annotation.Resource;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.UncheckedException;
-import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerRegistry;
@@ -42,21 +43,32 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.DestinationWithEndpoint;
 import org.apache.cxf.transport.http.UrlUtilities;
+import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.transports.http.StemMatchingQueryHandler;
 
+@NoJSR250Annotations(unlessNull = "bus")
 public class JavascriptQueryHandler implements StemMatchingQueryHandler {
     private static final String JS_UTILS_PATH = "/org/apache/cxf/javascript/cxf-utils.js";
-    private static final Logger LOG = LogUtils.getL7dLogger(JavascriptQueryHandler.class);
     private static final Charset UTF8 = Charset.forName("utf-8");
     private static final String NO_UTILS_QUERY_KEY = "nojsutils";
     private static final String CODE_QUERY_KEY = "js";
     private Bus bus;
 
     public JavascriptQueryHandler(Bus b) {
-        bus = b;
-        LOG.finest("Bus " + bus);
+        setBus(b);
     }
-
+    
+    @Resource
+    public final void setBus(Bus b) {
+        if (bus != b) {
+            bus = b;
+            QueryHandlerRegistry reg = b.getExtension(QueryHandlerRegistry.class);
+            if (reg != null) {
+                reg.registerHandler(this);
+            }
+        }
+    }
+    
     public String getResponseContentType(String fullQueryString, String ctx) {
         URI uri = URI.create(fullQueryString);
         Map<String, String> map = UrlUtilities.parseQueryString(uri.getQuery());

Modified: cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml?rev=808614&r1=808613&r2=808614&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
(original)
+++ cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
Thu Aug 27 20:42:39 2009
@@ -22,9 +22,9 @@
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
-    <bean class="org.apache.cxf.javascript.JavascriptQueryHandlerRegistry"
-    	id="org.apache.cxf.javascript.JavascriptQueryHandlerRegistry" 
-    	init-method="register"
+    <bean class="org.apache.cxf.javascript.JavascriptQueryHandler"
+    	id="org.apache.cxf.javascript.JavascriptQueryHandler" 
+    	lazy-init="true"
     	>
         <constructor-arg ref="cxf"/>
     </bean>



Mime
View raw message