The support SAT provides for creating a Managed Service is split between two classes:
ManagedServiceBundleActivator: This class is an
abstract subclass of BaseBundleActivator and an implementer
of OSGi's ManagedService interface. The class
registers an instance of itself with the OSGi framework as a
ManagedService.
ManagedService
creates its activator as a concrete subclass of this class.
ManagedServiceBundleActivator class implements
the updated(Dictionary) method and knows how to manage
the object created for its configuration.
ConfigurationAdmin the
ManagedServiceBundleActivator class is capable of
deciding whether the updated(Dictionary) method
requires the creation of a new object, or simply the updating of an
existing object. In both cases the
ManagedServiceBundleActivator delegates to
its advisor, an implementation of the interface
IManagedServiceAdvisor that concrete subclasses are
expected to create.
ManagedServiceBundleActivator
are required to implement the method createAdvisor()
that returns an instance of the IManagedServiceAdvisor
interface. An abstract implementation of this interface is provided
by the class BaseManagedServiceAdvisor.
BaseManagedServiceAdvisor: This class is an abstract
implementation of the IManagedServiceAdvisor interface.
Concrete subclasses must provide behavior for managing an object based
on a configuration provided by ConfigurationAdmin.
IManagedServiceAdvisor interface is as follows:
public interface IManagedServiceAdvisor {
public Object create(String, Dictionary, IBundleActivationManager);
public void createImportedServiceFilters(String, Dictionary, Dictionary, IBundleActivationManager);
public void destroy(String, Object, Dictionary , IBundleActivationManager);
public String[] getImportedServiceNames(String, Dictionary, Dictionary, IBundleActivationManager);
public String[] getOptionalImportedServiceNames(String, Dictionary, Dictionary, IBundleActivationManager);
public void handleAcquiredOptionalImportedService(String, Object, String, Object, IBundleActivationManager);
public void handleReleasedOptionalImportedService(String, Object, String, Object, IBundleActivationManager);
public Object update(String, Object, Dictionary, Dictionary, IBundleActivationManager);
public void validateConfiguration(String, Dictionary) throws ConfigurationException;
}
IManagedServiceAdvisor API.
Copyright © 2001, 2008 IBM Corporation and others. All Rights Reserved.