| 1 | package de.uka.ipd.sdq.simucomframework.simulationdock; |
| 2 | |
| 3 | import java.util.Hashtable; |
| 4 | |
| 5 | import org.osgi.framework.BundleActivator; |
| 6 | import org.osgi.framework.BundleContext; |
| 7 | import org.osgi.framework.ServiceRegistration; |
| 8 | import org.osgi.util.tracker.ServiceTracker; |
| 9 | |
| 10 | import ch.ethz.iks.r_osgi.RemoteOSGiService; |
| 11 | |
| 12 | public class Activator implements BundleActivator { |
| 13 | |
| 14 | private SimulationDockService service; |
| 15 | private ServiceRegistration serviceRegistryEntry; |
| 16 | private ServiceTracker eventService; |
| 17 | |
| 18 | /* |
| 19 | * (non-Javadoc) |
| 20 | * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) |
| 21 | */ |
| 22 | public void start(BundleContext context) throws Exception { |
| 23 | Hashtable properties = new Hashtable(); |
| 24 | if (System.getProperty("simucom.registerDock") != null) |
| 25 | properties.put(RemoteOSGiService.R_OSGi_REGISTRATION, true); |
| 26 | |
| 27 | service = new SimulationDockServiceImpl(context); |
| 28 | // register the service |
| 29 | serviceRegistryEntry = context.registerService(SimulationDockService.class.getName(), service, properties); |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | * (non-Javadoc) |
| 34 | * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) |
| 35 | */ |
| 36 | public void stop(BundleContext context) throws Exception { |
| 37 | serviceRegistryEntry.unregister(); |
| 38 | service = null; |
| 39 | } |
| 40 | |
| 41 | } |