Class TypeFilteringRepositoryManager
- java.lang.Object
-
- org.eclipse.rdf4j.repository.manager.RepositoryManager
-
- org.eclipse.rdf4j.repository.manager.util.TypeFilteringRepositoryManager
-
- All Implemented Interfaces:
HttpClientDependent,RepositoryResolver
public class TypeFilteringRepositoryManager extends RepositoryManager
- 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
Constructors Constructor Description TypeFilteringRepositoryManager(String type, RepositoryManager delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRepositoryConfig(RepositoryConfig config)Adds or updates the configuration of a repository to the manager.protected RepositorycreateRepository(String id)Creates and initializes the repository with the specified ID.Collection<RepositoryInfo>getAllRepositoryInfos()Retrieve meta information of all configured repositories.org.apache.http.client.HttpClientgetHttpClient()Collection<Repository>getInitializedRepositories()Returns all initialized repositories.Set<String>getInitializedRepositoryIDs()Returns all initialized repositories.URLgetLocation()Gets the URL of the server or directory.StringgetNewRepositoryID(String baseName)Generates an ID for a new repository based on the specified base name.RepositorygetRepository(String id)Gets the repository that is known by the specified ID from this manager.RepositoryConfiggetRepositoryConfig(String repositoryID)Set<String>getRepositoryIDs()Get the IDs of all available repositories.RepositoryInfogetRepositoryInfo(String id)Gets the repository that is known by the specified ID from this manager.booleanhasRepositoryConfig(String repositoryID)voidinit()Initializes the repository manager.protected booleanisCorrectType(String repositoryID)protected booleanisCorrectType(RepositoryConfig repositoryConfig)voidrefresh()Shuts down all initialized user repositories.voidsetHttpClient(org.apache.http.client.HttpClient httpClient)Should be called beforeRepositoryManager.init().voidshutDown()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 Detail
-
TypeFilteringRepositoryManager
public TypeFilteringRepositoryManager(String type, RepositoryManager delegate)
-
-
Method Detail
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient()
- Specified by:
getHttpClientin interfaceHttpClientDependent- Specified by:
getHttpClientin classRepositoryManager- Returns:
- Returns the httpClient passed to
Repositoryconstruction. - See Also:
RepositoryManager.getHttpClient()
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
Description copied from class:RepositoryManagerShould be called beforeRepositoryManager.init().- Specified by:
setHttpClientin interfaceHttpClientDependent- Specified by:
setHttpClientin classRepositoryManager- Parameters:
httpClient-- See Also:
RepositoryManager.setHttpClient(org.apache.http.client.HttpClient)
-
init
public void init() throws RepositoryExceptionDescription copied from class:RepositoryManagerInitializes the repository manager.- Overrides:
initin classRepositoryManager- Throws:
RepositoryException- If the manager failed to initialize.
-
getLocation
public URL getLocation() throws MalformedURLException
Description copied from class:RepositoryManagerGets the URL of the server or directory.- Specified by:
getLocationin 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:RepositoryManagerGenerates 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:
getNewRepositoryIDin 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:
RepositoryExceptionRepositoryConfigException
-
getRepositoryIDs
public Set<String> getRepositoryIDs() throws RepositoryException
Description copied from class:RepositoryManagerGet the IDs of all available repositories. Note that this is potentially slow as it may initialize all available repository configurations.- Overrides:
getRepositoryIDsin classRepositoryManager- Returns:
- a list of repository ID strings.
- Throws:
RepositoryException
-
hasRepositoryConfig
public boolean hasRepositoryConfig(String repositoryID) throws RepositoryException, RepositoryConfigException
- Overrides:
hasRepositoryConfigin classRepositoryManager- Throws:
RepositoryExceptionRepositoryConfigException
-
getRepositoryConfig
public RepositoryConfig getRepositoryConfig(String repositoryID) throws RepositoryConfigException, RepositoryException
- Specified by:
getRepositoryConfigin classRepositoryManager- Throws:
RepositoryConfigExceptionRepositoryException
-
addRepositoryConfig
public void addRepositoryConfig(RepositoryConfig config) throws RepositoryException, RepositoryConfigException
Description copied from class:RepositoryManagerAdds 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:
addRepositoryConfigin 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
public Repository getRepository(String id) throws RepositoryConfigException, RepositoryException
Description copied from class:RepositoryManagerGets the repository that is known by the specified ID from this manager.- Specified by:
getRepositoryin interfaceRepositoryResolver- Overrides:
getRepositoryin 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
public Set<String> getInitializedRepositoryIDs()
Description copied from class:RepositoryManagerReturns all initialized repositories. This method returns fast as no lazy creation of repositories takes place.- Overrides:
getInitializedRepositoryIDsin classRepositoryManager- Returns:
- a collection containing the IDs of all initialized repositories.
- See Also:
RepositoryManager.getRepositoryIDs()
-
getInitializedRepositories
public Collection<Repository> getInitializedRepositories()
Description copied from class:RepositoryManagerReturns all initialized repositories. This method returns fast as no lazy creation of repositories takes place.- Overrides:
getInitializedRepositoriesin classRepositoryManager- Returns:
- a set containing the initialized repositories.
- See Also:
RepositoryManager.getAllRepositories()
-
createRepository
protected Repository createRepository(String id) throws RepositoryConfigException, RepositoryException
Description copied from class:RepositoryManagerCreates and initializes the repository with the specified ID.- Specified by:
createRepositoryin 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
public Collection<RepositoryInfo> getAllRepositoryInfos() throws RepositoryException
Description copied from class:RepositoryManagerRetrieve meta information of all configured repositories.- Specified by:
getAllRepositoryInfosin classRepositoryManager- Returns:
- a collection of
RepositoryInfoobjects - Throws:
RepositoryException- if the repository meta information could not be retrieved.
-
getRepositoryInfo
public RepositoryInfo getRepositoryInfo(String id) throws RepositoryException
Description copied from class:RepositoryManagerGets the repository that is known by the specified ID from this manager.- Overrides:
getRepositoryInfoin 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:RepositoryManagerShuts down all initialized user repositories.- Overrides:
refreshin classRepositoryManager- See Also:
RepositoryManager.shutDown()
-
shutDown
public void shutDown()
Description copied from class:RepositoryManagerShuts down all initialized repositories.- Overrides:
shutDownin classRepositoryManager- See Also:
RepositoryManager.refresh()
-
isCorrectType
protected boolean isCorrectType(String repositoryID) throws RepositoryConfigException, RepositoryException
-
isCorrectType
protected boolean isCorrectType(RepositoryConfig repositoryConfig)
-
-