org.apache.felix.ipojo.handlers.providedservice.strategy
Class ConfigurableCreationStrategy

java.lang.Object
  extended by org.apache.felix.ipojo.handlers.providedservice.CreationStrategy
      extended by org.apache.felix.ipojo.handlers.providedservice.strategy.ConfigurableCreationStrategy
All Implemented Interfaces:
ServiceFactory

public abstract class ConfigurableCreationStrategy
extends CreationStrategy

This CreationStrategy is here to ease customization of the strategy by hiding all the reflection stuff.

Author:
Felix Project Team

Constructor Summary
ConfigurableCreationStrategy()
           
 
Method Summary
 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.
 
Methods inherited from class org.apache.felix.ipojo.handlers.providedservice.CreationStrategy
isGetServiceMethod, isUngetServiceMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableCreationStrategy

public ConfigurableCreationStrategy()
Method Detail

onPublication

public void onPublication(InstanceManager manager,
                          String[] specifications,
                          Properties props)
Method called when the underlying iPOJO Service factory is published.

Specified by:
onPublication in class CreationStrategy
Parameters:
manager - the instance manager
specifications - the provided specifications
props - the service properties
See Also:
CreationStrategy.onPublication(org.apache.felix.ipojo.InstanceManager, java.lang.String[], java.util.Properties)

onUnpublication

public void onUnpublication()
Method called when the underlying iPOJO Service factory is un-published.

Specified by:
onUnpublication in class CreationStrategy
See Also:
CreationStrategy.onUnpublication()

getService

public Object getService(Bundle bundle,
                         ServiceRegistration registration)
Method called when a bundle want to access a service. This method is called once per asking bundle. To turn around this limitation, a proxy is registered.

Parameters:
bundle - the asking bundle
registration - the service registration
Returns:
the service object
See Also:
ServiceFactory.getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration)

ungetService

public void ungetService(Bundle bundle,
                         ServiceRegistration registration,
                         Object service)
Method called when a bundle release a service.

Parameters:
bundle - the bundle
registration - the service registration
service - the service object
See Also:
ServiceFactory.ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object)

getServiceFactory

protected abstract IPOJOServiceFactory getServiceFactory(InstanceManager manager)
User provided CreationStrategy MUST implement this method to provide the real iPOJO ServiceFactory instance.

Parameters:
manager - InstanceManager that the factory could use
Returns:
an instance of IPOJOServiceFactory


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.