@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.
And here is the Dictionary service: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.") Listwords(); }
import java.util.List; import aQute.bnd.annotation.metatype.Configurable; @FactoryConfigurationAdapterService(factoryPidClass=DictionaryConfiguration.class) public class DictionaryImpl implements DictionaryService { protected void updated(Dictionary<String, ?> props) { // load configuration from the provided dictionary, or throw an exception of any configuration error. DictionaryConfiguration cnf = Configurable.createConfigurable(DictionaryConfiguration.class, props); 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.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
Returns the factory pid from a class name.
|
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.String factoryPid
public abstract java.lang.Class<?> factoryPidClass
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
public abstract java.lang.String factoryMethod