Java Reference
In-Depth Information
With versioning covered, let's look into another important management task: con-
figuring your bundles.
9.2
Configuring bundles
To m a k e y o u r b u n d l e s m o r e r e u s a b l e , i t 's a g o o d i d e a t o i n t r o d u c e c o n f i g u r a t i o n
properties to control their behavior. Recall from chapter 3, when we introduced the
shell example, that you used configuration properties to alter its behavior, such as the
port on which it listened for client connections. Configuring bundles is an important
aspect of using them, so it would be beneficial if there was a standard way of managing
this. At a minimum, it would be nice to have the following:
A common way to set the configuration information for a given bundle
A common format for specifying the type of configuration data a given bundle
expects
A common mechanism for bundles to safely store bundle- and user-related con-
figuration information
Fortunately, the OSG i Alliance defines the following three compendium specifications
to help you address these issues:
Configuration Admin Service —Manages key/value pair configuration properties
for bundles
Metatype Service —Allows bundles to describes their configuration properties
Preferences Service —Provides a place to store bundle- and user-related information
Even with these specifications to help you, adding bundle configurations to the mix
creates more issues for you to worry about. Configuration data becomes yet another
artifact to manage. For example, you have to make sure to consider this data when you
change the bundles in your systems, because configuration data generally isn't com-
patible across bundles or even bundle versions. The data is subject to deployment and
provisioning just like bundles.
In the remainder of this section, we'll introduce you to these configuration-related
services and show you how you can manage configurations. We'll start with the Config-
uration Admin Service.
9.2.1
Configuration Admin Service
The Configuration Admin Service is an important piece of the deployment of the
OSG i Service Platform. It allows you to set the configuration information of deployed
bundles. You use this service to set a bundle's configuration data, and it ensures that
the bundle receives the data when it becomes active.
What happens is pretty simple. Consider the scenario in figure 9.4, where a bundle
needs an integer port number and a Boolean secure property. In this case, you pro-
vide these values to the Configuration Admin Service, and it provides these values to
the bundle when it's activated. Using this approach, bundles have a simple, standard
way of obtaining configuration data.
Search WWH ::




Custom Search