You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by lessonz <le...@gmail.com> on 2013/04/24 18:52:15 UTC

[iPOJO] ServiceController

I'm trying to use the @ServiceController annotation to handle registering a
service. In this case I need to use it because I have a field the service
really should have an @Requires relationship with, but I cannot use that
annotation because I also need to provide a setter. So, that setter uses
the @Bind annotation and sets the service controller field to true. This
method is being called as gogo's instance command shows the value of the
@Bind field as resolved. Unfortunately, gogo's instance command also shows
the service is unregistered and controller value as false.

I am using:

    @ServiceController
    private boolean valid = false;

but have also tried:

    @ServiceController(value = false)
    private boolean valid;

Neither changes the outcome. The service remains unregistered and its
controller value false.

I have successfully used the @ServiceController annotation elsewhere, but
not within a @Bind annotated method. Is that the issue? Is the method
sandboxed somehow? Is there a better way to achieve my objective of
preventing registration of my service until after a field has been bound?

Cheers.

Re: [iPOJO] ServiceController

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

Yes, the service controller has a default value set to true. 

About the bindX instead of setX, you can set the dependency id in the @Bind annotation. If the @Requires use the same id, it will be added to the same dependency. The bindX is just a sugar.

Regards,

Clement

On 25 avr. 2013, at 02:06, lessonz <le...@gmail.com> wrote:

> For anyone who may find this, the problem, as indicated in my last message,
> was the @Bind annotated method was not being called. This was due to the
> method being named setX rather than bindX AND Bind's id attribute not being
> set. Hope that helps someone.
> 
> 
> On Wed, Apr 24, 2013 at 2:38 PM, lessonz <le...@gmail.com> wrote:
> 
>> Just realized ServiceController has a default value of true. So, that's
>> why it appears to be working. So, it seems my @Bind is never being called.
>> 
>> 
>> On Wed, Apr 24, 2013 at 11:08 AM, lessonz <le...@gmail.com>wrote:
>> 
>>> I should also add if I use:
>>> 
>>>    @ServiceController
>>>    private boolean valid;
>>> 
>>> it appears to work.
>>> 
>>> 
>>> 
>>> On Wed, Apr 24, 2013 at 10:52 AM, lessonz <le...@gmail.com>wrote:
>>> 
>>>> I'm trying to use the @ServiceController annotation to handle
>>>> registering a service. In this case I need to use it because I have a field
>>>> the service really should have an @Requires relationship with, but I cannot
>>>> use that annotation because I also need to provide a setter. So, that
>>>> setter uses the @Bind annotation and sets the service controller field to
>>>> true. This method is being called as gogo's instance command shows the
>>>> value of the @Bind field as resolved. Unfortunately, gogo's instance
>>>> command also shows the service is unregistered and controller value as
>>>> false.
>>>> 
>>>> I am using:
>>>> 
>>>>    @ServiceController
>>>>    private boolean valid = false;
>>>> 
>>>> but have also tried:
>>>> 
>>>>    @ServiceController(value = false)
>>>>    private boolean valid;
>>>> 
>>>> Neither changes the outcome. The service remains unregistered and its
>>>> controller value false.
>>>> 
>>>> I have successfully used the @ServiceController annotation elsewhere,
>>>> but not within a @Bind annotated method. Is that the issue? Is the method
>>>> sandboxed somehow? Is there a better way to achieve my objective of
>>>> preventing registration of my service until after a field has been bound?
>>>> 
>>>> Cheers.
>>>> 
>>> 
>>> 
>> 


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


Re: [iPOJO] ServiceController

Posted by lessonz <le...@gmail.com>.
For anyone who may find this, the problem, as indicated in my last message,
was the @Bind annotated method was not being called. This was due to the
method being named setX rather than bindX AND Bind's id attribute not being
set. Hope that helps someone.


On Wed, Apr 24, 2013 at 2:38 PM, lessonz <le...@gmail.com> wrote:

> Just realized ServiceController has a default value of true. So, that's
> why it appears to be working. So, it seems my @Bind is never being called.
>
>
> On Wed, Apr 24, 2013 at 11:08 AM, lessonz <le...@gmail.com>wrote:
>
>> I should also add if I use:
>>
>>     @ServiceController
>>     private boolean valid;
>>
>> it appears to work.
>>
>>
>>
>> On Wed, Apr 24, 2013 at 10:52 AM, lessonz <le...@gmail.com>wrote:
>>
>>> I'm trying to use the @ServiceController annotation to handle
>>> registering a service. In this case I need to use it because I have a field
>>> the service really should have an @Requires relationship with, but I cannot
>>> use that annotation because I also need to provide a setter. So, that
>>> setter uses the @Bind annotation and sets the service controller field to
>>> true. This method is being called as gogo's instance command shows the
>>> value of the @Bind field as resolved. Unfortunately, gogo's instance
>>> command also shows the service is unregistered and controller value as
>>> false.
>>>
>>> I am using:
>>>
>>>     @ServiceController
>>>     private boolean valid = false;
>>>
>>> but have also tried:
>>>
>>>     @ServiceController(value = false)
>>>     private boolean valid;
>>>
>>> Neither changes the outcome. The service remains unregistered and its
>>> controller value false.
>>>
>>> I have successfully used the @ServiceController annotation elsewhere,
>>> but not within a @Bind annotated method. Is that the issue? Is the method
>>> sandboxed somehow? Is there a better way to achieve my objective of
>>> preventing registration of my service until after a field has been bound?
>>>
>>> Cheers.
>>>
>>
>>
>

Re: [iPOJO] ServiceController

Posted by lessonz <le...@gmail.com>.
Just realized ServiceController has a default value of true. So, that's why
it appears to be working. So, it seems my @Bind is never being called.


On Wed, Apr 24, 2013 at 11:08 AM, lessonz <le...@gmail.com> wrote:

> I should also add if I use:
>
>     @ServiceController
>     private boolean valid;
>
> it appears to work.
>
>
>
> On Wed, Apr 24, 2013 at 10:52 AM, lessonz <le...@gmail.com>wrote:
>
>> I'm trying to use the @ServiceController annotation to handle registering
>> a service. In this case I need to use it because I have a field the service
>> really should have an @Requires relationship with, but I cannot use that
>> annotation because I also need to provide a setter. So, that setter uses
>> the @Bind annotation and sets the service controller field to true. This
>> method is being called as gogo's instance command shows the value of the
>> @Bind field as resolved. Unfortunately, gogo's instance command also shows
>> the service is unregistered and controller value as false.
>>
>> I am using:
>>
>>     @ServiceController
>>     private boolean valid = false;
>>
>> but have also tried:
>>
>>     @ServiceController(value = false)
>>     private boolean valid;
>>
>> Neither changes the outcome. The service remains unregistered and its
>> controller value false.
>>
>> I have successfully used the @ServiceController annotation elsewhere, but
>> not within a @Bind annotated method. Is that the issue? Is the method
>> sandboxed somehow? Is there a better way to achieve my objective of
>> preventing registration of my service until after a field has been bound?
>>
>> Cheers.
>>
>
>

Re: [iPOJO] ServiceController

Posted by lessonz <le...@gmail.com>.
I should also add if I use:

    @ServiceController
    private boolean valid;

it appears to work.



On Wed, Apr 24, 2013 at 10:52 AM, lessonz <le...@gmail.com> wrote:

> I'm trying to use the @ServiceController annotation to handle registering
> a service. In this case I need to use it because I have a field the service
> really should have an @Requires relationship with, but I cannot use that
> annotation because I also need to provide a setter. So, that setter uses
> the @Bind annotation and sets the service controller field to true. This
> method is being called as gogo's instance command shows the value of the
> @Bind field as resolved. Unfortunately, gogo's instance command also shows
> the service is unregistered and controller value as false.
>
> I am using:
>
>     @ServiceController
>     private boolean valid = false;
>
> but have also tried:
>
>     @ServiceController(value = false)
>     private boolean valid;
>
> Neither changes the outcome. The service remains unregistered and its
> controller value false.
>
> I have successfully used the @ServiceController annotation elsewhere, but
> not within a @Bind annotated method. Is that the issue? Is the method
> sandboxed somehow? Is there a better way to achieve my objective of
> preventing registration of my service until after a field has been bound?
>
> Cheers.
>