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

[cxf] branch master updated: [CXF-7711] enable JavaToWS to use custom compiler

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

asoldano pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new cab75e1  [CXF-7711] enable JavaToWS to use custom compiler
cab75e1 is described below

commit cab75e1a9651b69187bfe217b6404f4d1a3e01b7
Author: rsearls <rs...@ibm-p8-kvm-05-fsp.mgmt.pnr.lab.eng.rdu2.redhat.com>
AuthorDate: Tue Apr 17 16:02:02 2018 -0400

    [CXF-7711] enable JavaToWS to use custom compiler
---
 .../src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java | 12 ++++++++++++
 .../java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java |  6 ++++++
 .../cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java  |  5 ++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

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 22df372..ed9f7a0 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 {
@@ -84,6 +85,17 @@ public class JavaToWS {
                            .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");
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 08366b9..08a1d5c 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<>()));
+
+                // 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 3df2ee2..49e4d2f 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
@@ -82,7 +82,10 @@ public class BeanGenerator extends AbstractGenerator<File> {
             }
 
                 //compile the classes
-            Compiler compiler = new Compiler();
+            Compiler compiler = (Compiler)getToolContext().get(ToolConstants.COMPILER);
+            if (compiler == null) {
+                compiler = new Compiler();
+            }
             compiler.setOutputDir(compileToDir);
             List<String> files = new ArrayList<>(generatedFiles.size());
             for (File file : generatedFiles) {

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