To be able to successfully use the abstract classes
ManagedServiceFactoryBundleActivator and
BaseManagedServiceFactoryAdvisor it is helpful to understand
how the various events are handled. The flow diagram below should help
understand where events come from and how they are handled. As you read
this section, refer to both the dialog and the implementation of the
example since this will aid your understanding.
There are two types of events to consider:
IBundleActivationManager. If the configuration is
not new the factory compares the updated properties with the
ones it currently has for the configuration to see if they've
changed; if the properties have not changed the update is ignored.
If the configuration is new, or if the properties have changed, the
advisor's createImportedServiceFilters method is
called. The advisor's implementation of the
createImportedServiceFilters method calls the manager's
addImportServiceFilter method that causes the manager's
imported services to be released and/or acquired to match the
specified LDAP filters. As services are released asynchronous
Service Released Events arrive. As services are acquired
asynchronous Service Acquired Events arrive. See below for
details of asynchronous events. If the object created by the
advisor for the configuration is not new then the advisor's
update method is called to ensure that the object is updated
appropriately with properties that do not affect the
manager's imported service filters.
IBundleActivationManager associated
with the configuration, causing the manager's imported services to
be released. As the manager's imported services are released
asynchronous Service Released Events arrive. See below for
details of asynchronous events.
IBundleActivationManager for each configuration. When
a manager stops its imported services are released. As services are
released asynchronous Service Released Events arrive. See
below for details of asynchronous events.
create method is called to create an
object associated with the configuration. This object is returned
and managed by the factory.
destroy
method to be called and the object associated with the configuration
destroyed. Subsequent events are ignored.
While the details of where events come from and how they are handled can be rather complicated studying the diagram and the example while implementing a Managed Service Factory is highly recommended.
Copyright © 2001, 2007 IBM Corporation and others. All Rights Reserved.