<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>
* under the License.
*/
+import com.atlassian.plugin.osgi.container.OsgiContainerManager;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
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;
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();
}
}
- 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");
}
}
<?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>
</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>