[esb-java-dev] svn commit r23637 - in branches/synapse: . modules/core modules/core/src/main/resources modules/extensions modules/handler modules/mar modules/mar/src modules/mar/src/main modules/mar/src/main/resources modules/mar/src/main/resources/META-INF modules/samples modules/transports modules/war modules/xar-maven-plugin modules/xar-maven-plugin/src modules/xar-maven-plugin/src/main modules/xar-maven-plugin/src/main/java modules/xar-maven-plugin/src/main/java/org modules/xar-maven-plugin/src/main/java/org/apache modules/xar-maven-plugin/src/main/java/org/apache/synapse modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar modules/xar-maven-plugin/src/main/resources modules/xar-maven-plugin/src/main/resources/META-INF modules/xar-maven-plugin/src/main/resources/META-INF/plexus
ruwan at wso2.com
ruwan at wso2.com
Mon Nov 10 20:47:52 PST 2008
Author: ruwan
Date: Mon Nov 10 20:47:51 2008
New Revision: 23637
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=23637
Log:
Initial mergining of the content required for the carbon based ESB over the custom branch
Added:
branches/synapse/modules/mar/src/
branches/synapse/modules/mar/src/main/
branches/synapse/modules/mar/src/main/resources/
branches/synapse/modules/mar/src/main/resources/META-INF/
branches/synapse/modules/mar/src/main/resources/META-INF/LICENSE
- copied unchanged from r23579, /branches/synapse/modules/core/src/main/resources/META-INF/LICENSE
branches/synapse/modules/mar/src/main/resources/META-INF/NOTICE
- copied unchanged from r23579, /branches/synapse/modules/core/src/main/resources/META-INF/NOTICE
branches/synapse/modules/mar/src/main/resources/META-INF/module.xml
- copied unchanged from r23579, /branches/synapse/modules/core/src/main/resources/module.xml
branches/synapse/modules/xar-maven-plugin/
branches/synapse/modules/xar-maven-plugin/pom.xml
branches/synapse/modules/xar-maven-plugin/src/
branches/synapse/modules/xar-maven-plugin/src/main/
branches/synapse/modules/xar-maven-plugin/src/main/java/
branches/synapse/modules/xar-maven-plugin/src/main/java/org/
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/AbstractXarMojo.java
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScanner.java
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScannerException.java
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassVisitor.java
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ServiceLocator.java
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarExplodedMojo.java
branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarMojo.java
branches/synapse/modules/xar-maven-plugin/src/main/resources/
branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/
branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/LICENSE
branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/NOTICE
branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/plexus/
branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/plexus/components.xml
Removed:
branches/synapse/modules/core/src/main/resources/module.xml
Modified:
branches/synapse/modules/core/pom.xml
branches/synapse/modules/extensions/pom.xml
branches/synapse/modules/handler/pom.xml
branches/synapse/modules/mar/pom.xml
branches/synapse/modules/samples/pom.xml
branches/synapse/modules/transports/pom.xml
branches/synapse/modules/war/pom.xml
branches/synapse/pom.xml
Modified: branches/synapse/modules/core/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/core/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/core/pom.xml (original)
+++ branches/synapse/modules/core/pom.xml Mon Nov 10 20:47:51 2008
@@ -35,7 +35,7 @@
<name>Apache Synapse - Core</name>
<description>Apache Synapse - Core</description>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<build>
<plugins>
@@ -84,31 +84,7 @@
<mkdir dir="target/test_repos/synapse/services"/>
<mkdir dir="target/test_repos/client/modules"/>
- <echo message="*** Creating synapse.mar ***"/>
- <mkdir dir="target/modules/synapse/META-INF"/>
- <copy file="src/main/resources/module.xml" tofile="target/modules/synapse/META-INF/module.xml"/>
-
- <manifest file="target/MANIFEST.MF">
- <attribute name="Extension-Name" value="org.apache.synapse"/>
- <attribute name="Specification-Title" value="synapse"/>
- <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
- <attribute name="Specification-Version" value="${pom.version}"/>
- <attribute name="Implementation-Title" value="Apache Synapse"/>
- <attribute name="Implementation-Vendor-Id" value="org.apache"/>
- <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
- <attribute name="Implementation-Version" value="${pom.version}"/>
- </manifest>
-
- <jar jarfile="target/synapse-${version}.mar" manifest="target/MANIFEST.MF">
- <fileset dir="target/modules/synapse">
- <include name="**"/>
- </fileset>
- <!--<fileset dir="target/classes">
- <include name="**"/>
- </fileset>-->
- </jar>
-
- <copy file="target/synapse-${version}.mar"
+ <copy file="../mar/target/synapse-${version}.mar"
tofile="target/test_repos/synapse/modules/synapse-${version}.mar"/>
</tasks>
@@ -142,6 +118,81 @@
</configuration>
</plugin>
+ <!-- Attach a JAR with the test classes so that we can reuse them in other modules
+ (see http://maven.apache.org/guides/mini/guide-attached-tests.html). -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.3.0</Bundle-Version>
+ <Bundle-Name>org.apache.synapse.core</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>org.apache.synapse.core</Bundle-SymbolicName>
+ <Export-Package>
+ !org.apache.synapse.transport.*,
+ !org.apache.synapse.format.*,
+ org.apache.synapse.*;-split-package:=merge-last,
+ </Export-Package>
+ <Import-Package>
+ !javax.xml.namespace,
+ !javax.xml.soap,
+ !org.apache.woden.*,
+ !org.apache.commons.io,
+ javax.xml.namespace; version=0.0.0,
+ javax.activation,
+ javax.crypto,
+ javax.mail.internet,
+ javax.naming,
+ javax.servlet,
+ javax.servlet.http,
+ javax.sql,
+ javax.wsdl.*,
+ javax.xml.parsers,
+ javax.xml.soap; version=0.0.0,
+ javax.xml.stream,
+ javax.xml.transform.*,
+ javax.xml.validation,
+ org.apache.axiom.*,
+ org.apache.axis2.*,
+ org.apache.commons.dbcp,
+ org.apache.commons.dbcp.datasources,
+ org.apache.commons.io; version=0.0.0,
+ org.apache.commons.logging,
+ org.apache.log4j,
+ org.apache.neethi,
+ org.apache.synapse.transport.*,
+ org.apache.synapse.format.*,
+ org.apache.woden.*; version=0.0.0,
+ org.apache.ws.commons.schema.resolver,
+ org.jaxen.*,
+ org.quartz.*,
+ javax.transaction.*,
+ org.springframework.xml.transform,
+ org.w3c.dom,
+ org.wso2.caching.*,
+ org.xml.sax.*,
+ *;resolution:=optional,
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
</plugins>
<resources>
<resource>
Deleted: branches/synapse/modules/core/src/main/resources/module.xml
URL: http://wso2.org/svn/browse/wso2/None?pathrev=23636
Modified: branches/synapse/modules/extensions/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/extensions/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/extensions/pom.xml (original)
+++ branches/synapse/modules/extensions/pom.xml Mon Nov 10 20:47:51 2008
@@ -35,7 +35,7 @@
<name>Apache Synapse - Extensions</name>
<description>Apache Synapse - Extensions</description>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<build>
<plugins>
@@ -46,6 +46,55 @@
<version>2.2</version>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.3.0</Bundle-Version>
+ <Bundle-Name>org.apache.synapse.extension</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>org.apache.synapse.extension</Bundle-SymbolicName>
+ <Export-Package>
+ org.apache.synapse.format.hessian.*;-split-package:=merge-last,
+ org.apache.synapse.format.syslog.*;-split-package:=merge-last,
+ org.apache.synapse.mediators.bsf.*;-split-package:=merge-last,
+ org.apache.synapse.mediators.spring.*;-split-package:=merge-last,
+ org.apache.synapse.mediators.throttle.*;-split-package:=merge-last,
+ org.apache.synapse.mediators.xquery.*;-split-package:=merge-last,
+ </Export-Package>
+ <Import-Package>
+ !javax.xml.namespace,
+ javax.xml.namespace; version=0.0.0,
+ javax.xml.stream,
+ javax.xml.transform.dom,
+ javax.xml.transform.stream,
+ <!--net.sf.saxon.javax.xml.xquery,-->
+ <!--net.sf.saxon.xqj,-->
+ org.apache.axiom.*,
+ org.apache.axis2.*,
+ <!--org.apache.bsf.xml,-->
+ org.apache.commons.logging,
+ org.apache.neethi,
+ org.apache.synapse.*,
+ org.jaxen,
+ <!--org.springframework.beans.factory.support,-->
+ <!--org.springframework.beans.factory.xml,-->
+ <!--org.springframework.context,-->
+ <!--org.springframework.context.support,-->
+ <!--org.springframework.core.io,-->
+ org.w3c.dom,
+ <!--org.wso2.throttle,-->
+ org.xml.sax
+ </Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
Modified: branches/synapse/modules/handler/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/handler/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/handler/pom.xml (original)
+++ branches/synapse/modules/handler/pom.xml Mon Nov 10 20:47:51 2008
@@ -35,13 +35,55 @@
<name>Apache Synapse - Handler Module</name>
<description>Apache Synapse - Handler Module</description>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.3.0</Bundle-Version>
+ <Bundle-Name>${pom.artifactId}</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Private-Package>
+ org.apache.synapse.util;-split-package:=merge-first,
+ org.apache.synapse.handler,
+ </Private-Package>
+ <Export-Package>
+ !*,
+ </Export-Package>
+ <Import-Package>
+ org.apache.axiom.attachments,
+ org.apache.axiom.soap,
+ org.apache.axis2,
+ org.apache.axis2.addressing,
+ org.apache.axis2.context,
+ org.apache.axis2.description,
+ org.apache.axis2.engine,
+ org.apache.axis2.handlers,
+ org.apache.axis2.modules,
+ org.apache.commons.logging,
+ org.apache.neethi,
+ org.apache.synapse,
+ org.apache.synapse.config,
+ org.apache.synapse.core,
+ org.apache.synapse.core.axis2,
+ org.apache.synapse.uti,
+ *;resolution:=optional,
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
Modified: branches/synapse/modules/mar/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/mar/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/mar/pom.xml (original)
+++ branches/synapse/modules/mar/pom.xml Mon Nov 10 20:47:51 2008
@@ -35,13 +35,51 @@
<name>Apache Synapse - Module</name>
<description>Apache Synapse - Module</description>
- <packaging>pom</packaging>
+ <packaging>bundle</packaging>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.3.0</Bundle-Version>
+ <Bundle-Name>org.apache.synapse.module</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>org.apache.synapse.module</Bundle-SymbolicName>
+ <Export-Package>
+ !*,
+ </Export-Package>
+ <Import-Package>
+ org.apache.axiom.attachments,
+ org.apache.axiom.soap,
+ org.apache.axis2,
+ org.apache.axis2.addressing,
+ org.apache.axis2.context,
+ org.apache.axis2.description,
+ org.apache.axis2.engine,
+ org.apache.axis2.handlers,
+ org.apache.axis2.modules,
+ org.apache.commons.logging,
+ org.apache.neethi,
+ org.apache.synapse,
+ org.apache.synapse.config,
+ org.apache.synapse.core,
+ org.apache.synapse.core.axis2,
+ org.apache.synapse.util,
+ *;resolution:=optional,
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
@@ -51,7 +89,8 @@
<phase>package</phase>
<configuration>
<tasks>
- <copy file="../core/target/synapse-${synapse.version}.mar" tofile="target/synapse-${synapse.version}.mar"/>
+ <copy file="target/synapse-${synapse.version}.jar"
+ tofile="target/synapse-${synapse.version}.mar"/>
</tasks>
</configuration>
<goals>
Modified: branches/synapse/modules/samples/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/samples/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/samples/pom.xml (original)
+++ branches/synapse/modules/samples/pom.xml Mon Nov 10 20:47:51 2008
@@ -35,7 +35,7 @@
<name>Apache Synapse - Samples</name>
<description>Apache Synapse - Samples</description>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<profiles>
<profile>
@@ -387,6 +387,27 @@
</profile>
</profiles>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.3.0</Bundle-Version>
+ <Bundle-Name>${pom.artifactId}</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Private-Package>samples.*</Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
Modified: branches/synapse/modules/transports/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/transports/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/transports/pom.xml (original)
+++ branches/synapse/modules/transports/pom.xml Mon Nov 10 20:47:51 2008
@@ -33,7 +33,7 @@
<artifactId>synapse-transports</artifactId>
<name>Apache Synapse - Transports</name>
<description>Apache Synapse - Transports</description>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<build>
<plugins>
@@ -49,6 +49,49 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.3.0</Bundle-Version>
+ <Bundle-Name>org.apache.synapse.transport</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>org.apache.synapse.transport</Bundle-SymbolicName>
+ <Export-Package>
+ org.apache.synapse.*;-split-package:=merge-last,
+ </Export-Package>
+ <Import-Package>
+ !javax.xml.namespace,
+ !org.apache.synapse.*,
+ javax.xml.namespace; version=0.0.0,
+ javax.activation,
+ javax.jms,
+ javax.mail,
+ javax.mail.internet,
+ javax.management,
+ javax.naming,
+ javax.net.ssl,
+ javax.security.auth.x500,
+ javax.xml.stream,
+ org.apache.axiom.*,
+ org.apache.axis2.*,
+ org.apache.commons.io.*; version=0.0.0,
+ org.apache.commons.logging,
+ org.apache.commons.vfs.*,
+ org.apache.http.params,
+ org.apache.http.protocol,
+ org.apache.http.nio.reactor,
+ org.apache.http.nio,
+ org.apache.ws.commons.schema,
+ *;resolution:=optional,
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
</plugins>
</build>
Modified: branches/synapse/modules/war/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/war/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/modules/war/pom.xml (original)
+++ branches/synapse/modules/war/pom.xml Mon Nov 10 20:47:51 2008
@@ -25,7 +25,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.synapse</groupId>
- <artifactId>synapse</artifactId>
+ <artifactId>Apache-Synapse</artifactId>
<version>1.2.wso2v1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Added: branches/synapse/modules/xar-maven-plugin/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/pom.xml?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/pom.xml Mon Nov 10 20:47:51 2008
@@ -0,0 +1,77 @@
+<?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>
+ <groupId>org.apache.synapse</groupId>
+ <artifactId>synapse-xar-maven-plugin</artifactId>
+ <version>1.2.wso2v1</version>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Synapse - XAR Maven Plugin</name>
+ <description>Maven 2 plugin to create Synapse extension archives</description>
+
+ <properties>
+ <maven.version>2.0.7</maven.version>
+ <maven.artifact.version>2.0.8</maven.artifact.version>
+ <maven.archiver.version>2.2</maven.archiver.version>
+ <plexus.utils.version>1.5.4</plexus.utils.version>
+ </properties>
+
+ <dependencies>
+ <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>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>${maven.artifact.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>${maven.archiver.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>${plexus.utils.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/AbstractXarMojo.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/AbstractXarMojo.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/AbstractXarMojo.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,394 @@
+/*
+ * 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.synapse.maven.xar;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactCollector;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.DebugResolutionListener;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.TypeArtifactFilter;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Abstract base class for all the mojos in the XAR plugin.
+ */
+public abstract class AbstractXarMojo extends AbstractMojo implements LogEnabled {
+ /**
+ * List of dependencies to be excluded by default because the corresponding APIs are provided
+ * by the Synapse runtime.
+ */
+ private static final String[] defaultRuntimeExcludes = {
+ "org.apache.synapse:synapse-core:jar",
+ "commons-logging:commons-logging-api:jar",
+ };
+
+ private static final String[] serviceClassNames = {
+ "org.apache.synapse.config.xml.MediatorFactory",
+ "org.apache.synapse.config.xml.MediatorSerializer",
+ "org.apache.synapse.config.xml.StartupFactory",
+ };
+
+ /**
+ * The projects base directory.
+ *
+ * @parameter expression="${project.basedir}"
+ * @required
+ * @readonly
+ */
+ private File baseDir;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * Local maven repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @required
+ * @readonly
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * Remote repositories.
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @required
+ * @readonly
+ */
+ private List remoteArtifactRepositories;
+
+ /**
+ * @component role="org.apache.maven.artifact.metadata.ArtifactMetadataSource" hint="maven"
+ */
+ private ArtifactMetadataSource artifactMetadataSource;
+
+ /**
+ * Artifact collector, needed to resolve dependencies.
+ *
+ * @component role="org.apache.maven.artifact.resolver.ArtifactCollector"
+ * @required
+ * @readonly
+ */
+ private ArtifactCollector artifactCollector;
+
+ /**
+ * Project builder.
+ *
+ * @component role="org.apache.maven.project.MavenProjectBuilder"
+ * @required
+ * @readonly
+ */
+ private MavenProjectBuilder projectBuilder;
+
+ /**
+ * Artifact factory.
+ *
+ * @component role="org.apache.maven.artifact.factory.ArtifactFactory"
+ * @required
+ * @readonly
+ */
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * The directory containing generated classes.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @required
+ */
+ private File buildOutputDirectory;
+
+ /**
+ * The directory where temporary files for inclusion in the XAR are stored.
+ *
+ * @parameter expression="${project.build.directory}/xar-files"
+ * @required
+ */
+ private File tmpDirectory;
+
+ /**
+ * Whether the dependency jars should be included in the XAR.
+ *
+ * @parameter expression="${includeDependencies}" default-value="true"
+ */
+ private boolean includeDependencies;
+
+ /**
+ * Whether metadata for the extensions should be generated automatically.
+ *
+ * @parameter expression="${generateMetadata}" default-value="true"
+ */
+ private boolean generateMetadata;
+
+ private Logger logger;
+
+ public void enableLogging(Logger logger) {
+ this.logger = logger;
+ }
+
+ /**
+ * Build the XAR using the provided archiver.
+ *
+ * @throws MojoExecutionException
+ */
+ protected void buildArchive(Archiver archiver)
+ throws ArchiverException, MojoExecutionException {
+
+ Log log = getLog();
+ archiver.addDirectory(buildOutputDirectory);
+ if (includeDependencies) {
+ log.debug("Adding dependencies ...");
+ addDependencies(archiver);
+ }
+ if (generateMetadata) {
+ log.debug("Generating XAR metadata ...");
+ generateMetadata(archiver);
+ }
+ }
+
+ private void addDependencies(Archiver archiver)
+ throws ArchiverException, MojoExecutionException {
+
+ Log log = getLog();
+ AndArtifactFilter filter = new AndArtifactFilter();
+ filter.add(new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME));
+ filter.add(new ArtifactFilter() {
+ public boolean include(Artifact artifact) {
+ return !artifact.isOptional();
+ }
+ });
+ filter.add(new TypeArtifactFilter("jar"));
+ filter.add(buildSynapseRuntimeArtifactFilter());
+ for (Artifact artifact : filterArtifacts(project.getArtifacts(), filter)) {
+ String targetFileName = artifact.getArtifactId() + "-" + artifact.getVersion() + "." +
+ artifact.getArtifactHandler().getExtension();
+ log.info("Adding " + targetFileName + " (scope " + artifact.getScope() + ")");
+ archiver.addFile(artifact.getFile(), "lib/" + targetFileName);
+ }
+ }
+
+ private void generateMetadata(Archiver archiver)
+ throws ArchiverException, MojoExecutionException {
+
+ Log log = getLog();
+ File tmpServicesDir = new File(new File(tmpDirectory, "META-INF"), "services");
+ File buildServicesDir = new File(new File(buildOutputDirectory, "META-INF"), "services");
+ tmpServicesDir.mkdirs();
+
+ log.debug("Initializing class scanner ...");
+ ClassScanner scanner = new ClassScanner(buildOutputDirectory);
+ for (Artifact artifact : filterArtifacts(project.getArtifacts(),
+ new ScopeArtifactFilter(Artifact.SCOPE_COMPILE))) {
+ scanner.addToClasspath(artifact.getFile());
+ }
+ List<ServiceLocator> serviceLocators =
+ new ArrayList<ServiceLocator>(serviceClassNames.length);
+ for (String serviceClassName : serviceClassNames) {
+ // If the user provided its own service file, skip generation
+ File file = new File(buildServicesDir, serviceClassName);
+ if (file.exists()) {
+ log.debug(file + " exists; don't scan for " + serviceClassName +
+ " implementation");
+ } else {
+ ServiceLocator sl = new ServiceLocator(serviceClassName);
+ serviceLocators.add(sl);
+ scanner.addVisitor(sl);
+ }
+ }
+ try {
+ scanner.scan();
+ } catch (ClassScannerException e) {
+ throw new MojoExecutionException("Failed to scan classes for services", e);
+ }
+ for (ServiceLocator sl : serviceLocators) {
+ File file = new File(tmpServicesDir, sl.getServiceClassName());
+ if (!sl.getImplementations().isEmpty()) {
+ String destFileName = "META-INF/services/" + sl.getServiceClassName();
+ log.info("Generating " + destFileName);
+ try {
+ Writer out = new OutputStreamWriter(new FileOutputStream(file));
+ try {
+ for (String impl : sl.getImplementations()) {
+ log.debug(" " + impl);
+ out.write(impl);
+ out.write("\n");
+ }
+ } finally {
+ out.close();
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to create temporary file " + file, e);
+ }
+ archiver.addFile(file, destFileName);
+ }
+ }
+ }
+
+ /**
+ * Build a filter that excludes all artifacts that are provided by Synapse at runtime.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private ArtifactFilter buildSynapseRuntimeArtifactFilter() throws MojoExecutionException {
+ final Map<String,Artifact> artifacts = new HashMap<String,Artifact>();
+ for (Artifact artifact : getSynapseRuntimeArtifacts()) {
+ artifacts.put(artifact.getDependencyConflictId(), artifact);
+ }
+ final Set<String> defaultExclusionSet
+ = new HashSet<String>(Arrays.asList(defaultRuntimeExcludes));
+ return new ArtifactFilter() {
+ public boolean include(Artifact artifact) {
+ Artifact runtimeArtifact = artifacts.get(artifact.getDependencyConflictId());
+ if (runtimeArtifact == null) {
+ return !defaultExclusionSet.contains(artifact.getDependencyConflictId());
+ } else {
+ if (!runtimeArtifact.getVersion().equals(artifact.getVersion())) {
+ getLog().warn("Possible runtime version conflict for "
+ + artifact.getArtifactId() + ": XAR depends on "
+ + artifact.getVersion() + ", Synapse runtime provides "
+ + runtimeArtifact.getVersion());
+ }
+ return false;
+ }
+ }
+ };
+ }
+
+ /**
+ * Get the set of artifacts that are provided by Synapse at runtime.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private Set<Artifact> getSynapseRuntimeArtifacts() throws MojoExecutionException {
+ Log log = getLog();
+ log.debug("Looking for synapse-core artifact in XAR project dependencies ...");
+ Artifact synapseCore = null;
+ for (Iterator<?> it = project.getDependencyArtifacts().iterator(); it.hasNext(); ) {
+ Artifact artifact = (Artifact)it.next();
+ if (artifact.getGroupId().equals("org.apache.synapse")
+ && artifact.getArtifactId().equals("synapse-core")) {
+ synapseCore = artifact;
+ break;
+ }
+ }
+ if (synapseCore == null) {
+ throw new MojoExecutionException("Could not locate dependency on synapse-core");
+ }
+
+ log.debug("Loading project data for " + synapseCore + " ...");
+ MavenProject synapseCoreProject;
+ try {
+ synapseCoreProject = projectBuilder.buildFromRepository(synapseCore,
+ remoteArtifactRepositories, localRepository);
+ } catch (ProjectBuildingException e) {
+ throw new MojoExecutionException("Unable to retrieve project information for "
+ + synapseCore, e);
+ }
+ Set<Artifact> synapseRuntimeDeps;
+ try {
+ synapseRuntimeDeps = synapseCoreProject.createArtifacts(artifactFactory,
+ Artifact.SCOPE_RUNTIME, new TypeArtifactFilter("jar"));
+ } catch (InvalidDependencyVersionException e) {
+ throw new MojoExecutionException("Unable to get project dependencies for "
+ + synapseCore, e);
+ }
+ log.debug("Direct runtime dependencies for " + synapseCore + " :");
+ logArtifacts(synapseRuntimeDeps);
+
+ log.debug("Resolving transitive dependencies for " + synapseCore + " ...");
+ try {
+ synapseRuntimeDeps = artifactCollector.collect(synapseRuntimeDeps,
+ synapseCoreProject.getArtifact(), synapseCoreProject.getManagedVersionMap(),
+ localRepository, remoteArtifactRepositories, artifactMetadataSource, null,
+ Collections.singletonList(new DebugResolutionListener(logger))).getArtifacts();
+ } catch (ArtifactResolutionException e) {
+ throw new MojoExecutionException("Unable to resolve transitive dependencies for "
+ + synapseCore);
+ }
+ log.debug("All runtime dependencies for " + synapseCore + " :");
+ logArtifacts(synapseRuntimeDeps);
+
+ return synapseRuntimeDeps;
+ }
+
+ private void logArtifacts(Collection<Artifact> collection) {
+ List<Artifact> artifacts = new ArrayList<Artifact>(collection);
+ Collections.sort(artifacts, new Comparator<Artifact>() {
+ public int compare(Artifact o1, Artifact o2) {
+ return o1.getArtifactId().compareTo(o2.getArtifactId());
+ }
+ });
+ for (Artifact artifact : artifacts) {
+ getLog().debug(" " + artifact.getArtifactId() + "-" + artifact.getVersion()
+ + "." + artifact.getArtifactHandler().getExtension());
+ }
+ }
+
+ private static Set<Artifact> filterArtifacts(Set<Artifact> artifacts, ArtifactFilter filter) {
+ Set<Artifact> result = new HashSet<Artifact>();
+ for (Artifact artifact : artifacts) {
+ if (filter.include(artifact)) {
+ result.add(artifact);
+ }
+ }
+ return result;
+ }
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScanner.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScanner.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScanner.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,101 @@
+/*
+ * 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.synapse.maven.xar;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+public class ClassScanner {
+ private final File dir;
+ private List<File> classpath = new LinkedList<File>();
+ private List<ClassVisitor> visitors = new LinkedList<ClassVisitor>();
+ private ClassLoader loader;
+
+ public ClassScanner(File dir) {
+ this.dir = dir;
+ addToClasspath(dir);
+ }
+
+ public void addToClasspath(File file) {
+ classpath.add(file);
+ }
+
+ public void addVisitor(ClassVisitor visitor) {
+ visitors.add(visitor);
+ }
+
+ public void scan() throws ClassScannerException {
+ if (visitors.isEmpty()) {
+ return;
+ }
+ List<URL> urls = new ArrayList<URL>(classpath.size());
+ for (File classpathEntry : classpath) {
+ try {
+ urls.add(classpathEntry.toURL());
+ } catch (MalformedURLException e) {
+ throw new ClassScannerException("Unable to build classpath", e);
+ }
+ }
+ loader = URLClassLoader.newInstance(urls.toArray(new URL[urls.size()]));
+ try {
+ for (ClassVisitor visitor : visitors) {
+ visitor.init(loader);
+ }
+ scan(dir, null);
+ } finally {
+ loader = null;
+ }
+ }
+
+ private void scan(File dir, String packageName) throws ClassScannerException {
+ File[] children = dir.listFiles(new FileFilter() {
+ public boolean accept(File file) {
+ return file.isDirectory() || (file.isFile() && file.getName().endsWith(".class"));
+ }
+ });
+ for (File child : children) {
+ String name = child.getName();
+ if (child.isDirectory()) {
+ scan(child, packageName == null ? name : packageName + "." + name);
+ } else {
+ StringBuilder className = new StringBuilder();
+ if (packageName != null) {
+ className.append(packageName).append('.');
+ }
+ className.append(name.substring(0, name.length()-6));
+ Class<?> clazz;
+ try {
+ clazz = loader.loadClass(className.toString());
+ } catch (ClassNotFoundException e) {
+ throw new ClassScannerException("Unable to load class " + className, e);
+ }
+ for (ClassVisitor visitor : visitors) {
+ visitor.visit(clazz);
+ }
+ }
+ }
+ }
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScannerException.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScannerException.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassScannerException.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,32 @@
+/*
+ * 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.synapse.maven.xar;
+
+public class ClassScannerException extends Exception {
+ private static final long serialVersionUID = 7666486328035342350L;
+
+ public ClassScannerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ClassScannerException(String message) {
+ super(message);
+ }
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassVisitor.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassVisitor.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ClassVisitor.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,25 @@
+/*
+ * 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.synapse.maven.xar;
+
+public interface ClassVisitor {
+ void init(ClassLoader classLoader) throws ClassScannerException;
+ void visit(Class<?> clazz) throws ClassScannerException;
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ServiceLocator.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ServiceLocator.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/ServiceLocator.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,56 @@
+/*
+ * 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.synapse.maven.xar;
+
+import java.lang.reflect.Modifier;
+import java.util.LinkedList;
+import java.util.List;
+
+public class ServiceLocator implements ClassVisitor {
+ private final String serviceClassName;
+ private Class<?> serviceClass;
+ private List<String> implementations = new LinkedList<String>();
+
+ public ServiceLocator(String serviceClassName) {
+ this.serviceClassName = serviceClassName;
+ }
+
+ public String getServiceClassName() {
+ return serviceClassName;
+ }
+
+ public List<String> getImplementations() {
+ return implementations;
+ }
+
+ public void init(ClassLoader classLoader) throws ClassScannerException {
+ try {
+ serviceClass = classLoader.loadClass(serviceClassName);
+ } catch (ClassNotFoundException e) {
+ throw new ClassScannerException("Class " + serviceClassName + " not found");
+ }
+ }
+
+ public void visit(Class<?> clazz) throws ClassScannerException {
+ if (serviceClass.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
+ implementations.add(clazz.getName());
+ }
+ }
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarExplodedMojo.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarExplodedMojo.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarExplodedMojo.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,58 @@
+/*
+ * 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.synapse.maven.xar;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.dir.DirectoryArchiver;
+
+/**
+ * Generate the exploded XAR.
+ *
+ * @goal exploded
+ * @phase package
+ * @requiresDependencyResolution runtime
+ */
+public class XarExplodedMojo extends AbstractXarMojo {
+ /**
+ * The directory where the exploded XAR is built.
+ *
+ * @parameter expression="${project.build.directory}/xar"
+ * @required
+ */
+ private File xarDirectory;
+
+ public void execute() throws MojoExecutionException {
+ Archiver archiver = new DirectoryArchiver();
+ archiver.setDestFile(xarDirectory);
+ try {
+ buildArchive(archiver);
+ archiver.createArchive();
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException("Unable to build archive", e);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to build archive", e);
+ }
+ }
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarMojo.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarMojo.java?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/java/org/apache/synapse/maven/xar/XarMojo.java Mon Nov 10 20:47:51 2008
@@ -0,0 +1,132 @@
+/*
+ * 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.synapse.maven.xar;
+
+import java.io.File;
+
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+
+/**
+ * Build a XAR.
+ *
+ * @goal xar
+ * @phase package
+ * @requiresDependencyResolution runtime
+ */
+public class XarMojo extends AbstractXarMojo {
+ /**
+ * The directory for the generated XAR.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectory;
+
+ /**
+ * The name of the generated XAR.
+ *
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String xarName;
+
+ /**
+ * The Jar archiver.
+ *
+ * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
+ * @required
+ */
+ private JarArchiver jarArchiver;
+
+ /**
+ * The maven archive configuration to use.
+ *
+ * @parameter
+ */
+ private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+
+ /**
+ * Classifier to add to the artifact generated. If given, the artifact will be an attachment
+ * instead.
+ *
+ * @parameter
+ */
+ private String classifier;
+
+ /**
+ * Whether this is the main artifact being built. Set to <code>false</code> if you don't want to
+ * install or deploy it to the local repository instead of the default one in an execution.
+ *
+ * @parameter expression="${primaryArtifact}" default-value="true"
+ */
+ private boolean primaryArtifact;
+
+ /**
+ * @component
+ */
+ private MavenProjectHelper projectHelper;
+
+ /**
+ * Executes the XarMojo on the current project.
+ *
+ * @throws MojoExecutionException if an error occurred while building the XAR
+ */
+ public void execute() throws MojoExecutionException {
+
+ File xarFile = new File(outputDirectory, xarName + ".xar");
+
+ // generate xar file
+ getLog().info("Generating XAR " + xarFile.getAbsolutePath());
+ MavenArchiver archiver = new MavenArchiver();
+ archiver.setArchiver(jarArchiver);
+ archiver.setOutputFile(xarFile);
+ try {
+ buildArchive(jarArchiver);
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException("Unable to build archive", e);
+ }
+
+ // create archive
+ try {
+ archiver.createArchive(project, archive);
+ } catch (Exception e) {
+ throw new MojoExecutionException("Unable to create archive", e);
+ }
+
+ if (classifier != null) {
+ projectHelper.attachArtifact(project, "xar", classifier, xarFile);
+ } else {
+ Artifact artifact = project.getArtifact();
+ if (primaryArtifact) {
+ artifact.setFile(xarFile);
+ } else if (artifact.getFile() == null || artifact.getFile().isDirectory()) {
+ artifact.setFile(xarFile);
+ } else {
+ projectHelper.attachArtifact(project, "xar", xarFile);
+ }
+ }
+ }
+}
Added: branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/LICENSE
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/LICENSE?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/LICENSE Mon Nov 10 20:47:51 2008
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
Added: branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/NOTICE
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/NOTICE?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/NOTICE Mon Nov 10 20:47:51 2008
@@ -0,0 +1,5 @@
+ Apache Synapse
+ Copyright 2005-2006 The Apache Software Foundation
+
+ This product includes software developed at
+ The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
Added: branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/plexus/components.xml?pathrev=23637
==============================================================================
--- (empty file)
+++ branches/synapse/modules/xar-maven-plugin/src/main/resources/META-INF/plexus/components.xml Mon Nov 10 20:47:51 2008
@@ -0,0 +1,56 @@
+<!--
+ ~ 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.
+ -->
+
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>xar</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <extension>xar</extension>
+ <type>xar</type>
+ <language>java</language>
+ <addedToClasspath>false</addedToClasspath>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>xar</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <lifecycles>
+ <lifecycle>
+ <id>default</id>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+ <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+ <package>org.apache.synapse:synapse-xar-maven-plugin:xar</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </lifecycle>
+ </lifecycles>
+ </configuration>
+ </component>
+ </components>
+</component-set>
Modified: branches/synapse/pom.xml
URL: http://wso2.org/svn/browse/wso2/branches/synapse/pom.xml?rev=23637&r1=23636&r2=23637&view=diff
==============================================================================
--- branches/synapse/pom.xml (original)
+++ branches/synapse/pom.xml Mon Nov 10 20:47:51 2008
@@ -1111,12 +1111,13 @@
<modules>
<module>modules/transports</module>
+ <module>modules/mar</module>
<module>modules/core</module>
<module>modules/extensions</module>
<module>modules/samples</module>
- <module>modules/mar</module>
<module>modules/war</module>
<module>modules/handler</module>
+ <module>modules/xar-maven-plugin</module>
</modules>
<properties>
More information about the Esb-java-dev
mailing list