@Retention(value=CLASS)
@Target(value=TYPE)
public @interface FactoryConfigurationAdapterService
Config Admin
factory configuration matching the specified factoryPid, an instance of this service will be created.
The adapter will be registered with the specified interface, and with the specified adapter service properties.
Depending on the propagate
parameter, every public factory configuration properties
(which don't start with ".") will be propagated along with the adapter service properties.
If you specify a configuration type, then the fqdn of the configuration interface is used as the factory pid, else you can specify the factory pid explicitly using the factoryPid attribute. If no configuration type is used and no factoryPid attribute is specified, then the factory pid will be set to the fqdn of the class on which this annotation is applied.
(see javadoc from ConfigurationDependency
for more informations about configuration types).
And here is the factory pid adapter service, which is instantiated for each instance of the "sample.DictionaryConfiguration" factory pid:package sample; import java.util.List; import aQute.bnd.annotation.metatype.Meta.AD; import aQute.bnd.annotation.metatype.Meta.OCD; @OCD(factory = true, description = "Declare here some Dictionary instances.") public interface DictionaryConfiguration { @AD(description = "Describes the dictionary language.", deflt = "en") String lang(); @AD(description = "Declare here the list of words supported by this dictionary.") List<String> words(); }
import java.util.List; import aQute.bnd.annotation.metatype.Configurable; @FactoryConfigurationAdapterService(configType=DictionaryConfiguration.class) public class DictionaryImpl implements DictionaryService { protected void updated(DictionaryConfiguration config) { m_lang = config.lang(); m_words.clear(); for (String word : conf.words()) { m_words.add(word); } } ... }
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<?> |
configType
Returns the type safe configuration class which will be injected in the updated callback.
|
java.lang.String |
description
Deprecated.
use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
|
java.lang.String |
factoryMethod
Sets the static method used to create the adapter instance.
|
java.lang.String |
factoryPid
Returns the factory pid whose configurations will instantiate the annotated service class.
|
java.lang.Class<?> |
factoryPidClass
Deprecated.
use
configType() and accept a configuration type parameter from your updated callback. The pid
is then assumed to match the fqdn of the configuration type. |
java.lang.String |
heading
Deprecated.
use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
|
PropertyMetaData[] |
metadata
Deprecated.
use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
|
boolean |
propagate
Returns true if the configuration properties must be published along with the service.
|
Property[] |
properties
Adapter Service properties.
|
java.lang.Class<?>[] |
provides
The interface(s) to use when registering adapters.
|
java.lang.String |
updated
The Update method to invoke (defaulting to "updated"), when a factory configuration is created or updated
|
public abstract java.lang.Class<?>[] provides
public abstract Property[] properties
public abstract java.lang.Class<?> configType
ConfigurationDependency
for more informations about configuration types.ConfigurationDependency
public abstract java.lang.String factoryPid
public abstract java.lang.Class<?> factoryPidClass
configType()
and accept a configuration type parameter from your updated callback. The pid
is then assumed to match the fqdn of the configuration type.public abstract java.lang.String updated
public abstract boolean propagate
public abstract java.lang.String heading
public abstract java.lang.String description
public abstract PropertyMetaData[] metadata