Interface NotifyingRepository
-
- All Superinterfaces:
Repository
- All Known Implementing Classes:
NotifyingRepositoryWrapper
public interface NotifyingRepository extends Repository
- Author:
- Herko ter Horst
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addRepositoryConnectionListener(RepositoryConnectionListener listener)
Registers a RepositoryConnectionListener that will receive notifications of operations that are performed on any< 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.NotifyingRepositoryConnection
getConnection()
Opens a connection to this repository that can be used for querying and updating the contents of the repository.void
removeRepositoryConnectionListener(RepositoryConnectionListener listener)
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 Detail
-
addRepositoryListener
void addRepositoryListener(RepositoryListener listener)
Registers a RepositoryListener that will receive notifications of operations that are performed on this repository.
-
removeRepositoryListener
void removeRepositoryListener(RepositoryListener listener)
Removes a registered RepositoryListener from this repository.
-
addRepositoryConnectionListener
void addRepositoryConnectionListener(RepositoryConnectionListener listener)
Registers a RepositoryConnectionListener that will receive notifications of operations that are performed on any< connections that are created by this repository.
-
removeRepositoryConnectionListener
void removeRepositoryConnectionListener(RepositoryConnectionListener listener)
Removes a registered RepositoryConnectionListener from this repository.
-
getConnection
NotifyingRepositoryConnection getConnection() throws RepositoryException
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.
-
-