Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] ServiceTracker for remote services

Hi Scott,

thanks for your reply. I guess I will check out the RemoteServiceTracker and look whether he does what we need.

Regards,
Eugen

Am May 11, 2009 um 19:33  schrieb Scott Lewis:

Hi Eugen,

Eugen Reiswich wrote:
Hi all,

I'm using ECF over XMPP with an Jabber-Server. What I need is the functionallity similar to an OSGi ServiceTracker. Is there something comparable in ECF?

There is, but it's not yet thoroughly tested. It's a 'RemoteServiceTracker', in org.eclipse.ecf.remoteservice.util.tracker.RemoteServiceTracker.


When I start my application I need the ability:
1. to search for remote services already provided by my online clients 2. I also want to be informed about new service registrations if a new client logs in and offers his remote services

Can the ECF ServiceDiscovery-API be used to deal with this problem?

Yes.

If yes, how would I use the ServiceDiscoveryAPI to create a ServiceTracker for ECF-remote-services?

Well, the discovery API can deliver arbitrary service properties...and these service properties can include things like the targetID...that can be used to to create a proxy for a client that is discovered...e.g.

IRemoteServiceReference[] ref = containerAdapter.getRemoteServiceReferences(targetID,interface,null);
IRemoteService rs = containerAdapter.getRemoteService(ref[0]);
Object proxy = rs.getProxy();

But one thing to say about this: what is being described here is basically what the ECF implementation of RFC119 does...that is, it gets meta-data about discovered services from the discovery service properties, and then calls containerAdapter .getRemoteServiceReferences(targetID,interface,props) for you...then creates a proxy and puts it in the local service registry (where a ServiceTracker for that service will then be notified).

You can see test code that tests this mechanism (the RFC119 impl) in the org.eclipse.ecf.tests.osgi.services.distribution test bundle. In there are some test cases where a ServiceTracker is used so that client code can be notified when a remote service is discovered, lookedup, and then added to the local service registry (see org .eclipse .ecf .tests .osgi.services.distribution.AbstractServiceRegisterTest.testGetProxy for example).

Thanks,

Scott


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top