Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] How to register a discovery provider?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bryan Hunt wrote:
> What's the proper way in ECF 3.0 to register a discovery provider?  In
> looking at the existing jmdns provider, it registers a
> ContainerInstantiator as an extension but createInstance() is never
> called.  

ContainerInstantiators are called by the
org.eclipse.ecf.core.ContainerFactory hooked up via the extension point
registry. It's ECF's way of registering a provider.

A IDiscoveryAdvertiser and Locator are registered separately with ECF in
3.0, by:

   <extension
         point="org.eclipse.ecf.containerFactory">
      <containerFactory
class="org.eclipse.ecf.provider.jmdns.container.ContainerInstantiator"
            description="Discovery Container Locator"
            name="ecf.discovery.jmdns.locator">
      </containerFactory>
      <containerFactory
class="org.eclipse.ecf.provider.jmdns.container.ContainerInstantiator"
            description="Discovery Container Advertiser"
            name="ecf.discovery.jmdns.advertiser">
      </containerFactory>
   </extension>

Prefixing your discovery provider with "ecf.discovery." and suffixing
with "advertiser|locator" is mandatory. Otherwise e.g. the composite
discovery provider won't find your provider.

> The bundle activator instead registers the container as a
> service.  In looking at the dnssd provider, it only uses the
> ContainerInstantiator extension but again, createInstance() is never
> called.  So it seems that registering the provider as an OSGi service in
> the bundle activator is the way to go? 

Making your discovery provider known to the OSGi service registry is an
alternative approach to registering a service. Personally I prefer this
way over the ContainerFactory and thus the jSLP as well as the jmDNS
provider both register them selves as services. For dnssd it just hasn't
been implemented yet.
Btw. composite discovery provider also queries the OSGi service registry
for discovery provider.

> The jmdns provider is registered
> with the property IDiscoveryService.CONTAINER_NAME which is deprecated.
>  I'm ok using that to get going, but need to know the proper way to get
> my provider hooked into ECF.

IDiscoveryService.CONTAINER_NAME is likely to be moved with 4.0. For the
moment you're fine with it though.

Markus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkonjY0ACgkQH/hL0IhDj1lJ4wCgmW92cf3UTiY3oly8HpOqSuXh
km8AoKQMunB6l9wz/6rYq67q0c/aqtuw
=hLTb
-----END PGP SIGNATURE-----


Back to the top