Author: veithen
Date: Mon May 1 10:13:15 2017
New Revision: 1793299
URL: http://svn.apache.org/viewvc?rev=1793299&view=rev
Log:
Add code for the axis2-xsd2java-maven-plugin provided by Jeff Thomas.
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/pom.xml
(with props)
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/XSD2JavaMojo.java
(with props)
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/configuration.apt
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/goals.apt
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/introduction.apt
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/site.xml
(with props)
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/pom.xml?rev=1793299&view=auto
==============================================================================
---
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/pom.xml
(added)
+++
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/pom.xml
Mon May 1 10:13:15 2017
@@ -0,0 +1,31 @@
+<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/xsd/maven-4.0.0.xsd">
+
+<modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2</artifactId>
+ <version>1.7.3.0-PWC-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>axis2-xsd2java-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb-codegen</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>
+ </dependencies>
+
+</project>
Propchange:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/XSD2JavaMojo.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/XSD2JavaMojo.java?rev=1793299&view=auto
==============================================================================
---
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/XSD2JavaMojo.java
(added)
+++
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/XSD2JavaMojo.java
Mon May 1 10:13:15 2017
@@ -0,0 +1,98 @@
+package org.apache.axis2.maven2.xsd2java;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.axis2.schema.XSD2Java;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Generates Java classes from the specified XSD schema files.
+ *
+ * @goal xsd2java
+ * @phase generate-sources
+ * @requiresDependencyResolution compile
+ */
+public class XSD2JavaMojo extends AbstractMojo {
+
+ /**
+ * The maven project.
+ * @parameter expression="${project}"
+ * @read-only
+ * @required
+ */
+ protected MavenProject project;
+
+ /**
+ * The list of XSD files for which to generate the Java code.
+ * @parameter
+ * @required true
+ */
+ protected List<String> xsdFiles;
+
+ /**
+ * The output directory to generate the source into.
+ * @parameter
+ * @required true
+ */
+ public File outputFolder;
+
+ /**
+ * Specify namespaces explicitly for packages.
+ * @parameter
+ */
+ protected List<String> namespace2Packages;
+
+ /**
+ * Run the 'xsd2java' utility.
+ * @throws MojoExecutionException if an error occurs during processing
+ * @throws MojoFailureException if an error occurs during processing
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+
+ String[] args = getCommandLineArgumentsForXSD2Java();
+
+ try {
+ XSD2Java.main(args);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ throw new MojoExecutionException("An error occurred during 'xsd2java'
processing: " + ex.getMessage(), ex);
+ }
+
+ }
+
+ /**
+ * Process the maven parameters to xsd2java command-line arguments
+ * @return the array of command line arguments
+ */
+ private String[] getCommandLineArgumentsForXSD2Java() {
+
+ final List<String> commandLineArguments = new ArrayList<String>();
+
+ // add the namespace-to-package mappings
+ if (namespace2Packages != null) {
+ for (String namespace2Package : namespace2Packages) {
+ commandLineArguments.add("-ns2p");
+ commandLineArguments.add(namespace2Package);
+ }
+ }
+
+ // add the XSD files
+ for (String xsdFile : xsdFiles) {
+ commandLineArguments.add(xsdFile);
+ }
+
+ // add the output path
+ commandLineArguments.add(outputFolder.getAbsolutePath());
+
+ final String[] args = commandLineArguments.toArray(new String[]{});
+
+ return args;
+
+ }
+
+}
Propchange:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/main/java/org/apache/axis2/maven2/xsd2java/XSD2JavaMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/configuration.apt
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/configuration.apt?rev=1793299&view=auto
==============================================================================
---
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/configuration.apt
(added)
+++
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/configuration.apt
Mon May 1 10:13:15 2017
@@ -0,0 +1,13 @@
+Configuration
+
+ The XSD2Java goal takes the following parameters as input.
+
+*-----------------------------+---------------------------------+---------------------------------------------------------------+
+| Parameter name | Default value | Description
|
+*-----------------------------+---------------------------------+---------------------------------------------------------------+
+| xsdFiles | | List of XSD
files which should be converted to Java classes. |
+*-----------------------------+---------------------------------+---------------------------------------------------------------+
+| outputFolder | | The output
directory for the generated Java classes. |
+*-----------------------------*---------------------------------+---------------------------------------------------------------+
+| namespace2Packages | | Mapping of
namespaces to target Java packages. |
+*-----------------------------+---------------------------------+---------------------------------------------------------------+
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/goals.apt
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/goals.apt?rev=1793299&view=auto
==============================================================================
---
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/goals.apt
(added)
+++
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/goals.apt
Mon May 1 10:13:15 2017
@@ -0,0 +1,53 @@
+ ------
+ Maven 2 XSD2Java Plugin: configuration examples
+ ------
+
+Goals
+
+ The XSD2Java plugin offers a single goal:
+
+ * xsd2java (default): Reads one or more XSD-files class and generates the
corresponding Java Axis2 ADB beans.
+
+ To run the plugin, add the following section to your POM:
+
+------------------------
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.axis2.maven2</groupId>
+ <artifactId>axis2-xsd2java-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>xsd2java</goal>
+ </goals>
+ </execution>
+ <configuration>
+
<outputFolder>${project.basedir}/target/generated-sources/java</outputFolder>
+ <xsdFiles>
+
<xsdFile>${project.basedir}/src/main/resources/xsd/attribute.xsd</xsdFile>
+ </xsdFiles>
+ <namespace2Packages>
+
<namespace2Package>http://www.example.org/schema/test=org.example.schema.test</namespace2Package>
+ </namespace2Packages>
+ </configuration>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+------------------------
+
+ The plugin will be invoked automatically in the generate-sources
+ phase. You can also invoke it directly from the command line by
+ running the command
+
++--------
+ mvn xsd2java:xsd2java
++---------
+
+The XSD2Java Goal
+
+ The plugin reads the specified XSD files and creates the matching Axis2 ADB
Java bean classes. The mapping from
+ XSD target-namespaces to Java packages is specified with the
<<<namespace2Packages>>> configuration element above.
+
+ See the detailed documentation on {{{configuration.html}properties}} for how
to configure the goal.
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/introduction.apt
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/introduction.apt?rev=1793299&view=auto
==============================================================================
---
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/introduction.apt
(added)
+++
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/apt/introduction.apt
Mon May 1 10:13:15 2017
@@ -0,0 +1,9 @@
+ ------
+ Maven 2 XSD2Java Plugin
+ ------
+
+Introduction
+
+ This plugin takes as input a one or more XSD schemas and generates Axis2 ADB
Java Bean classes.
+
+ The full description of goals is available {{{goals.html}here}}.
Added:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/site.xml
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/site.xml?rev=1793299&view=auto
==============================================================================
---
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/site.xml
(added)
+++
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/site.xml
Mon May 1 10:13:15 2017
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ 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 name="Maven Axis 2 XSD2Java Plugin">
+ <bannerLeft>
+ <name>Maven Axis 2 XSD2Java Plugin</name>
+ <src>http://maven.apache.org/images/apache-maven-project.png</src>
+ <href>http://maven.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://maven.apache.org/images/maven-small.gif</src>
+ </bannerRight>
+ <body>
+ <links>
+ <item name="Apache" href="http://www.apache.org/"/>
+ <item name="Webservices" href="http://ws.apache.org/"/>
+ <item name="Axis 2" href="http://ws.apache.org/axis2/"/>
+ <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Introduction" href="introduction.html"/>
+ <item name="How to Use" href="howto.html"/>
+ <item name="Configuration" href="configuration.html"/>
+ </menu>
+ ${reports}
+ </body>
+</project>
Propchange:
axis/axis2/java/core/branches/AXIS2-5785/modules/tool/axis2-xsd2java-maven-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native