public class ProxyRepository extends AbstractRepository implements RepositoryResolverClient
Repository implementation that takes a
RepositoryResolver instance and the id of a managed repository, and delegate all
calls through to the given repository.
The purpose is to allow Sails to refer to other local repositories using a unique
identifier without having to go through an HTTP layer.
The implementation is independent of DelegatingRepository so that it is freed
from having to provide implementation details in its configuration data. Instead, it only has to provide an
unambiguous local identifier to the proxy.
logger| Constructor and Description |
|---|
ProxyRepository() |
ProxyRepository(RepositoryResolver resolver,
String proxiedIdentity)
Creates a repository instance that proxies to the given repository.
|
ProxyRepository(String proxiedIdentity)
Creates a repository instance that proxies to a repository of the give ID.
|
| Modifier and Type | Method and Description |
|---|---|
RepositoryConnection |
getConnection()
Opens a connection to this repository that can be used for querying and updating the contents of the repository.
|
File |
getDataDir()
Get the directory where data and logging for this repository is stored.
|
String |
getProxiedIdentity() |
ValueFactory |
getValueFactory()
Gets a ValueFactory for this Repository.
|
protected void |
initializeInternal() |
boolean |
isWritable()
Checks whether this repository is writable, i.e.
|
void |
setDataDir(File dataDir)
Set the directory where data and logging for this repository is stored.
|
void |
setProxiedIdentity(String value) |
void |
setRepositoryResolver(RepositoryResolver resolver) |
protected void |
shutDownInternal() |
init, initialize, isInitialized, shutDownpublic ProxyRepository()
public ProxyRepository(String proxiedIdentity)
proxiedIdentity - id of the proxied repositorypublic ProxyRepository(RepositoryResolver resolver, String proxiedIdentity)
resolver - manager that the proxied repository is associated withproxiedIdentity - id of the proxied repositorypublic final void setProxiedIdentity(String value)
public String getProxiedIdentity()
public final void setRepositoryResolver(RepositoryResolver resolver)
setRepositoryResolver in interface RepositoryResolverClientpublic void setDataDir(File dataDir)
RepositorysetDataDir in interface RepositorydataDir - the directory where data for this repository is storedpublic File getDataDir()
RepositorygetDataDir in interface Repositorypublic boolean isWritable()
throws RepositoryException
RepositoryisWritable in interface RepositoryRepositoryExceptionpublic RepositoryConnection getConnection() throws RepositoryException
Repository
try (RepositoryConnection conn = repository.getConnection()) {
// perform operations on the connection
}
Note that RepositoryConnection is not guaranteed to be thread-safe! The recommended pattern for
repository access in a multi-threaded application is to share the Repository object between threads, but have
each thread create and use its own RepositoryConnections.getConnection in interface RepositoryRepositoryException - If something went wrong during the creation of the Connection.public ValueFactory getValueFactory()
RepositorygetValueFactory in interface Repositoryprotected void initializeInternal()
throws RepositoryException
initializeInternal in class AbstractRepositoryRepositoryExceptionprotected void shutDownInternal()
throws RepositoryException
shutDownInternal in class AbstractRepositoryRepositoryExceptionCopyright © 2015-2021 Eclipse Foundation. All Rights Reserved.