Steven E. Harris a écrit :
Clement Escoffier <[EMAIL PROTECTED]> writes:

Yes, it is but it does nothing. iPOJO will publish an
ManagedServiceFacotry service with foo.factory as service.pid. You
can create component instances via this service.

When you say "it does nothing", do you just mean that no instances
actually get created? If so, all is well, as it's just the provision
of the ManagedServiceFactory that I was after here.
Yes, it does not create any instance. Moreover, once you create an instance with the factory, this instance will do nothing with the following metadata :
<iPOJO>
   <component className="Foo" factory="foo.factory"/>
</iPOJO>

If you want to create on POJO object, add immediate="true" in the component tag. By default, the POJO instantiation are delayed (lazzy). If you do not have "immediate="true" or a invalid->invalid callback, your POJO is not instantiated until it is really needed (to serve a service for example).
Looking at my bundle running, I see the ManagedServiceFactory is
registered.

Else, you can create instances dynamically with another service :
org.apache.felix.ipojo.Factory. This service does not have exactly
the same semantic as ManagedServiceFactory.

Can you summarize briefly why one would choose to use iPOJO's Factory
interface rather than ManagedServiceFactory?
It is the same difference than between ManagedServiceFactory and DS ComponentFactory. However, the iPOJO Factory allows to get the component-type description, check if a configuration is acceptable or not ..

To create instances, with the ManagedServiceFactory, you push a new configuration. With iPOJO Factory, you will call createInstance, then you received a reference on the instance. You have a stronger control on it. The instance modification is not supported by iPOJO Factory. However, for the Managed ServiceFactory, when an instance is modified, the instance is killed and re-created with the new configuration (I am not sure that's consitent with the DS specification). To delete an instance with the ManagedServiceFactory, you called the delete method. With the iPOJO Factory, you stop the instance. (stop is similar to the DS dispose method).


[...]

Thanks for the prompt explanation.
You're welcome.

Clement


--
Clement Escoffier
Grenoble University
LSR - Bat. C
220, Rue de la Chimie
BP 53
38041 GRENOBLE CEDEX 9
04.76.51.40.24
http://clement.plop-plop.net

Reply via email to