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: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to