Author: ema
Date: Mon Oct 22 00:52:27 2007
New Revision: 587024
URL: http://svn.apache.org/viewvc?rev=587024&view=rev
Log:
Fix the compile generated code error using simple front end
Modified:
incubator/cxf/trunk/tools/javato/ws/pom.xml
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/JavaToWSDLProcessor.java
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleClientGenerator.ja
va
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleServerGenerator.ja
va
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/client.vm
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/impl.vm
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools
/java2ws/JavaToWSTest.java
Modified: incubator/cxf/trunk/tools/javato/ws/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/pom.x
ml?rev=587024&r1=587023&r2=587024&view=diff
======================================================================
======== --- incubator/cxf/trunk/tools/javato/ws/pom.xml (original)
+++ incubator/cxf/trunk/tools/javato/ws/pom.xml Mon Oct 22 00:52:27
2007 @@ -73,6 +73,12 @@
<artifactId>cxf-tools-wsdlto-frontend-jaxws</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/JavaToWSDLProcessor.java URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/m
ain/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.j
ava?rev=587024&r1=587023&r2=587024&view=diff
======================================================================
======== ---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/JavaToWSDLProcessor.java (original) +++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/JavaToWSDLProcessor.java Mon Oct 22 00:52:27 2007
@@ -197,6 +197,8 @@
if (clz.getInterfaces().length == 1) {
context.put(ToolConstants.SEI_CLASS,
clz.getInterfaces()[0].getName()); }
+ //TODO: if it is simple frontend, and the impl class
implments + //multiple interfaces
context.put(ToolConstants.GEN_FROM_SEI, Boolean.FALSE);
}
builderFactory.setServiceClass(clz);
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleClientGenerator.ja
va URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/m
ain/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/gener
ator/SimpleClientGenerator.java?rev=587024&r1=587023&r2=587024&view=dif
f
======================================================================
======== ---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleClientGenerator.ja
va (original) +++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleClientGenerator.ja
va Mon Oct 22 00:52:27 2007 @@ -58,7 +58,7 @@
setAttributes("seiClass",
env.get(ToolConstants.SEI_CLASS)); setCommonAttributes();
doWrite(CLIENT_TEMPLATE,
parseOutputName(intf.getPackageName(), intf.getName() + "Client")); -
+ env.put(ToolConstants.CLIENT_CLASS,
intf.getFullClassName() + "Client"); }
}
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/m
ain/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/gener
ator/SimpleImplGenerator.java?rev=587024&r1=587023&r2=587024&view=diff
======================================================================
======== ---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java
(original) +++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleImplGenerator.java
Mon Oct 22 00:52:27 2007 @@ -59,6 +59,7 @@
for (JavaInterface intf : interfaces.values()) {
clearAttributes();
setAttributes("intf", intf);
+ setAttributes("seiClass",
env.get(ToolConstants.SEI_CLASS)); setCommonAttributes();
doWrite(IMPL_TEMPLATE,
parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleServerGenerator.ja
va URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/m
ain/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/gener
ator/SimpleServerGenerator.java?rev=587024&r1=587023&r2=587024&view=dif
f
======================================================================
======== ---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleServerGenerator.ja
va (original) +++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/SimpleServerGenerator.ja
va Mon Oct 22 00:52:27 2007 @@ -62,6 +62,7 @@
setAttributes("implClass",
env.get(ToolConstants.IMPL_CLASS)); setCommonAttributes();
doWrite(SERVER_TEMPLATE,
parseOutputName(intf.getPackageName(), intf.getName() + "Server")); +
env.put(ToolConstants.SERVER_CLASS, intf.getFullClassName()
+ "Server"); }
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/client.vm URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/m
ain/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/gener
ator/template/client.vm?rev=587024&r1=587023&r2=587024&view=diff
======================================================================
======== ---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/client.vm
(original) +++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/client.vm Mon
Oct 22 00:52:27 2007 @@ -22,14 +22,14 @@
package $intf.PackageName;
import org.apache.cxf.bus.CXFBusFactory;
-import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ClientFactoryBean;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
/**
- * This cla ss was generated by the CXF $version
+ * This class was generated by the CXF $version
* $currentdate
- * Generated source version: $version
- *
+ * Generated source version: $version
*/
public class ${intf.Name}Client {
public static void main(String[] args) {
@@ -40,6 +40,6 @@
clientBean.setTransportId("http://schemas.xmlsoap.org/wsdl/http/");
clientBean.setServiceClass(${seiClass}.class);
proxyFactory.getServiceFactory().setDataBinding(new
AegisDatabinding()); - ${intf.FullClassName} client =
(${intf.FullClassName})proxyFactory.create(); + ${seiClass}
client = (${seiClass})proxyFactory.create(); }
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/impl.vm URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/m
ain/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/gener
ator/template/impl.vm?rev=587024&r1=587023&r2=587024&view=diff
======================================================================
======== ---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/impl.vm
(original) +++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools
/java2wsdl/processor/internal/simple/generator/template/impl.vm Mon Oct
22 00:52:27 2007 @@ -23,13 +23,13 @@
package $intf.PackageName;
/**
- * This cla ss was generated by the CXF $version
+ * This class was generated by the CXF $version
* $currentdate
* Generated source version: $version
*
*/
-public class ${intf.Name}Impl implements $intf.Name {
+public class ${intf.Name}Impl implements ${seiClass} {
#foreach ($method in $intf.Methods)
public $method.return.ClassName
${method.Name}(#if($method.ParameterList.size() ==
0))#end#if($method.ParameterList.size() != 0)#foreach ($param in
${method.ParameterList})$param#end)#end#if($method.Exceptions.size() >
0) throws#foreach($exception in $method.Exceptions)
$exception.ClassName#if($method.Exceptions.size() !=
$velocityCount),#end#end#end { #foreach ($parameter in
$method.Parameters)
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/t
est/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=587024&r1=5
87023&r2=587024&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 Mon Oct 22 00:52:27 2007 @@ -26,6 +26,7 @@
import org.apache.cxf.helpers.FileUtils;
import org.apache.cxf.tools.common.ToolContext;
import org.apache.cxf.tools.common.ToolTestBase;
+import org.apache.cxf.tools.util.Compiler;
import org.junit.After;
import org.junit.Before;
@@ -36,15 +37,20 @@
protected String cp;
protected ToolContext env;
protected File output;
+ protected File classDir;
@Before
- public void startUp() throws Exception {
+ public void setUpResource() throws Exception {
+ super.setUp();
env = new ToolContext();
cp = System.getProperty("java.class.path");
URL url = getClass().getResource(".");
output = new File(url.toURI());
+ System.setProperty("java.class.path", getClassPath());
output = new File(output, "/generated/");
FileUtils.mkDir(output);
+ classDir = new File(output, "/classes/");
+ FileUtils.mkDir(classDir);
}
@After
@@ -106,6 +112,13 @@
assertTrue("Failed to generate client file for simple front
end ", client.exists()); assertTrue("Failed to generate server file
for simple front end ", server.exists()); assertTrue("Failed to
generate impl file for simple front end ", impl.exists()); +
Compiler compiler = new Compiler();
+ String[] files = new
String[]{client.getAbsoluteFile().toString(), +
server.getAbsoluteFile().toString(), +
impl.getAbsoluteFile().toString()}; +
compiler.compileFiles(files, this.classDir);
+
+
}
@Test
@@ -210,6 +223,7 @@
.indexOf("Simple front end only supports aegis
databinding") > -1); }
+
@Test
public void testImplClassWithoutSei() throws Exception {
File wsdlFile = outputFile("tmp.wsdl");
@@ -226,9 +240,7 @@
File server =
outputFile("org/apache/cxf/tools/fortest/GreeterImpl_PortTypeServer.ja
va"); assertTrue("Failed to generate SEI file :
GreeterImpl_PortTypeServer.java", server.exists()); }
-
-
-
+
protected String getClassPath() throws URISyntaxException {
ClassLoader loader = getClass().getClassLoader();
StringBuffer classPath = new StringBuffer();