You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/02/19 14:36:05 UTC
svn commit: r1291000 - in /axis/axis1/java/trunk: integration/
integration/src/main/ integration/src/main/java/
integration/src/main/java/test/ integration/src/main/java/test/wsdl/
integration/src/main/java/test/wsdl/anytype/ maven/ maven/maven-java2ws...
Author: veithen
Date: Sun Feb 19 13:36:03 2012
New Revision: 1291000
URL: http://svn.apache.org/viewvc?rev=1291000&view=rev
Log:
Initial version of the maven-java2wsdl-plugin.
Added:
axis/axis1/java/trunk/integration/src/main/
axis/axis1/java/trunk/integration/src/main/java/
axis/axis1/java/trunk/integration/src/main/java/test/
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/anytype/
axis/axis1/java/trunk/integration/src/main/java/test/wsdl/anytype/AnyService.java
- copied unchanged from r1290991, axis/axis1/java/trunk/test/wsdl/anytype/AnyService.java
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/pom.xml (with props)
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/
axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java (with props)
axis/axis1/java/trunk/maven/nsmap/
axis/axis1/java/trunk/maven/nsmap/pom.xml (with props)
axis/axis1/java/trunk/maven/nsmap/src/
axis/axis1/java/trunk/maven/nsmap/src/main/
axis/axis1/java/trunk/maven/nsmap/src/main/java/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/Mapping.java
- copied, changed from r1290991, axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/Mapping.java
axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/MappingUtil.java (with props)
Removed:
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/Mapping.java
axis/axis1/java/trunk/test/wsdl/anytype/AnyService.java
Modified:
axis/axis1/java/trunk/integration/pom.xml
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml
axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/AbstractWsdl2JavaMojo.java
axis/axis1/java/trunk/maven/pom.xml
Modified: axis/axis1/java/trunk/integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/pom.xml?rev=1291000&r1=1290999&r2=1291000&view=diff
==============================================================================
--- axis/axis1/java/trunk/integration/pom.xml (original)
+++ axis/axis1/java/trunk/integration/pom.xml Sun Feb 19 13:36:03 2012
@@ -54,6 +54,31 @@
<plugins>
<plugin>
<groupId>${project.groupId}</groupId>
+ <artifactId>maven-java2wsdl-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>anytype</id>
+ <goals>
+ <goal>generate-wsdl</goal>
+ </goals>
+ <configuration>
+ <output>${project.build.directory}/work/test/wsdl/anytype/AnyService.wsdl</output>
+ <className>test.wsdl.anytype.AnyService</className>
+ <namespace>http://test.com/AnyService</namespace>
+ <location>http://localhost:8080/axis/services/AnyService</location>
+ <mappings>
+ <mapping>
+ <package>test.wsdl.anytype</package>
+ <namespace>http://test.com/AnyService</namespace>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
<artifactId>maven-wsdl2java-plugin</artifactId>
<version>${project.version}</version>
<configuration>
Added: axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/pom.xml?rev=1291000&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/pom.xml (added)
+++ axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/pom.xml Sun Feb 19 13:36:03 2012
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.axis</groupId>
+ <artifactId>maven</artifactId>
+ <version>1.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>maven-java2wsdl-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>java2wsdl plugin</name>
+ <description>
+ Axis java2wsdl Maven plugin.
+ </description>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nsmap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.github.veithen.ulog</groupId>
+ <artifactId>ulog</artifactId>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.9</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Propchange: axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java?rev=1291000&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java (added)
+++ axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java Sun Feb 19 13:36:03 2012
@@ -0,0 +1,145 @@
+/*
+ * 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.axis.maven.java2wsdl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+
+import org.apache.axis.maven.shared.nsmap.Mapping;
+import org.apache.axis.maven.shared.nsmap.MappingUtil;
+import org.apache.axis.utils.ClassUtils;
+import org.apache.axis.wsdl.fromJava.Emitter;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+import com.github.veithen.ulog.PlexusLoggerInjector;
+
+/**
+ *
+ *
+ * @goal generate-wsdl
+ * @phase process-classes
+ * @requiresDependencyResolution compile
+ */
+public class GenerateWsdlMojo extends AbstractMojo {
+ /**
+ * @component
+ */
+ // This is necessary to set up logging such that all messages logged by the Axis
+ // libraries through commons logging are redirected to Plexus logs.
+ PlexusLoggerInjector loggerInjector;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * The name of the class to generate a WSDL for. The class must be on the classpath.
+ *
+ * @parameter
+ * @required
+ */
+ private String className;
+
+ /**
+ * The target namespace for the interface.
+ *
+ * @parameter
+ * @required
+ */
+ private String namespace;
+
+ /**
+ * Mappings of packages to namespaces.
+ *
+ * @parameter
+ */
+ private Mapping[] mappings;
+
+ /**
+ * The url of the location of the service. The name after the last slash or
+ * backslash is the name of the service port (unless overridden by the -s
+ * option). The service port address location attribute is assigned the
+ * specified value.
+ *
+ * @parameter
+ * @required
+ */
+ private String location;
+
+ /**
+ * The name of the output WSDL file.
+ *
+ * @parameter
+ * @required
+ */
+ private File output;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ List classpath;
+ try {
+ classpath = project.getCompileClasspathElements();
+ } catch (DependencyResolutionRequiredException ex) {
+ throw new MojoExecutionException("Unexpected exception", ex);
+ }
+ URL[] urls = new URL[classpath.size()];
+ for (int i=0; i<classpath.size(); i++) {
+ try {
+ urls[i] = new File((String)classpath.get(i)).toURL();
+ } catch (MalformedURLException ex) {
+ throw new MojoExecutionException("Unexpected exception", ex);
+ }
+ }
+ // TODO: this will likely make the plugin non thread safe
+ ClassUtils.setDefaultClassLoader(new URLClassLoader(urls));
+ try {
+ Emitter emitter = new Emitter();
+ if (mappings != null && mappings.length > 0) {
+ emitter.setNamespaceMap(MappingUtil.getPackageToNamespaceMap(mappings));
+ }
+ try {
+ emitter.setCls(className);
+ } catch (ClassNotFoundException ex) {
+ throw new MojoFailureException("Class " + className + " not found");
+ }
+ emitter.setIntfNamespace(namespace);
+ emitter.setLocationUrl(location);
+ output.getParentFile().mkdirs();
+ try {
+ emitter.emit(output.getAbsolutePath(), Emitter.MODE_ALL);
+ } catch (Exception ex) {
+ throw new MojoFailureException("java2wsdl failed", ex);
+ }
+ } finally {
+ // TODO: apparently this is a no-op
+ ClassUtils.setDefaultClassLoader(null);
+ }
+ }
+}
Propchange: axis/axis1/java/trunk/maven/maven-java2wsdl-plugin/src/main/java/org/apache/axis/maven/java2wsdl/GenerateWsdlMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml?rev=1291000&r1=1290999&r2=1291000&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml (original)
+++ axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/pom.xml Sun Feb 19 13:36:03 2012
@@ -37,6 +37,11 @@
<artifactId>axis</artifactId>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nsmap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</dependency>
Modified: axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/AbstractWsdl2JavaMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/AbstractWsdl2JavaMojo.java?rev=1291000&r1=1290999&r2=1291000&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/AbstractWsdl2JavaMojo.java (original)
+++ axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/AbstractWsdl2JavaMojo.java Sun Feb 19 13:36:03 2012
@@ -20,9 +20,10 @@ package org.apache.axis.maven.wsdl2java;
import java.io.File;
import java.net.MalformedURLException;
-import java.util.HashMap;
import org.apache.axis.constants.Scope;
+import org.apache.axis.maven.shared.nsmap.Mapping;
+import org.apache.axis.maven.shared.nsmap.MappingUtil;
import org.apache.axis.wsdl.toJava.Emitter;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -162,11 +163,7 @@ public abstract class AbstractWsdl2JavaM
//do the mappings, with namespaces mapped as the key
if (mappings != null && mappings.length > 0) {
- HashMap namespaceMap = new HashMap();
- for (int i=0; i<mappings.length; i++) {
- namespaceMap.put(mappings[i].getNamespace(), mappings[i].getPackage());
- }
- emitter.setNamespaceMap(namespaceMap);
+ emitter.setNamespaceMap(MappingUtil.getNamespaceToPackageMap(mappings));
}
// emitter.setTestCaseWanted(testCase);
// emitter.setHelperWanted(helperGen);
Added: axis/axis1/java/trunk/maven/nsmap/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/nsmap/pom.xml?rev=1291000&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/nsmap/pom.xml (added)
+++ axis/axis1/java/trunk/maven/nsmap/pom.xml Sun Feb 19 13:36:03 2012
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.axis</groupId>
+ <artifactId>maven</artifactId>
+ <version>1.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>nsmap</artifactId>
+ <name>Maven plugin common classes</name>
+ <description>
+ Contains classes shared by maven-wsdl2java-plugin and maven-java2wsdl-plugin.
+ </description>
+</project>
Propchange: axis/axis1/java/trunk/maven/nsmap/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Copied: axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/Mapping.java (from r1290991, axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/Mapping.java)
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/Mapping.java?p2=axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/Mapping.java&p1=axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/Mapping.java&r1=1290991&r2=1291000&rev=1291000&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/maven-wsdl2java-plugin/src/main/java/org/apache/axis/maven/wsdl2java/Mapping.java (original)
+++ axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/Mapping.java Sun Feb 19 13:36:03 2012
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.axis.maven.wsdl2java;
+package org.apache.axis.maven.shared.nsmap;
public class Mapping {
private String namespace;
Added: axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/MappingUtil.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/MappingUtil.java?rev=1291000&view=auto
==============================================================================
--- axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/MappingUtil.java (added)
+++ axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/MappingUtil.java Sun Feb 19 13:36:03 2012
@@ -0,0 +1,46 @@
+/*
+ * 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.axis.maven.shared.nsmap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Andreas Veithen
+ */
+public final class MappingUtil {
+ private MappingUtil() {}
+
+ // TODO: this returns a HashMap because the toJava emitter expects a HashMap (bad!)
+ public static HashMap getNamespaceToPackageMap(Mapping[] mappings) {
+ HashMap namespaceMap = new HashMap();
+ for (int i=0; i<mappings.length; i++) {
+ namespaceMap.put(mappings[i].getNamespace(), mappings[i].getPackage());
+ }
+ return namespaceMap;
+ }
+
+ public static Map getPackageToNamespaceMap(Mapping[] mappings) {
+ HashMap namespaceMap = new HashMap();
+ for (int i=0; i<mappings.length; i++) {
+ namespaceMap.put(mappings[i].getPackage(), mappings[i].getNamespace());
+ }
+ return namespaceMap;
+ }
+}
Propchange: axis/axis1/java/trunk/maven/nsmap/src/main/java/org/apache/axis/maven/shared/nsmap/MappingUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis1/java/trunk/maven/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/maven/pom.xml?rev=1291000&r1=1290999&r2=1291000&view=diff
==============================================================================
--- axis/axis1/java/trunk/maven/pom.xml (original)
+++ axis/axis1/java/trunk/maven/pom.xml Sun Feb 19 13:36:03 2012
@@ -67,7 +67,9 @@
</dependencies>
</dependencyManagement>
<modules>
+ <module>nsmap</module>
<module>maven-wsdl2java-plugin</module>
+ <module>maven-java2wsdl-plugin</module>
<module>maven-axis-server-plugin</module>
</modules>