Class RemoteRepositoryManager
java.lang.Object
org.eclipse.rdf4j.repository.manager.RepositoryManager
org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager
- All Implemented Interfaces:
HttpClientDependent, RepositoryResolver
A manager for
Repositorys that reside on a remote server. This repository manager allows one to access
repositories over HTTP similar to how local repositories are accessed using the LocalRepositoryManager.- Author:
- Arjohn Kampman
-
Field Summary
Fields inherited from class RepositoryManager
initializedRepositories, logger, NAMESPACE, PROXIED_IDModifier and TypeFieldDescriptionprotected Map<String, Repository> protected final org.slf4j.Loggerstatic final StringDeprecated.static final IRIDeprecated, for removal: This API element is subject to removal in a future version.useCONFIG.Proxy.proxiedIDinstead. -
Constructor Summary
ConstructorsConstructorDescriptionRemoteRepositoryManager(String serverURL) Creates a new RepositoryManager that operates on the specified base directory. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRepositoryConfig(RepositoryConfig config) Adds or updates the configuration of a repository to the manager.protected RepositoryCreates and initializes the repository with the specified ID.Retrieve meta information of all configured repositories.RDF4JHttpClientthat has been assigned or has been used by this object.static RemoteRepositoryManagergetInstance(String serverURL) Creates an initializedRemoteRepositoryManagerwith the specified server URL.static RemoteRepositoryManagergetInstance(String serverURL, String username, String password) Creates an initializedRemoteRepositoryManagerwith the specified server URL and credentials.Gets the URL of the remote server, e.g.Gets the URL of the remote server, e.g.protected SharedHttpClientSessionManagerbooleanremoveRepository(String repositoryID) Removes the specified repository by deleting its configuration if such a configuration is present, and removing any persistent data associated with the repository.voidsetHttpClient(RDF4JHttpClient protocolSession) Should be called beforeRepositoryManager.init().voidsetUsernameAndPassword(String username, String password) Set the username and password for authenication with the remote server.voidshutDown()Shuts down all initialized repositories.Methods inherited from class RepositoryManager
getAllRepositories, getAllRepositoryInfos, getAllUserRepositoryInfos, getInitializedRepositories, getInitializedRepositoryIDs, getModelFactory, getNewRepositoryID, getRepository, getRepositoryIDs, getRepositoryInfo, hasRepositoryConfig, init, isInitialized, isSafeToRemove, refresh, setInitializedRepositories, setModelFactory, updateInitializedRepositoriesModifier and TypeMethodDescriptionReturns all configured repositories.getAllRepositoryInfos(boolean skipSystemRepo) Deprecated.UseRepositoryManager.getAllRepositoryInfos()instead.Deprecated.UseRepositoryManager.getAllRepositoryInfos()instead.Returns all initialized repositories.Returns all initialized repositories.Get theModelFactoryused for creating newModelobjects in the manager.getNewRepositoryID(String baseName) Generates an ID for a new repository based on the specified base name.getRepository(String identity) Gets the repository that is known by the specified ID from this manager.Get the IDs of all available repositories.Gets the repository that is known by the specified ID from this manager.booleanhasRepositoryConfig(String repositoryID) voidinit()Initializes the repository manager.booleanIndicates if this RepositoryManager has been initialized.booleanisSafeToRemove(String repositoryID) Checks on whether the given repository is referred to by aProxyRepositoryconfiguration.voidrefresh()Shuts down all initialized user repositories.protected voidsetInitializedRepositories(Map<String, Repository> nextInitializedRepositories) voidsetModelFactory(ModelFactory modelFactory) Set theModelFactoryto use for creating newModelobjects in the manager.protected void
-
Constructor Details
-
RemoteRepositoryManager
Creates a new RepositoryManager that operates on the specified base directory.- Parameters:
serverURL- The URL of the server.
-
-
Method Details
-
getInstance
Creates an initializedRemoteRepositoryManagerwith the specified server URL.- Throws:
RepositoryException
-
getInstance
public static RemoteRepositoryManager getInstance(String serverURL, String username, String password) throws RepositoryException Creates an initializedRemoteRepositoryManagerwith the specified server URL and credentials.- Throws:
RepositoryException
-
getHttpClient
Description copied from interface:HttpClientDependentRDF4JHttpClientthat 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 whetherRDF4JHttpClientwas passed to or created by this object respectively.- Specified by:
getHttpClientin interfaceHttpClientDependent- Specified by:
getHttpClientin classRepositoryManager- Returns:
- Returns the httpClient passed to
Repositoryconstruction.
-
setHttpClient
Description copied from class:RepositoryManagerShould be called beforeRepositoryManager.init().- Specified by:
setHttpClientin interfaceHttpClientDependent- Specified by:
setHttpClientin classRepositoryManager- Parameters:
protocolSession- The httpClient to use for remote/service calls.
-
shutDown
public void shutDown()Description copied from class:RepositoryManagerShuts down all initialized repositories.- Overrides:
shutDownin classRepositoryManager- See Also:
-
setUsernameAndPassword
-
getLocation
Gets the URL of the remote server, e.g. "http://localhost:8080/rdf4j-server/".- Specified by:
getLocationin classRepositoryManager- Throws:
MalformedURLException- If serverURL cannot be parsed
-
getServerURL
Gets the URL of the remote server, e.g. "http://localhost:8080/rdf4j-server/". -
createRepository
protected Repository createRepository(String id) throws RepositoryConfigException, RepositoryException Creates and initializes the repository with the specified ID.- Specified by:
createRepositoryin classRepositoryManager- Parameters:
id- A repository ID.- Returns:
- The created 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.
-
getRepositoryConfig
- Specified by:
getRepositoryConfigin classRepositoryManager- Throws:
RepositoryException
-
getAllRepositoryInfos
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.
-
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.
-
removeRepository
public boolean removeRepository(String repositoryID) throws RepositoryException, RepositoryConfigException Description copied from class:RepositoryManagerRemoves 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!- Overrides:
removeRepositoryin classRepositoryManager- 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.
-
CONFIG.Proxyinstead.