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 "File-based Discovery"

 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
ECF 3.1 makes available a contribution from Siemens, called File-Based Discovery.  File-based discovery allows those using the ECF remote services implementation to trigger remote service discovery by publishing endpoints in a service description xml file.
+
Starting with ECF 3.5 the old xml-file format for File-based remote services discovery is deprecated in favor of the OSGi 4.2 Remote Services Admin (RSA) specification Endpoint Description Extender Format (edef).  This format is specified by chapter 122.8 of the [http://www.osgi.org/download/r4v42/r4.enterprise.pdf OSGi enterprise specification].
  
The four pieces of information to describe a remote service with the ECF remote services endpoint are
+
See also [[File-based Discovery with the Endpoint Description Extender Format]]  
 
+
# The service interface (i.e. the fully-qualified classname of the service interface class.  Example:  '''org.eclipse.ecf.examples.remoteservices.hello.IHello'''
+
# The ECF connect ID (also known as URI of the endpoint).  Example (ECF generic provider):  '''ecftcp://localhost:3282/server'''
+
# The connect ID namespace name.  Example (ECF generic provider): '''org.eclipse.ecf.core.identity.StringID'''.
+
# The ECF remote service config type of the remote service host.  Example (ECF generic provider): '''ecf.generic.server'''
+
<pre>
+
<?xml version="1.0" encoding="UTF-8"?>
+
  <service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+
    <service-description>
+
      <provide
+
interface="org.eclipse.ecf.examples.remoteservices.hello.IHello"/>
+
      <property
+
name="ecf.sp.cid">ecftcp://localhost:3787/server</property>
+
      <property name="ecf.sp.cns">org.eclipse.ecf.core.identity.StringID</property>
+
      <property name="ecf.sp.ect">ecf.generic.server</property>
+
  </service-description>
+
</service-descriptions>
+
</pre>
+
 
+
Here, for another example, is a service description file that publishes the same service interface '''org.eclipse.ecf.examples.remoteservices.hello.IHello''' with the r-OSGi provider.
+
<pre>
+
<?xml version="1.0" encoding="UTF-8"?>
+
  <service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+
    <service-description>
+
      <provide
+
interface="org.eclipse.ecf.examples.remoteservices.hello.IHello"/>
+
      <property
+
name="ecf.sp.cid">r-osgi://localhost</property>
+
      <property name="ecf.sp.cns">ecf.namespace.r_osgi</property>
+
      <property name="ecf.sp.ect">ecf.r_osgi.peer</property>
+
  </service-description>
+
</service-descriptions>
+
 
+
==Initiating File-Based Discovery==
+
 
+
To read the service description in the xml file, and have it trigger discovery of the given service description the following must occur:
+
 
+
# This bundle: '''org.eclipse.ecf.osgi.services.discovery.local''' must be started
+
# A file with an xml file name suffix must be in '''either''' a directory named '''OSGI-INF/remote-service''' OR at a path given by the the '''Remote-Service''' header in the META-INF/MANIFEST.MF file. 
+
 
+
For example, the file named servicedescriptions.xml will be read and processed by the file-based discovery when the bundle is started if the servicedescriptions.xml is present in the following location within your bundle.
+
 
+
<pre>
+
[bundle root]/OSGI-INF/remote-service/servicedescriptions.xml
+
</pre>
+
 
+
Or, if the manifest of your bundle has the following in it
+
 
+
<pre>
+
...<other manifest headers>
+
Remote-Service: foo/bar.xml
+
</pre>
+
 
+
Then the file bar.xml will be read for service descriptions and used to publish discovered remote services when the containing bundle is started.
+
 
+
As another way to introduce service descriptions into a running Equinox instance, once the '''org.eclipse.ecf.osgi.services.discovery.local''' bundle is started, the OSGi console will allow service description xml files to be published via the OSGi console
+
 
+
<pre>
+
osgi>help
+
...other OSGi console help
+
---Remote Services and Discovery Commands---
+
publish <URL of ServiceEndpointDescriptor XML> -- publish the given Service Endpoint Descriptor
+
unpublish <URL of ServiceEndpointDescriptor XML> -- unpublish the given Service ndpoint Descriptor
+
osgi> publish file:/c:/temp/myremoteservicedescriptions.xml
+
<read the myremoteservicedescriptions.xml file and publish given services and connect ids/namespaces.
+
</pre>
+
  
 
[[Category:Draft Documentation]]
 
[[Category:Draft Documentation]]

Latest revision as of 15:44, 3 March 2011

Starting with ECF 3.5 the old xml-file format for File-based remote services discovery is deprecated in favor of the OSGi 4.2 Remote Services Admin (RSA) specification Endpoint Description Extender Format (edef). This format is specified by chapter 122.8 of the OSGi enterprise specification.

See also File-based Discovery with the Endpoint Description Extender Format

Back to the top