You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by sa...@apache.org on 2009/10/08 18:50:47 UTC

svn commit: r823231 - in /webservices/woden/trunk/java/woden-converter-maven-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/woden/ src/main/java/org/apache/woden/converter/ src/main/java/o...

Author: sagara
Date: Thu Oct  8 16:50:46 2009
New Revision: 823231

URL: http://svn.apache.org/viewvc?rev=823231&view=rev
Log:
add woden converter maven plugin.

Added:
    webservices/woden/trunk/java/woden-converter-maven-plugin/
    webservices/woden/trunk/java/woden-converter-maven-plugin/pom.xml   (with props)
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/ConverterMojo.java   (with props)
    webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/resources/

Added: webservices/woden/trunk/java/woden-converter-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-converter-maven-plugin/pom.xml?rev=823231&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-converter-maven-plugin/pom.xml (added)
+++ webservices/woden/trunk/java/woden-converter-maven-plugin/pom.xml Thu Oct  8 16:50:46 2009
@@ -0,0 +1,109 @@
+<?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.woden</groupId>
+		<artifactId>woden</artifactId>
+        <version>1.0-SNAPSHOT</version>
+		
+	</parent>
+	
+	<artifactId>woden-converter-maven-plugin</artifactId>
+	<name>Woden - converter Maven plugin</name>
+	<version>1.0-SNAPSHOT</version>
+	<packaging>maven-plugin</packaging>
+	
+	<build>
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+			</resource>
+			<resource>				
+				<directory>../</directory>
+				<includes>
+					<include>LICENSE</include>
+					<include>README</include>
+					<include>NOTICE</include>
+				</includes>
+			</resource>
+		</resources>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.4</source>
+					<target>1.4</target>
+					<compilerArgument>-g</compilerArgument>
+				</configuration>
+			</plugin>
+			<!--<plugin>
+				<artifactId>maven-one-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>install-maven-one-repository</goal>
+							<goal>deploy-maven-one-repository</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<remoteRepositoryId>apache</remoteRepositoryId>
+					<remoteRepositoryUrl>
+						scpexe://people.apache.org/www/people.apache.org/repo/m1-snapshot-repository
+					</remoteRepositoryUrl>
+				</configuration>
+			</plugin>-->
+			<plugin>
+				<artifactId>maven-plugin-plugin</artifactId>
+				<version>2.3</version>
+				<configuration>
+					<goalPrefix>woden</goalPrefix>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.plexus</groupId>
+				<artifactId>plexus-maven-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>descriptor</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>			
+		</plugins>
+	</build>
+	
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.woden</groupId>
+			<artifactId>woden-tool</artifactId>
+			<version>${woden.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+			<version>2.0.3</version>
+		</dependency>		
+	</dependencies>
+</project>
\ No newline at end of file

Propchange: webservices/woden/trunk/java/woden-converter-maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/ConverterMojo.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/ConverterMojo.java?rev=823231&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/ConverterMojo.java (added)
+++ webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/ConverterMojo.java Thu Oct  8 16:50:46 2009
@@ -0,0 +1,140 @@
+/**
+ * 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.woden.converter.maven2;
+
+import java.io.IOException;
+
+import javax.wsdl.WSDLException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.woden.tool.converter.Convert;
+
+/**
+ * <p>
+ * This is used to invoke Woden WSDL converter as Maven2 plug-in.
+ * Following meta data required  for this Mojo.
+ * </p>
+ * <p>
+ * It is possible run this command using
+ * "mvn woden:convert" command.
+ * </p>
+ * 
+ * @goal convert
+ * @execute phase="generate-sources"
+ * @requiresDependencyResolution runtime  *
+ * @description Woden Converter Maven plig-in
+ * @author Sagara Gunathunga
+ */
+public class ConverterMojo extends AbstractMojo {
+
+    /** 
+     * File or URL of wsdl1.1 document.Also multiple
+     * WSDL files can be specified as a comma separated list.
+     * 
+     * @parameter expression="${woden.converter.wsdl}"
+     * @required
+     */
+    private String wsdl;
+
+    /** 
+     * New target namespace for WSDL2.0 document.
+     * 
+     * @parameter expression="${woden.converter.wsdl}" 
+     */
+    private String targetNS;
+
+    /** 
+     * Target directory for out put, default 
+     * location is project build directory. 
+     * 
+     * @parameter expression="${woden.converter.wsdl}" default-value="${project.build.directory}"
+     */
+    private String targetDir;
+
+    /** 
+     * sourceDir directory for out put. 
+     * 
+     * @parameter expression="${woden.converter.wsdl}" 
+     */
+    private String sourceDir;
+
+    /** 
+     * verbose option. 
+     * 
+     * @parameter expression="${woden.converter.wsdl}"
+     */
+    private boolean verbose;
+
+    /** 
+     * Overwrite existing files. 
+     * 
+     * @parameter expression="${woden.converter.wsdl}"
+     */
+    private boolean overwrite;
+    
+
+    private Log log = getLog();
+
+    /*
+     * @see org.apache.maven.plugin.AbstractMojo#execute()
+     */
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        if (wsdl != null && !"".equals(wsdl)) {
+            String[] wsdlFiles = wsdl.split(",");
+            for (int i = 0; i < wsdlFiles.length; i++) {
+                if (wsdlFiles[i] != null && !"".equals(wsdlFiles[i])) {
+                    convertEachFile(wsdlFiles[i].trim());
+                }
+            }
+
+        }
+    }
+
+    /**
+     * Convert each WSDL1.1 file in to WSDL2.0 file.     * 
+     */
+    private void convertEachFile(String wsdlFile) throws MojoFailureException,
+            MojoExecutionException {
+        long startTime = System.currentTimeMillis();
+
+        if (wsdl != null) {
+
+            try {
+                Convert convert = new Convert();
+                convert.convertFile(targetNS, wsdlFile, targetDir, verbose, overwrite);
+            } catch (WSDLException e) {
+                throw new MojoExecutionException(e.getMessage(), e);
+            } catch (IOException e) {
+                throw new MojoExecutionException(e.getMessage(), e);
+            }
+        } else {
+            log.info("No WSDL 1.1 document was specified (use the '-wsdl' " + "argument.)");
+        }
+
+        long endTime = System.currentTimeMillis();
+
+        if (verbose) {
+            log.info("Done.\n" + "Elapsed time: " + (endTime - startTime) + "ms");
+        }
+
+    }
+
+}
\ No newline at end of file

Propchange: webservices/woden/trunk/java/woden-converter-maven-plugin/src/main/java/org/apache/woden/converter/maven2/ConverterMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org