Service Activator Toolkit
Version 1.1.0 (20081206)

org.eclipse.soda.sat.core.framework
Class BaseManagedServiceFactoryAdvisor

java.lang.Object
  extended by org.eclipse.soda.sat.core.framework.BaseManagedServiceFactoryAdvisor
All Implemented Interfaces:
IManagedServiceFactoryAdvisor

public abstract class BaseManagedServiceFactoryAdvisor
extends Object
implements IManagedServiceFactoryAdvisor

BaseManagedServiceFactoryAdvisor is an abstract class from which bundles typically derive their IManagedServiceFactoryAdvisor.

This class provides reasonable defaults and no-op implementations of optional methods from IManagedServiceFactoryAdvisor, making it easier to create an advisor.


Field Summary
protected static String[] NO_SERVICES
           
 
Constructor Summary
BaseManagedServiceFactoryAdvisor()
           
 
Method Summary
protected  String[] basicGetImportedServiceNames(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager)
          Get the imported service names.
protected  String[] basicGetOptionalImportedServiceNames(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager)
          Get the optional imported service names.
protected  void collectImportedServiceNames(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager, Set serviceNames)
          Hook API: This method is extended by subclasses that have required imported services.
protected  void collectOptionalImportedServiceNames(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager, Set serviceNames)
          Hook API: This method is extended by subclasses that have required imported services.
 void createImportedServiceFilters(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager)
          Create the imported service filters for the configuration with the specified persistent ID and properties.
 void destroy(String pid, Object object, Dictionary properties, IBundleActivationManager manager)
          Destroy the specified object with the specified persistent ID.
 String[] getImportedServiceNames(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager)
          Get the imported service names for the configuration with the specified persistent ID.
 String[] getOptionalImportedServiceNames(String pid, Dictionary oldProperties, Dictionary properties, IBundleActivationManager manager)
          Get the optional imported service names for the configuration with the specified persistent ID.
 void handleAcquiredOptionalImportedService(String pid, Object object, String importedServiceName, Object importedService, IBundleActivationManager manager)
          This method is called when an optional imported service has been acquired.
 void handleReleasedOptionalImportedService(String pid, Object object, String importedServiceName, Object importedService, IBundleActivationManager manager)
          When all imported services are not required, this method is called when an imported service has been released.
 void validateConfiguration(String pid, Dictionary properties)
          Validate the configuration, throwing a ConfigurationException if the configuration is deemed to be invalid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.soda.sat.core.framework.interfaces.IManagedServiceFactoryAdvisor
create, update
 

Field Detail

NO_SERVICES

protected static final String[] NO_SERVICES
Constructor Detail

BaseManagedServiceFactoryAdvisor

public BaseManagedServiceFactoryAdvisor()
Method Detail

basicGetImportedServiceNames

protected final String[] basicGetImportedServiceNames(String pid,
                                                      Dictionary oldProperties,
                                                      Dictionary properties,
                                                      IBundleActivationManager manager)
Get the imported service names. This is the a basic implementation that collects the imported service names by delegating to the subclass.

Parameters:
pid - The persistent id for the configuration.
oldProperties - The configuration's old properties.
properties - The configuration's new properties.
manager - The configurations's IBundleActivationManager.
Returns:
An array of imported service names.

basicGetOptionalImportedServiceNames

protected final String[] basicGetOptionalImportedServiceNames(String pid,
                                                              Dictionary oldProperties,
                                                              Dictionary properties,
                                                              IBundleActivationManager manager)
Get the optional imported service names. This is the a basic implementation that collects the optional imported service names by delegating to the subclass.

Parameters:
pid - The persistent id for the configuration.
oldProperties - The configuration's old properties.
properties - The configuration's new properties.
manager - The configurations's IBundleActivationManager.
Returns:
An array of optional imported service names.

collectImportedServiceNames

protected void collectImportedServiceNames(String pid,
                                           Dictionary oldProperties,
                                           Dictionary properties,
                                           IBundleActivationManager manager,
                                           Set serviceNames)
Hook API: This method is extended by subclasses that have required imported services. Note: This method is an alternative to implementing getImportedServiceNames().

Parameters:
pid - The persistent id for the configuration.
oldProperties - The configuration's old properties.
properties - The configuration's new properties.
manager - The configurations's IBundleActivationManager.
serviceNames - A Set into which collected service names must be added.

collectOptionalImportedServiceNames

protected void collectOptionalImportedServiceNames(String pid,
                                                   Dictionary oldProperties,
                                                   Dictionary properties,
                                                   IBundleActivationManager manager,
                                                   Set serviceNames)
Hook API: This method is extended by subclasses that have required imported services. Note: This method is an alternative to implementing getOptionalImportedServiceNames().

Parameters:
pid - The persistent id for the configuration.
oldProperties - The configuration's old properties.
properties - The configuration's new properties.
manager - The configurations's IBundleActivationManager.
serviceNames - A Set into which collected service names must be added.

createImportedServiceFilters

public void createImportedServiceFilters(String pid,
                                         Dictionary oldProperties,
                                         Dictionary properties,
                                         IBundleActivationManager manager)
Description copied from interface: IManagedServiceFactoryAdvisor
Create the imported service filters for the configuration with the specified persistent ID and properties. The filter is an LDAP filter and must be added using the specified manager.

Specified by:
createImportedServiceFilters in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent ID for the configuration.
oldProperties - The old properties for the configuration.
properties - The properties for the configuration.
manager - The configurations's IBundleActivationManager.
See Also:
IManagedServiceFactoryAdvisor.createImportedServiceFilters(java.lang.String, java.util.Dictionary, java.util.Dictionary, org.eclipse.soda.sat.core.framework.interfaces.IBundleActivationManager)

destroy

public void destroy(String pid,
                    Object object,
                    Dictionary properties,
                    IBundleActivationManager manager)
Description copied from interface: IManagedServiceFactoryAdvisor
Destroy the specified object with the specified persistent ID.

Specified by:
destroy in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent ID for the configuration.
object - The object to destroy.
properties - The properties for the configuration.
manager - The configurations's IBundleActivationManager.
See Also:
IManagedServiceFactoryAdvisor.destroy(java.lang.String, java.lang.Object, java.util.Dictionary, org.eclipse.soda.sat.core.framework.interfaces.IBundleActivationManager)

getImportedServiceNames

public String[] getImportedServiceNames(String pid,
                                        Dictionary oldProperties,
                                        Dictionary properties,
                                        IBundleActivationManager manager)
Description copied from interface: IManagedServiceFactoryAdvisor
Get the imported service names for the configuration with the specified persistent ID.

Specified by:
getImportedServiceNames in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent ID for the configuration.
oldProperties - The old configuration properties.
properties - The new configuration properties
manager - The configuration's IBundleActivationManager.
Returns:
The imported service names for the configuration.
See Also:
IManagedServiceFactoryAdvisor.getImportedServiceNames(java.lang.String, java.util.Dictionary, java.util.Dictionary, org.eclipse.soda.sat.core.framework.interfaces.IBundleActivationManager)

getOptionalImportedServiceNames

public String[] getOptionalImportedServiceNames(String pid,
                                                Dictionary oldProperties,
                                                Dictionary properties,
                                                IBundleActivationManager manager)
Description copied from interface: IManagedServiceFactoryAdvisor
Get the optional imported service names for the configuration with the specified persistent ID.

Specified by:
getOptionalImportedServiceNames in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent ID for the configuration.
oldProperties - The old configuration properties.
properties - The new configuration properties
manager - The configuration's IBundleActivationManager.
Returns:
The imported service names for the configuration.
See Also:
IManagedServiceFactoryAdvisor.getOptionalImportedServiceNames(java.lang.String, java.util.Dictionary, java.util.Dictionary, org.eclipse.soda.sat.core.framework.interfaces.IBundleActivationManager)

handleAcquiredOptionalImportedService

public void handleAcquiredOptionalImportedService(String pid,
                                                  Object object,
                                                  String importedServiceName,
                                                  Object importedService,
                                                  IBundleActivationManager manager)
Description copied from interface: IManagedServiceFactoryAdvisor
This method is called when an optional imported service has been acquired.

Specified by:
handleAcquiredOptionalImportedService in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent id for the configuration.
object - The configured object for the specified persistent ID.
importedServiceName - The fully-qualified name of the optional imported service.
importedService - The acquired optional imported service.
manager - The configuration's IBundleActivationManager.
See Also:
IManagedServiceFactoryAdvisor.handleAcquiredOptionalImportedService(java.lang.String, java.lang.Object, java.lang.String, java.lang.Object, org.eclipse.soda.sat.core.framework.interfaces.IBundleActivationManager)

handleReleasedOptionalImportedService

public void handleReleasedOptionalImportedService(String pid,
                                                  Object object,
                                                  String importedServiceName,
                                                  Object importedService,
                                                  IBundleActivationManager manager)
Description copied from interface: IManagedServiceFactoryAdvisor
When all imported services are not required, this method is called when an imported service has been released.

Specified by:
handleReleasedOptionalImportedService in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent id for the configuration.
object - The object for the specified persistent ID.
importedServiceName - The fully-qualified name of the optional imported service.
importedService - The released optional imported service.
manager - The configurations's IBundleActivationManager.
See Also:
IManagedServiceFactoryAdvisor.handleReleasedOptionalImportedService(java.lang.String, java.lang.Object, java.lang.String, java.lang.Object, org.eclipse.soda.sat.core.framework.interfaces.IBundleActivationManager)

validateConfiguration

public void validateConfiguration(String pid,
                                  Dictionary properties)
                           throws ConfigurationException
Description copied from interface: IManagedServiceFactoryAdvisor
Validate the configuration, throwing a ConfigurationException if the configuration is deemed to be invalid.

Specified by:
validateConfiguration in interface IManagedServiceFactoryAdvisor
Parameters:
pid - The persistent ID for the configuration.
properties - The properties for the configuration.
Throws:
ConfigurationException
See Also:
IManagedServiceFactoryAdvisor.validateConfiguration(java.lang.String, java.util.Dictionary)

Service Activator Toolkit
Version 1.1.0 (20081206)