public abstract class RepositoryManager extends Object implements RepositoryResolver, HttpClientDependent
Repositorys. Every RepositoryManager has one SYSTEM repository and zero or
more "user repositories". The SYSTEM repository contains data that describes the configuration of the other
repositories (their IDs, which implementations of the Repository API to use, access rights, etc.). The
other repositories are instantiated based on this configuration data.RepositoryProvider| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Repository> |
initializedRepositories |
protected org.slf4j.Logger |
logger |
static String |
NAMESPACE
The
ProxyRepository schema namespace (
http://www.openrdf.org/config/repository/proxy#). |
static IRI |
PROXIED_ID
http://www.openrdf.org/config/repository/proxy#proxiedID
|
| Constructor and Description |
|---|
RepositoryManager()
Creates a new RepositoryManager.
|
RepositoryManager(Map<String,Repository> initializedRepositories)
Create a new RepositoryManager using the given map to store repository information.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRepositoryConfig(RepositoryConfig config)
Adds or updates the configuration of a repository to the manager's system repository.
|
protected void |
cleanUpRepository(String repositoryID)
Deprecated.
|
protected abstract Repository |
createRepository(String id)
Creates and initializes the repository with the specified ID.
|
protected Repository |
createSystemRepository()
Deprecated.
|
Collection<Repository> |
getAllRepositories()
Returns all configured repositories.
|
Collection<RepositoryInfo> |
getAllRepositoryInfos() |
abstract Collection<RepositoryInfo> |
getAllRepositoryInfos(boolean skipSystemRepo) |
Collection<RepositoryInfo> |
getAllUserRepositoryInfos() |
abstract org.apache.http.client.HttpClient |
getHttpClient()
HttpClient that has been assigned or has been used by this object. |
Collection<Repository> |
getInitializedRepositories()
Returns all initialized repositories.
|
Set<String> |
getInitializedRepositoryIDs()
Returns all initialized repositories.
|
abstract URL |
getLocation()
Gets the URL of the server or directory.
|
String |
getNewRepositoryID(String baseName)
Generates an ID for a new repository based on the specified base name.
|
Repository |
getRepository(String identity)
Gets the repository that is known by the specified ID from this manager.
|
RepositoryConfig |
getRepositoryConfig(String repositoryID) |
Set<String> |
getRepositoryIDs() |
RepositoryInfo |
getRepositoryInfo(String id)
Gets the repository that is known by the specified ID from this manager.
|
Repository |
getSystemRepository()
Deprecated.
|
boolean |
hasRepositoryConfig(String repositoryID) |
void |
initialize()
Initializes the repository manager.
|
boolean |
isInitialized()
Indicates if this RepositoryManager has been initialized.
|
boolean |
isSafeToRemove(String repositoryID)
Checks on whether the given repository is referred to by a
ProxyRepository configuration. |
void |
refresh()
Shuts down all initialized user repositories.
|
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.
|
boolean |
removeRepositoryConfig(String repositoryID)
Deprecated.
since 2.6.7. Use
removeRepository(String repositoryID) instead. |
abstract void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Should be called before
initialize(). |
protected void |
setInitializedRepositories(Map<String,Repository> nextInitializedRepositories) |
void |
shutDown()
Shuts down all initialized repositories, including the SYSTEM repository.
|
protected void |
updateInitializedRepositories() |
protected final org.slf4j.Logger logger
public static final String NAMESPACE
ProxyRepository schema namespace (
http://www.openrdf.org/config/repository/proxy#).public static final IRI PROXIED_ID
protected Map<String,Repository> initializedRepositories
public RepositoryManager()
public RepositoryManager(Map<String,Repository> initializedRepositories)
initializedRepositories - A map that will be used to store repository information.public boolean isInitialized()
public abstract org.apache.http.client.HttpClient getHttpClient()
HttpClientDependentHttpClient 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.getHttpClient in interface HttpClientDependentRepository construction.public abstract void setHttpClient(org.apache.http.client.HttpClient httpClient)
initialize().setHttpClient in interface HttpClientDependenthttpClient - The httpClient to use for remote/service calls.public void initialize()
throws RepositoryException
RepositoryException - If the manager failed to initialize the SYSTEM repository.@Deprecated protected Repository createSystemRepository() throws RepositoryException
RepositoryException@Deprecated public Repository getSystemRepository()
public String getNewRepositoryID(String baseName) throws RepositoryException, RepositoryConfigException
baseName - The String on which the returned ID should be based, must not be null.RepositoryExceptionRepositoryConfigExceptionpublic Set<String> getRepositoryIDs() throws RepositoryException
RepositoryExceptionpublic boolean hasRepositoryConfig(String repositoryID) throws RepositoryException, RepositoryConfigException
public RepositoryConfig getRepositoryConfig(String repositoryID) throws RepositoryConfigException, RepositoryException
public void addRepositoryConfig(RepositoryConfig config) throws RepositoryException, RepositoryConfigException
config - The repository configuration that should be added to or updated in the system repository.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.@Deprecated public boolean removeRepositoryConfig(String repositoryID) throws RepositoryException, RepositoryConfigException
removeRepository(String repositoryID) instead.repositoryID - The ID of the repository whose configuration needs to be removed.RepositoryException - If the manager failed to update it's system repository.RepositoryConfigException - If the manager doesn't know how to remove 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.public boolean isSafeToRemove(String repositoryID) throws RepositoryException
ProxyRepository configuration.repositoryID - id to checkRepositoryExceptionpublic boolean removeRepository(String repositoryID) throws RepositoryException, RepositoryConfigException
repositoryID - The ID of the repository that needs to be removed.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.public Repository getRepository(String identity) throws RepositoryConfigException, RepositoryException
getRepository in interface RepositoryResolveridentity - A repository ID.RepositoryConfigException - If no repository could be created due to invalid or incomplete configuration data.RepositoryExceptionpublic Set<String> getInitializedRepositoryIDs()
getRepositoryIDs()public Collection<Repository> getInitializedRepositories()
getAllRepositories()protected void setInitializedRepositories(Map<String,Repository> nextInitializedRepositories)
protected void updateInitializedRepositories()
public Collection<Repository> getAllRepositories() throws RepositoryConfigException, RepositoryException
RepositoryConfigExceptionRepositoryExceptiongetInitializedRepositories()protected abstract Repository createRepository(String id) throws RepositoryConfigException, RepositoryException
id - A repository ID.RepositoryConfigException - If no repository could be created due to invalid or incomplete configuration data.RepositoryException - If the repository could not be initialized.public RepositoryInfo getRepositoryInfo(String id) throws RepositoryException
id - A repository ID.RepositoryException - When not able to retrieve existing configurationspublic Collection<RepositoryInfo> getAllRepositoryInfos() throws RepositoryException
RepositoryExceptionpublic Collection<RepositoryInfo> getAllUserRepositoryInfos() throws RepositoryException
RepositoryExceptionpublic abstract Collection<RepositoryInfo> getAllRepositoryInfos(boolean skipSystemRepo) throws RepositoryException
skipSystemRepo - RepositoryException - When not able to retrieve existing configurationspublic void refresh()
shutDown()public void shutDown()
refresh()@Deprecated protected void cleanUpRepository(String repositoryID) throws IOException
repositoryID - the ID of the repository to clean upIOExceptionpublic abstract URL getLocation() throws MalformedURLException
MalformedURLException - If the location cannot be represented as a URL.Copyright © 2015-2018 Eclipse Foundation. All Rights Reserved.