You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Marcel Schlegel <ma...@googlemail.com> on 2012/10/09 01:07:20 UTC

Declarative Service: "Activate" Method

Hi,

I have a short question realating to the "Activate" method of a
ComponentClass:
Is it possible to call always at first the Activate method of a
component or set a higher priority for it?

e.g.:

I have a class with an "@Component" and two"@Reference" annotations on
class level.
Furthermore I have  the "@Activate" annotated method and some
bind/unbind methods for my references.

My problem:
If I use this class in my osgi environment the "@Activate" method isn't
called before the"bind..." methods.

Best regards
Marcel



Re: Declarative Service: "Activate" Method

Posted by Marcel Schlegel <ma...@googlemail.com>.
OK

I think you are right and I have to find another solution:)

Thanks for you answer:)

Best regards
Marcel

Am 09.10.2012 09:12, schrieb David Jencks:
> That is as expected.  If the references are required or static that is the only possible order.
>
> You could try to force the other order by making the references optional and dynamic and registering the target services for the references after the component you are interested in, but I think you will find it difficult to maintain this order in a working system.
>
> david jencks
>
> On Oct 8, 2012, at 4:07 PM, Marcel Schlegel wrote:
>
>> Hi,
>>
>> I have a short question realating to the "Activate" method of a
>> ComponentClass:
>> Is it possible to call always at first the Activate method of a
>> component or set a higher priority for it?
>>
>> e.g.:
>>
>> I have a class with an "@Component" and two"@Reference" annotations on
>> class level.
>> Furthermore I have  the "@Activate" annotated method and some
>> bind/unbind methods for my references.
>>
>> My problem:
>> If I use this class in my osgi environment the "@Activate" method isn't
>> called before the"bind..." methods.
>>
>> Best regards
>> Marcel
>>
>>


Re: Declarative Service: "Activate" Method

Posted by David Jencks <da...@yahoo.com>.
That is as expected.  If the references are required or static that is the only possible order.

You could try to force the other order by making the references optional and dynamic and registering the target services for the references after the component you are interested in, but I think you will find it difficult to maintain this order in a working system.

david jencks

On Oct 8, 2012, at 4:07 PM, Marcel Schlegel wrote:

> Hi,
> 
> I have a short question realating to the "Activate" method of a
> ComponentClass:
> Is it possible to call always at first the Activate method of a
> component or set a higher priority for it?
> 
> e.g.:
> 
> I have a class with an "@Component" and two"@Reference" annotations on
> class level.
> Furthermore I have  the "@Activate" annotated method and some
> bind/unbind methods for my references.
> 
> My problem:
> If I use this class in my osgi environment the "@Activate" method isn't
> called before the"bind..." methods.
> 
> Best regards
> Marcel
> 
>