use of org.eclipse.ecf.core.util.ExtensionRegistryRunnable in project ecf by eclipse.
the class Activator method start.
/**
* Called when the OSGi framework starts the bundle.
*
* @param bc
* the bundle context.
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(final BundleContext bc) throws Exception {
this.context = bc;
r_osgi_tracker = new ServiceTracker(context, RemoteOSGiService.class.getName(), null);
r_osgi_tracker.open();
// bug 495535
if (DELETE_PROXY_BUNDLES_ON_INIT)
deleteProxyBundles();
SafeRunner.run(new ExtensionRegistryRunnable(bc) {
protected void runWithoutRegistry() throws Exception {
bc.registerService(Namespace.class, new R_OSGiNamespace(), null);
bc.registerService(Namespace.class, new R_OSGiWSNamespace(), null);
bc.registerService(Namespace.class, new R_OSGiWSSNamespace(), null);
bc.registerService(Namespace.class, new R_OSGiRemoteServiceNamespace(), null);
// $NON-NLS-1$
bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME, new R_OSGiContainerInstantiator(), "R_OSGi Container", true, false), null);
// $NON-NLS-1$
bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME_HTTP, new R_OSGiContainerInstantiator(), "R_OSGi Websockets Container", true, false), null);
// $NON-NLS-1$
bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME_HTTPS, new R_OSGiContainerInstantiator(), "R_OSGi Secure Websockets Container", true, false), null);
}
});
}
use of org.eclipse.ecf.core.util.ExtensionRegistryRunnable in project ecf by eclipse.
the class Activator method start.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(final BundleContext context) throws Exception {
bundleContext = context;
SafeRunner.run(new ExtensionRegistryRunnable(context) {
protected void runWithoutRegistry() throws Exception {
context.registerService(Namespace.class, new JSLPNamespace(), null);
// $NON-NLS-1$//$NON-NLS-2$
context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp", new ContainerInstantiator(), "JSLP Discovery Container", true, false), null);
// $NON-NLS-1$//$NON-NLS-2$
context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.locator", new ContainerInstantiator(), "JSLP Discovery Locator Container", true, false), null);
// $NON-NLS-1$//$NON-NLS-2$
context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.advertiser", new ContainerInstantiator(), "JSLP Discovery Advertiser Container", true, false), null);
}
});
// initially get the locator and add a life cycle listener
locatorSt = new ServiceTracker(context, Locator.class.getName(), null);
// initially get the advertiser and add a life cycle listener
advertiserSt = new ServiceTracker(context, Advertiser.class.getName(), null);
// register ourself as an OSGi service
final Properties props = new Properties();
props.put(IDiscoveryService.CONTAINER_NAME, JSLPDiscoveryContainer.NAME);
props.put(Constants.SERVICE_RANKING, new Integer(500));
String[] clazzes = new String[] { IDiscoveryService.class.getName(), IDiscoveryLocator.class.getName(), IDiscoveryAdvertiser.class.getName() };
serviceRegistration = context.registerService(clazzes, serviceFactory, props);
}
use of org.eclipse.ecf.core.util.ExtensionRegistryRunnable in project ecf by eclipse.
the class Activator method start.
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
this.context = context;
plugin = this;
SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
protected void runWithoutRegistry() throws Exception {
// If we don't have a registry, then register trivial namespace
Activator.this.context.registerService(Namespace.class, new TrivialNamespace(TrivialNamespace.NAME), null);
// And create and register ContainerTypeDescription
Activator.this.context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(TrivialContainerInstantiator.NAME, (IContainerInstantiator) new TrivialContainerInstantiator()), null);
}
});
}
use of org.eclipse.ecf.core.util.ExtensionRegistryRunnable in project ecf by eclipse.
the class Activator method start.
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(final BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
SafeRunner.run(new ExtensionRegistryRunnable(bundleContext) {
protected void runWithoutRegistry() throws Exception {
bundleContext.registerService(Namespace.class, new LocalNamespace(), null);
// $NON-NLS-1$//$NON-NLS-2$
bundleContext.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.local", new LocalRemoteServiceContainerInstantiator(), "Local Container Instantiator", false, false), null);
}
});
}
use of org.eclipse.ecf.core.util.ExtensionRegistryRunnable in project ecf by eclipse.
the class Activator method start.
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(final BundleContext context) throws Exception {
this.context = context;
SafeRunner.run(new ExtensionRegistryRunnable(context) {
protected void runWithoutRegistry() throws Exception {
context.registerService(Namespace.class, new DnsSdNamespace(), null);
context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(DISCOVERY_CONTAINER_NAME_VALUE + LOCATOR, new ContainerInstantiator(), "Discovery Locator Container"), null);
context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(DISCOVERY_CONTAINER_NAME_VALUE + ADVERTISER, new ContainerInstantiator(), "Discovery Advertiser Container"), null);
}
});
// register a managed factory for the locator service
final Properties locCmProps = new Properties();
locCmProps.put(Constants.SERVICE_PID, DISCOVERY_CONTAINER_NAME_VALUE + LOCATOR);
context.registerService(ManagedServiceFactory.class.getName(), new DnsSdManagedServiceFactory(DnsSdDiscoveryLocator.class), locCmProps);
// register the locator service
final Properties locProps = new Properties();
locProps.put(DISCOVERY_CONTAINER_NAME_KEY, DISCOVERY_CONTAINER_NAME_VALUE + LOCATOR);
locProps.put(Constants.SERVICE_RANKING, new Integer(750));
serviceRegistrations.put(null, context.registerService(IDiscoveryLocator.class.getName(), new DnsSdServiceFactory(DnsSdDiscoveryLocator.class), locProps));
// register a managed factory for the advertiser service
final Properties advCmProps = new Properties();
advCmProps.put(Constants.SERVICE_PID, DISCOVERY_CONTAINER_NAME_VALUE + ADVERTISER);
context.registerService(ManagedServiceFactory.class.getName(), new DnsSdManagedServiceFactory(DnsSdDiscoveryAdvertiser.class), advCmProps);
// register the advertiser service
final Properties advProps = new Properties();
advProps.put(DISCOVERY_CONTAINER_NAME_KEY, DISCOVERY_CONTAINER_NAME_VALUE + ADVERTISER);
advProps.put(Constants.SERVICE_RANKING, new Integer(750));
serviceRegistrations.put(null, context.registerService(IDiscoveryAdvertiser.class.getName(), new DnsSdServiceFactory(DnsSdDiscoveryAdvertiser.class), advProps));
}
Aggregations