« Return to Thread: iPojo - How can I force the factory to create an instance

Re: iPojo - How can I force the factory to create an instance

by clement escoffier :: Rate this Message:

Reply to Author | View in Thread


On 24.06.2009, at 12:14, Vrignaud Etienne wrote:

>
> Hi,
>
> I am in trouble to figure out how I can force the factories of iPojo  
> to
> create an instance of a component.
>
> In my case, I have a "manager" class that have an optional @Requires  
> on an
> Array of plugins.
> My problem is that if nobody use my "manager", no instance of this  
> manager
> is created.
> And in my case, it's the fact nobody use it because it's a "manager".
>
> I found a simple workaround. When my manager implements also the Felix
> Command interface, then the instance is created.
> Could you help me to figure out what can be done to "force" the
> instantiation without the workaround.

You can just set immediate="true" in your component type declaration:
@Component(immediate="true")

this will creates a POJO object as soon as your instance is valid (as  
you have an optional service requirement, it will be immediately).
(components that do not provide any service are immediate by default)


>
> I also tried with arch to dig into that problem and try to get a  
> list of
> pending instantiations.
> But I fail to find this. Don't you thing that this kind of feature  
> could be
> helpful?

Your iPOJO instance should be listed with arch -instances. However  
arch -instance your_instance_name says :
- I'm valid
- I have no created any POJO object

Regards,

Clement


>
> Regards,
> /Etienne
>
> --
> View this message in context: http://www.nabble.com/iPojo---How-can-I-force-the-factory-to-create-an-instance-tp24182075p24182075.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: iPojo - How can I force the factory to create an instance