The Apache Felix Maven SCR Plugin is a great tool to ease the development of OSGi components and services. Components and services are defined through annotations and the plugin creates the necessary descriptors for the OSGi Declarative Services, Config Admin and Metatype services. Starting with version 1.4.0 of the plugin, OSGi Declarative Services versions 1.0 and 1.1 are supported.
Make sure to see the FAQ for known problems.
Introduction
In OSGi based systems functionality is mainly provided through services. Unlike traditional systems but comparable to Spring, a service is not reqiured to implement a framework defined interface. Instead services implement one or more interfaces, which stipulate the type of service provided. It is the lifetime of the bundle, which defines the lifetime of the service: A service object may be instantiated when the bundle is started and will automatically be removed when the bundle is stopped (and the service has not already been unregistered).
...
No Format |
---|
<dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.scr.annotations</artifactId> <version>1.02.0</version> </dependency> |
...
Name | Default Value | Required | SCR | Metatype | Description | ||
name | The name of constant | yes | | | The name of the property. If this tag is defined on a field with an initialization expression, the value of that expression is used as the name if the field is of type | ||
value | – | no | | | The string value of the property. This can either be a single value or an array. | ||
longValue | – | no | | | The long value of the property. This can either be a single value or an array. | ||
doubleValue | – | no | | | The double value of the property. This can either be a single value or an array. | ||
floatValue | – | no | | | The float value of the property. This can either be a single value or an array. | ||
intValue | – | no | | | The int value of the property. This can either be a single value or an array. | ||
byteValue | – | no | | | The byte value of the property. This can either be a single value or an array. | ||
charValue | – | no | | | The char value of the property. This can either be a single value or an array. | ||
boolValue | – | no | | | The boolean value of the property. This can either be a single value or an array. | ||
shortValue | – | no | | | The short value of the property. This can either be a single value or an array. | ||
label | | no | – | | The label to display in a form to configure this property. This name may be localized by prepending a | ||
description | | no | – | | A descriptive text to provide the client in a form to configure this property. This name may be localized by prepending a | ||
propertyPrivate | Depending on the name | no | – | See description | Boolean flag defining whether a metatype descriptor entry should be generated for this property or not. By default a metatype descriptor entry, i.e. an | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c4ab4e6d8d834b45-d26c74d6-4e2a466b-b17ea151-2b60b60429cb91134030c331"><ac:plain-text-body><![CDATA[ | cardinality | Depends on property value(s) | no | – | | Defines the cardinality of the property and its collection type. If the cardinality is negative, the property is expected to be stored in a | ]]></ac:plain-text-body></ac:structured-macro> |
options | – | no | – | See below | See below for a description of the |
...
Name | Default Value | Required | SCR | Metatype | Description | ||
name | The name of constant | yes | | | The name of the property. If this tag is defined on a field with an initialization expression, the value of that expression is used as the name if the field is of type | ||
value | – | no | | | The value of the property. If the property type is not | ||
type | | no | | | The type of the property value. This must be one of | ||
label | | no | – | | The label to display in a form to configure this property. This name may be localized by prepending a | ||
description | | no | – | | A descriptive text to provide the client in a form to configure this property. This name may be localized by prepending a | ||
private | Depending on the name | no | – | See description | Boolean flag defining whether a metatype descriptor entry should be generated for this property or not. By default a metatype descriptor entry, i.e. an | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d07599bc71edaa19-fc3cf3d1-440a453e-bb7cb77b-caaf897b1a22bdc90e9f9f89"><ac:plain-text-body><![CDATA[ | cardinality | Depends on property value(s) | no | – | | Defines the cardinality of the property and its collection type. If the cardinality is negative, the property is expected to be stored in a | ]]></ac:plain-text-body></ac:structured-macro> |
options | – | no | – | See below | See below for a description of the | ||
values* | – | no | – | See below | See below for a description of parameters starting with | ||
valueRef | – | no | – | | A constant containing the value for this property. The constant can either be declared in the same class as this property or in any class that is imported. The type of the property is derived from the constant. | ||
valueRefs | – | no | – | See below | Same as the |
...