public class InterceptingRepositoryWrapper extends RepositoryWrapper implements InterceptingRepository
InterceptingRepositoryConnectionWrapper
Constructor and Description |
---|
InterceptingRepositoryWrapper() |
InterceptingRepositoryWrapper(Repository delegate) |
Modifier and Type | Method and Description |
---|---|
void |
addRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
Registers a RepositoryConnectionInterceptor that will receive notifications of operations that are
performed on any connections that are created by this repository.
|
void |
addRepositoryInterceptor(RepositoryInterceptor interceptor)
Registers a RepositoryInterceptor that will receive notifications of operations that are performed on
this repository.
|
InterceptingRepositoryConnection |
getConnection()
Opens a connection to this repository that can be used for querying and updating the contents of the repository.
|
void |
initialize()
Initializes this repository.
|
void |
removeRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
Removes a registered RepositoryConnectionInterceptor from this repository.
|
void |
removeRepositoryInterceptor(RepositoryInterceptor interceptor)
Removes a registered RepositoryInterceptor from this repository.
|
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.
|
getDataDir, getDelegate, getValueFactory, isInitialized, isWritable, setDelegate, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDataDir, getValueFactory, init, isInitialized, isWritable
public InterceptingRepositoryWrapper()
public InterceptingRepositoryWrapper(Repository delegate)
public void addRepositoryInterceptor(RepositoryInterceptor interceptor)
addRepositoryInterceptor
in interface InterceptingRepository
public void removeRepositoryInterceptor(RepositoryInterceptor interceptor)
removeRepositoryInterceptor
in interface InterceptingRepository
public void addRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
addRepositoryConnectionInterceptor
in interface InterceptingRepository
public void removeRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
removeRepositoryConnectionInterceptor
in interface InterceptingRepository
public InterceptingRepositoryConnection getConnection() throws RepositoryException
Repository
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.getConnection
in interface Repository
getConnection
in class RepositoryWrapper
RepositoryException
- If something went wrong during the creation of the Connection.public void initialize() throws RepositoryException
Repository
initialize
in interface Repository
initialize
in class RepositoryWrapper
RepositoryException
- If the initialization failed.public void setDataDir(File dataDir)
Repository
setDataDir
in interface Repository
setDataDir
in class RepositoryWrapper
dataDir
- the directory where data for this repository is storedpublic void shutDown() throws RepositoryException
Repository
shutDown
in interface Repository
shutDown
in class RepositoryWrapper
RepositoryException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.