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.
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() |
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
Connection con = repository.getConnection(); try { // perform operations on the connection } finally { con.close(); }Note that
RepositoryConnection
is not guaranteed to be
thread-safe! The recommended pattern for repository access in a
multithreaded 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 © 2001-2016 Aduna. All Rights Reserved.