Java Reference
In-Depth Information
CONFIGURATION
Configuration properties provide a mechanism for the service provider to communi-
cate explicit settings to the distribution provider. Given the range of possible configu-
ration schemes, the Remote Services specification defines a mechanism for how the
configuration is encoded. In the earlier example, you added the following property to
the service:
props.put("service.exported.configs","org.apache.cxf.ws");
This specifies that the configuration properties follow the
CXF
web-services configura-
tion scheme or configuration type. Note that this doesn't mean that only
CXF
can be
used to distribute the service; it means the semantics of the configuration properties
are defined by
CXF
. The Remote Services specification suggests a naming convention
for configuration properties, which is the configuration type followed by
.
and a key.
In the example, you specified a single configuration property:
props.put(
"org.apache.cxf.ws.address","http://localhost:9090/stockprovider");
Here, the configuration type is
org.apache.cxf.ws
and the key is
address
. It's possi-
ble to use a number of different configuration types, in which case you may see some-
thing like this:
props.put("service.exported.configs", new String[]{"foo","bar"});
props.put("foo.key1","value1");
props.put("foo.key2","value2");
props.put("bar.key1","value3");
props.put("bar.key2","value4");
The idea behind using configuration properties from multiple configuration types is
to make your service's configuration more broadly applicable. Clearly, the Apache
CXF
distribution provider understands the
org.apache.cxf.ws
configuration type.
Some other distribution providers may understand it too, but not all of them will. By
using additional configuration types, you make your service's configuration under-
standable to a wider range of distribution providers.
This concludes our overview of intents and configurations. They provide an exten-
sible and flexible mechanism for service providers to specify to distribution providers
SCA configuration
For interoperability purposes, the OSGi R4.2 Enterprise specification introduces a
standard configuration type based on the SCA XML format. This configuration format
uses the configuration type
org.osgi.sca
and defines a single configuration attri-
bute
org.osgi.sca.bindings
which points to a named service definition. This
forms a recommended approach for different distribution providers to share configu-
ration data in a vendor-neutral format. A full description of this functionality is outside
the scope of this topic, but you can refer to the OSGi Enterprise specification for more
information (
www.osgi.org/Download/Release4V42
).