public abstract class ConfigurableCreationStrategy extends CreationStrategy
CreationStrategy
is here to ease customization of the strategy
by hiding all the reflection stuff.Modifier and Type | Field and Description |
---|---|
private IPOJOServiceFactory |
m_factory
The iPOJO ServiceFactory.
|
private InstanceManager |
m_manager
The instance manager passed to the iPOJO ServiceFactory to manage
instances.
|
private String[] |
m_specs
The lists of interfaces provided by this service.
|
Constructor and Description |
---|
ConfigurableCreationStrategy() |
Modifier and Type | Method and Description |
---|---|
private Class[] |
getModifiedSpecifications(BundleContext context)
Utility method that transform the specifications names into a Class
array, appending the IPOJOServiceFactory interface to it.
|
Object |
getService(Bundle bundle,
ServiceRegistration registration)
Method called when a bundle want to access a service.
|
protected abstract IPOJOServiceFactory |
getServiceFactory(InstanceManager manager)
User provided
CreationStrategy MUST implement this method to
provide the real iPOJO ServiceFactory instance. |
void |
onPublication(InstanceManager manager,
String[] specifications,
Properties props)
Method called when the underlying iPOJO Service factory
is published.
|
void |
onUnpublication()
Method called when the underlying iPOJO Service factory is
un-published.
|
void |
ungetService(Bundle bundle,
ServiceRegistration registration,
Object service)
Method called when a bundle release a service.
|
isGetServiceMethod, isUngetServiceMethod
private InstanceManager m_manager
private IPOJOServiceFactory m_factory
public ConfigurableCreationStrategy()
public void onPublication(InstanceManager manager, String[] specifications, Properties props)
onPublication
in class CreationStrategy
manager
- the instance managerspecifications
- the provided specificationsprops
- the service propertiesCreationStrategy.onPublication(org.apache.felix.ipojo.InstanceManager, java.lang.String[], java.util.Properties)
public void onUnpublication()
onUnpublication
in class CreationStrategy
CreationStrategy.onUnpublication()
public Object getService(Bundle bundle, ServiceRegistration registration)
bundle
- the asking bundleregistration
- the service registrationServiceFactory
public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
bundle
- the bundleregistration
- the service registrationservice
- the service objectServiceFactory
private Class[] getModifiedSpecifications(BundleContext context)
context
- used for class loadingprotected abstract IPOJOServiceFactory getServiceFactory(InstanceManager manager)
CreationStrategy
MUST implement this method to
provide the real iPOJO ServiceFactory instance.manager
- InstanceManager
that the factory could useIPOJOServiceFactory
Copyright © 2014. All rights reserved.