Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package fr.velossity.sample.adapter.device.impl;
 
 
 import  org.osgi.framework.BundleActivator;
 import  org.osgi.framework.BundleContext;
 import  org.osgi.framework.ServiceReference;
 import  org.osgi.framework.ServiceRegistration;
import  org.osgi.util.tracker.ServiceTracker;
This factory is responsible to create dynamically a Device adapter when a low device is appearing and to delete it when it is disappearing. It is using a simple tracker for discovering low devices.

Author(s):
C. Saint-Marcel
public class BundleActivatorImpl implements BundleActivator {

A reference to the low device tracker.
The tracker extension.
	private class AdapteeTracker extends ServiceTracker {
	    public AdapteeTracker(BundleContext ctx) {
	        super(ctxAdapteeDevice.class.getName(), null);
	    }

    

See also:
ServiceTracker.addingService(ServiceReference)
		public Object addingService(ServiceReference ref) {
	        AdapteeDevice adaptee = (AdapteeDevice) context.getService(ref);
	        Device adapter = new DeviceAdapterImpl(adaptee);
	        
	        // REGISTERS with mandatory properties 
	        Dictionary properties = new Hashtable();
			properties.put(.adapter.getType());
			return context.registerService(Device.class.getName(), adapterproperties);
	    }
    

See also:
ServiceTracker.removedService(ServiceReference, Object)
	    public void removedService(ServiceReference refObject svc) {
	        ServiceRegistration reg = (ServiceRegistration) svc;
	        reg.unregister();
	        context.ungetService(ref);
	    }
	}

See also:
BundleActivator.start(BundleContext)
	public void start(BundleContext contextthrows Exception {
		 = new AdapteeTracker(context);
	}

See also:
BundleActivator.stop(BundleContext)
	public void stop(BundleContext contextthrows Exception {
	}
New to GrepCode? Check out our FAQ X