1 package com.atlassian.plugins.rest.module; 2 3 import org.osgi.framework.BundleActivator; 4 import org.osgi.framework.BundleContext; 5 import org.springframework.beans.factory.DisposableBean; 6 import org.springframework.beans.factory.InitializingBean; 7 import org.springframework.osgi.context.BundleContextAware; 8 9 public class Activator implements BundleContextAware, InitializingBean, DisposableBean 10 { 11 private final BundleActivator coreActivator = new com.sun.jersey.core.osgi.Activator(); 12 private final BundleActivator serverActivator = new com.sun.jersey.server.osgi.Activator(); 13 private BundleContext bundleContext; 14 15 public void afterPropertiesSet() throws Exception 16 { 17 coreActivator.start(bundleContext); 18 serverActivator.start(bundleContext); 19 } 20 21 public void destroy() throws Exception 22 { 23 serverActivator.stop(bundleContext); 24 coreActivator.stop(bundleContext); 25 } 26 27 public void setBundleContext(BundleContext bundleContext) 28 { 29 this.bundleContext = bundleContext; 30 } 31 }