You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/04/23 11:35:34 UTC

[cxf] 02/02: add master's compile instance changes to JavaToWS to branch 3.1.x-fixes. This closes #410.

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 141f25abe50bb1e34d0bc3545ec9e87d17a5fe2f
Author: rsearls <rs...@localhost.localdomain>
AuthorDate: Fri Apr 20 09:26:35 2018 -0400

    add master's compile instance changes to JavaToWS to branch 3.1.x-fixes. This closes #410.
---
 .../main/java/org/apache/cxf/tools/java2ws/JavaToWS.java | 16 +++++++++++++---
 .../org/apache/cxf/tools/java2ws/JavaToWSContainer.java  |  6 ++++++
 .../tools/java2wsdl/generator/wsdl11/BeanGenerator.java  | 16 +++++++---------
 3 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java
index 888e28f..db3c6a0 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java
@@ -24,6 +24,7 @@ import java.util.List;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.tools.common.CommandInterfaceUtils;
+import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.toolspec.ToolRunner;
 
 public class JavaToWS {
@@ -83,7 +84,18 @@ public class JavaToWS {
         ToolRunner.runTool(JavaToWSContainer.class, JavaToWSContainer.class
                            .getResourceAsStream("java2ws.xml"), false, args, os);      
     }
-    
+
+    /**
+     * Pass user app's (compiler) information in the context.
+     * @param context
+     * @param os
+     * @throws Exception
+     */
+    public void run(ToolContext context, OutputStream os) throws Exception {
+        ToolRunner.runTool(JavaToWSContainer.class,
+                JavaToWSContainer.class.getResourceAsStream("java2ws.xml"),
+                false, args, isExitOnFinish(), context, os);
+    }
 
     private boolean isExitOnFinish() {
         String exit = System.getProperty("exitOnFinish");
@@ -92,7 +104,5 @@ public class JavaToWS {
         }
         return "YES".equalsIgnoreCase(exit) || "TRUE".equalsIgnoreCase(exit);
     }
-    
-    
 
 }
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
index 3e4d030..666d38d 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
@@ -52,6 +52,12 @@ public class JavaToWSContainer extends AbstractCXFToolContainer {
             if (!hasInfoOption()) {
                 ToolContext env = new ToolContext();
                 env.setParameters(getParametersMap(new HashSet<String>()));
+
+                // check for custom compiler object to pass on
+                if (getContext() != null && getContext().get(ToolConstants.COMPILER) != null) {
+                    env.put(ToolConstants.COMPILER, getContext().get(ToolConstants.COMPILER));
+                }
+
                 if (env.get(ToolConstants.CFG_OUTPUTDIR) == null) {
                     env.put(ToolConstants.CFG_OUTPUTDIR, ".");
                 }
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
index ca5683f..3a03af5 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
@@ -80,20 +80,18 @@ public class BeanGenerator extends AbstractGenerator<File> {
             
                 generator.clearAttributes();
             }
-        
-                //compile the classes
-            Compiler compiler = new Compiler();
+
+            //compile the classes
+            Compiler compiler = (Compiler)getToolContext().get(ToolConstants.COMPILER);
+            if (compiler == null) {
+                compiler = new Compiler();
+            }
             compiler.setOutputDir(compileToDir);
             List<String> files = new ArrayList<String>(generatedFiles.size());
             for (File file : generatedFiles) {
                 files.add(file.getAbsolutePath());
             }
-            if (!compiler.compileFiles(files.toArray(new String[files.size()]))) {
-                // TODO - compile issue
-            }
-
-            
-            
+            compiler.compileFiles(files.toArray(new String[files.size()]));
         } catch (Exception e) {
             e.printStackTrace();
         }

-- 
To stop receiving notification emails like this one, please contact
coheigea@apache.org.