cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r951043 - /cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Date Thu, 03 Jun 2010 15:55:52 GMT
Author: dkulp
Date: Thu Jun  3 15:55:52 2010
New Revision: 951043

URL: http://svn.apache.org/viewvc?rev=951043&view=rev
Log:
Delay creating bus until it's really needed

Modified:
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=951043&r1=951042&r2=951043&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Thu Jun  3 15:55:52 2010
@@ -358,11 +358,8 @@ public class WSDL2JavaMojo extends Abstr
         try {
             classLoaderSwitcher.switchClassLoader(project, useCompileClasspath, classesDir);
 
-            bus = BusFactory.newInstance().createBus();
-            BusFactory.setThreadDefaultBus(bus);
-
             for (WsdlOption o : effectiveWsdlOptions) {
-                callWsdl2Java(o);
+                bus = callWsdl2Java(o, bus);
 
                 File dirs[] = o.getDeleteDirs();
                 if (dirs != null) {
@@ -388,7 +385,7 @@ public class WSDL2JavaMojo extends Abstr
         System.gc();
     }
 
-    private void callWsdl2Java(WsdlOption wsdlOption) throws MojoExecutionException {
+    private Bus callWsdl2Java(WsdlOption wsdlOption, Bus bus) throws MojoExecutionException
{
         File outputDirFile = wsdlOption.getOutputDir();
         outputDirFile.mkdirs();
         URI basedir = project.getBasedir().toURI();
@@ -396,9 +393,14 @@ public class WSDL2JavaMojo extends Abstr
         File doneFile = getDoneFile(basedir, wsdlURI);
 
         if (!shouldRun(wsdlOption, doneFile, wsdlURI)) {
-            return;
+            return bus;
         }
-        
+
+        if (bus == null) {
+            bus = BusFactory.newInstance().createBus();
+            BusFactory.setThreadDefaultBus(bus);
+        }
+
         doneFile.delete();
         List<String> list = wsdlOption.generateCommandLine(outputDirFile, basedir,
wsdlURI, getLog()
             .isDebugEnabled());
@@ -416,6 +418,7 @@ public class WSDL2JavaMojo extends Abstr
             getLog().warn("Could not create marker file " + doneFile.getAbsolutePath());
             getLog().debug(e);
         }
+        return bus;
     }
 
     private File getDoneFile(URI basedir, URI wsdlURI) {



Mime
View raw message