Hi,
On Tue, Jun 12, 2012 at 11:22 PM, fabiolf <[email protected]> wrote:
>
> clement escoffier wrote
> >
> > Hi,
> >
> > It depends what you want to do with the instance.
> >
>
> For now I just want to know its status.
>
>
> clement escoffier wrote
> >
> > If 'reading' metadata is enough, then use the Architecture service and
> the
> > 'architecture.instance' service property.
> >
>
> I think I am doing that (or something like that). I have created a service
> requirement for the Architecture interface (in the array form) and iPOJO
> binds there every instance that has a valid architecture handler. Then I
> iterate over it checking each InstanceDescription to find the desired
> instance. Finally I get the instance state. But I think this process is not
> efficient because I have to iterate through all instances and so on... I
> thought I could call some getInstanceByName() or something like that.
>
You can also use filtering on your Archtitecture requirement like
"(architecture.instate=your_instance_name)".
Then only your intended instance's Architecture reference will be injected
into your Array, or you can use just single reference.
As i understand your situation, something like following may help:
@Bind(filter="(architecture.instance=your_instance_name)")
public void bind_instance(Architecture arch)
{
// Will be called when instance having specified "your_instance_name"
is activated with its Architecture reference.
}
>
>
> clement escoffier wrote
> >
> > If you really need to access the Component Instance, it's more complex.
> > We're trying to improve this in
> > https://issues.apache.org/jira/browse/FELIX-3537. Feel free to comment
> the
> > issue if you have ideas.
> >
>
> I will have a look and try to help.
>
> Thanks,
> Fabio
>
>
>
> --
> View this message in context:
> http://apache-felix.18485.n6.nabble.com/How-to-get-the-ComponentInstance-from-the-instance-name-attribute-tp4997990p4998005.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>