Distributed OSGi Reference Guide
Table of Contents | ||||
---|---|---|---|---|
|
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. Theinterface
attribute takes regular expressions, so specifyingorg.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 thetest.prop
property set to the valuexyz
. Other services don't match. Any number ofmatch-property
tags can be specified. - The
add-property
specifies the extra property to be added to the remote service. The above example addsservice.exported.interfaces="*"
which will cause any matching service to be exposed remotely. Theadd-property
has an optionaltype
attribute which defaults tojava.lang.String
. You can specify other Java basic types such asjava.lang.Long
if needed. You can have any number ofadd-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).