Interface SearchableRepository


  • @ProviderType
    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.
    • Method Detail

      • getResources

        java.util.Set<SearchableRepository.ResourceDescriptor> getResources​(java.net.URI url,
                                                                            boolean includeDependencies)
                                                                     throws java.lang.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:
        java.lang.Exception
      • query

        java.util.Set<SearchableRepository.ResourceDescriptor> query​(java.lang.String query)
                                                              throws java.lang.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:
        java.lang.Exception
      • addResource

        boolean addResource​(SearchableRepository.ResourceDescriptor resource)
                     throws java.lang.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:
        java.lang.Exception
      • findResources

        java.util.Set<SearchableRepository.ResourceDescriptor> findResources​(org.osgi.resource.Requirement requirement,
                                                                             boolean includeDependencies)
                                                                      throws java.lang.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:
        java.lang.Exception
      • browse

        java.net.URI browse​(java.lang.String searchString)
                     throws java.lang.Exception
        Return the URL to a web page that allows browsing or searching of the repository.
        Parameters:
        searchString - A search string, or null for general browsing
        Returns:
        A URL that may be opened in a web browser, or null if the repository does not support web browsing.
        Throws:
        java.lang.Exception