You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Steven E. Harris" <se...@panix.com> on 2007/03/02 21:04:50 UTC

Using iPOJO's ManagedServiceFactory support

I have a class in a bundle of which I'd like instances to be created
per the ManagedServiceFactory model; whenever a Configuration gets
established for a particular factory PID, an instance of this class
should get created and, somehow, this new instance should have some
access to the properties in the Configuration that forced it to be
created.

This bundle's iPOJO metadata is as follows:

,----
| <?xml version="1.0" encoding="UTF-8"?>
| <iPOJO>
|    <component className="mycorp.Foo"
|               factory="mycorp.foo_factory"/>
| </iPOJO>
`----

I can see that this bundle has both an org.apache.felix.ipojo.Factory
and an org.osgi.service.cm.ManagedServiceFactory registered on its
behalf, including the property

  service.pid=mycorp.foo_factory

In another bundle, I use the ConfigurationAdmin service to create a
new factory configuration using "mycorp.foo_factory" as the
PID. However, I never see my mycorp.Foo class constructor get
called.

For the record, it doesn't look like
org.apache.felix.ipojo.ComponentFactory.updated() ever gets called
either, which I assume is iPOJO's ManagedServiceFactory
implementation.

Should iPOJO create an instance of mycorp.Foo when a Configuration
with a matching factoryPid is available? Am I missing some
declarations in the metadata file to enable this behavior?

-- 
Steven E. Harris