You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by blaz <bl...@gmail.com> on 2010/12/07 19:31:12 UTC

RepositoryAdmin Filters and Capabilities

Hi,

I would like to use a custom capability defined in my repository.xml and a
filter to match only the bundles matching these capabilities.

I joined the extract of my repository.xml corresponding to the bundle
description, the entry is generated with the maven-bundle-plugin and a
custom obr.xml to add my custom property.

And here is the code portion I use to get the resource corresponding to my
bundle.

   final String filter = "(sensortype=thermometer)";

Resolver resolver = repositoryAdmin.resolver();

Resource[] resources = repositoryAdmin.discoverResources(filter);


Unfortunately this doesn't work, and I'm not if it comes from the way I use
my custom capability and the filter or if there is another problem
elsewhere.


Could anyone tell me if the way of doing this is right, or point me to doc
explaining how to do it ?


Thanks in advance.


Pierre-Yves Aillet

Re: RepositoryAdmin Filters and Capabilities

Posted by blaz <bl...@gmail.com>.
Thank you for this answer.

I will try to work around this for now, and hope the finalized API suits my
needs at the end :)

2010/12/7 Richard S. Hall <he...@ungoverned.org>

> This part of the API wasn't thought out very well originally. The
> RepositoryAdmin.discoverResources(String filter) method only filters
> according to the attributes of the Resource itself, not against the
> attributes of its Capabilities.
>
> I believe the
> org.apache.felix.bundlerepository.RepositoryAdmin.discoverResources(Requirement[])
> method does what you want, i.e., it queries against the resource's
> capabilities.
>
> There is ongoing work on the OBR spec inside the OSGi Alliance, so
> hopefully we'll actually have a finalized API before the end of time.
>
> -> richard
>
>
> On 12/7/10 13:31, blaz wrote:
>
>> Hi,
>>
>> I would like to use a custom capability defined in my repository.xml and a
>> filter to match only the bundles matching these capabilities.
>>
>> I joined the extract of my repository.xml corresponding to the bundle
>> description, the entry is generated with the maven-bundle-plugin and a
>> custom obr.xml to add my custom property.
>>
>> And here is the code portion I use to get the resource corresponding to my
>> bundle.
>>
>> final String filter = "(sensortype=thermometer)";
>>
>> Resolver resolver = repositoryAdmin.resolver();
>>
>> Resource[] resources = repositoryAdmin.discoverResources(filter);
>>
>>
>> Unfortunately this doesn't work, and I'm not if it comes from the way I
>> use my custom capability and the filter or if there is another problem
>> elsewhere.
>>
>>
>> Could anyone tell me if the way of doing this is right, or point me to doc
>> explaining how to do it ?
>>
>>
>> Thanks in advance.
>>
>>
>> Pierre-Yves Aillet
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: RepositoryAdmin Filters and Capabilities

Posted by "Richard S. Hall" <he...@ungoverned.org>.
This part of the API wasn't thought out very well originally. The 
RepositoryAdmin.discoverResources(String filter) method only filters 
according to the attributes of the Resource itself, not against the 
attributes of its Capabilities.

I believe the 
org.apache.felix.bundlerepository.RepositoryAdmin.discoverResources(Requirement[]) 
method does what you want, i.e., it queries against the resource's 
capabilities.

There is ongoing work on the OBR spec inside the OSGi Alliance, so 
hopefully we'll actually have a finalized API before the end of time.

-> richard

On 12/7/10 13:31, blaz wrote:
> Hi,
>
> I would like to use a custom capability defined in my repository.xml 
> and a filter to match only the bundles matching these capabilities.
>
> I joined the extract of my repository.xml corresponding to the bundle 
> description, the entry is generated with the maven-bundle-plugin and a 
> custom obr.xml to add my custom property.
>
> And here is the code portion I use to get the resource corresponding 
> to my bundle.
>
> final String filter = "(sensortype=thermometer)";
>
> Resolver resolver = repositoryAdmin.resolver();
>
> Resource[] resources = repositoryAdmin.discoverResources(filter);
>
>
> Unfortunately this doesn't work, and I'm not if it comes from the way 
> I use my custom capability and the filter or if there is another 
> problem elsewhere.
>
>
> Could anyone tell me if the way of doing this is right, or point me to 
> doc explaining how to do it ?
>
>
> Thanks in advance.
>
>
> Pierre-Yves Aillet
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

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