On 12.08.2010, at 16:50, mhutton86 wrote:
>
> Hi Clement and also Richard,
>
> I was able to remove @Requires, I was already populating my own list luckily
> so removing the @Requires array didn't break a thing.
>
> I did have to set the aggregate option to true in the bind annotation
> eg: @Bind(aggregate=true, id="tidgets")
Right, dependencies are scalar (not aggregate) by default. iPOJO is able to
detect the 'aggregate' flavor with @Requires as it can inspect the field type
(array, list, set, collection...). However, with bind method it can't be
detected 'magically'.
Regards,
Clement
>
> because I would only have one tidget be bound, and only until i decided to
> close the bundle waiting on tidgets did the rest load. aggregate fixed this,
> all the tidgets loaded correctly in the beginning and if any additional
> tidgets were added. This didn't quite solve my original problem, but I now
> believe the problem is not with this, but a @Publisher, @Subscriber setup I
> have. I will make a new post once I have more information.
>
> Thanks to both of you for your help.
>
> Mark-Anthony Hutton
>
>
> clement escoffier wrote:
>>
>> Hi,
>>
>> On 11.08.2010, at 19:17, mhutton86 wrote:
>>
>> There is several way to fix this issue:
>>
>> 1) Richard's idea (removing the @Requires)
>> @Bind(id="tidget_devices", optional="true", filter="(...)"
>> and
>> @Unbind(id="tidget_devices")
>>
>> In the method, populate your own list.
>>
>> 2) Using your current code but without adding the services inside the list
>> Indeed, they are already injected by iPOJO, you don't need to add them to
>> the list. Moreover, iPOJO checks that each matching service are injected
>> only once in the list.
>> So,
>> @Requires TidgetSaasmDevice[] devices;
>> @Bind(id=......)
>> public void bind(TidgetSaasmDevice device) {
>> // 'device' is already present in the devices list.
>> }
>>
>> The devices array does not only contain initial values but all current
>> matching services.
>>
>> Regards,
>>
>> Clement
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/%40requires-with-late-binding-headaches-tp29410576p29419552.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]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]