public class BeanConfigurationFactory extends AbstractServiceConfigurationFactory<BeanConfigurationFactory.BeanServiceInstance>
If the created bean supports Disposable
then the Disposable.dispose()
method will be called when the object is being removed from the factory.
Modifier and Type | Class and Description |
---|---|
protected static class |
BeanConfigurationFactory.BeanServiceInstance |
AbstractServiceConfigurationFactory.Entry<T>
context
Constructor and Description |
---|
BeanConfigurationFactory(org.osgi.framework.BundleContext context,
Class<?> beanClazz) |
BeanConfigurationFactory(org.osgi.framework.BundleContext context,
Class<?> beanClazz,
boolean mergeIdField)
Create a new factory
|
Modifier and Type | Method and Description |
---|---|
protected AbstractServiceConfigurationFactory.Entry<BeanConfigurationFactory.BeanServiceInstance> |
createService(UserInformation userInformation,
String configurationId,
org.osgi.framework.BundleContext context,
Map<String,String> parameters)
Create a new service instance
|
protected void |
disposeService(UserInformation userInformation,
String id,
BeanConfigurationFactory.BeanServiceInstance service)
Dispose a service
|
protected AbstractServiceConfigurationFactory.Entry<BeanConfigurationFactory.BeanServiceInstance> |
updateService(UserInformation userInformation,
String configurationId,
AbstractServiceConfigurationFactory.Entry<BeanConfigurationFactory.BeanServiceInstance> entry,
Map<String,String> parameters)
Update a service configuration
|
delete, dispose, getService, unregisterService, update
public BeanConfigurationFactory(org.osgi.framework.BundleContext context, Class<?> beanClazz, boolean mergeIdField)
context
- the bundle contextbeanClazz
- the bean class to usemergeIdField
- apply the configuration id as idif set the
true
public BeanConfigurationFactory(org.osgi.framework.BundleContext context, Class<?> beanClazz)
protected AbstractServiceConfigurationFactory.Entry<BeanConfigurationFactory.BeanServiceInstance> createService(UserInformation userInformation, String configurationId, org.osgi.framework.BundleContext context, Map<String,String> parameters) throws Exception
AbstractServiceConfigurationFactory
The method must also register the service with the OSGi bundle context if needed. The service registration must then be placed into the result that is returned. This is an optional step. There is no need to register the created service.
createService
in class AbstractServiceConfigurationFactory<BeanConfigurationFactory.BeanServiceInstance>
configurationId
- the configuration id for which the service should be createdcontext
- the bundle contextparameters
- the initial parametersnull
Exception
- if anything goes wrongprotected void disposeService(UserInformation userInformation, String id, BeanConfigurationFactory.BeanServiceInstance service)
AbstractServiceConfigurationFactory
If the service entry contains a service handle, the service is automatically unregistered.
disposeService
in class AbstractServiceConfigurationFactory<BeanConfigurationFactory.BeanServiceInstance>
protected AbstractServiceConfigurationFactory.Entry<BeanConfigurationFactory.BeanServiceInstance> updateService(UserInformation userInformation, String configurationId, AbstractServiceConfigurationFactory.Entry<BeanConfigurationFactory.BeanServiceInstance> entry, Map<String,String> parameters) throws Exception
AbstractServiceConfigurationFactory
If a new service entry is returned the old one will get disposed after the call returns
updateService
in class AbstractServiceConfigurationFactory<BeanConfigurationFactory.BeanServiceInstance>
configurationId
- the configuration to updateentry
- the original service entryparameters
- the new parametersnull
if the entry did not
changeException
- if anything goes wrongCopyright © 2016 Eclipse NeoSCADA Project. All rights reserved.