public abstract class RepositoryManager extends Object implements RepositoryResolver, HttpClientDependent
Repository
s.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
|
Modifier | Constructor and Description |
---|---|
protected |
RepositoryManager()
Creates a new RepositoryManager.
|
protected |
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.
|
ModelFactory |
getModelFactory()
Get the
ModelFactory used for creating new Model objects in the manager. |
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.
Repository configuration is no longer stored in a centralized system repository, instead using a file
config.ttl per repository, stored in that repository's datadir. |
boolean |
hasRepositoryConfig(String repositoryID) |
void |
init()
Initializes the repository manager.
|
void |
initialize()
Deprecated.
since 2.0. Use
init() instead. |
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.0. Use
removeRepository(String repositoryID) instead. |
abstract void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Should be called before
init() . |
protected void |
setInitializedRepositories(Map<String,Repository> nextInitializedRepositories) |
void |
setModelFactory(ModelFactory modelFactory)
Set the
ModelFactory to use for creating new Model objects in the manager. |
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
protected RepositoryManager()
protected 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()
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.getHttpClient
in interface HttpClientDependent
Repository
construction.public abstract void setHttpClient(org.apache.http.client.HttpClient httpClient)
init()
.setHttpClient
in interface HttpClientDependent
httpClient
- The httpClient to use for remote/service calls.public ModelFactory getModelFactory()
ModelFactory
used for creating new Model
objects in the manager.public void setModelFactory(ModelFactory modelFactory)
ModelFactory
to use for creating new Model
objects in the manager.modelFactory
- the modelFactory to set. May not be null
.@Deprecated public void initialize() throws RepositoryException
init()
instead.RepositoryException
- If the manager failed to initializepublic void init() throws RepositoryException
RepositoryException
- If the manager failed to initialize.@Deprecated protected Repository createSystemRepository() throws RepositoryException
RepositoryException
@Deprecated public Repository getSystemRepository()
config.ttl
per repository, stored in that repository's datadir.public String getNewRepositoryID(String baseName) throws RepositoryException, RepositoryConfigException
baseName
- The String on which the returned ID should be based, must not be null.RepositoryException
RepositoryConfigException
public Set<String> getRepositoryIDs() throws RepositoryException
RepositoryException
public 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 checkRepositoryException
public 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 RepositoryResolver
identity
- A repository ID.RepositoryConfigException
- If no repository could be created due to invalid or incomplete configuration
data.RepositoryException
public 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
RepositoryConfigException
RepositoryException
getInitializedRepositories()
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
RepositoryException
public Collection<RepositoryInfo> getAllUserRepositoryInfos() throws RepositoryException
RepositoryException
public 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 upIOException
public abstract URL getLocation() throws MalformedURLException
MalformedURLException
- If the location cannot be represented as a URL.Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.