Component description


Service components are described inside an XML file called a component descriptor (see: descriptor DTD), which is an extension to the bundle manifest file (the component descriptor is referenced inside the manifest through the key Metadata-Location). Inside this descriptor, components are declared as shown in figure 1. A bundle can contain several components.


<?xml version="1.0" encoding="UTF-8"?>
<bundle>
  <component class="org.simpleclient.impl.ServiceImpl">
    <provides service="org.simpleclient.interfaces.SimpleClientServiceA"/>
    <provides service="org.simpleclient.interfaces.SimpleClientServiceB"/>
    <property name="provider" value="Beanome.org" type="string"/>
    <requires
        service="org.simpleservice.interfaces.SimpleService"
        filter="(version=*)"
        cardinality="1..n"
        policy="static"
        bind-method="setServiceReference"
        unbind-method="unsetServiceReference"
    />
  </component>
</bundle>

Figure 1. Example component descriptor file.

The different tags that can be used in the component descriptor are:

<bundle>
Tag that delimits the set of components contained inside a bundle. Several components can be declared for one bundle.
<component> (was <instance> in version 1.0)
Defines the class that implements the component. This class must implement all the provided service interfaces.
<provides> [optional] (was<service interface="..."> in version 1.0)
One of these tags must be included for each service interface that the instance implements. If at least one these tags exist, it will result in a service registration for the defined service interfaces.
<property> [optional]
One of these tags must be included for each service property. If a <provides> tag is present, the properties will used during service registration. The description of a property includes its name, value, and type (supported types are: string, boolean, byte, char, short, int, long, float, double).
<requires> [optional]
One of these tags must be included for each of the instance's service dependencies. The properties of this tag are:


Last revision: 20 January 2004
(c) H. Cervantes and R.S. Hall

Next : Instance management

Previous : The ServiceBinder

Index