Author: gnodet
Date: Sat Jan 12 15:32:40 2008
New Revision: 611508

URL: http://svn.apache.org/viewvc?rev=611508&view=rev
Log:
Add war deployer (non functional yet)

Added:
    servicemix/smx4/features/trunk/activemq/pom.xml
    servicemix/smx4/features/trunk/war/   (with props)
    servicemix/smx4/features/trunk/war/bundles/   (with props)
    servicemix/smx4/features/trunk/war/bundles/jasper/   (with props)
    servicemix/smx4/features/trunk/war/bundles/jasper/pom.xml
    servicemix/smx4/features/trunk/war/bundles/pom.xml
    servicemix/smx4/features/trunk/war/deployer/   (with props)
    servicemix/smx4/features/trunk/war/deployer/pom.xml
    servicemix/smx4/features/trunk/war/deployer/src/
    servicemix/smx4/features/trunk/war/deployer/src/main/
    servicemix/smx4/features/trunk/war/deployer/src/main/java/
    servicemix/smx4/features/trunk/war/deployer/src/main/java/org/
    servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/
    
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/
    
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/
    
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/
    
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/
    
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/Activator.java
    
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/WarDeploymentListener.java
    servicemix/smx4/features/trunk/war/pom.xml
Modified:
    servicemix/smx4/features/trunk/activemq/   (props changed)
    servicemix/smx4/features/trunk/activemq/activemq-osgi/pom.xml
    servicemix/smx4/features/trunk/camel/pom.xml
    servicemix/smx4/features/trunk/camel/servicemix-camel/   (props changed)
    servicemix/smx4/features/trunk/camel/servicemix-camel/pom.xml
    servicemix/smx4/features/trunk/pom.xml

Propchange: servicemix/smx4/features/trunk/activemq/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 12 15:32:40 2008
@@ -0,0 +1,11 @@
+target
+*.iml
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Modified: servicemix/smx4/features/trunk/activemq/activemq-osgi/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/activemq-osgi/pom.xml?rev=611508&r1=611507&r2=611508&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/activemq/activemq-osgi/pom.xml (original)
+++ servicemix/smx4/features/trunk/activemq/activemq-osgi/pom.xml Sat Jan 12 
15:32:40 2008
@@ -23,16 +23,16 @@
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.apache.servicemix</groupId>
-        <artifactId>servicemix</artifactId>
-        <version>4.0-SNAPSHOT</version>
+           <groupId>org.apache.servicemix.activemq</groupId>
+           <artifactId>activemq</artifactId>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.servicemix</groupId>
+    <groupId>org.apache.servicemix.activemq</groupId>
     <artifactId>org.apache.servicemix.activemq</artifactId>
     <packaging>bundle</packaging>
-    <version>4.0-SNAPSHOT</version>
-    <name>ServiceMix ActiveMQ</name>
+    <version>1.0-SNAPSHOT</version>
+    <name>ServiceMix Features :: ActiveMQ</name>
     
     <properties>
        <commons-pool.version>1.3</commons-pool.version>
@@ -43,18 +43,22 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-jms_1.1_spec</artifactId>
+            <version>${geronimo.jms.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-jta_1.1_spec</artifactId>
+            <version>${geronimo.jta.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.activemq</groupId>
             <artifactId>activemq-core</artifactId>
+            <version>${activemq.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework.osgi</groupId>
             <artifactId>spring-osgi-core</artifactId>
+            <version>${spring.osgi.version}</version>
         </dependency>
         <dependency>
             <groupId>commons-pool</groupId>
@@ -64,21 +68,25 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.osgi.core</artifactId>
+            <version>${felix.core.version}</version>
             <scope>provided</scope>
         </dependency>        
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.components</groupId>
             <artifactId>geronimo-transaction</artifactId>
+            <version>${geronimo.transaction.version}</version>
         </dependency>
         <dependency>
             <groupId>org.jencks</groupId>

Added: servicemix/smx4/features/trunk/activemq/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/activemq/pom.xml?rev=611508&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/activemq/pom.xml (added)
+++ servicemix/smx4/features/trunk/activemq/pom.xml Sat Jan 12 15:32:40 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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";>
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.features</groupId>
+        <artifactId>features</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.activemq</groupId>
+    <artifactId>activemq</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>ServiceMix Features :: ActiveMQ</name>
+
+    <modules>
+        <module>activemq-osgi</module>
+    </modules>
+
+</project>

Modified: servicemix/smx4/features/trunk/camel/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/camel/pom.xml?rev=611508&r1=611507&r2=611508&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/camel/pom.xml (original)
+++ servicemix/smx4/features/trunk/camel/pom.xml Sat Jan 12 15:32:40 2008
@@ -31,7 +31,7 @@
     <artifactId>camel</artifactId>
     <packaging>pom</packaging>
     <version>1.0-SNAPSHOT</version>
-    <name>ServiceMix Runtime :: Camel</name>
+    <name>ServiceMix Features :: Camel</name>
 
     <modules>
         <module>bundles</module>

Propchange: servicemix/smx4/features/trunk/camel/servicemix-camel/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jan 12 15:32:40 2008
@@ -1,5 +1,7 @@
 target
 *.iml
+target
+*.iml
 *.ipr
 *.iws
 .classpath

Modified: servicemix/smx4/features/trunk/camel/servicemix-camel/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/camel/servicemix-camel/pom.xml?rev=611508&r1=611507&r2=611508&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/camel/servicemix-camel/pom.xml (original)
+++ servicemix/smx4/features/trunk/camel/servicemix-camel/pom.xml Sat Jan 12 
15:32:40 2008
@@ -111,6 +111,12 @@
           <artifactId>cxf-rt-ws-security</artifactId>
           <version>${cxf.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <version>${jaxb.impl.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

Modified: servicemix/smx4/features/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/pom.xml?rev=611508&r1=611507&r2=611508&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/pom.xml (original)
+++ servicemix/smx4/features/trunk/pom.xml Sat Jan 12 15:32:40 2008
@@ -34,7 +34,9 @@
   <name>Apache ServiceMix Features</name>
 
   <modules>
+    <module>activemq</module>
     <module>camel</module>
+    <module>war</module>
   </modules>
 
   <scm>
@@ -53,16 +55,25 @@
   </prerequisites>
 
   <properties>
+      <activemq.version>5.0.0</activemq.version>
       <camel.version>1.3-SNAPSHOT</camel.version>
+      <commons.logging.version>1.1</commons.logging.version>
       <cxf.version>2.0.3-incubator</cxf.version>
+      <felix.core.version>1.1.0-r605854</felix.core.version>
+      <felix.osgi.version>1.0.0</felix.osgi.version>
       <felix.plugin.version>1.1.0-r605854</felix.plugin.version>
+      <geronimo.jms.version>1.1</geronimo.jms.version>
+      <geronimo.jta.version>1.1</geronimo.jta.version>
+      <geronimo.transaction.version>2.0.1</geronimo.transaction.version>
+      <jasper.version>6.0.14</jasper.version>
       <jaxb.api.version>2.0</jaxb.api.version>
       <jaxb.impl.version>2.0.3</jaxb.impl.version>
       <junit.version>4.4</junit.version>
+      <log4j.version>1.2.14</log4j.version>
+      <servicemix.runtime.version>1.0-m2-SNAPSHOT</servicemix.runtime.version>
       <servicemix.nmr.version>1.0-SNAPSHOT</servicemix.nmr.version>
-      <commons.logging.version>1.1</commons.logging.version>
       <spring.version>2.5</spring.version>
-      <log4j.version>1.2.13</log4j.version>
+      <spring.osgi.version>1.0-rc1</spring.osgi.version>
   </properties>
 
    <repositories>

Propchange: servicemix/smx4/features/trunk/war/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 12 15:32:40 2008
@@ -0,0 +1,11 @@
+target
+*.iml
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Propchange: servicemix/smx4/features/trunk/war/bundles/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 12 15:32:40 2008
@@ -0,0 +1,11 @@
+target
+*.iml
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Propchange: servicemix/smx4/features/trunk/war/bundles/jasper/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 12 15:32:40 2008
@@ -0,0 +1,11 @@
+target
+*.iml
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Added: servicemix/smx4/features/trunk/war/bundles/jasper/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/war/bundles/jasper/pom.xml?rev=611508&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/war/bundles/jasper/pom.xml (added)
+++ servicemix/smx4/features/trunk/war/bundles/jasper/pom.xml Sat Jan 12 
15:32:40 2008
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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";>
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.war.bundles</groupId>
+        <artifactId>bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.bundles</groupId>
+    <artifactId>${pom.groupId}.${pkgArtifactId}-${pkgVersion}</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>ServiceMix OSGI Common Bundles: ${pkgArtifactId}</name>
+    <description>
+        This bundle simply wraps ${pkgArtifactId}-${pkgVersion}.jar.
+    </description>
+
+    <properties>
+        <pkgArtifactId>jasper</pkgArtifactId>
+        <pkgVersion>${jasper.version}</pkgVersion>
+        
<servicemix.osgi.export.pkg>org.apache,org.apache.jasper*</servicemix.osgi.export.pkg>
+        <servicemix.osgi.import.pkg>
+            javax*;resolution:=optional,
+            javax.servlet.jsp.resources;resolution:=optional,
+            org.apache*;resolution:=optional,
+            org.apache.tools.ant*;resolution:=optional,
+            org.eclipse.jdt*;resolution:=optional,
+            *
+        </servicemix.osgi.import.pkg>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>${pkgArtifactId}</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+    </dependencies>
+</project>

Added: servicemix/smx4/features/trunk/war/bundles/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/war/bundles/pom.xml?rev=611508&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/war/bundles/pom.xml (added)
+++ servicemix/smx4/features/trunk/war/bundles/pom.xml Sat Jan 12 15:32:40 2008
@@ -0,0 +1,71 @@
+<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";>
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.war</groupId>
+        <artifactId>war</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.war.bundles</groupId>
+    <artifactId>bundles</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>ServiceMix OSGI Common Bundles</name>
+
+    <modules>
+        <module>jasper</module>
+    </modules>
+
+    <properties>
+        
<servicemix.osgi.export>${servicemix.osgi.export.pkg}*;version=${pkgVersion}</servicemix.osgi.export>
+        <servicemix.osgi.export.pkg />
+        <servicemix.osgi.import.pkg />
+        <servicemix.osgi.private.pkg />
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>bundle</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <instructions>
+                        
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        
<Export-Package>${servicemix.osgi.export}</Export-Package>
+                        
<Import-Package>${servicemix.osgi.import.pkg}*</Import-Package>
+                        
<Private-Package>${servicemix.osgi.private.pkg}</Private-Package>
+                    </instructions>
+                    <unpackBundle>true</unpackBundle>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

Propchange: servicemix/smx4/features/trunk/war/deployer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 12 15:32:40 2008
@@ -0,0 +1,10 @@
+target
+*.iml
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+

Added: servicemix/smx4/features/trunk/war/deployer/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/war/deployer/pom.xml?rev=611508&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/war/deployer/pom.xml (added)
+++ servicemix/smx4/features/trunk/war/deployer/pom.xml Sat Jan 12 15:32:40 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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";>
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.war</groupId>
+        <artifactId>war</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.war</groupId>
+    <artifactId>org.apache.servicemix.war.deployer</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>ServiceMix WAR Deployer</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.runtime</groupId>
+            <artifactId>org.apache.servicemix.runtime.filemonitor</artifactId>
+            <version>${servicemix.runtime.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+               <version>${felix.osgi.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        
<Bundle-Activator>${pom.artifactId}.impl.Activator</Bundle-Activator>
+                        <Export-Package>${pom.artifactId}*</Export-Package>
+                        <Import-Package>*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+         </plugins>
+    </build>
+
+</project>

Added: 
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/Activator.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/Activator.java?rev=611508&view=auto
==============================================================================
--- 
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/Activator.java
 (added)
+++ 
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/Activator.java
 Sat Jan 12 15:32:40 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.servicemix.war.deployer.impl;
+
+import org.osgi.framework.*;
+import org.apache.servicemix.runtime.filemonitor.DeploymentListener;
+
+public class Activator implements BundleActivator {
+       
+    public void start(org.osgi.framework.BundleContext bundleContext) throws 
java.lang.Exception {
+           bundleContext.registerService(DeploymentListener.class.getName(), 
new WarDeploymentListener(), null);
+    }
+    
+    public void stop(org.osgi.framework.BundleContext bundleContext) throws 
java.lang.Exception {
+       
+    }
+}
\ No newline at end of file

Added: 
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/WarDeploymentListener.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/WarDeploymentListener.java?rev=611508&view=auto
==============================================================================
--- 
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/WarDeploymentListener.java
 (added)
+++ 
servicemix/smx4/features/trunk/war/deployer/src/main/java/org/apache/servicemix/war/deployer/impl/WarDeploymentListener.java
 Sat Jan 12 15:32:40 2008
@@ -0,0 +1,143 @@
+/*
+ * 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.servicemix.war.deployer.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.runtime.filemonitor.DeploymentListener;
+
+
+public class WarDeploymentListener implements DeploymentListener {
+       
+       private static final Log LOGGER = 
LogFactory.getLog(WarDeploymentListener.class);
+       
+       public boolean canHandle(File artifact) {
+               try {
+            // Accept wars
+            if (!artifact.getName().endsWith(".war")) {
+                return false;
+            }
+                       JarFile jar = new JarFile(artifact);
+                       JarEntry entry = jar.getJarEntry("WEB-INF/web.xml");
+            // Only handle WAR artifacts
+            if (entry == null) {
+                               return false;
+                       }
+            // Only handle non OSGi bundles
+            Manifest m = jar.getManifest();
+            if (m.getMainAttributes().getValue(new 
Attributes.Name("Bundle-SymbolicName")) != null &&
+                m.getMainAttributes().getValue(new 
Attributes.Name("Bundle-Version")) != null) {
+                return false;
+            }
+            return true;
+               } catch (Exception e) {
+                       return false;
+               }
+       }
+
+       public File handle(File artifact, File tmpDir) {
+               try {
+               JarFile jar = new JarFile(artifact);
+               Manifest m = jar.getManifest();
+
+               String version = 
m.getMainAttributes().getValue("Implementation-Version");
+               String name = 
m.getMainAttributes().getValue("Implementation-Title");
+            if (name == null) {
+                name = artifact.getName();
+                int idx = name.lastIndexOf('/');
+                if (idx > 0) {
+                    name = name.substring(idx + 1);
+                }
+                idx = name.lastIndexOf('.');
+                if (idx > 0) {
+                    name = name.substring(0, idx - 1);
+                }
+            }
+            m.getMainAttributes().put(new 
Attributes.Name("Bundle-SymbolicName"), name);
+               m.getMainAttributes().put(new 
Attributes.Name("Bundle-Version"), version);
+            m.getMainAttributes().put(new Attributes.Name("Bundle-ClassPath"), 
getClassPath(jar));
+            m.getMainAttributes().put(new Attributes.Name("Import-Package"), 
"javax.servlet,javax.servlet.http");
+            m.getMainAttributes().put(new 
Attributes.Name("DynamicImport-Package"), "javax.*,org.xml.*,org.w3c.*");
+
+            return generateWARArtifactBundle(artifact, tmpDir, m);
+               } catch (Exception e) {
+                       LOGGER.error("Failed in transforming the WAR artifact 
to be OSGified");
+                       return null;
+               }
+       }
+
+    private String getClassPath(JarFile jar) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(".,WEB-INF/classes");
+        for (Enumeration<JarEntry> e = jar.entries(); e.hasMoreElements();) {
+            JarEntry j = e.nextElement();
+            if (j.getName().startsWith("WEB-INF/lib/")) {
+                sb.append(",");
+                sb.append(j.getName());
+            }
+        }
+        return sb.toString();
+    }
+
+    private File generateWARArtifactBundle(File artifact, File tmpDir, 
Manifest m) throws Exception {
+               String bundleName = artifact.getName().substring(0, 
artifact.getName().length() -4 ) + ".jar";
+               File destFile = new File(tmpDir, bundleName);
+               if (destFile.exists()) {
+                       destFile.delete();
+               }
+               
+               JarInputStream jis = new JarInputStream(new 
FileInputStream(artifact));
+               JarOutputStream jos = new JarOutputStream(new 
FileOutputStream(destFile), m);
+               
+               JarEntry entry = jis.getNextJarEntry();
+               while (entry != null) {
+                   jos.putNextEntry(entry);
+                   copyInputStream(jis, jos);
+                   jos.closeEntry();
+                   entry = jis.getNextJarEntry();
+               }
+               
+               jos.close();
+               jis.close();
+               
+               LOGGER.debug("Converted the WAR artifact to OSGified bundle [" 
+ destFile.getAbsolutePath() + "]");
+               return destFile;
+       }
+
+    protected void copyInputStream(InputStream in, OutputStream out) throws 
IOException {
+        byte[] buffer = new byte[4096];
+        int len;
+        while ((len = in.read(buffer)) >= 0) {
+            out.write(buffer, 0, len);
+        }
+    }
+
+}

Added: servicemix/smx4/features/trunk/war/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/war/pom.xml?rev=611508&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/war/pom.xml (added)
+++ servicemix/smx4/features/trunk/war/pom.xml Sat Jan 12 15:32:40 2008
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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";>
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.features</groupId>
+        <artifactId>features</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.war</groupId>
+    <artifactId>war</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>ServiceMix WAR Support</name>
+
+    <modules>
+        <module>bundles</module>
+        <module>deployer</module>
+    </modules>
+
+</project>


Reply via email to