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 2017/05/01 14:44:44 UTC

svn commit: r1793348 - in /axis/axis2/java/core/trunk: ./ modules/tool/axis2-wsdl2code-maven-plugin/ modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/ modules/tool/maven-shared/ modules/tool/maven-shared/src/ mo...

Author: veithen
Date: Mon May  1 14:44:44 2017
New Revision: 1793348

URL: http://svn.apache.org/viewvc?rev=1793348&view=rev
Log:
AXIS2-5785: Extract some code from axis2-wsdl2code-maven-plugin for reuse in axis2-xsd2java-maven-plugin.

Added:
    axis/axis2/java/core/trunk/modules/tool/maven-shared/   (with props)
    axis/axis2/java/core/trunk/modules/tool/maven-shared/pom.xml   (with props)
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMapping.java
      - copied, changed from r1793347, axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/NamespaceURIMapping.java
    axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMappingUtil.java   (with props)
Removed:
    axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/NamespaceURIMapping.java
Modified:
    axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml
    axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java
    axis/axis2/java/core/trunk/pom.xml

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml?rev=1793348&r1=1793347&r2=1793348&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/pom.xml Mon May  1 14:44:44 2017
@@ -57,6 +57,11 @@
             <artifactId>maven-core</artifactId>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>maven-shared</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-codegen</artifactId>
             <version>${project.version}</version>

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java?rev=1793348&r1=1793347&r2=1793348&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java Mon May  1 14:44:44 2017
@@ -19,6 +19,8 @@
 
 package org.apache.axis2.maven2.wsdl2code;
 
+import org.apache.axis2.maven.shared.NamespaceMapping;
+import org.apache.axis2.maven.shared.NamespaceMappingUtil;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
@@ -249,7 +251,7 @@ public abstract class AbstractWSDL2CodeM
      * 
      * @parameter
      */
-    private NamespaceURIMapping[] namespaceURIs = null;
+    private NamespaceMapping[] namespaceURIs = null;
     
     /**
      * The charset encoding to use for generated source files.
@@ -340,21 +342,7 @@ public abstract class AbstractWSDL2CodeM
                 map.put(values[0].trim(), values[1].trim());
             }
         }
-        if (namespaceURIs != null) {
-            for (NamespaceURIMapping mapping : namespaceURIs) {
-                String uri = mapping.getUri();
-                if (uri == null) {
-                    throw new MojoFailureException(
-                            "A namespace to package mapping requires an uri child element.");
-                }
-                String uriPackageName = mapping.getPackageName();
-                if (uriPackageName == null) {
-                    throw new MojoFailureException(
-                            "A namespace to package mapping requires a packageName child element.");
-                }
-                map.put(uri, uriPackageName);
-            }
-        }
+        NamespaceMappingUtil.addToMap(namespaceURIs, map);
         return map;
     }
 

Propchange: axis/axis2/java/core/trunk/modules/tool/maven-shared/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon May  1 14:44:44 2017
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: axis/axis2/java/core/trunk/modules/tool/maven-shared/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/maven-shared/pom.xml?rev=1793348&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/maven-shared/pom.xml (added)
+++ axis/axis2/java/core/trunk/modules/tool/maven-shared/pom.xml Mon May  1 14:44:44 2017
@@ -0,0 +1,61 @@
+<?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.axis2</groupId>
+        <artifactId>axis2</artifactId>
+        <version>1.8.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+    <artifactId>maven-shared</artifactId>
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/maven-shared</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/tool/maven-shared</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/maven-shared</url>
+    </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-remote-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>process</goal>
+                        </goals>
+                        <configuration>
+                            <resourceBundles>
+                                <resourceBundle>org.apache.axis2:axis2-resource-bundle:${project.version}</resourceBundle>
+                            </resourceBundles>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: axis/axis2/java/core/trunk/modules/tool/maven-shared/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMapping.java (from r1793347, axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/NamespaceURIMapping.java)
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMapping.java?p2=axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMapping.java&p1=axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/NamespaceURIMapping.java&r1=1793347&r2=1793348&rev=1793348&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/NamespaceURIMapping.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMapping.java Mon May  1 14:44:44 2017
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-package org.apache.axis2.maven2.wsdl2code;
+package org.apache.axis2.maven.shared;
 
 /** Data class for specifying URI->Package mappings. */
-public class NamespaceURIMapping {
+public class NamespaceMapping {
     private String uri, packageName;
 
     /** Returns the package name, to which the URI shall be mapped. */

Added: axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMappingUtil.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMappingUtil.java?rev=1793348&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMappingUtil.java (added)
+++ axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMappingUtil.java Mon May  1 14:44:44 2017
@@ -0,0 +1,45 @@
+/*
+ * 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.axis2.maven.shared;
+
+import java.util.Map;
+
+import org.apache.maven.plugin.MojoFailureException;
+
+public final class NamespaceMappingUtil {
+    private NamespaceMappingUtil() {}
+    
+    public static void addToMap(NamespaceMapping[] mappings, Map<String,String> map) throws MojoFailureException {
+        if (mappings != null) {
+            for (NamespaceMapping mapping : mappings) {
+                String uri = mapping.getUri();
+                if (uri == null) {
+                    throw new MojoFailureException(
+                            "A namespace to package mapping requires an uri child element.");
+                }
+                String packageName = mapping.getPackageName();
+                if (packageName == null) {
+                    throw new MojoFailureException(
+                            "A namespace to package mapping requires a packageName child element.");
+                }
+                map.put(uri, packageName);
+            }
+        }
+    }
+}

Propchange: axis/axis2/java/core/trunk/modules/tool/maven-shared/src/main/java/org/apache/axis2/maven/shared/NamespaceMappingUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/pom.xml?rev=1793348&r1=1793347&r2=1793348&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/pom.xml (original)
+++ axis/axis2/java/core/trunk/pom.xml Mon May  1 14:44:44 2017
@@ -60,6 +60,7 @@
         <module>modules/soapmonitor/module</module>
         <module>modules/spring</module>
         <module>modules/testutils</module>
+        <module>modules/tool/maven-shared</module>
         <module>modules/tool/axis2-aar-maven-plugin</module>
         <module>modules/tool/axis2-ant-plugin</module>
         <module>modules/tool/axis2-eclipse-codegen-plugin</module>