use of org.eclipse.ecf.discovery.IDiscoveryLocator in project ecf by eclipse.
the class AbstractMetadataFactoryTest method getDiscoveryLocator.
protected IDiscoveryLocator getDiscoveryLocator() {
ServiceTracker serviceTracker = new ServiceTracker(Activator.getDefault().getContext(), IDiscoveryLocator.class.getName(), null);
serviceTracker.open();
IDiscoveryLocator result = (IDiscoveryLocator) serviceTracker.getService();
serviceTracker.close();
return result;
}
use of org.eclipse.ecf.discovery.IDiscoveryLocator in project ecf by eclipse.
the class ZooDiscoveryTest method getDiscoveryLocator.
protected IDiscoveryLocator getDiscoveryLocator() {
final IDiscoveryLocator adapter = (IDiscoveryLocator) this.container.getAdapter(IDiscoveryLocator.class);
// $NON-NLS-1$
assertNotNull("Adapter must not be null", adapter);
return adapter;
}
use of org.eclipse.ecf.discovery.IDiscoveryLocator in project ecf by eclipse.
the class Activator method getLocator.
public IDiscoveryLocator getLocator() {
if (locatorTracker == null) {
locatorTracker = new ServiceTracker(this.context, IDiscoveryLocator.class.getName(), null);
locatorTracker.open();
}
try {
return (IDiscoveryLocator) locatorTracker.waitForService(DISCOVERY_TIMEOUT);
} catch (InterruptedException e) {
// $NON-NLS-1$
log("getLocator", "Cannot get IDiscoveryAdvertiser", e);
}
return null;
}
use of org.eclipse.ecf.discovery.IDiscoveryLocator in project ecf by eclipse.
the class Activator method stop.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(final BundleContext context) throws Exception {
// TODO-mkuppe here we should do something like a deregisterAll(), but see ungetService(...);
if (serviceRegistration != null && serviceFactory.isActive()) {
ServiceReference reference = serviceRegistration.getReference();
IDiscoveryLocator aLocator = (IDiscoveryLocator) context.getService(reference);
serviceRegistration.unregister();
IContainer container = (IContainer) aLocator.getAdapter(IContainer.class);
container.disconnect();
container.dispose();
serviceRegistration = null;
}
plugin = null;
bundleContext = null;
if (advertiserSt != null) {
advertiserSt.close();
advertiserSt = null;
}
if (locatorSt != null) {
locatorSt.close();
locatorSt = null;
}
}
use of org.eclipse.ecf.discovery.IDiscoveryLocator in project ecf by eclipse.
the class JMDNSPlugin method stop.
/**
* This method is called when the plug-in is stopped
*/
public void stop(final BundleContext ctxt) throws Exception {
if (serviceRegistration != null && serviceFactory.isActive()) {
ServiceReference reference = serviceRegistration.getReference();
IDiscoveryLocator aLocator = (IDiscoveryLocator) ctxt.getService(reference);
serviceRegistration.unregister();
IContainer container = (IContainer) aLocator.getAdapter(IContainer.class);
container.disconnect();
container.dispose();
serviceRegistration = null;
}
if (adapterManagerTracker != null) {
adapterManagerTracker.close();
adapterManagerTracker = null;
}
if (logServiceTracker != null) {
logServiceTracker.close();
logServiceTracker = null;
logService = null;
}
this.context = ctxt;
plugin = null;
}
Aggregations