Class RepositoryWrapper
- java.lang.Object
-
- org.eclipse.rdf4j.repository.base.RepositoryWrapper
-
- All Implemented Interfaces:
DelegatingRepository,Repository
- Direct Known Subclasses:
ContextAwareRepository,DatasetRepository,FedXRepositoryWrapper,InterceptingRepositoryWrapper,NotifyingRepositoryWrapper
public class RepositoryWrapper extends Object implements DelegatingRepository
ADelegatingRepositoryimplementation that, by default, forwards all method calls to its delegate.- Author:
- Herko ter Horst, Arjohn Kampman
-
-
Constructor Summary
Constructors Constructor Description RepositoryWrapper()Creates a new RepositoryWrapper.RepositoryWrapper(Repository delegate)Creates a new RepositoryWrapper and callssetDelegate(Repository)with the supplied delegate repository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RepositoryConnectiongetConnection()Opens a connection to this repository that can be used for querying and updating the contents of the repository.FilegetDataDir()Get the directory where data and logging for this repository is stored.RepositorygetDelegate()ValueFactorygetValueFactory()Gets a ValueFactory for this Repository.voidinit()Initializes this repository.booleanisInitialized()Indicates if the Repository has been initialized.booleanisWritable()Checks whether this repository is writable, i.e.voidsetDataDir(File dataDir)Set the directory where data and logging for this repository is stored.voidsetDelegate(Repository delegate)voidshutDown()Shuts the repository down, releasing any resources that it keeps hold of.StringtoString()
-
-
-
Constructor Detail
-
RepositoryWrapper
public RepositoryWrapper()
Creates a new RepositoryWrapper.
-
RepositoryWrapper
public RepositoryWrapper(Repository delegate)
Creates a new RepositoryWrapper and callssetDelegate(Repository)with the supplied delegate repository.
-
-
Method Detail
-
setDelegate
public void setDelegate(Repository delegate)
- Specified by:
setDelegatein interfaceDelegatingRepository
-
getDelegate
public Repository getDelegate()
- Specified by:
getDelegatein interfaceDelegatingRepository
-
setDataDir
public void setDataDir(File dataDir)
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
public File 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.
-
shutDown
public void shutDown() throws RepositoryExceptionDescription copied from interface:RepositoryShuts the repository down, releasing any resources that it keeps hold of. Once shut down, the repository can no longer be used until it is re-initialized.- Specified by:
shutDownin interfaceRepository- Throws:
RepositoryException
-
isWritable
public boolean isWritable() throws RepositoryExceptionDescription 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
public RepositoryConnection getConnection() throws RepositoryException
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 thatRepositoryConnectionis 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
public ValueFactory getValueFactory()
Description copied from interface:RepositoryGets a ValueFactory for this Repository.- Specified by:
getValueFactoryin interfaceRepository- Returns:
- A repository-specific ValueFactory.
-
isInitialized
public boolean isInitialized()
Description copied from interface:RepositoryIndicates if the Repository has been initialized. Note that the initialization status may change if the Repository is shut down.- Specified by:
isInitializedin interfaceRepository- Returns:
- true iff the repository has been initialized.
-
init
public void init() throws RepositoryExceptionDescription copied from interface:RepositoryInitializes this repository. A repository needs to be initialized before it can be used, however explicitly calling this method is not necessary: the repository will automatically initialize itself if an operation is executed on it that requires it to be initialized.- Specified by:
initin interfaceRepository- Throws:
RepositoryException- If the initialization failed.
-
-