[jboss-osgi-commits] JBoss-OSGI SVN: r95203 - in projects/jboss-osgi/projects/bundles: webapp and 12 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Oct 20 17:29:47 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-20 17:29:46 -0400 (Tue, 20 Oct 2009)
New Revision: 95203

Added:
   projects/jboss-osgi/projects/bundles/webapp/
   projects/jboss-osgi/projects/bundles/webapp/trunk/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WARSuppportActivator.java
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppInterceptor.java
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java
Removed:
   projects/jboss-osgi/projects/bundles/webapp/trunk/
   projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/
Modified:
   projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
Log:
jboss-osgi-webapp first cut

Copied: projects/jboss-osgi/projects/bundles/webapp (from rev 94638, projects/jboss-osgi/projects/bundles/hotdeploy)

Copied: projects/jboss-osgi/projects/bundles/webapp/trunk (from rev 95188, projects/jboss-osgi/projects/bundles/hotdeploy/trunk)

Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml	2009-10-20 16:22:11 UTC (rev 95188)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml	2009-10-20 21:29:46 UTC (rev 95203)
@@ -14,14 +14,14 @@
 <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>
 
-  <name>JBossOSGi Bundles - HotDeployment</name>
-  <description>The JBossOSGi Hot Deployment Service</description>
+  <name>JBossOSGi Bundles - WebApp Support</name>
+  <description>The JBossOSGi WebApp Support</description>
 
   <groupId>org.jboss.osgi.bundles</groupId>
-  <artifactId>jboss-osgi-hotdeploy</artifactId>
+  <artifactId>jboss-osgi-webapp</artifactId>
   <packaging>bundle</packaging>
 
-  <version>1.0.3-SNAPSHOT</version>
+  <version>1.0.0-SNAPSHOT</version>
   
   <!-- Parent -->
   <parent>
@@ -32,36 +32,34 @@
   
   <!-- Subversion -->
   <scm>
-    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/hotdeploy/trunk</connection>
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/hotdeploy/trunk</developerConnection>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/webapp/trunk</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/webapp/trunk</developerConnection>
     <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
   </scm>
   
   <!-- Properties -->
   <properties>
-    <version.jboss.osgi.common>1.0.3-SNAPSHOT</version.jboss.osgi.common>
     <version.jboss.osgi.deployment>1.0.0-SNAPSHOT</version.jboss.osgi.deployment>
-    <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
+    <version.ops4j.pax.web>0.7.1</version.ops4j.pax.web>
     <version.osgi>r4v42</version.osgi>
   </properties>
   
   <!-- Dependencies -->
   <dependencies>
     <dependency>
-      <groupId>org.jboss.osgi</groupId>
-      <artifactId>jboss-osgi-spi</artifactId>
-      <version>${version.jboss.osgi.spi}</version>
+      <groupId>org.ops4j.pax.web</groupId>
+      <artifactId>pax-web-api</artifactId>
+      <version>${version.ops4j.pax.web}</version>
     </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.web</groupId>
+      <artifactId>pax-web-extender-war</artifactId>
+      <version>${version.ops4j.pax.web}</version>
+    </dependency>
   
     <!-- Bundle dependencies -->
     <dependency>
       <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-common</artifactId>
-      <version>${version.jboss.osgi.common}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
       <artifactId>jboss-osgi-deployment</artifactId>
       <version>${version.jboss.osgi.deployment}</version>
       <scope>provided</scope>
@@ -91,21 +89,27 @@
         <configuration>
           <instructions>
             <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-            <Bundle-Activator>org.jboss.osgi.hotdeploy.internal.DeploymentScannerActivator</Bundle-Activator>
-            <Private-Package>org.jboss.osgi.hotdeploy.internal</Private-Package>
+            <Bundle-Activator>org.jboss.osgi.webapp.internal.WARSuppportActivator</Bundle-Activator>
+            <Private-Package>org.jboss.osgi.webapp.internal</Private-Package>
             <Import-Package>
-               javax.management, 
-               org.jboss.osgi.common.log;version=1.0,
+               javax.servlet, 
+               javax.servlet.http, 
+               javax.xml.parsers, 
                org.jboss.osgi.deployment.common;version=1.0,
-               org.jboss.osgi.deployment.deployer;version=1.0,
-               org.jboss.osgi.deployment.scanner;version=1.0,
-               org.jboss.osgi.spi.service;version=1.0,
-               org.jboss.osgi.spi.util;version=1.0,
+               org.jboss.osgi.deployment.interceptor;version=1.0,
+               org.jboss.virtual,
+               org.osgi.service.http, 
                org.osgi.framework,
-               org.osgi.service.log,
                org.osgi.util.tracker,
                org.slf4j;version=1.5,
+               org.w3c.dom, 
+               org.xml.sax,
             </Import-Package>
+            <Embed-Transitive>true</Embed-Transitive>
+            <Embed-Dependency>
+              pax-web-api;inline=false,
+              pax-web-extender-war;inline=false,
+            </Embed-Dependency>
           </instructions>
         </configuration>
       </plugin>

Copied: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WARSuppportActivator.java (from rev 94638, projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerActivator.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WARSuppportActivator.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WARSuppportActivator.java	2009-10-20 21:29:46 UTC (rev 95203)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.webapp.internal;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The WebApp support activator
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 20-Oct-2009
+ */
+public class WARSuppportActivator implements BundleActivator
+{
+   public void start(BundleContext context)
+   {
+   }
+
+   public void stop(BundleContext context)
+   {
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppInterceptor.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppInterceptor.java	2009-10-20 21:29:46 UTC (rev 95203)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.webapp.internal;
+
+//$Id$
+
+import java.io.IOException;
+
+import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.jboss.virtual.VirtualFile;
+import org.ops4j.pax.web.extender.war.internal.WebAppPublisherExt;
+import org.ops4j.pax.web.extender.war.internal.model.WebApp;
+import org.ops4j.pax.web.extender.war.internal.parser.dom.DOMWebXmlParser;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * The WebApp lifecycle interceptor.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 20-Oct-2009
+ */
+public class WebAppInterceptor extends AbstractLifecycleInterceptor implements LifecycleInterceptor
+{
+   private BundleContext context;
+   private ServiceTracker serviceTracker;
+   private WebAppPublisherExt publisher;
+   
+   public WebAppInterceptor(BundleContext context)
+   {
+      this.context = context;
+      this.publisher = new WebAppPublisherExt();
+   }
+
+   public void start()
+   {
+      final LifecycleInterceptor interceptor = this;
+      serviceTracker = new ServiceTracker(context, LifecycleInterceptorService.class.getName(), null)
+      {
+         @Override
+         public Object addingService(ServiceReference reference)
+         {
+            LifecycleInterceptorService service = (LifecycleInterceptorService)super.addingService(reference);
+            service.addInterceptor(interceptor);
+            return service;
+         }
+
+         @Override
+         public void removedService(ServiceReference reference, Object service)
+         {
+            ((LifecycleInterceptorService)service).removeInterceptor(interceptor);
+            super.removedService(reference, service);
+         }
+      };
+      serviceTracker.open();
+   }
+   
+   public void stop()
+   {
+      if (serviceTracker != null)
+      {
+         serviceTracker.close();
+         serviceTracker = null;
+      }
+   }
+
+   public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+   {
+      if (state == Bundle.STARTING)
+      {
+         try
+         {
+            VirtualFile root = dep.getRoot();
+            VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
+            if (webXML != null)
+            {
+               DOMWebXmlParser parser = new DOMWebXmlParser();
+               WebApp webApp = parser.parse(webXML.openStream());
+               dep.addAttachment(WebApp.class, webApp);
+               publisher.publish(webApp);
+            }
+         }
+         catch (IOException ex)
+         {
+            throw new LifecycleInterceptorException("Cannot parse web.xml", ex);
+         }
+      }
+      else if (state == Bundle.STOPPING)
+      {
+         WebApp webApp = dep.getAttachment(WebApp.class);
+         if (webApp != null)
+         {
+            publisher.unpublish(webApp);
+         }
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppInterceptor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java	2009-10-20 21:29:46 UTC (rev 95203)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.ops4j.pax.web.extender.war.internal;
+
+//$Id$
+
+/**
+ * Public visibility for the package protected WebAppPublisher 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 20-Oct-2009
+ */
+public class WebAppPublisherExt extends WebAppPublisher
+{
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF



More information about the jboss-osgi-commits mailing list