The elements included in a component description vary depending on the functionality a component provides.
Generally, the possible elements of a component description are:
component – This is the opening element of the component description. It can have the following attributes:
name – The component name. A component's name must be unique, it will be also used as a service PID in case the component implements a service or its properties are exported for configuration in the OSGi Configuration Admin service. This attribute is mandatory.
factory – This attribute is included for factory components and specifies a factory name.
immediate – This attribute specifies if the component should be activated right after its bundle is deployed and its dependencies are met. The default value is "false". This attribute is optional.
enabled – This attribute indicates whether the component should be enabled for usage immediately after its bundle is started. Its default value is "true". If set to "false" the component will remain disabled until it is explicitly enabled. The attribute is optional.
implementation – The component's implementation class. This element has the following attribute:
class – The fully qualified name of the component's implementation class.
service – This element provides information about the services registered by the component. Each provided service interface name is declared in a provide sub-element with an interface=<interface_name> attribute. The service element can have the following attribute:
servicefactory – It enables using a Service Factory concept for the provided service. Its default value is "false". When "true", a different component configuration is created, activated and its component instance returned as a service object for each bundle that requests the corresponding service.
reference – This element provides information about the references a component makes to other services. The reference element can include the following attributes:
name – The name of the reference.
interface – The fully qualified name of the referenced service interface.
bind – The name of the method binding the service object to the component. See "Referencing a Service" section.
unbind – The name of the method unbinding the service object from the component. See "Referencing a Service"section.
cardinality – The reference cardinality.
target – A filter that further constraints the set of referenced services.
property – A component property. It has the following attributes:
name – The name of the property.
value – The default value of the property.
type – The property type. As the default type is "String", you are not required to include the type attribute for a String property.
properties – Here you can specify the path to a standard Java properties file containing the set of properties that the component uses.