Class ProxyRepository
- All Implemented Interfaces:
Repository,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.
- Author:
- Dale Visser
-
Field Summary
Fields inherited from class org.eclipse.rdf4j.repository.base.AbstractRepository
logger -
Constructor Summary
ConstructorsConstructorDescriptionProxyRepository(String proxiedIdentity) Creates a repository instance that proxies to a repository of the give ID.ProxyRepository(RepositoryResolver resolver, String proxiedIdentity) Creates a repository instance that proxies to the given repository. -
Method Summary
Modifier and TypeMethodDescriptionOpens a connection to this repository that can be used for querying and updating the contents of the repository.Get the directory where data and logging for this repository is stored.Gets a ValueFactory for this Repository.protected voidbooleanChecks whether this repository is writable, i.e.voidsetDataDir(File dataDir) Set the directory where data and logging for this repository is stored.final voidsetProxiedIdentity(String value) final voidsetRepositoryResolver(RepositoryResolver resolver) protected voidMethods inherited from class org.eclipse.rdf4j.repository.base.AbstractRepository
init, isInitialized, shutDown
-
Constructor Details
-
ProxyRepository
public ProxyRepository() -
ProxyRepository
Creates a repository instance that proxies to a repository of the give ID.- Parameters:
proxiedIdentity- id of the proxied repository
-
ProxyRepository
Creates a repository instance that proxies to the given repository.- Parameters:
resolver- manager that the proxied repository is associated withproxiedIdentity- id of the proxied repository
-
-
Method Details
-
setProxiedIdentity
-
getProxiedIdentity
-
setRepositoryResolver
- Specified by:
setRepositoryResolverin interfaceRepositoryResolverClient
-
setDataDir
Description copied from interface:RepositorySet the directory where data and logging for this repository is stored.- Specified by:
setDataDirin interfaceRepository- Parameters:
dataDir- the directory where data for this repository is stored
-
getDataDir
Description copied from interface:RepositoryGet the directory where data and logging for this repository is stored.- Specified by:
getDataDirin interfaceRepository- Returns:
- the directory where data for this repository is stored.
-
isWritable
Description copied from interface:RepositoryChecks whether this repository is writable, i.e. if the data contained in this repository can be changed. The writability of the repository is determined by the writability of the Sail that this repository operates on.- Specified by:
isWritablein interfaceRepository- Throws:
RepositoryException
-
getConnection
Description copied from interface:RepositoryOpens a connection to this repository that can be used for querying and updating the contents of the repository. Created connections need to be closed to make sure that any resources they keep hold of are released. The best way to do this is to use a try-with-resources block, as follows:try (RepositoryConnection conn = repository.getConnection()) { // perform operations on the connection }Note that
RepositoryConnectionis 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 ownRepositoryConnections.- Specified by:
getConnectionin interfaceRepository- Returns:
- A connection that allows operations on this repository.
- Throws:
RepositoryException- If something went wrong during the creation of the Connection.
-
getValueFactory
Description copied from interface:RepositoryGets a ValueFactory for this Repository.- Specified by:
getValueFactoryin interfaceRepository- Returns:
- A repository-specific ValueFactory.
-
initializeInternal
- Specified by:
initializeInternalin classAbstractRepository- Throws:
RepositoryException
-
shutDownInternal
- Specified by:
shutDownInternalin classAbstractRepository- Throws:
RepositoryException
-