You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/06/11 19:30:04 UTC

svn commit: r953782 - in /cxf/branches/2.2.x-fixes: ./ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Author: dkulp
Date: Fri Jun 11 17:30:03 2010
New Revision: 953782

URL: http://svn.apache.org/viewvc?rev=953782&view=rev
Log:
Merged revisions 951043 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r951043 | dkulp | 2010-06-03 11:55:52 -0400 (Thu, 03 Jun 2010) | 1 line
  
  Delay creating bus until it's really needed
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=953782&r1=953781&r2=953782&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java (original)
+++ cxf/branches/2.2.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java Fri Jun 11 17:30:03 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) {