1 package org.feistymeow.bundle.serviceosgi;
3 import org.osgi.framework.BundleActivator;
4 import org.osgi.framework.BundleContext;
5 import org.osgi.framework.ServiceRegistration;
7 public class HelloServiceActivator implements BundleActivator
10 @SuppressWarnings("rawtypes")
11 ServiceRegistration helloServiceRegistration;
16 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
18 public void start(BundleContext context) throws Exception
20 System.out.println("hello-service start");
22 HelloService helloService = new HelloServiceImpl();
23 helloServiceRegistration = context.registerService(HelloService.class.getName(), helloService, null);
29 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
31 public void stop(BundleContext context) throws Exception
33 helloServiceRegistration.unregister();
34 System.out.println("hello-service stop");