Package org.eclipse.rdf4j.repository.manager

## Class LocalRepositoryManager

- java.lang.Object
- - org.eclipse.rdf4j.repository.manager.RepositoryManager
  - - org.eclipse.rdf4j.repository.manager.LocalRepositoryManager

- All Implemented Interfaces:
    `HttpClientDependent`, `RepositoryResolver`
  Direct Known Subclasses:
    `NotifyingLocalRepositoryManager`

      public class LocalRepositoryManager
      extends RepositoryManager

  An implementation of the `RepositoryManager` interface that operates directly on the repository data files in the local file system.
  Author:
    Arjohn Kampman

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `REPOSITORIES_DIR` |

    - ### Fields inherited from class org.eclipse.rdf4j.repository.manager.RepositoryManager

      `initializedRepositories, logger, NAMESPACE, PROXIED_ID`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LocalRepositoryManager​(File baseDir)` | Creates a new RepositoryManager that operates on the specfified base directory.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addRepositoryConfig​(RepositoryConfig config)` | Adds or updates the configuration of a repository to the manager's system repository.
    `protected Repository` | `createRepository​(String id)` | Creates and initializes the repository with the specified ID.
    `protected SystemRepository` | `createSystemRepository()` | Deprecated.
    `List<RepositoryInfo>` | `getAllRepositoryInfos​(boolean skipSystemRepo)` |
    `File` | `getBaseDir()` | Gets the base dir against which to resolve relative paths.
    `protected FederatedServiceResolver` | `getFederatedServiceResolver()` |
    `org.apache.http.client.HttpClient` | `getHttpClient()` | `HttpClient` that has been assigned or has been used by this object.
    `URL` | `getLocation()` | Gets the base dir against which to resolve relative paths.
    `RepositoryConfig` | `getRepositoryConfig​(String id)` |
    `File` | `getRepositoryDir​(String repositoryID)` |
    `RepositoryInfo` | `getRepositoryInfo​(String id)` | Gets the repository that is known by the specified ID from this manager.
    `protected SharedHttpClientSessionManager` | `getSesameClient()` |
    `SystemRepository` | `getSystemRepository()` | Deprecated.
    `boolean` | `removeRepository​(String repositoryID)` | Removes the specified repository by deleting its configuration from the manager's system repository if such a configuration is present, and removing any persistent data associated with the repository.
    `File` | `resolvePath​(String path)` | Resolves the specified path against the manager's base directory.
    `void` | `setHttpClient​(org.apache.http.client.HttpClient httpClient)` | Should be called before `RepositoryManager.init()`.
    `void` | `shutDown()` | Shuts down all initialized repositories, including the SYSTEM repository.

    - ### Methods inherited from class org.eclipse.rdf4j.repository.manager.RepositoryManager

      `cleanUpRepository, getAllRepositories, getAllRepositoryInfos, getAllUserRepositoryInfos, getInitializedRepositories, getInitializedRepositoryIDs, getModelFactory, getNewRepositoryID, getRepository, getRepositoryIDs, hasRepositoryConfig, init, initialize, isInitialized, isSafeToRemove, refresh, removeRepositoryConfig, setInitializedRepositories, setModelFactory, updateInitializedRepositories`

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

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

- - ### Field Detail

    - #### REPOSITORIES_DIR

          public static final String REPOSITORIES_DIR

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### LocalRepositoryManager

          public LocalRepositoryManager​(File baseDir)

      Creates a new RepositoryManager that operates on the specfified base directory.
      Parameters:
        `baseDir` - The base directory where data for repositories can be stored, among other things.

  - ### Method Detail

    - #### createSystemRepository

          @Deprecated
          protected SystemRepository createSystemRepository()
                                                     throws RepositoryException

      Deprecated.
      Overrides:
        `createSystemRepository` in class `RepositoryManager`
      Throws:
        `RepositoryException`

    - #### getBaseDir

          public File getBaseDir()

      Gets the base dir against which to resolve relative paths.

    - #### getLocation

          public URL getLocation()
                          throws MalformedURLException

      Gets the base dir against which to resolve relative paths.
      Specified by:
        `getLocation` in class `RepositoryManager`
      Throws:
        `MalformedURLException` - If the path cannot be parsed as a URL

    - #### getSesameClient

          protected SharedHttpClientSessionManager getSesameClient()

      Returns:
        Returns the httpClient.

    - #### getHttpClient

          public org.apache.http.client.HttpClient getHttpClient()

      Description copied from interface: `HttpClientDependent`
      `HttpClient` that has been assigned or has been used by this object. The life cycle might not be or might be tied to this object, depending on whether `HttpClient` was passed to or created by this object respectively.
      Specified by:
        `getHttpClient` in interface `HttpClientDependent`
      Specified by:
        `getHttpClient` in class `RepositoryManager`
      Returns:
        Returns the httpClient passed to `Repository` construction.

    - #### setHttpClient

          public void setHttpClient​(org.apache.http.client.HttpClient httpClient)

      Description copied from class: `RepositoryManager`
      Should be called before `RepositoryManager.init()`.
      Specified by:
        `setHttpClient` in interface `HttpClientDependent`
      Specified by:
        `setHttpClient` in class `RepositoryManager`
      Parameters:
        `httpClient` - The httpClient to use for remote/service calls.

    - #### getFederatedServiceResolver

          protected FederatedServiceResolver getFederatedServiceResolver()

      Returns:
        Returns the serviceResolver.

    - #### shutDown

          public void shutDown()

      Description copied from class: `RepositoryManager`
      Shuts down all initialized repositories, including the SYSTEM repository.
      Overrides:
        `shutDown` in class `RepositoryManager`
      See Also:
        `RepositoryManager.refresh()`

    - #### resolvePath

          public File resolvePath​(String path)

      Resolves the specified path against the manager's base directory.
      See Also:
        `getBaseDir()`

    - #### getRepositoryDir

          public File getRepositoryDir​(String repositoryID)

    - #### getSystemRepository

          @Deprecated
          public SystemRepository getSystemRepository()

      Deprecated.
      Description copied from class: `RepositoryManager`
      Gets the SYSTEM repository.
      Overrides:
        `getSystemRepository` in class `RepositoryManager`

    - #### createRepository

          protected Repository createRepository​(String id)
                                         throws RepositoryConfigException,
                                                RepositoryException

      Description copied from class: `RepositoryManager`
      Creates and initializes the repository with the specified ID.
      Specified by:
        `createRepository` in class `RepositoryManager`
      Parameters:
        `id` - A repository ID.
      Returns:
        The created and initialized repository, or null if no such repository exists.
      Throws:
        `RepositoryConfigException` - If no repository could be created due to invalid or incomplete configuration data.
        `RepositoryException` - If the repository could not be initialized.

    - #### getRepositoryConfig

          public RepositoryConfig getRepositoryConfig​(String id)

      Overrides:
        `getRepositoryConfig` in class `RepositoryManager`

    - #### getRepositoryInfo

          public RepositoryInfo getRepositoryInfo​(String id)

      Description copied from class: `RepositoryManager`
      Gets the repository that is known by the specified ID from this manager.
      Overrides:
        `getRepositoryInfo` in class `RepositoryManager`
      Parameters:
        `id` - A repository ID.
      Returns:
        A Repository object, or null if no repository was known for the specified ID.

    - #### getAllRepositoryInfos

          public List<RepositoryInfo> getAllRepositoryInfos​(boolean skipSystemRepo)
                                                     throws RepositoryException

      Specified by:
        `getAllRepositoryInfos` in class `RepositoryManager`
      Throws:
        `RepositoryException` - When not able to retrieve existing configurations

    - #### addRepositoryConfig

          public void addRepositoryConfig​(RepositoryConfig config)
                                   throws RepositoryException,
                                          RepositoryConfigException

      Description copied from class: `RepositoryManager`
      Adds or updates the configuration of a repository to the manager's system repository. The system repository may already contain a configuration for a repository with the same ID as specified by config, in which case all previous configuration data for that repository will be cleared before the new configuration is added.
      Overrides:
        `addRepositoryConfig` in class `RepositoryManager`
      Parameters:
        `config` - The repository configuration that should be added to or updated in the system repository.
      Throws:
        `RepositoryException` - If the manager failed to update it's system repository.
        `RepositoryConfigException` - If the manager doesn't know how to update a configuration due to inconsistent configuration data in the system repository. For example, this happens when there are multiple existing configurations with the concerning ID.

    - #### removeRepository

          public boolean removeRepository​(String repositoryID)
                                   throws RepositoryException,
                                          RepositoryConfigException

      Description copied from class: `RepositoryManager`
      Removes the specified repository by deleting its configuration from the manager's system repository if such a configuration is present, and removing any persistent data associated with the repository. Returns true if the system repository actually contained the specified repository configuration. NB this operation can not be undone!
      Overrides:
        `removeRepository` in class `RepositoryManager`
      Parameters:
        `repositoryID` - The ID of the repository that needs to be removed.
      Throws:
        `RepositoryException` - If the manager failed to update its system repository.
        `RepositoryConfigException` - If the manager doesn't know how to remove a repository due to inconsistent configuration data in the system repository. For example, this happens when there are multiple existing configurations with the concerning ID.