Author: dkulp
Date: Fri Sep 17 01:36:04 2010
New Revision: 997961
URL: http://svn.apache.org/viewvc?rev=997961&view=rev
Log:
Merged revisions 997960 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r997960 | dkulp | 2010-09-16 21:27:38 -0400 (Thu, 16 Sep 2010) | 2 lines
[CXF-2988,CXF-2989] Fix issues with generating wrapper beans from
java2ws plugin.
........
Added:
cxf/branches/2.2.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
- copied unchanged from r997960,
cxf/trunk/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java?rev=997961&r1=997960&r2=997961&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
(original)
+++
cxf/branches/2.2.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/Java2WSMojo.java
Fri Sep 17 01:36:04 2010
@@ -35,7 +35,8 @@ import org.apache.maven.project.MavenPro
/**
* @goal java2ws
* @description CXF Java To Webservice Tool
- */
+ * @requiresDependencyResolution test
+*/
public class Java2WSMojo extends AbstractMojo {
/**
* @parameter
@@ -142,24 +143,21 @@ public class Java2WSMojo extends Abstrac
private Boolean attachWsdl;
public void execute() throws MojoExecutionException {
- StringBuilder buf = new StringBuilder();
- for (Object classpathElement : classpathElements) {
- buf.append(classpathElement.toString());
- buf.append(File.pathSeparatorChar);
- }
- String newCp = buf.toString();
- String cp = System.getProperty("java.class.path");
+ ClassLoaderSwitcher classLoaderSwitcher = new
ClassLoaderSwitcher(getLog());
+
+
try {
- System.setProperty("java.class.path", newCp);
- processJavaClass();
+ String cp = classLoaderSwitcher.switchClassLoader(project, false,
+ classpath,
classpathElements);
+ processJavaClass(cp);
} finally {
- System.setProperty("java.class.path", cp);
+ classLoaderSwitcher.restoreClassLoader();
}
System.gc();
}
- private void processJavaClass() throws MojoExecutionException {
+ private void processJavaClass(String cp) throws MojoExecutionException {
List<String> args = new ArrayList<String>();
// outputfile arg
@@ -220,7 +218,7 @@ public class Java2WSMojo extends Abstrac
// classpath arg
args.add("-cp");
- args.add(classpath);
+ args.add(cp);
// soap12 arg
if (soap12 != null && soap12.booleanValue()) {
Modified:
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java?rev=997961&r1=997960&r2=997961&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
(original)
+++
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
Fri Sep 17 01:36:04 2010
@@ -96,6 +96,11 @@ public class RequestWrapper extends Wrap
@Override
public WrapperBeanClass getWrapperBeanClass(final Method method) {
javax.xml.ws.RequestWrapper reqWrapper =
method.getAnnotation(javax.xml.ws.RequestWrapper.class);
+ javax.jws.WebMethod webMethod =
method.getAnnotation(javax.jws.WebMethod.class);
+ String methName = webMethod == null ? null : webMethod.operationName();
+ if (StringUtils.isEmpty(methName)) {
+ methName = method.getName();
+ }
String reqClassName = getClassName();
String reqNs = null;
@@ -104,7 +109,7 @@ public class RequestWrapper extends Wrap
reqNs = reqWrapper.targetNamespace().length() > 0 ?
reqWrapper.targetNamespace() : null;
}
if (reqClassName == null) {
- reqClassName = getPackageName(method) + ".jaxws." +
StringUtils.capitalize(method.getName());
+ reqClassName = getPackageName(method) + ".jaxws." +
StringUtils.capitalize(methName);
}
WrapperBeanClass jClass = new WrapperBeanClass();
Modified:
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java?rev=997961&r1=997960&r2=997961&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
(original)
+++
cxf/branches/2.2.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
Fri Sep 17 01:36:04 2010
@@ -129,6 +129,11 @@ public final class ResponseWrapper exten
@Override
public WrapperBeanClass getWrapperBeanClass(final Method method) {
javax.xml.ws.ResponseWrapper resWrapper =
method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
+ javax.jws.WebMethod webMethod =
method.getAnnotation(javax.jws.WebMethod.class);
+ String methName = webMethod == null ? null : webMethod.operationName();
+ if (StringUtils.isEmpty(methName)) {
+ methName = method.getName();
+ }
String resClassName = getClassName();
String resNs = null;
@@ -138,7 +143,7 @@ public final class ResponseWrapper exten
}
if (resClassName == null) {
resClassName = getPackageName(method) + ".jaxws."
- + StringUtils.capitalize(method.getName())
+ + StringUtils.capitalize(methName)
+ "Response";
}
Modified:
cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=997961&r1=997960&r2=997961&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
(original)
+++
cxf/branches/2.2.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
Fri Sep 17 01:36:04 2010
@@ -86,10 +86,10 @@ public class JavaToWSTest extends ToolTe
"-wsdl", "-wrapperbean",
"-s", output.getPath(),
"-o", output.getPath() + "/cxf2941.wsdl",
- "org.apache.cxf.tools.fortest.cxf2941.WebResultService"
+
org.apache.cxf.tools.fortest.cxf2941.WebResultService.class.getName()
};
JavaToWS.main(args);
- File wrapper =
outputFile("org/apache/cxf/tools/fortest/cxf2941/jaxws/HelloResponse.java");
+ File wrapper =
outputFile("org/apache/cxf/tools/fortest/cxf2941/jaxws/HelloStringResponse.java");
String str = FileUtils.getStringFromFile(wrapper);
assertTrue("namespace value in annoataion @XmlElement is not correct"
, str.indexOf("hello/name") > -1);
@@ -107,7 +107,7 @@ public class JavaToWSTest extends ToolTe
"org.apache.cxf.tools.fortest.cxf2934.WebParamService"
};
JavaToWS.main(args);
- File wrapper =
outputFile("org/apache/cxf/tools/fortest/cxf2934/jaxws/HelloResponse.java");
+ File wrapper =
outputFile("org/apache/cxf/tools/fortest/cxf2934/jaxws/HelloStringResponse.java");
String str = FileUtils.getStringFromFile(wrapper);
assertTrue("namespace value in annoataion @XmlElement is not correct:
" + str,
str.indexOf("helloString/Name") > -1);