Hi On Sun, Feb 10, 2013 at 2:59 PM, florent andré <florent.andre-...@4sengines.com> wrote: > 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" ? >
For the OSGi registration (properties) you should use String as URIs are not supported by OSGI. If you also would like to have a getter for the TcPropvider I would use UriRef. best Rupert > ++ > > > > 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-...@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.westentha...@gmail.com >> | Bodenlehenstraße 11 ++43-699-11108907 >> | A-5500 Bischofshofen >> > -- | Rupert Westenthaler rupert.westentha...@gmail.com | Bodenlehenstraße 11 ++43-699-11108907 | A-5500 Bischofshofen