Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Distributed OSGi Reference Guide

Table of Contents
maxLevel3
typelist

Configuration Properties

These properties are set on the Service Registration in the OSGi Service Registry.

...

No Format
Remote-Service: META-INF/osgi

Contributing Distribution properties to Existing Services (without changing them)

CXF/DOSGi allows you to add the distribution properties to existing services. You can do this by installing a bundle that contains an XML file with the extra properties in the OSGI-INF/remote-service directory:

A sample OSGI-INF/remote-service/sd.xml file looks like this:

No Format

<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
 <service-decoration>
   <match interface="org.apache.F(.*)">
     <match-property name="test.prop" value="xyz"/>
     <add-property name="service.exported.interfaces" value="*"/>
   </match>
 </service-decoration>
</service-decorations>

A service decorations file can have any number of service-decoration tags, each tag describing a match rule for services that are to be decorated.
The match rules are defined as follows:

  • match interface="org.apache.Foo" matches any service that is registered under the org.apache.Foo class or interface. The interface attribute takes regular expressions, so specifying org.apache(.)* will match any service registered with an interface in a subpackage of org.apache.
  • The optional match-property tags allows you to declare extra conditions to be applied to services of which the interface matches. In the above example the decoration will only match services that have the test.prop property set to the value xyz. Other services don't match. Any number of match-property tags can be specified.
  • The add-property specifies the extra property to be added to the remote service. The above example adds service.exported.interfaces="*" which will cause any matching service to be exposed remotely. The add-property has an optional type attribute which defaults to java.lang.String. You can specify other Java basic types such as java.lang.Long if needed. You can have any number of add-property tags.

Note the bundle with the extra metadata will need to be started before the bundle with the service that is to be remoted is started (need to fix this).