6d49301a31e83b2be056727b6fb128852cd6d201
[feisty_meow.git] /
1 package org.feistymeow.bundle.serviceosgi;
2
3 import org.osgi.framework.BundleActivator;
4 import org.osgi.framework.BundleContext;
5 import org.osgi.framework.ServiceRegistration;
6
7 public class HelloServiceActivator implements BundleActivator
8 {
9
10         @SuppressWarnings("rawtypes")
11         ServiceRegistration helloServiceRegistration;
12
13         /*
14          * (non-Javadoc)
15          * 
16          * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
17          */
18         public void start(BundleContext context) throws Exception
19         {
20                 System.out.println("hello-service start");
21
22                 HelloService helloService = new HelloServiceImpl();
23                 helloServiceRegistration = context.registerService(HelloService.class.getName(), helloService, null);
24         }
25
26         /*
27          * (non-Javadoc)
28          * 
29          * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
30          */
31         public void stop(BundleContext context) throws Exception
32         {
33                 helloServiceRegistration.unregister();
34                 System.out.println("hello-service stop");
35         }
36
37 }