]> source.dussan.org Git - archiva.git/commitdiff
In goes the plugin container...
authorJames William Dumay <jdumay@apache.org>
Thu, 30 Oct 2008 05:58:49 +0000 (05:58 +0000)
committerJames William Dumay <jdumay@apache.org>
Thu, 30 Oct 2008 05:58:49 +0000 (05:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@709094 13f79535-47bb-0310-9956-ffa450edef68

archiva-plugins/archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
archiva-plugins/pom.xml

index eded1ad3caed1560f0458dc458bb590b4dc61b36..a89309abf82677c685000504db6f3831c3826c27 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-webdav</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.atlassian.plugins</groupId>
+      <artifactId>atlassian-plugins-osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.atlassian.plugins</groupId>
+      <artifactId>atlassian-plugins-spring</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.struts</groupId>
       <artifactId>struts2-spring-plugin</artifactId>
               <name>appserver.base</name>
               <value>${project.build.directory}/appserver-base</value>
             </systemProperty>
+            <systemProperty>
+              <name>archiva.home</name>
+              <value>${project.build.directory}/archiva-home</value>
+            </systemProperty>
             <systemProperty>
               <name>appserver.home</name>
               <value>${project.build.directory}/appserver-home</value>
index 329667b44e353b53de68911246ca48f68cc19a3e..e78bcc41df057c49f7b8d6224418ae11741509b6 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.web.startup;
  * under the License.
  */
 
+import com.atlassian.plugin.osgi.container.OsgiContainerManager;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
@@ -26,6 +27,7 @@ import org.apache.maven.archiva.common.ArchivaException;
 import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
 import org.codehaus.plexus.spring.PlexusToSpringUtils;
 import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
+import org.springframework.context.ApplicationContext;
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 
@@ -46,9 +48,15 @@ public class ArchivaStartup
         ArchivaTaskScheduler taskScheduler = (ArchivaTaskScheduler) wac.getBean(PlexusToSpringUtils.buildSpringId(ArchivaTaskScheduler.class));
         TaskQueueExecutor databaseUpdateQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update"));
         TaskQueueExecutor repositoryScanningQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning"));
+        OsgiContainerManager containerManager = getOsgiContainerManager(wac);
 
         try
         {
+            if (!containerManager.isRunning())
+            {
+                containerManager.start();
+            }
+            containerManager.start();
             securitySync.startup();
             resolverFactory.startup();
             taskScheduler.startup();
@@ -60,6 +68,18 @@ public class ArchivaStartup
         }
     }
 
-    public void contextDestroyed(ServletContextEvent contextEvent) {
+    public void contextDestroyed(ServletContextEvent contextEvent)
+    {
+        WebApplicationContext wac =  WebApplicationContextUtils.getRequiredWebApplicationContext(contextEvent.getServletContext());
+        OsgiContainerManager containerManager = getOsgiContainerManager(wac);
+        if (containerManager.isRunning())
+        {
+            containerManager.stop();
+        }
+    }
+
+    private OsgiContainerManager getOsgiContainerManager(ApplicationContext context)
+    {
+        return (OsgiContainerManager)context.getBean("osgiContainerManager");
     }
 }
index a45d39c0bb5d8d23e2d717dd2ca2c86eeb089f58..b2ca928f9d0c156e4d97bc5d36993ef30b9f9100 100644 (file)
@@ -1,8 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xmlns:aop="http://www.springframework.org/schema/aop"
+      xmlns:plugin="http://atlassian.com/schema/spring/plugin"
+      xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+http://atlassian.com/schema/spring/plugin http://atlassian.com/schema/spring/plugin.xsd
+http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
+
+  <bean id="testbean" class="java.lang.Object" plugin:available="true"/>
 
   <bean id="loggerManager" class="org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager"
     init-method="initialize"/>
 
   <bean name="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
     <property name="session" ref="mailSession"/>
-  </bean>  
+  </bean>
+
+  <!-- Plugin framework -->
+
+  <bean name="pluginEventManager" class="com.atlassian.plugin.event.impl.DefaultPluginEventManager" scope="singleton"/>
+
+  <bean id="packageScanningConfiguration" class="com.atlassian.plugin.osgi.container.impl.DefaultPackageScannerConfiguration">
+  <property name="packageIncludes">
+    <list>
+        <value>org.apache.*</value>
+    </list>
+  </property>
+  <property name="packageExcludes">
+    <list>
+        <value>com.springframework*</value>
+        <value>org.apache.commons.logging*</value>
+        <value>org.slf4j*</value>
+    </list>
+  </property>
+  </bean>
+
+  <bean id="osgiContainerManager" class="com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager" scope="singleton">
+      <constructor-arg value="${archiva.home}/framework-bundles"/>
+      <constructor-arg ref="packageScanningConfiguration"/>
+      <constructor-arg ref="hostComponentProvider"/>
+      <constructor-arg ref="pluginEventManager"/>
+  </bean>
+
+  <!-- end plugin framework -->
 </beans>
index ae9839f88d428bdfbb6b9f4d572be6373ab4d3b0..afbfc63fa5884305d03ab0d297dd260cd2fc69e8 100644 (file)
       </dependency>
       <dependency>
         <groupId>xerces</groupId>
-       <artifactId>xercesImpl</artifactId>
-       <version>2.8.1</version>
+           <artifactId>xercesImpl</artifactId>
+           <version>2.8.1</version>
       </dependency>
       <dependency>
         <groupId>javax.activation</groupId>
         <artifactId>archiva-xmlrpc-security</artifactId>
         <version>1.2-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>com.atlassian.plugins</groupId>
+        <artifactId>atlassian-plugins-osgi</artifactId>
+        <version>2.2.0-SNAPSHOT</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+      <dependency>
+        <groupId>com.atlassian.plugins</groupId>
+        <artifactId>atlassian-plugins-spring</artifactId>
+        <version>2.2.0-SNAPSHOT</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-spring</artifactId>
-        <version>1.2</version>
+        <version>1.3-SNAPSHOT</version>
         <exclusions>
           <exclusion>
             <groupId>org.codehaus.plexus</groupId>
       <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
-        <version>1.2.14</version>
+        <version>1.2.15</version>
+  <exclusions>
+    <exclusion>
+      <groupId>com.sun.jdmk</groupId>
+      <artifactId>jmxtools</artifactId>
+    </exclusion>
+    <exclusion>
+      <groupId>com.sun.jmx</groupId>
+      <artifactId>jmxri</artifactId>
+    </exclusion>
+    <exclusion>
+      <groupId>javax.jms</groupId>
+      <artifactId>jms</artifactId>
+    </exclusion>
+    <exclusion>
+      <groupId>javax.mail</groupId>
+      <artifactId>mail</artifactId>
+    </exclusion>
+    <exclusion>
+      <groupId>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+    </exclusion>
+  </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.lucene</groupId>