incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reto Bachmann-Gmür <r...@apache.org>
Subject Re: How to get a particular TcProvider ?
Date Sat, 09 Feb 2013 15:26:32 GMT
Hi Florent

On Fri, Feb 8, 2013 at 6:43 PM, florent andré <
florent.andre-dev@4sengines.com> wrote:

> Thanks for your answers you two !
>
> The @reference can do some tricks, but lacks a little bit of "dynamics"
> (if you, for example, want to choose your repository depending on some
> parameters... more over if you don't know in advance your available
> repositories/provider).
>

Well you can access the services via the bundle-context which gives you
this kind of dynamism

>
> ClassName is really too limited as you can have 1+ provider based on the
> same implementation...
>
> What about an issue around "Add an identification property to Tcprovider
> interface" ? Or I'm the only one interested in ?
>

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.

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 !
>>> ++
>>>
>>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message