1 package org.feistymeow.bundle.helloosgi;
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;
8 @SuppressWarnings("rawtypes")
9 public class Activator implements BundleActivator {
11 ServiceReference helloServiceReference;
15 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
17 public void start(BundleContext context) throws Exception {
19 System.out.println("into Hello OSGi!");
21 helloServiceReference = context.getServiceReference(HelloService.class.getName());
22 @SuppressWarnings("unchecked")
23 HelloService helloService = (HelloService)context.getService(helloServiceReference);
24 System.out.println(helloService.sayHello());
29 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
31 public void stop(BundleContext context) throws Exception {
32 System.out.println("out of Hello OSGi!");