aQute.bnd.service.repository
Interface SearchableRepository


public interface SearchableRepository

A Searchable Repository is backed by a search engine that holds more revisions than that are currently available locally. For example, it is backed by a database. This interface provides a query interface for text search as well as a requirement based search.


Nested Class Summary
static class SearchableRepository.ResourceDescriptor
          Describes a resource that is a member of the underlying remote repository.
 
Method Summary
 boolean addResource(SearchableRepository.ResourceDescriptor resource)
          Add a resource descriptors to the underlying repository.
 Set<SearchableRepository.ResourceDescriptor> findResources(Requirement requirement, boolean includeDependencies)
          Find a set of resources that match the given requirement.This is intended to be used to provide extra resources when a resolve fails.
 Set<SearchableRepository.ResourceDescriptor> getResources(URI url, boolean includeDependencies)
          Convert a URL to a set of resource descriptors.
 Set<SearchableRepository.ResourceDescriptor> query(String query)
          Search a repository and return a set of resource descriptors that match the query.
 

Method Detail

getResources

Set<SearchableRepository.ResourceDescriptor> getResources(URI url,
                                                          boolean includeDependencies)
                                                          throws Exception
Convert a URL to a set of resource descriptors. If the url is not recognized null is returned. This method can be used if a URL is dropped and you need to know the resources identified by this url. The returned set is owned by the caller and may be modified.

The @{code includeDependencies} parameter indicates that if possible any mandatory compile and runtime dependencies should be added to the result set.

Parameters:
url - the dropped url
includeDependencies - Include any dependent revisions
Returns:
null or the modifiable set of associated resource descriptors.
Throws:
Exception

query

Set<SearchableRepository.ResourceDescriptor> query(String query)
                                                   throws Exception
Search a repository and return a set of resource descriptors that match the query. The query string may use any syntax. If the syntax is not recognized or no results are returned an empty set should be returned. The returned set is owned by the caller and may be modified. Returned items are not automatically added to the repository.

Parameters:
query - The query syntax
Returns:
a set of resource descriptors.
Throws:
Exception

addResource

boolean addResource(SearchableRepository.ResourceDescriptor resource)
                    throws Exception
Add a resource descriptors to the underlying repository. Only descriptors recognized to be from the designated repository are added, others must be ignored. True must be returned if this descriptor was accepted.

Parameters:
resource - the descriptor to add
Returns:
true if added, false if rejected
Throws:
Exception

findResources

Set<SearchableRepository.ResourceDescriptor> findResources(Requirement requirement,
                                                           boolean includeDependencies)
                                                           throws Exception
Find a set of resources that match the given requirement.This is intended to be used to provide extra resources when a resolve fails. Returned are all revisions that have a matching capability.

The @{code includeDependencies} parameter indicates that if possible any mandatory compile and runtime dependencies should be added to the result set.

Parameters:
requirement - The requirement to match
includeDependencies - Include any dependent revisions
Returns:
the set of resource descriptors that match, potentially empty
Throws:
Exception


Copyright © 2014 aQute SARL. All rights reserved.