public interface FactoryComponent extends Component<FactoryComponent>
When a factory configuration is created, an instance of the component is created and the configuration is injected by default in the "updated" callback, which supports the following signatures:
public class Activator extends DependencyActivatorBase { &Override public void init(BundleContext context, DependencyManager dm) throws Exception { Component factoryComponent = createFactoryComponent() .setFactoryPid("my.factory.pid") .setInterface(MySevice.class.getName(), null) .setImplementation(MyComponent.class) .setConfigType(MyConfig.class); dm.add(factoryComponent); } } public interface MyConfig { int getPort(); String getAddress(); } public class MyComponent implements MyService { void updated(MyConfig cnf) { int port = cnf.getPort(); String addr = cnf.getAddress(); ... } }
Component.ServiceScope| Modifier and Type | Method and Description |
|---|---|
FactoryComponent |
add(PropertyMetaData... metaData)
Sets metatype MetaData regarding configuration properties.
|
FactoryComponent |
setConfigType(java.lang.Class<?>... configTypes)
Sets the configuration type to use instead of a dictionary.
|
FactoryComponent |
setDesc(java.lang.String desc)
A metatype human readable description of the factory PID this configuration is associated with.
|
FactoryComponent |
setFactoryPid(java.lang.Class<?> clazz)
Sets the pid matching the factory configuration using the specified class.
|
FactoryComponent |
setFactoryPid(java.lang.String factoryPid)
Sets the pid matching the factory configuration
|
FactoryComponent |
setHeading(java.lang.String heading)
Sets the metatype label used to display the tab name (or section) where the properties are displayed.
|
FactoryComponent |
setLocalization(java.lang.String localization)
Points to the metatype basename of the Properties file that can localize the Meta Type informations.
|
FactoryComponent |
setPropagate(boolean propagate)
Sets the propagate flag (true means all public configuration properties are propagated to service properties).
|
FactoryComponent |
setUpdated(java.lang.String update)
Sets the method name that will be notified when the factory configuration is created/updated.
|
FactoryComponent |
setUpdateInstance(java.lang.Object updatedCallbackInstance)
Sets the object on which the updated callback will be invoked.
|
add, add, getServiceRegistration, remove, remove, setAutoConfig, setAutoConfig, setCallbacks, setCallbacks, setComposition, setComposition, setDebug, setFactory, setFactory, setImplementation, setInterface, setInterface, setInterface, setInterface, setScope, setServicePropertiesgetComponentDeclaration, getDependencyManager, getInstance, getInstances, getServicePropertiesFactoryComponent setFactoryPid(java.lang.String factoryPid)
factoryPid - the pid matching the factory configurationFactoryComponent setFactoryPid(java.lang.Class<?> clazz)
clazz - the class whose FQDN name will be used for the factory pidFactoryComponent setUpdated(java.lang.String update)
updated
TODO describe supported signaturesupdate - the method name that will be notified when the factory configuration is created/updated.FactoryComponent setUpdateInstance(java.lang.Object updatedCallbackInstance)
updatedCallbackInstance - the object on which the updated callback will be invoked.FactoryComponent setPropagate(boolean propagate)
propagate - the propagate flag (false, by default; true means all public configuration properties are propagated to service properties).FactoryComponent setConfigType(java.lang.Class<?>... configTypes)
configTypes - the configuration type to use instead of a dictionaryConfigurationDependencyFactoryComponent setHeading(java.lang.String heading)
heading - the label used to display the tab name (or section) where the properties are displayed.FactoryComponent setDesc(java.lang.String desc)
desc - FactoryComponent setLocalization(java.lang.String localization)
"person" will match person_du_NL.properties in the root bundle directory).localization - FactoryComponent add(PropertyMetaData... metaData)
metaData - the metadata regarding configuration properties