Search in sources :

Example 1 with ContainerInstantiator

use of org.eclipse.ecf.provider.jmdns.container.ContainerInstantiator in project ecf by eclipse.

the class JMDNSPlugin method start.

/**
 * This method is called upon plug-in activation
 */
public void start(final BundleContext ctxt) throws Exception {
    this.context = ctxt;
    final Properties props = new Properties();
    props.put(IDiscoveryService.CONTAINER_NAME, NAME);
    props.put(Constants.SERVICE_RANKING, new Integer(750));
    String[] clazzes = new String[] { IDiscoveryService.class.getName(), IDiscoveryLocator.class.getName(), IDiscoveryAdvertiser.class.getName() };
    serviceRegistration = context.registerService(clazzes, serviceFactory, props);
    SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {

        protected void runWithoutRegistry() throws Exception {
            ctxt.registerService(Namespace.class, new JMDNSNamespace("JMDNS Discovery Namespace"), null);
            ctxt.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(ContainerInstantiator.JMDNS_CONTAINER_NAME, new ContainerInstantiator(), "JMDNS Discovery Container", true, false), null);
            ctxt.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(ContainerInstantiator.JMDNS_LOCATOR_NAME, new ContainerInstantiator(), "JMDNS Discovery Locator"), null);
            ctxt.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(ContainerInstantiator.JMDNS_ADVERTISER_NAME, new ContainerInstantiator(), "JMDNS Discovery Advertiser"), null);
        }
    });
}
Also used : ContainerInstantiator(org.eclipse.ecf.provider.jmdns.container.ContainerInstantiator) Properties(java.util.Properties) JMDNSNamespace(org.eclipse.ecf.provider.jmdns.identity.JMDNSNamespace) IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) Namespace(org.eclipse.ecf.core.identity.Namespace) JMDNSNamespace(org.eclipse.ecf.provider.jmdns.identity.JMDNSNamespace)

Aggregations

Properties (java.util.Properties)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 Namespace (org.eclipse.ecf.core.identity.Namespace)1 ContainerInstantiator (org.eclipse.ecf.provider.jmdns.container.ContainerInstantiator)1 JMDNSNamespace (org.eclipse.ecf.provider.jmdns.identity.JMDNSNamespace)1