Class LocalRepositoryManager

    • Field Detail

      • REPOSITORIES_DIR

        public static final java.lang.String REPOSITORIES_DIR
        See Also:
        Constant Field Values
      • CONFIG_FORMAT

        private static final RDFFormat CONFIG_FORMAT
      • CFG_FILE

        private static final java.lang.String CFG_FILE
      • baseDir

        private final java.io.File baseDir
        The base dir to resolve any relative paths against.
    • Constructor Detail

      • LocalRepositoryManager

        public LocalRepositoryManager​(java.io.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

      • getBaseDir

        public java.io.File getBaseDir()
        Gets the base dir against which to resolve relative paths.
      • getLocation

        public java.net.URL getLocation()
                                 throws java.net.MalformedURLException
        Gets the base dir against which to resolve relative paths.
        Specified by:
        getLocation in class RepositoryManager
        Throws:
        java.net.MalformedURLException - If the path cannot be parsed as a URL
      • 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.
      • getFederatedServiceResolver

        protected FederatedServiceResolver getFederatedServiceResolver()
        Returns:
        Returns the serviceResolver.
      • resolvePath

        public java.io.File resolvePath​(java.lang.String path)
        Resolves the specified path against the manager's base directory.
        See Also:
        getBaseDir()
      • getRepositoryDir

        public java.io.File getRepositoryDir​(java.lang.String repositoryID)
      • createRepositoryStack

        private Repository createRepositoryStack​(RepositoryImplConfig config)
                                          throws RepositoryConfigException
        Creates the stack of Repository objects for the repository represented by the specified RepositoryImplConfig. Uses a RepositoryFactory to create the repository and initialize it.
        Parameters:
        config - The node representing the to-be-created repository in the configuration.
        Returns:
        The created repository, or null if no such repository exists.
        Throws:
        RepositoryConfigException - If no repository could be created due to invalid or incomplete configuration data.
      • getRepositoryInfo

        public RepositoryInfo getRepositoryInfo​(java.lang.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.
      • 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. The manager 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.
        Specified by:
        addRepositoryConfig in class RepositoryManager
        Parameters:
        config - The repository configuration that should be added to or updated in the manager.
        Throws:
        RepositoryException - If the manager failed to update.
        RepositoryConfigException - If the manager doesn't know how to update a configuration due to inconsistent configuration data. For example, this happens when there are multiple existing configurations with the concerning ID.
      • removeRepository

        public boolean removeRepository​(java.lang.String repositoryID)
                                 throws RepositoryException,
                                        RepositoryConfigException
        Description copied from class: RepositoryManager
        Removes the specified repository by deleting its configuration if such a configuration is present, and removing any persistent data associated with the repository. Returns true if the specified repository configuration was actually present. 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 the configuration.
        RepositoryConfigException - If the manager doesn't know how to remove a repository due to inconsistent configuration data. For example, this can happen when there are multiple existing configurations with the concerning ID.