Class TypeFilteringRepositoryManager
java.lang.Object
org.eclipse.rdf4j.repository.manager.RepositoryManager
org.eclipse.rdf4j.repository.manager.util.TypeFilteringRepositoryManager
- All Implemented Interfaces:
HttpClientDependent
,RepositoryResolver
- Author:
- Herko ter Horst, Arjohn Kampman
-
Field Summary
Fields inherited from class org.eclipse.rdf4j.repository.manager.RepositoryManager
initializedRepositories, logger, NAMESPACE, PROXIED_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRepositoryConfig
(RepositoryConfig config) Adds or updates the configuration of a repository to the manager.protected Repository
Creates and initializes the repository with the specified ID.Retrieve meta information of all configured repositories.org.apache.http.client.HttpClient
HttpClient
that has been assigned or has been used by this object.Returns all initialized repositories.Returns all initialized repositories.Gets the URL of the server or directory.getNewRepositoryID
(String baseName) Generates an ID for a new repository based on the specified base name.getRepository
(String id) Gets the repository that is known by the specified ID from this manager.getRepositoryConfig
(String repositoryID) Get the IDs of all available repositories.Gets the repository that is known by the specified ID from this manager.boolean
hasRepositoryConfig
(String repositoryID) void
init()
Initializes the repository manager.protected boolean
isCorrectType
(String repositoryID) protected boolean
isCorrectType
(RepositoryConfig repositoryConfig) void
refresh()
Shuts down all initialized user repositories.void
setHttpClient
(org.apache.http.client.HttpClient httpClient) Should be called beforeRepositoryManager.init()
.void
shutDown()
Shuts down all initialized repositories.Methods inherited from class org.eclipse.rdf4j.repository.manager.RepositoryManager
getAllRepositories, getAllRepositoryInfos, getAllUserRepositoryInfos, getModelFactory, isInitialized, isSafeToRemove, removeRepository, setInitializedRepositories, setModelFactory, updateInitializedRepositories
-
Constructor Details
-
TypeFilteringRepositoryManager
-
-
Method Details
-
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 whetherHttpClient
was passed to or created by this object respectively.- Specified by:
getHttpClient
in interfaceHttpClientDependent
- Specified by:
getHttpClient
in classRepositoryManager
- Returns:
- Returns the httpClient passed to
Repository
construction. - See Also:
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient) Description copied from class:RepositoryManager
Should be called beforeRepositoryManager.init()
.- Specified by:
setHttpClient
in interfaceHttpClientDependent
- Specified by:
setHttpClient
in classRepositoryManager
- Parameters:
httpClient
-- See Also:
-
init
Description copied from class:RepositoryManager
Initializes the repository manager.- Overrides:
init
in classRepositoryManager
- Throws:
RepositoryException
- If the manager failed to initialize.
-
getLocation
Description copied from class:RepositoryManager
Gets the URL of the server or directory.- Specified by:
getLocation
in classRepositoryManager
- Throws:
MalformedURLException
- If the location cannot be represented as a URL.
-
getNewRepositoryID
public String getNewRepositoryID(String baseName) throws RepositoryException, RepositoryConfigException Description copied from class:RepositoryManager
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).- Overrides:
getNewRepositoryID
in classRepositoryManager
- 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
Description copied from class:RepositoryManager
Get the IDs of all available repositories. Note that this is potentially slow as it may initialize all available repository configurations.- Overrides:
getRepositoryIDs
in classRepositoryManager
- Returns:
- a list of repository ID strings.
- Throws:
RepositoryException
-
hasRepositoryConfig
public boolean hasRepositoryConfig(String repositoryID) throws RepositoryException, RepositoryConfigException - Overrides:
hasRepositoryConfig
in classRepositoryManager
- Throws:
RepositoryException
RepositoryConfigException
-
getRepositoryConfig
public RepositoryConfig getRepositoryConfig(String repositoryID) throws RepositoryConfigException, RepositoryException - Specified by:
getRepositoryConfig
in classRepositoryManager
- Throws:
RepositoryConfigException
RepositoryException
-
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 classRepositoryManager
- 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.
-
getRepository
Description copied from class:RepositoryManager
Gets the repository that is known by the specified ID from this manager.- Specified by:
getRepository
in interfaceRepositoryResolver
- Overrides:
getRepository
in classRepositoryManager
- Parameters:
id
- A repository ID.- Returns:
- An initialized Repository object, or null if no repository was known for the specified ID.
- Throws:
RepositoryConfigException
- If no repository could be created due to invalid or incomplete configuration data.RepositoryException
-
getInitializedRepositoryIDs
Description copied from class:RepositoryManager
Returns all initialized repositories. This method returns fast as no lazy creation of repositories takes place.- Overrides:
getInitializedRepositoryIDs
in classRepositoryManager
- Returns:
- a collection containing the IDs of all initialized repositories.
- See Also:
-
getInitializedRepositories
Description copied from class:RepositoryManager
Returns all initialized repositories. This method returns fast as no lazy creation of repositories takes place.- Overrides:
getInitializedRepositories
in classRepositoryManager
- Returns:
- a set containing the initialized repositories.
- See Also:
-
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 classRepositoryManager
- 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.
-
getAllRepositoryInfos
Description copied from class:RepositoryManager
Retrieve meta information of all configured repositories.- Specified by:
getAllRepositoryInfos
in classRepositoryManager
- Returns:
- a collection of
RepositoryInfo
objects - Throws:
RepositoryException
- if the repository meta information could not be retrieved.
-
getRepositoryInfo
Description copied from class:RepositoryManager
Gets the repository that is known by the specified ID from this manager.- Overrides:
getRepositoryInfo
in classRepositoryManager
- 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()Description copied from class:RepositoryManager
Shuts down all initialized user repositories.- Overrides:
refresh
in classRepositoryManager
- See Also:
-
shutDown
public void shutDown()Description copied from class:RepositoryManager
Shuts down all initialized repositories.- Overrides:
shutDown
in classRepositoryManager
- See Also:
-
isCorrectType
protected boolean isCorrectType(String repositoryID) throws RepositoryConfigException, RepositoryException -
isCorrectType
-