All pastes #593457 Raw Edit

Untitled

public java v1 · immutable
#593457 ·published 2007-06-28 10:24 UTC
rendered paste body
/* * Created on Wed Jun 27 12:52:31 EEST 2007 */package r_osgi.demo.service.impl;import java.util.Hashtable;import org.osgi.framework.BundleActivator;import org.osgi.framework.BundleContext;import org.osgi.framework.Constants;import r_osgi.demo.service.api.Foo;import ch.ethz.iks.r_osgi.RemoteOSGiService;public class Activator implements BundleActivator {  public static BundleContext bc = null;  /* (non-Javadoc)   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)   */  public void start(BundleContext context) throws Exception {		  Activator.bc = context;	  Hashtable properties = new Hashtable();		// this is the hint for R-OSGi that the service 		// is made available for remote access	  properties.put(RemoteOSGiService.R_OSGi_REGISTRATION,			  RemoteOSGiService.SERVICE_PROXY_POLICY);	  	  FooImpl test = new FooImpl();	  System.out.println("Test : " + test.toString());	  bc.registerService(Foo.class.getName(),			  test, properties);  }  /* (non-Javadoc)   * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)   */  public void stop(BundleContext context) throws Exception {	  System.out.println(Activator.bc.getBundle().getHeaders().			  get(Constants.BUNDLE_NAME) + " stopped !");	  Activator.bc = null;  }}