[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] ECF 3.11.0: new provider api

Hi Folks,

Over the past year, a lot of work has gone into the creation of new remote services distribution providers...e.g.

1) Websockets using R-OSGi [1]
2) MQTT [2]
3) Hazelcast [3]
4) JaxRS based providers (Jersey) [4]

I expect that there will be consumer desires for using other distribution providers, as this ability to create and use custom distribution providers with standards-based remoting (OSGi remote services) is very useful for integration.

I would like to make it easier for us and other to create new distribution providers, so I decided to put in place a small new API to make it easier for those that might wish to do so.

It's currently implemented as 3 new classes in a new package 'org.eclipse.ecf.remoteservices.provider' [5]. The notion is is that a provider implementation can create an instance of IRemoteServiceDistributionProvider and register this instance via the OSGi whiteboard pattern...e.g.:

bundleContext.registerService(IRemoteServiceDistributionProvider.class, myProviderImpl, null);

and the myProviderImpl will be used by ECF's RSA implementation at export and/or import time.

I've created a RemoteServiceDistributionProvider class, so that the myProviderImpl can use the now-common 'builder' pattern to create myProviderImpl:

IRemoteServiceDistributionProvider myProviderImpl = new RemoteServiceDistributionProvider.Builder().setName('com.mycorp.myprovider.client').setInstantiator(new MyContainerInstantiator()).build();

The name 'com.mycorp.myprovider.client' and the MyContainerInstantiator() are required and define the relationship between the container/config type (e.g. 'ecf.generic.client') and the IContainerInstantiator that's responsible for creating IContainer instances associated with the container/config type. Below is a full example for the Hazelcast provider. Note that using ds would also work great.

The Builder also allows other customization (e.g. defining a new Namespace), and flexibility it's currently possible for providers to sub-class RemoteServiceDistributionProvider .

I would like to include this new API in 3.11.0, which I propose releasing sometime in September. Since it's new API a minor release is called for and requires a review.

If you have any comments, suggestions, or criticisms of this new API let's discuss here on this list.

Thanks,

Scott

[1] https://github.com/ECF/Websockets
[2] https://github.com/ECF/Mqtt-Provider
[3] https://github.com/ECF/HazelcastProvider
[4] https://github.com/ECF/JaxRSProviders
[5] http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider



// Build and register hazelcast manager distribution provider
context.registerService(IRemoteServiceDistributionProvider.class,
new RemoteServiceDistributionProvider.Builder()
.setName(HazelcastManagerContainer.HAZELCAST_MANAGER_NAME)
.setInstantiator(new HazelcastManagerContainer.Instantiator())
.setDescription("ECF Hazelcast Manager").setServer(true)
.setAdapterConfig(new AdapterConfig(new RemoteServiceContainerAdapterFactory(),
HazelcastManagerContainer.class))
.build(),
null);