public class InterceptingRepositoryConnectionWrapper extends RepositoryConnectionWrapper implements InterceptingRepositoryConnection
InterceptingRepositoryWrapper
logger
Constructor and Description |
---|
InterceptingRepositoryConnectionWrapper(Repository repository,
RepositoryConnection connection) |
Modifier and Type | Method and Description |
---|---|
void |
addRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
Registers a RepositoryConnectionInterceptor that will receive notifications of operations that are
performed on this connection.
|
void |
addWithoutCommit(Resource subject,
IRI predicate,
Value object,
Resource... contexts) |
void |
begin()
Begins a new transaction, requiring
RepositoryConnection.commit() or RepositoryConnection.rollback() to be called to end the transaction. |
void |
clear(Resource... contexts)
Removes all statements from a specific contexts in the repository.
|
void |
clearNamespaces()
Removes all namespace declarations from the repository.
|
void |
close()
Closes the connection, freeing resources.
|
void |
commit()
Commits the active transaction.
|
protected boolean |
isDelegatingAdd()
If false then the following add methods will call
RepositoryConnectionWrapper.addWithoutCommit(Resource, IRI, Value, Resource[]) . |
protected boolean |
isDelegatingRemove()
If false then the following remove methods will call
RepositoryConnectionWrapper.removeWithoutCommit(Resource, IRI, Value, Resource[]) . |
Update |
prepareUpdate(QueryLanguage ql,
String update,
String baseURI)
Prepares an Update operation.
|
void |
removeNamespace(String prefix)
Removes a namespace declaration by removing the association between a prefix and a namespace name.
|
void |
removeRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
Removes a registered RepositoryConnectionInterceptor from this connection.
|
void |
removeWithoutCommit(Resource subject,
IRI predicate,
Value object,
Resource... contexts) |
void |
rollback()
Rolls back all updates in the active transaction.
|
void |
setAutoCommit(boolean autoCommit)
Deprecated.
|
void |
setNamespace(String prefix,
String name)
Sets the prefix for a namespace.
|
add, add, add, add, add, add, add, add, begin, exportStatements, exportStatements, getContextIDs, getDelegate, getIsolationLevel, getNamespace, getNamespaces, getStatements, hasStatement, hasStatement, isActive, isAutoCommit, isDelegatingRead, isEmpty, isOpen, prepareBooleanQuery, prepareGraphQuery, prepareQuery, prepareTupleQuery, remove, remove, remove, remove, setDelegate, setIsolationLevel, setParserConfig, size
addWithoutCommit, conditionalCommit, conditionalRollback, export, getParserConfig, getRepository, getValueFactory, prepareBooleanQuery, prepareGraphQuery, prepareQuery, prepareTupleQuery, prepareUpdate, removeWithoutCommit, startLocalTransaction
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, add, add, add, add, add, add, add, add, begin, export, exportStatements, getContextIDs, getIsolationLevel, getNamespace, getNamespaces, getParserConfig, getRepository, getStatements, getStatements, getStatements, getValueFactory, hasStatement, hasStatement, hasStatement, isActive, isAutoCommit, isEmpty, isOpen, prepareBooleanQuery, prepareBooleanQuery, prepareBooleanQuery, prepareGraphQuery, prepareGraphQuery, prepareGraphQuery, prepareQuery, prepareQuery, prepareQuery, prepareTupleQuery, prepareTupleQuery, prepareTupleQuery, prepareUpdate, prepareUpdate, remove, remove, remove, remove, remove, remove, setIsolationLevel, setParserConfig, size
public InterceptingRepositoryConnectionWrapper(Repository repository, RepositoryConnection connection)
public void addRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
addRepositoryConnectionInterceptor
in interface InterceptingRepositoryConnection
public void removeRepositoryConnectionInterceptor(RepositoryConnectionInterceptor interceptor)
removeRepositoryConnectionInterceptor
in interface InterceptingRepositoryConnection
protected boolean isDelegatingAdd()
RepositoryConnectionWrapper
RepositoryConnectionWrapper.addWithoutCommit(Resource, IRI, Value, Resource[])
.isDelegatingAdd
in class RepositoryConnectionWrapper
true
to delegate add methods, false
to call
RepositoryConnectionWrapper.addWithoutCommit(Resource, IRI, Value, Resource[])
RepositoryConnectionWrapper.add(Iterable, Resource...)
,
RepositoryConnectionWrapper.add(Iteration, Resource...)
,
RepositoryConnectionWrapper.add(Statement, Resource...)
,
RepositoryConnectionWrapper.add(File, String, RDFFormat, Resource...)
,
RepositoryConnectionWrapper.add(InputStream, String, RDFFormat, Resource...)
,
RepositoryConnectionWrapper.add(Reader, String, RDFFormat, Resource...)
,
RepositoryConnectionWrapper.add(Resource, IRI, Value, Resource...)
,
RepositoryConnectionWrapper.add(URL, String, RDFFormat, Resource...)
protected boolean isDelegatingRemove()
RepositoryConnectionWrapper
RepositoryConnectionWrapper.removeWithoutCommit(Resource, IRI, Value, Resource[])
.isDelegatingRemove
in class RepositoryConnectionWrapper
true
to delegate remove methods, false
to call
RepositoryConnectionWrapper.removeWithoutCommit(Resource, IRI, Value, Resource...)
RepositoryConnectionWrapper.clear(Resource...)
,
RepositoryConnectionWrapper.remove(Iterable, Resource...)
,
RepositoryConnectionWrapper.remove(Iteration, Resource...)
,
RepositoryConnectionWrapper.remove(Statement, Resource...)
,
RepositoryConnectionWrapper.remove(Resource, IRI, Value, Resource...)
public void addWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException
addWithoutCommit
in class RepositoryConnectionWrapper
RepositoryException
public void clear(Resource... contexts) throws RepositoryException
RepositoryConnection
clear
in interface RepositoryConnection
clear
in class RepositoryConnectionWrapper
contexts
- The context(s) to remove the data from. Note that this parameter is a vararg and as such is
optional. If no contexts are supplied the method operates on the entire repository.RepositoryException
- If the statements could not be removed from the repository, for example because the
repository is not writable.public void begin() throws RepositoryException
RepositoryConnection
RepositoryConnection.commit()
or RepositoryConnection.rollback()
to be called to end the transaction.
The transaction will use the currently set isolation level
for this connection.begin
in interface RepositoryConnection
begin
in class RepositoryConnectionWrapper
RepositoryException
- If the connection could not start the transaction. One possible reason this may
happen is if a transaction is already active
on the current
connection.RepositoryConnection.begin(IsolationLevel)
,
RepositoryConnection.isActive()
,
RepositoryConnection.commit()
,
RepositoryConnection.rollback()
,
RepositoryConnection.setIsolationLevel(IsolationLevel)
public void close() throws RepositoryException
RepositoryConnection
transaction
is active
on the
connection, all non-committed operations will be lost by actively calling RepositoryConnection.rollback()
on any active
transactions.
Implementation note: All implementations must override this method if they have any resources that they need to free.
close
in interface AutoCloseable
close
in interface RepositoryConnection
close
in class RepositoryConnectionWrapper
RepositoryException
- If the connection could not be closed.public void commit() throws RepositoryException
RepositoryConnection
commit
in interface RepositoryConnection
commit
in class RepositoryConnectionWrapper
UnknownTransactionStateException
- if the transaction state can not be determined. This can happen for
instance when communication with a repository fails or times out.RepositoryException
- If the connection could not be committed, or if the connection does not
have an active transaction.RepositoryConnection.isActive()
,
RepositoryConnection.begin()
,
RepositoryConnection.rollback()
public void removeWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException
removeWithoutCommit
in class RepositoryConnectionWrapper
RepositoryException
public void removeNamespace(String prefix) throws RepositoryException
RepositoryConnection
removeNamespace
in interface RepositoryConnection
removeNamespace
in class RepositoryConnectionWrapper
prefix
- The namespace prefix, or an empty string in case of the default namespace.RepositoryException
- If the namespace prefix could not be removed.public void clearNamespaces() throws RepositoryException
RepositoryConnection
clearNamespaces
in interface RepositoryConnection
clearNamespaces
in class RepositoryConnectionWrapper
RepositoryException
- If the namespace declarations could not be removed.public void rollback() throws RepositoryException
RepositoryConnection
rollback
in interface RepositoryConnection
rollback
in class RepositoryConnectionWrapper
UnknownTransactionStateException
- if the transaction state can not be determined. This can happen for
instance when communication with a repository fails or times out.RepositoryException
- If the transaction could not be rolled back, or if the connection does
not have an active transaction.RepositoryConnection.isActive()
,
RepositoryConnection.begin()
,
RepositoryConnection.commit()
@Deprecated public void setAutoCommit(boolean autoCommit) throws RepositoryException
RepositoryConnection
RepositoryConnection.commit()
or RepositoryConnection.rollback()
. By default, new connections are in
auto-commit mode.
NOTE: If this connection is switched to auto-commit mode during a transaction, the transaction is committed.
setAutoCommit
in interface RepositoryConnection
setAutoCommit
in class RepositoryConnectionWrapper
RepositoryException
- In case the mode switch failed, for example because a currently active transaction
failed to commit.RepositoryConnection.commit()
public void setNamespace(String prefix, String name) throws RepositoryException
RepositoryConnection
setNamespace
in interface RepositoryConnection
setNamespace
in class RepositoryConnectionWrapper
prefix
- The new prefix, or an empty string in case of the default namespace.name
- The namespace name that the prefix maps to.RepositoryException
- If the namespace could not be set in the repository, for example because the
repository is not writable.public Update prepareUpdate(QueryLanguage ql, String update, String baseURI) throws MalformedQueryException, RepositoryException
RepositoryConnection
prepareUpdate
in interface RepositoryConnection
prepareUpdate
in class RepositoryConnectionWrapper
ql
- The query language
in which the update operation is formulated.update
- The update operation string.baseURI
- The base URI to resolve any relative URIs that are in the update against, can be null if
the update does not contain any relative URIs.Update
ready to be executed on this RepositoryConnection
.MalformedQueryException
- If the supplied update operation string is malformed.RepositoryException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.