Interface NotifyingRepository
- All Superinterfaces:
Repository
- All Known Implementing Classes:
NotifyingRepositoryWrapper
- Author:
- Herko ter Horst
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers a RepositoryConnectionListener that will receive notifications of operations that are performed on anyinvalid input: '<' connections that are created by this repository.void
addRepositoryListener
(RepositoryListener listener) Registers a RepositoryListener that will receive notifications of operations that are performed on this repository.Opens a connection to this repository that can be used for querying and updating the contents of the repository.void
Removes a registered RepositoryConnectionListener from this repository.void
removeRepositoryListener
(RepositoryListener listener) Removes a registered RepositoryListener from this repository.Methods inherited from interface org.eclipse.rdf4j.repository.Repository
getDataDir, getValueFactory, init, isInitialized, isWritable, setDataDir, shutDown
-
Method Details
-
addRepositoryListener
Registers a RepositoryListener that will receive notifications of operations that are performed on this repository. -
removeRepositoryListener
Removes a registered RepositoryListener from this repository. -
addRepositoryConnectionListener
Registers a RepositoryConnectionListener that will receive notifications of operations that are performed on anyinvalid input: '<' connections that are created by this repository. -
removeRepositoryConnectionListener
Removes a registered RepositoryConnectionListener from this repository. -
getConnection
Opens 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-finally-block as follows: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 ownRepositoryConnection
s.- Specified by:
getConnection
in interfaceRepository
- Returns:
- A connection that allows operations on this repository.
- Throws:
RepositoryException
- If something went wrong during the creation of the Connection.
-