How to get all discovered endpoint descriptions? [message #756713] |
Mon, 14 November 2011 13:54  |
Eclipse User |
|
|
|
Hi!
I'm trying to get all currently discovered endpoint descriptions. There is an endpointListenerTracker that says it does the trick. I create and register as a service an EndpointListener class implementing org.osgi.service.remoteserviceadmin.EndpointListener, but endpointAdded is not called ever. I admit I haven't had time to go into this deeply, but any help would be appreciated.
Thank you very much!
Victor
|
|
|
|
|
Re: How to get all discovered endpoint descriptions? [message #769049 is a reply to message #768742] |
Wed, 21 December 2011 05:06  |
Eclipse User |
|
|
|
Hi, Pablo!
What I finally did is to mark our services of interest with distinctive specific properties and give less relevance to Endpoints.
You probably already know that the AbstractTopologyManager class contains the Collection 'importedRegistrations' of type ImportRegistration. In AbstractTopologyManager.handleEndpointAdded(...), when an Endpoint is successfully added to the topology, an ImportRegistration is created and added to the 'importedRegistrations' collection. Since it is a protected field you can either try to access its content, or register a parallel topology manager in which you have proper access to that collection.
Provided that the corresponding bundle is already started, you can, as a starting point, get the BasicTopologyManager service instance via code like this:
private EndpointListener getEndpointListener() {
synchronized (endpointListenerTrackerLock) {
if (endpointListenerTracker == null) {
endpointListenerTracker = new ServiceTracker(
getBundleContext(),
EndpointListener.class.getName(), null);
endpointListenerTracker.open();
}
}
return (EndpointListener) endpointListenerTracker.getService();
}
Hope this helps and is not misleading!
Victor
[Updated on: Wed, 21 December 2011 05:07] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03266 seconds