incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From florent andré <florent.andre-...@4sengines.com>
Subject Re: How to get a particular TcProvider ?
Date Sun, 10 Feb 2013 13:59:11 GMT
I first thinking to use UUID for ensuring uniqueness of id when user 
don't fix it.
But as Rupert states, this don't have to be a strong requirement for 
implementations.

Do the type of the id is just a string ? Or an UriRef as it can be 
considered as a "resource" ?

++


On 02/10/2013 08:50 AM, Rupert Westenthaler wrote:
>>
>> I'm wondering how this is best achieved in a way that ensures uniquness of
>> names. But a unique name would be better than the weight for which
>> service-ranking could be used instead.
>
> Unique names are not required, as ServiceTracker as well as @Reference
> annotations do support multiple matches for filters. In case two
> TcProvider would use the same id, users would get the one with the
> higher "service.ranking" injected. In case both have the same
> "service.ranking" the one with the lower "service.id" is injected.
> Services that are started earlier will have the lower "service.id".
>
> best
> Rupert
>
>>
>> Cheers,
>> Reto
>>
>>>
>>>
>>> May the Subject be with you !
>>> ++
>>>
>>>
>>> On 02/08/2013 02:48 PM, Reto Bachmann-Gmür wrote:
>>>
>>>> Hi Florent
>>>>
>>>> Rather than checking the weight you you could check the class with
>>>> getClass() but this sound like a hack as well.
>>>>
>>>> Another approach would be to add a service property to the TcProvider so
>>>> you can filter by it when you want this particular one:
>>>>
>>>> @Reference(name="provider", referenceInterface=**
>>>> WeightedTcProvider.class,
>>>>           target="(my.very.special.one=**true)",
>>>>           cardinality=**ReferenceCardinality.;**AMDATORY_UNARY,
>>>>           policy=ReferencePolicy.STATIC)**,
>>>>
>>>> Have a triple good day!
>>>> Reto
>>>>
>>>> On Fri, Feb 8, 2013 at 2:17 PM, florent andré <
>>>> florent.andre-dev@4sengines.**com <florent.andre-dev@4sengines.com>>
>>>> wrote:
>>>>
>>>>   Hi there !
>>>>>
>>>>> Working with multiple TcProvider I would like to get one in particular.
>>>>>
>>>>> The way I find for now is to call :
>>>>> SortedSet<WeightedTcProvider> providerList = tcManager.getProviderList();
>>>>>
>>>>> And then iterate throw my providerList, and select the one I would like
>>>>> by
>>>>> his "weight".
>>>>>
>>>>> "Weight" is really not an "user friendly" (nor reliable) property to
>>>>> select something in a list imo... but I don't see any selection method
>>>>> based on a name or an ID.
>>>>>
>>>>> Do I miss something here ? Or a kind of "id" property can be imagined
for
>>>>> the TcProvider objects ?
>>>>>
>>>>> Happy graph !
>>>>> ++
>>>>>
>>>>>
>>>>
>
>
>
> --
> | Rupert Westenthaler             rupert.westenthaler@gmail.com
> | Bodenlehenstraße 11                             ++43-699-11108907
> | A-5500 Bischofshofen
>

Mime
View raw message