cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r534300 - in /incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring: BusApplicationContext.java SpringBusFactory.java
Date Wed, 02 May 2007 03:14:01 GMT
Author: ningjiang
Date: Tue May  1 20:14:00 2007
New Revision: 534300

URL: http://svn.apache.org/viewvc?view=rev&rev=534300
Log:
CXF-621 applied the steven's patch

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java?view=diff&rev=534300&r1=534299&r2=534300
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
Tue May  1 20:14:00 2007
@@ -63,15 +63,17 @@
     }
 
     public BusApplicationContext(String cf, boolean include, ApplicationContext parent) {
-        super((String[])null, parent);
+        super((String[])null, false, parent);
         cfgFile = cf;
         includeDefaults = include;
+        refresh();
     }
     
     public BusApplicationContext(URL url, boolean include, ApplicationContext parent) {
-        super((String[])null, parent);
+        super((String[])null, false, parent);
         cfgFileURL = url;
         includeDefaults = include;
+        refresh();
     }
     
     @Override

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java?view=diff&rev=534300&r1=534299&r2=534300
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
Tue May  1 20:14:00 2007
@@ -39,9 +39,10 @@
     
     private static final Logger LOG = LogUtils.getL7dLogger(SpringBusFactory.class);
     
-    private ApplicationContext context;
+    private final ApplicationContext context;
 
     public SpringBusFactory() {
+        this.context = null;
     }
 
     public SpringBusFactory(ApplicationContext context) {
@@ -52,60 +53,49 @@
         return createBus((String)null);
     }
     
-    public Bus createBus(String cfgFile) {
-        boolean includeDefaults = true;
-        if (context != null) {
-            includeDefaults = !context.containsBean("cxf");
+    private boolean defaultBusNotExists() {
+        if (null != context) {
+            context.containsBean("cxf");
+            return false;
+        } else {
+            return true;
         }
+    }
+
+    public Bus createBus(String cfgFile) {
+        return createBus(cfgFile, defaultBusNotExists());
+    }
         
-        return createBus(cfgFile, includeDefaults);
+    private Bus finishCreatingBus(BusApplicationContext bac) {
+        final Bus bus = (Bus)bac.getBean(DEFAULT_BUS_ID);
+
+        bus.setExtension(new ConfigurerImpl(bac), Configurer.class);
+
+        possiblySetDefaultBus(bus);
+        registerApplicationContextLifeCycleListener(bus, bac);
+        return bus;
     }
     
     public Bus createBus(String cfgFile, boolean includeDefaults) {
-        BusApplicationContext bac = null;
         try {      
-            bac = new BusApplicationContext(cfgFile, includeDefaults, context);         
 
+            return finishCreatingBus(new BusApplicationContext(cfgFile, includeDefaults,
context));
         } catch (BeansException ex) {
             LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
             throw new RuntimeException(ex);
         }
-        
-        bac.refresh();
-        Bus bus = (Bus)bac.getBean(DEFAULT_BUS_ID);
-       
-        Configurer configurer = new ConfigurerImpl(bac);
-        bus.setExtension(configurer, Configurer.class);
-
-        possiblySetDefaultBus(bus);
-        registerApplicationContextLifeCycleListener(bus, bac);
-        return bus;
     }
     
     public Bus createBus(URL url) {
-        boolean includeDefaults = true;
-        if (context != null) {
-            includeDefaults = !context.containsBean("cxf");
-        }
-        return createBus(url, includeDefaults);
+        return createBus(url, defaultBusNotExists());
     }
     
     public Bus createBus(URL url, boolean includeDefaults) {
-        BusApplicationContext bac = null;
         try {      
-            bac = new BusApplicationContext(url, includeDefaults, context);           
+            return finishCreatingBus(new BusApplicationContext(url, includeDefaults, context));
         } catch (BeansException ex) {
             LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
+            throw new RuntimeException(ex);
         }
-        
-        bac.refresh();
-        Bus bus = (Bus)bac.getBean(DEFAULT_BUS_ID);
-       
-        Configurer configurer = new ConfigurerImpl(bac);
-        bus.setExtension(configurer, Configurer.class);
-
-        possiblySetDefaultBus(bus);
-        registerApplicationContextLifeCycleListener(bus, bac);
-        return bus;
     }
 
     



Mime
View raw message