Class RepositoryProvider


  • public class RepositoryProvider
    extends java.lang.Object
    A static access point to manage RepositoryManagers and Repositories. RepositoryProvider ensures that all managers and repositories obtained through it are automatically shutdown when the JVM exits.
    • Constructor Detail

      • RepositoryProvider

        public RepositoryProvider()
    • Method Detail

      • getRepositoryManagerOfRepository

        public static RepositoryManager getRepositoryManagerOfRepository​(java.lang.String url)
                                                                  throws RepositoryConfigException,
                                                                         RepositoryException
        Retrieves the RepositoryManager that will be used for the given repository URL. Creates a RepositoryManager, if not already created, that will be shutdown when the JVM exits cleanly.
        Parameters:
        url - the location of the repository for which to retrieve the corresponding RepositoryManager. The parameter must be a URL of the form http://host:port/path/repositories/id or file:///path/repositories/id.
        Returns:
        the RepositoryManager that manages the repository identified by the URL.
        Throws:
        java.lang.IllegalArgumentException - if the supplied URL is not a repository URL.
        RepositoryConfigException
        RepositoryException
      • getRepositoryIdOfRepository

        public static java.lang.String getRepositoryIdOfRepository​(java.lang.String url)
        Retrieves the Repository ID that will be passed to a RepositoryManager for the given repository URL.
        Parameters:
        url - the location URL for the repository. The parameter must be a URL of the form http://host:port/path/repositories/id or file:///path/repositories/id.
        Returns:
        the repository identifier string for the given repository URL.
        Throws:
        java.lang.IllegalArgumentException - if the supplied URL is not a repository URL.
      • getRepository

        public static Repository getRepository​(java.lang.String url)
                                        throws RepositoryException,
                                               RepositoryConfigException
        Retrieves a (new or existing) Repository object for the supplied repository URL. The Repository will be shutdown when the JVM exits cleanly.
        Parameters:
        url - the repository URL. The parameter must be a URL of the form http://host:port/path/repositories/id or file:///path/repositories/id.
        Returns:
        Repository from a RepositoryManager or null if repository is not defined
        Throws:
        RepositoryException
        RepositoryConfigException
      • normalizeDirectory

        private static java.lang.String normalizeDirectory​(java.lang.String url)
                                                    throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException