public class RemoteRepositoryManager extends RepositoryManager
Repository
s 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
.initializedRepositories, logger
Constructor and Description |
---|
RemoteRepositoryManager(String serverURL)
Creates a new RepositoryManager that operates on the specified base
directory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUpRepository(String repositoryID)
Clean up a removed repository.
|
protected Repository |
createRepository(String id)
Creates and initializes the repository with the specified ID.
|
protected Repository |
createSystemRepository() |
Collection<RepositoryInfo> |
getAllRepositoryInfos(boolean skipSystemRepo) |
org.apache.http.client.HttpClient |
getHttpClient()
HttpClient that has been assigned or has been used by this object. |
static RemoteRepositoryManager |
getInstance(String serverURL)
Creates an initialized
RemoteRepositoryManager with the specified
server URL. |
static RemoteRepositoryManager |
getInstance(String serverURL,
String username,
String password)
Creates an initialized
RemoteRepositoryManager with the specified
server URL and credentials. |
URL |
getLocation()
Gets the URL of the remote server, e.g.
|
RepositoryInfo |
getRepositoryInfo(String id)
Gets the repository that is known by the specified ID from this manager.
|
String |
getServerURL()
Gets the URL of the remote server, e.g.
|
protected SesameClient |
getSesameClient() |
void |
initialize()
Initializes the repository manager.
|
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.
|
void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Should be called before
RepositoryManager.initialize() . |
void |
setUsernameAndPassword(String username,
String password)
Set the username and password for authenication with the remote server.
|
void |
shutDown()
Shuts down all initialized repositories, including the SYSTEM repository.
|
addRepositoryConfig, getAllRepositories, getAllRepositoryInfos, getAllUserRepositoryInfos, getInitializedRepositories, getInitializedRepositoryIDs, getNewRepositoryID, getRepository, getRepositoryConfig, getRepositoryIDs, getSystemRepository, hasRepositoryConfig, isInitialized, isSafeToRemove, refresh, removeRepositoryConfig, setInitializedRepositories, updateInitializedRepositories
public RemoteRepositoryManager(String serverURL)
serverURL
- The URL of the server.public static RemoteRepositoryManager getInstance(String serverURL) throws RepositoryException
RemoteRepositoryManager
with the specified
server URL.RepositoryException
public static RemoteRepositoryManager getInstance(String serverURL, String username, String password) throws RepositoryException
RemoteRepositoryManager
with the specified
server URL and credentials.RepositoryException
protected SesameClient getSesameClient()
public 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
getHttpClient
in class RepositoryManager
Repository
construction.public void setHttpClient(org.apache.http.client.HttpClient httpClient)
RepositoryManager
RepositoryManager.initialize()
.setHttpClient
in interface HttpClientDependent
setHttpClient
in class RepositoryManager
httpClient
- The httpClient to use for remote/service calls.public void initialize() throws RepositoryException
RepositoryManager
initialize
in class RepositoryManager
RepositoryException
- If the manager failed to initialize the SYSTEM repository.public void shutDown()
RepositoryManager
shutDown
in class RepositoryManager
RepositoryManager.refresh()
public void setUsernameAndPassword(String username, String password)
username
- the usernamepassword
- the passwordprotected Repository createSystemRepository() throws RepositoryException
createSystemRepository
in class RepositoryManager
RepositoryException
public URL getLocation() throws MalformedURLException
getLocation
in class RepositoryManager
MalformedURLException
- If serverURL cannot be parsedpublic String getServerURL()
protected Repository createRepository(String id) throws RepositoryConfigException, RepositoryException
createRepository
in class RepositoryManager
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
RepositoryManager
getRepositoryInfo
in class RepositoryManager
id
- A repository ID.RepositoryException
- When not able to retrieve existing configurationspublic Collection<RepositoryInfo> getAllRepositoryInfos(boolean skipSystemRepo) throws RepositoryException
getAllRepositoryInfos
in class RepositoryManager
RepositoryException
- When not able to retrieve existing configurationspublic boolean removeRepository(String repositoryID) throws RepositoryException, RepositoryConfigException
RepositoryManager
removeRepository
in class RepositoryManager
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.protected void cleanUpRepository(String repositoryID) throws IOException
RepositoryManager
cleanUpRepository
in class RepositoryManager
repositoryID
- the ID of the repository to clean upIOException
Copyright © 2001-2016 Aduna. All Rights Reserved.