EIG:File-based Discovery with the Endpoint Description Extender Format

From Eclipsepedia

Jump to: navigation, search

Contents

Introduction

Starting with version 3.5, ECF supports/implements the OSGi 4.2 Remote Service Admin (RSA)...chapter 122 in the enterprise specification.

The RSA specification includes an xml-file-based discovery mechanism called the Endpoint Description Extender Format (edef). This allows remote service endpoints to be discovered statically, via xml-files that contain endpoint descriptions. These xml files, are delivered into a running framework via active bundles, as specified in section 122.8.

Example

There is an example of the use of the EDEF format here. See the Remote-Service header in the manifest:

...
Remote-Service: generic_hello.xml

And here is the contents of generic_hello.xml in the EDEF format:

<?xml version="1.0" encoding="UTF-8"?>
<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
  <endpoint-description>
    <property name="ecf.endpoint.id.ns" value-type="String" value="org.eclipse.ecf.core.identity.StringID"/>
    <property name="endpoint.framework.uuid" value-type="String" value="70cd3d4b-4931-0010-1b63-d64101cefd5e"/>
    <property name="endpoint.id" value-type="String" value="ecftcp://localhost:3787/server"/>
    <property name="endpoint.service.id" value-type="Long" value="0"/>
	<property name="endpoint.package.version.org.eclipse.ecf.examples.remoteservices.hello" value-type="String" value="3.0.0"/>
    <property name="objectClass" value-type="String">
      <array>
        <value>org.eclipse.ecf.examples.remoteservices.hello.IHello</value>
      </array>
    </property>
    <property name="remote.configs.supported" value-type="String">
      <array>
        <value>ecf.generic.server</value>
      </array>
    </property>
    <property name="remote.intents.supported" value-type="String">
      <array>
        <value>passByValue</value>
        <value>exactlyOnce</value>
        <value>ordered</value>
      </array>
    </property>
    <property name="service.id" value-type="Long" value="64"/>
    <property name="service.imported" value-type="String" value="true"/>
    <property name="service.imported.configs" value-type="String">
      <array>
        <value>ecf.generic.server</value>
      </array>
    </property>
  </endpoint-description>
</endpoint-descriptions>

Running Hello Example with EDEF Consumer Discovery

In the project org.eclipse.ecf.examples.remoteservices.hello.host there is the following product configuration file:

org.eclipse.ecf.examples.remoteservices.hello.host/products/Hello Service Host (edef,generic).product

and in the project org.eclipse.ecf.examples.remoteservices.hello.consumer there is the follwoing product configuration file:

org.eclipse.ecf.examples.remoteservices.hello.consumer/products/Hello Service Consumer (edef,generic).product

These start the host and consumer, respectively, using EDEF-based discovery (i.e. the xml file listed above in org.eclipse.ecf.remoteservices.hello.consumer.edef bundle above).

One the Hello Service Consumer (edef,generic).product is started, then to trigger the EDEF-file-based discovery, start the org.eclipse.ecf.remoteservices.hello.consumer.edef bundle from the OSGi console prompt:

osgi>start org.eclipse.ecf.remoteservices.hello.consumer.edef

this will trigger the consumer's reading/parsing of the EDEF file, and the EndpointDescription discovery, and remote service import.

Writing/Creating EDEF xml files

In ECF's remote service admin implementation, an EndpointDescriptionWriter class is available to allow EndpointDescriptions to be written...to disk or some other output stream.