Package org.eclipse.rdf4j.repository.manager

## Class RepositoryProvider

- java.lang.Object
- - org.eclipse.rdf4j.repository.manager.RepositoryProvider

-     public class RepositoryProvider
      extends Object

  A static access point to manage `RepositoryManager`s and `Repositories`. RepositoryProvider ensures that all managers and repositories obtained through it are automatically shutdown when the JVM exits.
  Author:
    James Leigh

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RepositoryProvider()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Repository` | `getRepository​(String url)` | Retrieves a (new or existing) Repository object for the supplied repository URL.
    `static String` | `getRepositoryIdOfRepository​(String url)` | Retrieves the Repository ID that will be passed to a RepositoryManager for the given repository URL.
    `static LocalRepositoryManager` | `getRepositoryManager​(File dir)` | Creates a `LocalRepositoryManager`, if not already created, that will be shutdown when the JVM exits cleanly.
    `static RepositoryManager` | `getRepositoryManager​(String url)` | Creates a `RepositoryManager`, if not already created, that will be shutdown when the JVM exits cleanly.
    `static RepositoryManager` | `getRepositoryManagerOfRepository​(String url)` | Retrieves the `RepositoryManager` that will be used for the given repository URL.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RepositoryProvider

          public RepositoryProvider()

  - ### Method Detail

    - #### getRepositoryManager

          public static RepositoryManager getRepositoryManager​(String url)
                                                        throws RepositoryConfigException,
                                                               RepositoryException

      Creates a `RepositoryManager`, if not already created, that will be shutdown when the JVM exits cleanly.
      Parameters:
        `url` - location of the data directory for the RepositoryManager. This should be a URL of the form http://host:port/path/ (for a RemoteRepositoryManager) or file:///path/ (for a LocalRepositoryManager).
      Returns:
        a (new or existing) `RepositoryManager` using the supplied url as its data dir.
      Throws:
        `RepositoryConfigException`
        `RepositoryException`

    - #### getRepositoryManager

          public static LocalRepositoryManager getRepositoryManager​(File dir)
                                                             throws RepositoryConfigException,
                                                                    RepositoryException

      Creates a `LocalRepositoryManager`, if not already created, that will be shutdown when the JVM exits cleanly.
      Parameters:
        `dir` - the data directory for the repository manager.
      Returns:
        a (new or existing) `LocalRepositoryManager`.
      Throws:
        `RepositoryConfigException`
        `RepositoryException`

    - #### getRepositoryManagerOfRepository

          public static RepositoryManager getRepositoryManagerOfRepository​(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:
        `IllegalArgumentException` - if the supplied URL is not a repository URL.
        `RepositoryConfigException`
        `RepositoryException`

    - #### getRepositoryIdOfRepository

          public static String getRepositoryIdOfRepository​(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:
        `IllegalArgumentException` - if the supplied URL is not a repository URL.

    - #### getRepository

          public static Repository getRepository​(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`