moving in some osgi bundles so as not to lose track of them.
[feisty_meow.git] / osgi / org.feistymeow.bundle.helloOSGi / src / org / feistymeow / bundle / helloosgi / Activator.java
1 package org.feistymeow.bundle.helloosgi;
2
3 import org.feistymeow.bundle.serviceosgi.HelloService;
4 import org.osgi.framework.BundleActivator;
5 import org.osgi.framework.BundleContext;
6 import org.osgi.framework.ServiceReference;
7
8 @SuppressWarnings("rawtypes")
9 public class Activator implements BundleActivator {
10
11         ServiceReference helloServiceReference;
12     
13         /*
14          * (non-Javadoc)
15          * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
16          */
17         public void start(BundleContext context) throws Exception {
18                 
19                 System.out.println("into Hello OSGi!");
20                 
21                 helloServiceReference = context.getServiceReference(HelloService.class.getName());
22         @SuppressWarnings("unchecked")
23                 HelloService helloService = (HelloService)context.getService(helloServiceReference);
24         System.out.println(helloService.sayHello());
25         }
26         
27         /*
28          * (non-Javadoc)
29          * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
30          */
31         public void stop(BundleContext context) throws Exception {
32                 System.out.println("out of Hello OSGi!");
33         }
34
35 }