Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Discovery of Remote Services"

Line 23: Line 23:
 
This menu provides access to four different ways of invoking the 'getProperty' method remotely...and is just an example UI (a better UI for selecting a remote method and providing parameters is forthcoming).  The four ways are
 
This menu provides access to four different ways of invoking the 'getProperty' method remotely...and is just an example UI (a better UI for selecting a remote method and providing parameters is forthcoming).  The four ways are
  
(s) = synchronously -- block calling thread until service host responds
+
*(s) = synchronously -- block calling thread until service host responds
(a) = asynchronously -- calling thread does not block and result is provided via notification to a listener
+
*(a) = asynchronously -- calling thread does not block and result is provided via notification to a listener
(f) = future -- calling thread does not block, and an instance of IAsynchResult is returned immediately  Receiver can inspect IAsynchResult for completion.
+
*(f) = future -- calling thread does not block, and an instance of IAsynchResult is returned immediately  Receiver can inspect IAsynchResult for completion.
(p) = proxy -- calling thread calls a proxy instance of service interface) with normal call/return semantics
+
*(p) = proxy -- calling thread calls a proxy instance of service interface) with normal call/return semantics
  
 
These access methods are made available via the ECF [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/remoteservice/IRemoteService.html IRemoteService].  Note that the proxy can also be accessed directly in the OSGi service registry via BundleContext.getServiceReference() or a ServiceTracker.
 
These access methods are made available via the ECF [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/remoteservice/IRemoteService.html IRemoteService].  Note that the proxy can also be accessed directly in the OSGi service registry via BundleContext.getServiceReference() or a ServiceTracker.
 +
 +
So, if the proxy is selected it brings up an example UI for getting the relevant parameter
 +
 +
[[Image:rs5.png]]
 +
 +
and then makes the call and presents the result (the result is the 'user.dir' directory on the service host)
 +
 +
[[Image:rs6.png]]

Revision as of 13:46, 7 February 2008

More work on examples...this time an example that combines the use of the ECF discovery API with the use of the ECF remote services API.

Here is a screen shot of the ECF service discovery view, after having discovered a remote service:

Rs1.png

Note the type of the service is 'remotesvcs', a new type. For those interested, the publicly registered types for RFC 2782 are listed here.

Note that in this case the discovery is being done by the ECF zeroconf/bonjour/rendevous provider. The UI and the code that uses the discovery, is, however, discovery protocol independent, so that it can (and will) also be used with SLP discovery...with no changes to the middleware or application code.

Here is an expanded view of the info about the service provided by service host via the discovery API:

Rs2.png

Now, the ECF discovery view UI has an extension point called 'serviceAccessHandler' that allows context menu contributions to be optionally added by extensions, based upon the discovered service info. For the client there is a serviceAccessHandler defined for the 'remotesvcs' type (defined in the schema here as extension point org.eclipse.ecf.discovery.ui.serviceAccessHandler) that presents the following when the user opens the context menu for the service

Rs3.png

If the user is not already connected to the given service, then it allows the connection to be established as above. If already connected, however, the context menu presents options for invoking a remote 'getProperty' method (part of the Equinox EnvironmentInfo service)

Rs4.png

This menu provides access to four different ways of invoking the 'getProperty' method remotely...and is just an example UI (a better UI for selecting a remote method and providing parameters is forthcoming). The four ways are

  • (s) = synchronously -- block calling thread until service host responds
  • (a) = asynchronously -- calling thread does not block and result is provided via notification to a listener
  • (f) = future -- calling thread does not block, and an instance of IAsynchResult is returned immediately Receiver can inspect IAsynchResult for completion.
  • (p) = proxy -- calling thread calls a proxy instance of service interface) with normal call/return semantics

These access methods are made available via the ECF IRemoteService. Note that the proxy can also be accessed directly in the OSGi service registry via BundleContext.getServiceReference() or a ServiceTracker.

So, if the proxy is selected it brings up an example UI for getting the relevant parameter

Rs5.png

and then makes the call and presents the result (the result is the 'user.dir' directory on the service host)

Rs6.png

Copyright © Eclipse Foundation, Inc. All Rights Reserved.