cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r579529 - in /incubator/cxf/trunk/tools/javato/ws/src: main/java/org/apache/cxf/tools/java2ws/ main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/ m...
Date Wed, 26 Sep 2007 09:14:56 GMT
Author: ema
Date: Wed Sep 26 02:14:55 2007
New Revision: 579529

URL: http://svn.apache.org/viewvc?rev=579529&view=rev
Log:
Fixed issue CXF-1070
Moved generated server and client side code to directory that "-s" specified  

Added:
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/GreeterImpl.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/HelloImpl.java
Modified:
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java?rev=579529&r1=579528&r2=579529&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
Wed Sep 26 02:14:55 2007
@@ -57,6 +57,11 @@
                 if (env.get(ToolConstants.CFG_OUTPUTDIR) == null) {
                     env.put(ToolConstants.CFG_OUTPUTDIR, ".");
                 }
+                
+                if (env.get(ToolConstants.CFG_SOURCEDIR) == null) {
+                    env.put(ToolConstants.CFG_SOURCEDIR, ".");
+                }
+                
                 if (isVerboseOn()) {
                     env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
                 }

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml?rev=579529&r1=579528&r2=579529&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
Wed Sep 26 02:14:55 2007
@@ -96,17 +96,18 @@
 
 			<option id="outputdir" maxOccurs="1">
 				<annotation>
-					The directory in which the output files are placed
+					The directory in which the output wsdl and other 
+					resource files are placed
 				</annotation>
 				<switch>d</switch>
 				<associatedArgument placement="afterSpace">
-					<annotation>output-directory</annotation>
+					<annotation>resource-directory</annotation>
 				</associatedArgument>
 			</option>
 
 			<option id="sourcedir" maxOccurs="1">
 				<annotation>
-					The directory in which the generated source files
+					The directory in which the generated java source files
 					are placed
 				</annotation>
 				<switch>s</switch>
@@ -116,7 +117,7 @@
 			</option>
 			<option id="classdir" maxOccurs="1">
 				<annotation>
-					The directory in which the generated sources are
+					The directory in which the generated wrapper sources are
 					compiled into. If not specified, the files are not
 					compiled.
 				</annotation>

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java?rev=579529&r1=579528&r2=579529&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JAXWSFrontEndProcessor.java
Wed Sep 26 02:14:55 2007
@@ -56,6 +56,7 @@
 import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator.JaxwsServerGenerator;
 
 public class JAXWSFrontEndProcessor implements Processor {
+    private static final String SEI_SUFFIX = "_PortType";
     private static final Logger LOG = LogUtils.getL7dLogger(JAXWSFrontEndProcessor.class);
     private ToolContext context;
     private List<AbstractJaxwsGenerator> generators = new ArrayList<AbstractJaxwsGenerator>();
@@ -67,6 +68,10 @@
         List<ServiceInfo> services = (List<ServiceInfo>)context.get(ToolConstants.SERVICE_LIST);
         ServiceInfo serviceInfo = services.get(0);
         JavaInterface jinf = JavaFirstUtil.serviceInfo2JavaInf(serviceInfo);
+        String className = (String)context.get(ToolConstants.IMPL_CLASS);
+        if (className != null && className.equals(jinf.getFullClassName())) {
+            jinf.setName(jinf.getName() + SEI_SUFFIX);
+        }
         JavaModel jm = new JavaModel();
         jm.addInterface("inf", jinf);
         jinf.setJavaModel(jm);

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java?rev=579529&r1=579528&r2=579529&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
Wed Sep 26 02:14:55 2007
@@ -18,12 +18,18 @@
  */
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.util.FileWriterUtil;
 import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
 
 public abstract class AbstractJaxwsGenerator extends AbstractGenerator {
@@ -34,6 +40,29 @@
     public abstract boolean passthrough();
 
     public abstract void generate(ToolContext penv) throws ToolException;
+    
+    @Override
+    protected Writer parseOutputName(String packageName, String filename, String ext) throws
ToolException {
+        FileWriterUtil fw = null;
+        Writer writer = null;
+
+        if (wantToKeep() && isCollision(packageName, filename, ext)) {
+            Message msg = new Message("SKIP_GEN", LOG, packageName + "." + filename + ext);
+            LOG.log(Level.INFO, msg.toString());
+            return null;
+        }
+
+        fw = new FileWriterUtil((String)env.get(ToolConstants.CFG_SOURCEDIR));
+        try {
+            writer = fw.getWriter(packageName, filename + ext);
+        } catch (IOException ioe) {
+            Message msg = new Message("FAIL_TO_WRITE_FILE", LOG, packageName + "." + filename
+ ext);
+            throw new ToolException(msg, ioe);
+        }
+
+        return writer;
+    }
+    
     public void register(final ClassCollector collector, String packageName, String fileName)
{
         
     }

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java?rev=579529&r1=579528&r2=579529&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
Wed Sep 26 02:14:55 2007
@@ -18,12 +18,18 @@
  */
 package org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.util.FileWriterUtil;
 import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
 
 public abstract class AbstractSimpleGenerator extends AbstractGenerator {
@@ -37,5 +43,27 @@
     public void register(final ClassCollector collector, String packageName, String fileName)
{
         
     }
+    
+    protected Writer parseOutputName(String packageName, String filename, String ext) throws
ToolException {
+        FileWriterUtil fw = null;
+        Writer writer = null;
+
+        if (wantToKeep() && isCollision(packageName, filename, ext)) {
+            Message msg = new Message("SKIP_GEN", LOG, packageName + "." + filename + ext);
+            LOG.log(Level.INFO, msg.toString());
+            return null;
+        }
+
+        fw = new FileWriterUtil((String)env.get(ToolConstants.CFG_SOURCEDIR));
+        try {
+            writer = fw.getWriter(packageName, filename + ext);
+        } catch (IOException ioe) {
+            Message msg = new Message("FAIL_TO_WRITE_FILE", LOG, packageName + "." + filename
+ ext);
+            throw new ToolException(msg, ioe);
+        }
+
+        return writer;
+    }
+    
 
 }

Added: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/GreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/GreeterImpl.java?rev=579529&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/GreeterImpl.java
(added)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/GreeterImpl.java
Wed Sep 26 02:14:55 2007
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tools.fortest;
+
+import javax.jws.WebService;
+
+@WebService
+public class GreeterImpl {
+    public String greetMe() {
+        return "";
+    }
+
+}

Added: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/HelloImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/HelloImpl.java?rev=579529&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/HelloImpl.java
(added)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/HelloImpl.java
Wed Sep 26 02:14:55 2007
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tools.fortest;
+
+import javax.jws.WebService;
+
+@WebService
+public class HelloImpl implements Hello {
+
+    public String sayHi(String arg) {
+        return "";
+    }
+
+}

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=579529&r1=579528&r2=579529&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
Wed Sep 26 02:14:55 2007
@@ -67,7 +67,7 @@
     @Test
     public void testFlagWSDL() throws Exception {
         File wsdlFile = outputFile("tmp.wsdl");
-        String[] args = new String[] {"-wsdl", "-o", wsdlFile.getAbsolutePath(), "-d", output.getPath(),
+        String[] args = new String[] {"-wsdl", "-o", wsdlFile.getAbsolutePath(), "-s", output.getPath(),
                                       "-client", "-server", "org.apache.hello_world_soap12_http.Greeter"};
         JavaToWS.main(args);
         checkStdErr();
@@ -84,7 +84,7 @@
     @Test
     public void testSimple() throws Exception {
         File wsdlFile = outputFile("tmp.wsdl");
-        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-d",
+        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-s",
                                       output.getPath(), "-frontend", "jaxws", "-client",
"-server",
                                       "org.apache.hello_world_doc_lit.Greeter"};
         JavaToWS.main(args);
@@ -94,7 +94,7 @@
     
     @Test
     public void testSimpleFrontend() throws Exception {
-        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-d",
+        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-s",
                                       output.getPath(), "-frontend", "simple", "-client",
"-server",
                                       "org.apache.cxf.tools.fortest.simple.Hello"};
         JavaToWS.main(args);
@@ -108,7 +108,7 @@
         
     @Test
     public void testMissingBeans() {
-        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-d",
+        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-s",
                                       output.getPath(), "-frontend", "jaxws", "-client",
"-server",
                                       "-beans", "nobodyHome.xml",
                                       "-beans", "nothing.xml",
@@ -122,7 +122,7 @@
     @Test
     public void testClassNoWebServiceAnno() throws Exception {
         File wsdlFile = outputFile("tmp.wsdl");
-        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-d",
+        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-s",
                                       output.getPath(), "-frontend", "jaxws", "-client",
"-server",
                                       "org.apache.cxf.tools.fortest.HelloWithNoAnno"};
         JavaToWS.main(args);
@@ -134,8 +134,8 @@
     @Test
     public void testClassWithRMI() throws Exception {
         File wsdlFile = outputFile("tmp.wsdl");
-        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-d",
-                                      output.getPath(), "-frontend", "jaxws", "-client",
"-server",
+        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",

+                                      "-s", output.getPath(), "-frontend", "jaxws", "-client",
"-server",
                                       "org.apache.cxf.tools.fortest.HelloRMI"};
         JavaToWS.main(args);
         assertTrue("Failed to generate WSDL file", wsdlFile.exists());
@@ -149,7 +149,7 @@
         File client = outputFile("org/apache/hello_world_soap12_http/GreeterClient.java");
         File server = outputFile("org/apache/hello_world_soap12_http/GreeterServer.java");
 
-        String[] args = new String[] {"-d", output.getPath(), "-client", "-server",
+        String[] args = new String[] {"-s", output.getPath(), "-client", "-server",
                                       "org.apache.hello_world_soap12_http.Greeter"};
         JavaToWS.main(args);
         checkStdErr();
@@ -162,7 +162,7 @@
         File server = outputFile("org/apache/hello_world_soap12_http/GreeterServer.java");
         File impl = outputFile("org/apache/hello_world_soap12_http/GreeterImpl.java");
 
-        String[] args = new String[] {"-d", output.getPath(), "-server",
+        String[] args = new String[] {"-s", output.getPath(), "-server",
                                       "org.apache.hello_world_soap12_http.Greeter"};
         JavaToWS.main(args);
         checkStdErr();
@@ -172,7 +172,7 @@
 
     @Test
     public void testGenWrapperBean() throws Exception {
-        String[] args = new String[] {"-d", output.getPath(), "-wrapperbean", "-server",
+        String[] args = new String[] {"-s", output.getPath(), "-wrapperbean", "-server",
                                       "org.apache.cxf.tools.java2ws.fortest.Calculator"};
         JavaToWS.main(args);
         checkStdErr();
@@ -207,6 +207,24 @@
         assertTrue("jaxb databinding warning should be detected", getStdErr()
                    .indexOf("Simple front end only supports aegis databinding") > -1);
     }
+    
+    @Test
+    public void testImplClassWithoutSei() throws Exception {
+        File wsdlFile = outputFile("tmp.wsdl");
+        String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl", "-verbose",
"-s",
+                                      output.getPath(), "-frontend", "jaxws", "-client",
"-server",
+                                      "org.apache.cxf.tools.fortest.GreeterImpl"};
+        JavaToWS.main(args);
+        assertTrue("Failed to generate WSDL file", wsdlFile.exists());
+        
+        File sei = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortType.java");
+        assertTrue("Failed to generate SEI file : GreeterImpl_PortType.java", sei.exists());
+        File client = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeClient.java");
+        assertTrue("Failed to generate client file : GreeterImpl_PortTypeClient.java", client.exists());
+        File server = outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeServer.java");
+        assertTrue("Failed to generate SEI file : GreeterImpl_PortTypeServer.java", server.exists());
+    }
+    
     
 
     protected String getClassPath() throws URISyntaxException {



Mime
View raw message