Class RepositoryManager

    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
      • NAMESPACE

        public static final String NAMESPACE
        Deprecated.
        use CONFIG.Proxy instead.
        The org.eclipse.rdf4j.repository.sail.ProxyRepository schema namespace ( http://www.openrdf.org/config/repository/proxy#).
        See Also:
        Constant Field Values
      • PROXIED_ID

        @Deprecated(since="4.3.0",
                    forRemoval=true)
        public static final org.eclipse.rdf4j.model.IRI PROXIED_ID
        Deprecated, for removal: This API element is subject to removal in a future version.
        use CONFIG.Proxy.proxiedID instead.
        http://www.openrdf.org/config/repository/proxy#proxiedID
    • Constructor Detail

      • RepositoryManager

        protected RepositoryManager()
        Creates a new RepositoryManager.
      • RepositoryManager

        protected RepositoryManager​(Map<String,​Repository> initializedRepositories)
        Create a new RepositoryManager using the given map to store repository information.
        Parameters:
        initializedRepositories - A map that will be used to store repository information.
    • Method Detail

      • isInitialized

        public boolean isInitialized()
        Indicates if this RepositoryManager has been initialized. Note that the initialization status may change if the Repository is shut down.
        Returns:
        true iff the repository manager has been initialized.
      • getHttpClient

        public abstract org.apache.http.client.HttpClient getHttpClient()
        Specified by:
        getHttpClient in interface HttpClientDependent
        Returns:
        Returns the httpClient passed to Repository construction.
      • setHttpClient

        public abstract void setHttpClient​(org.apache.http.client.HttpClient httpClient)
        Should be called before init().
        Specified by:
        setHttpClient in interface HttpClientDependent
        Parameters:
        httpClient - The httpClient to use for remote/service calls.
      • getModelFactory

        public org.eclipse.rdf4j.model.ModelFactory getModelFactory()
        Get the ModelFactory used for creating new Model objects in the manager.
        Returns:
        the modelFactory
        Since:
        3.0
      • setModelFactory

        public void setModelFactory​(org.eclipse.rdf4j.model.ModelFactory modelFactory)
        Set the ModelFactory to use for creating new Model objects in the manager.
        Parameters:
        modelFactory - the modelFactory to set. May not be null.
        Since:
        3.0
      • getNewRepositoryID

        public String getNewRepositoryID​(String baseName)
                                  throws RepositoryException,
                                         RepositoryConfigException
        Generates an ID for a new repository based on the specified base name. The base name may for example be a repository name entered by the user. The generated ID will contain a variant of this name that does not occur as a repository ID in this manager yet and is suitable for use as a file name (e.g. for the repository's data directory).
        Parameters:
        baseName - The String on which the returned ID should be based, must not be null.
        Returns:
        A new repository ID derived from the specified base name.
        Throws:
        RepositoryException
        RepositoryConfigException
      • getRepositoryIDs

        public Set<String> getRepositoryIDs()
                                     throws RepositoryException
        Get the IDs of all available repositories. Note that this is potentially slow as it may initialize all available repository configurations.
        Returns:
        a list of repository ID strings.
        Throws:
        RepositoryException
      • addRepositoryConfig

        public abstract void addRepositoryConfig​(RepositoryConfig config)
                                          throws RepositoryException,
                                                 RepositoryConfigException
        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.
        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.
      • isSafeToRemove

        public boolean isSafeToRemove​(String repositoryID)
                               throws RepositoryException
        Checks on whether the given repository is referred to by a org.eclipse.rdf4j.repository.sail.ProxyRepository configuration.
        Parameters:
        repositoryID - id to check
        Returns:
        true if there is no existing proxy reference to the given id, false otherwise
        Throws:
        RepositoryException
      • removeRepository

        public boolean removeRepository​(String repositoryID)
                                 throws RepositoryException,
                                        RepositoryConfigException
        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!
        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.
      • getInitializedRepositoryIDs

        public Set<String> getInitializedRepositoryIDs()
        Returns all initialized repositories. This method returns fast as no lazy creation of repositories takes place.
        Returns:
        a collection containing the IDs of all initialized repositories.
        See Also:
        getRepositoryIDs()
      • getInitializedRepositories

        public Collection<Repository> getInitializedRepositories()
        Returns all initialized repositories. This method returns fast as no lazy creation of repositories takes place.
        Returns:
        a set containing the initialized repositories.
        See Also:
        getAllRepositories()
      • setInitializedRepositories

        protected void setInitializedRepositories​(Map<String,​Repository> nextInitializedRepositories)
      • updateInitializedRepositories

        protected void updateInitializedRepositories()
      • getRepositoryInfo

        public RepositoryInfo getRepositoryInfo​(String id)
                                         throws RepositoryException
        Gets the repository that is known by the specified ID from this manager.
        Parameters:
        id - A repository ID.
        Returns:
        A Repository object, or null if no repository was known for the specified ID.
        Throws:
        RepositoryException - When not able to retrieve existing configurations
      • refresh

        public void refresh()
        Shuts down all initialized user repositories.
        See Also:
        shutDown()
      • shutDown

        public void shutDown()
        Shuts down all initialized repositories.
        See Also:
        refresh()