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 2011/12/31 12:58:34 UTC

svn commit: r1226073 - in /axis/axis1/java/trunk: ./ axis-maven-plugin/ axis-maven-plugin/src/ axis-maven-plugin/src/main/ axis-maven-plugin/src/main/java/ axis-maven-plugin/src/main/java/org/ axis-maven-plugin/src/main/java/org/apache/ axis-maven-plug...

Author: veithen
Date: Sat Dec 31 11:58:33 2011
New Revision: 1226073

URL: http://svn.apache.org/viewvc?rev=1226073&view=rev
Log:
Added a Maven plugin.

Added:
    axis/axis1/java/trunk/axis-maven-plugin/
    axis/axis1/java/trunk/axis-maven-plugin/pom.xml   (with props)
    axis/axis1/java/trunk/axis-maven-plugin/src/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Mapping.java   (with props)
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java   (with props)
    axis/axis1/java/trunk/integration/
    axis/axis1/java/trunk/integration/pom.xml   (with props)
Modified:
    axis/axis1/java/trunk/pom.xml

Added: axis/axis1/java/trunk/axis-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/pom.xml?rev=1226073&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-maven-plugin/pom.xml (added)
+++ axis/axis1/java/trunk/axis-maven-plugin/pom.xml Sat Dec 31 11:58:33 2011
@@ -0,0 +1,51 @@
+<?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>axis-project</artifactId>
+        <version>1.4.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>axis-maven-plugin</artifactId>
+    <packaging>maven-plugin</packaging>
+    <name>Axis :: Maven plugin</name>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axis</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>${maven.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+            <version>${maven.version}</version>
+        </dependency>
+    </dependencies>
+    <properties>
+        <maven.version>2.0.9</maven.version>
+    </properties>
+</project>

Propchange: axis/axis1/java/trunk/axis-maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Mapping.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Mapping.java?rev=1226073&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Mapping.java (added)
+++ axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Mapping.java Sat Dec 31 11:58:33 2011
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+public class Mapping {
+    private String namespace;
+    private String packageName;
+    
+    public String getNamespace() {
+        return namespace;
+    }
+    
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+    
+    public String getPackage() {
+        return packageName;
+    }
+    
+    public void setPackage(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public String toString() {
+        return "(" + namespace + "|" + packageName + ")";
+    }
+}

Propchange: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Mapping.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java?rev=1226073&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java (added)
+++ axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java Sat Dec 31 11:58:33 2011
@@ -0,0 +1,174 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+
+import org.apache.axis.constants.Scope;
+import org.apache.axis.wsdl.toJava.Emitter;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Create Java classes from local or remote WSDL.
+ * 
+ * @goal wsdl2java
+ * @phase generate-sources
+ */
+public class Wsdl2JavaMojo extends AbstractMojo {
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+    
+    /**
+     * The WSDL file to process.
+     * 
+     * @parameter
+     */
+    private File file;
+    
+    /**
+     * The URL of the WSDL to process. This should only be used for remote WSDLs. For local files,
+     * use the <code>file</code> parameter.
+     * 
+     * @parameter
+     */
+    private String url;
+    
+    /**
+     * Output directory for emitted files.
+     * 
+     * @parameter
+     * @required
+     */
+    private File output;
+
+    /**
+     * Add scope to deploy.xml: "Application", "Request", "Session".
+     * 
+     * @parameter
+     */
+    private String deployScope;
+
+    /**
+     * Mappings of namespaces to packages.
+     * 
+     * @parameter
+     */
+    private Mapping[] mappings;
+    
+    /**
+     * The default type mapping registry to use. Either 1.1 or 1.2.
+     * 
+     * @parameter default-value="1.2"
+     * @required
+     */
+    private String typeMappingVersion;
+    
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        String wsdlUrl;
+        if (file != null && url != null) {
+            throw new MojoFailureException("Invalid plugin configuration: either use file or url, but not both!");
+        } else if (file != null) {
+            try {
+                wsdlUrl = file.toURL().toExternalForm();
+            } catch (MalformedURLException ex) {
+                throw new MojoExecutionException("Unexpected exception", ex);
+            }
+        } else if (url != null) {
+            wsdlUrl = url;
+        } else {
+            throw new MojoFailureException("Invalid plugin configuration: file or url must be given!");
+        }
+        
+        // Instantiate the emitter
+        Emitter emitter = new Emitter();
+
+        //extract the scope
+        Scope scope = Scope.getScope(deployScope, null);
+        if (scope != null) {
+            emitter.setScope(scope);
+        } else if (deployScope != null) {
+            getLog().warn("Unrecognized scope:  " + deployScope + ".  Ignoring it.");
+        }
+
+        //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.setTestCaseWanted(testCase);
+//        emitter.setHelperWanted(helperGen);
+//        if (factory != null) {
+//            emitter.setFactory(factory);
+//        }
+//        emitter.setNamespaceIncludes(nsIncludes);
+//        emitter.setNamespaceExcludes(nsExcludes);
+//        emitter.setProperties(properties);
+//        emitter.setImports(!noImports);
+//        emitter.setAllWanted(all);
+        emitter.setOutputDir(output.getAbsolutePath());
+//        emitter.setServerSide(server);
+//        emitter.setSkeletonWanted(skeletonDeploy);
+//        emitter.setVerbose(verbose);
+//        emitter.setDebug(debug);
+//        emitter.setQuiet(quiet);
+        emitter.setTypeMappingVersion(typeMappingVersion);
+//        emitter.setNowrap(noWrapped);
+//        emitter.setAllowInvalidURL(allowInvalidURL);
+//        emitter.setWrapArrays(wrapArrays);
+//        if (namespaceMappingFile != null) {
+//            emitter.setNStoPkg(namespaceMappingFile.toString());
+//        }
+//        emitter.setTimeout(timeout);
+//        emitter.setImplementationClassName(implementationClassName);
+
+//        Authenticator.setDefault(new DefaultAuthenticator(username, password));
+//        if (classpath != null) {
+//            AntClassLoader cl = new AntClassLoader(
+//                    getClass().getClassLoader(),
+//                    getProject(),
+//                    classpath,
+//                    false);
+//            log("Using CLASSPATH " + cl.getClasspath(),
+//                    Project.MSG_VERBOSE);
+//            ClassUtils.setDefaultClassLoader(cl);
+//        }
+
+        try {
+            emitter.run(wsdlUrl);
+        } catch (Exception ex) {
+            throw new MojoFailureException("wsdl2java failed", ex);
+        }
+        
+        project.addCompileSourceRoot(output.getAbsolutePath());
+    }
+}

Propchange: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis1/java/trunk/integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/pom.xml?rev=1226073&view=auto
==============================================================================
--- axis/axis1/java/trunk/integration/pom.xml (added)
+++ axis/axis1/java/trunk/integration/pom.xml Sat Dec 31 11:58:33 2011
@@ -0,0 +1,68 @@
+<?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>axis-project</artifactId>
+        <version>1.4.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>integration</artifactId>
+    <name>Axis :: Integration tests</name>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axis</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>axis-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                        <configuration>
+                            <file>../samples/echo/InteropTest.wsdl</file>
+                            <output>${project.build.directory}/work</output>
+                            <typeMappingVersion>1.1</typeMappingVersion>
+                            <mappings>
+                                <mapping>
+                                    <namespace>http://soapinterop.org/</namespace>
+                                    <package>samples.echo</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>http://soapinterop.org/xsd</namespace>
+                                    <package>samples.echo</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: axis/axis1/java/trunk/integration/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis1/java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/pom.xml?rev=1226073&r1=1226072&r2=1226073&view=diff
==============================================================================
--- axis/axis1/java/trunk/pom.xml (original)
+++ axis/axis1/java/trunk/pom.xml Sat Dec 31 11:58:33 2011
@@ -34,6 +34,8 @@
         <module>axis-jaxrpc</module>
         <module>axis-saaj</module>
         <module>axis-ant</module>
+        <module>axis-maven-plugin</module>
+        <module>integration</module>
     </modules>
     <build>
         <pluginManagement>