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 Sail
s 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, shutDown
public 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 RepositoryResolverClient
public void setDataDir(File dataDir)
Repository
setDataDir
in interface Repository
dataDir
- the directory where data for this repository is storedpublic File getDataDir()
Repository
getDataDir
in interface Repository
public boolean isWritable() throws RepositoryException
Repository
isWritable
in interface Repository
RepositoryException
public 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 RepositoryConnection
s.getConnection
in interface Repository
RepositoryException
- If something went wrong during the creation of the Connection.public ValueFactory getValueFactory()
Repository
getValueFactory
in interface Repository
protected void initializeInternal() throws RepositoryException
initializeInternal
in class AbstractRepository
RepositoryException
protected void shutDownInternal() throws RepositoryException
shutDownInternal
in class AbstractRepository
RepositoryException
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.