From 42b3673f16b0b97ffc9b68ed517edbda3e915856 Mon Sep 17 00:00:00 2001 From: James William Dumay Date: Thu, 30 Oct 2008 05:58:49 +0000 Subject: [PATCH] In goes the plugin container... git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@709094 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-web/archiva-webapp/pom.xml | 12 +++++ .../archiva/web/startup/ArchivaStartup.java | 22 +++++++- .../webapp/WEB-INF/applicationContext.xml | 42 +++++++++++++-- archiva-plugins/pom.xml | 52 +++++++++++++++++-- 4 files changed, 119 insertions(+), 9 deletions(-) diff --git a/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/pom.xml index eded1ad3c..a89309abf 100644 --- a/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -175,6 +175,14 @@ org.apache.archiva archiva-webdav + + com.atlassian.plugins + atlassian-plugins-osgi + + + com.atlassian.plugins + atlassian-plugins-spring + org.apache.struts struts2-spring-plugin @@ -355,6 +363,10 @@ appserver.base ${project.build.directory}/appserver-base + + archiva.home + ${project.build.directory}/archiva-home + appserver.home ${project.build.directory}/appserver-home diff --git a/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java b/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java index 329667b44..e78bcc41d 100644 --- a/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java +++ b/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java @@ -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"); } } diff --git a/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml index a45d39c0b..b2ca928f9 100644 --- a/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/archiva-plugins/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml @@ -1,8 +1,14 @@ + 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"> + + @@ -61,5 +67,33 @@ - + + + + + + + + + + org.apache.* + + + + + com.springframework* + org.apache.commons.logging* + org.slf4j* + + + + + + + + + + + + diff --git a/archiva-plugins/pom.xml b/archiva-plugins/pom.xml index ae9839f88..afbfc63fa 100644 --- a/archiva-plugins/pom.xml +++ b/archiva-plugins/pom.xml @@ -237,8 +237,8 @@ xerces - xercesImpl - 2.8.1 + xercesImpl + 2.8.1 javax.activation @@ -408,10 +408,32 @@ archiva-xmlrpc-security 1.2-SNAPSHOT + + com.atlassian.plugins + atlassian-plugins-osgi + 2.2.0-SNAPSHOT + + + commons-logging + commons-logging + + + + + com.atlassian.plugins + atlassian-plugins-spring + 2.2.0-SNAPSHOT + + + commons-logging + commons-logging + + + org.codehaus.plexus plexus-spring - 1.2 + 1.3-SNAPSHOT org.codehaus.plexus @@ -511,7 +533,29 @@ log4j log4j - 1.2.14 + 1.2.15 + + + com.sun.jdmk + jmxtools + + + com.sun.jmx + jmxri + + + javax.jms + jms + + + javax.mail + mail + + + javax.activation + activation + + org.apache.lucene -- 2.39.5