public interface Repository
Please note that a repository should be shut down before it is discarded/garbage collected. Forgetting the latter can result in loss of data (depending on the Repository implementation)!
Repository implementations are thread-safe unless specifically documented otherwise.
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.
|
ValueFactory |
getValueFactory()
Gets a ValueFactory for this Repository.
|
default void |
init()
Initializes this repository.
|
void |
initialize()
Deprecated.
Use
init() instead. |
boolean |
isInitialized()
Indicates if the Repository has been initialized.
|
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 |
shutDown()
Shuts the repository down, releasing any resources that it keeps hold of.
|
void setDataDir(File dataDir)
dataDir
- the directory where data for this repository is storedFile getDataDir()
@Deprecated void initialize() throws RepositoryException
init()
instead.RepositoryException
- If the initialization failed.default void init() throws RepositoryException
RepositoryException
- If the initialization failed.boolean isInitialized()
void shutDown() throws RepositoryException
RepositoryException
boolean isWritable() throws RepositoryException
RepositoryException
RepositoryConnection getConnection() throws RepositoryException
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.RepositoryException
- If something went wrong during the creation of the Connection.ValueFactory getValueFactory()
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.