|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.sail.helpers.SailConnectionWrapper
org.openrdf.sail.helpers.SynchronizedSailConnection
public class SynchronizedSailConnection
Wrapper class offering synchronization functionality for SailConnection implementations. This wrapper enforces two things:
close() are exclusive. No other thread can call this
method, nor any other method at the same time.
| Constructor Summary | |
|---|---|
SynchronizedSailConnection(SailConnection wrappedCon)
|
|
| Method Summary | |
|---|---|
void |
addStatement(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Adds a statement to each context in the specified contexts. |
void |
clearNamespaces()
Removes all namespace declarations from the repository. |
void |
close()
Closes the connection. |
void |
commit()
Commits any updates that have been performed since the last time SailConnection.commit() or SailConnection.rollback() was called. |
Cursor<? extends BindingSet> |
evaluate(QueryModel query,
BindingSet bindings,
boolean includeInferred)
Evaluates the supplied TupleExpr on the data contained in this Sail object, using the (optional) dataset and supplied bindings as input parameters. |
Cursor<? extends Resource> |
getContextIDs()
Returns the set of all unique context identifiers that are used to store statements. |
protected Lock |
getExclusiveConnectionLock()
|
String |
getNamespace(String prefix)
Gets the namespace that is mapped to the specified prefix. |
Cursor<? extends Namespace> |
getNamespaces()
Gets the namespaces relevant to the data contained in this Sail object. |
protected Lock |
getSharedConnectionLock()
|
Cursor<? extends Statement> |
getStatements(Resource subj,
URI pred,
Value obj,
boolean includeInferred,
Resource... contexts)
Gets all statements from the specified contexts that have a specific subject, predicate and/or object. |
protected Lock |
getTransactionLock()
|
void |
removeNamespace(String prefix)
Removes a namespace declaration by removing the association between a prefix and a namespace name. |
void |
removeStatements(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Removes all statements matching the specified subject, predicate and object from the repository. |
void |
rollback()
Rolls back the SailConnection, discarding any uncommitted changes that have been made in this SailConnection. |
void |
setNamespace(String prefix,
String name)
Sets the prefix of a namespace. |
long |
size(Resource subj,
URI pred,
Value obj,
boolean includeInferred,
Resource... contexts)
Returns the number of statements matching the specified pattern. |
| Methods inherited from class org.openrdf.sail.helpers.SailConnectionWrapper |
|---|
begin, getDelegate, getTransactionIsolation, getValueFactory, isAutoCommit, isOpen, isReadOnly, setReadOnly, setTransactionIsolation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SynchronizedSailConnection(SailConnection wrappedCon)
| Method Detail |
|---|
public void close()
throws StoreException
SailConnection
close in interface SailConnectionclose in class SailConnectionWrapperStoreExceptionpublic Cursor<? extends BindingSet> evaluate(QueryModel query, BindingSet bindings, boolean includeInferred) throws StoreException
SailConnection
evaluate in interface SailConnectionevaluate in class SailConnectionWrapperbindings - A set of input parameters for the query evaluation. The keys
reference variable names that should be bound to the value they map
to.includeInferred - Indicates whether inferred triples are to be considered in the
query result. If false, no inferred statements are returned; if
true, inferred statements are returned if available
StoreException - If the Sail object encountered an error or unexpected situation
internally.public Cursor<? extends Resource> getContextIDs() throws StoreException
SailConnection
getContextIDs in interface SailConnectiongetContextIDs in class SailConnectionWrapperStoreExceptionpublic Cursor<? extends Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws StoreException
SailConnection
getStatements in interface SailConnectiongetStatements in class SailConnectionWrappersubj - A Resource specifying the subject, or null for a wildcard.pred - A URI specifying the predicate, or null for a wildcard.obj - A Value specifying the object, or null for a wildcard.includeInferred - if false, no inferred statements are returned; if true, inferred
statements are returned if availablecontexts - The context(s) to get 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.
StoreException - If the Sail object encountered an error or unexpected situation
internally.public long size(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws StoreException
SailConnection
size in interface SailConnectionsize in class SailConnectionWrappersubj - A Resource specifying the subject, or null for a wildcard.pred - A URI specifying the predicate, or null for a wildcard.obj - A Value specifying the object, or null for a wildcard.includeInferred - Indicates whether inferred statements should be counted.contexts - The context(s) to get 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.
StoreException
public void commit()
throws StoreException
SailConnectionSailConnection.commit() or SailConnection.rollback() was called.
commit in interface SailConnectioncommit in class SailConnectionWrapperStoreException - If the SailConnection could not be committed, or if the connection
does not have an active connection.
public void rollback()
throws StoreException
SailConnection
rollback in interface SailConnectionrollback in class SailConnectionWrapperStoreException - If the SailConnection could not be rolled back, or if the
connection does not have an active connection.public void addStatement(Resource subj, URI pred, Value obj, Resource... contexts) throws StoreException
SailConnection
addStatement in interface SailConnectionaddStatement in class SailConnectionWrappersubj - The subject of the statement to add.pred - The predicate of the statement to add.obj - The object of the statement to add.contexts - The context(s) to add the statement to. Note that this parameter is
a vararg and as such is optional. If no contexts are supplied the
method operates on the entire repository.
StoreException - If the statement could not be added.public void removeStatements(Resource subj, URI pred, Value obj, Resource... contexts) throws StoreException
SailConnection
removeStatements in interface SailConnectionremoveStatements in class SailConnectionWrappersubj - The subject of the statement that should be removed, or
null to indicate a wildcard.pred - The predicate of the statement that should be removed, or
null to indicate a wildcard.obj - The object of the statement that should be removed , or
null to indicate a wildcard. *contexts - The context(s) from which to remove the statement. Note that this
parameter is a vararg and as such is optional. If no contexts are
supplied the method operates on the entire repository.
StoreException - If the statement could not be removed.public Cursor<? extends Namespace> getNamespaces() throws StoreException
SailConnection
getNamespaces in interface SailConnectiongetNamespaces in class SailConnectionWrapperStoreException - If the Sail object encountered an error or unexpected situation
internally.public String getNamespace(String prefix) throws StoreException
SailConnection
getNamespace in interface SailConnectiongetNamespace in class SailConnectionWrapperprefix - A namespace prefix.
StoreExceptionpublic void setNamespace(String prefix, String name) throws StoreException
SailConnection
setNamespace in interface SailConnectionsetNamespace in class SailConnectionWrapperprefix - The new prefix.name - The namespace name that the prefix maps to.
StoreExceptionpublic void removeNamespace(String prefix) throws StoreException
SailConnection
removeNamespace in interface SailConnectionremoveNamespace in class SailConnectionWrapperprefix - The namespace prefix of which the assocation with a namespace name
is to be removed.
StoreException - If the namespace prefix could not be removed.
public void clearNamespaces()
throws StoreException
SailConnection
clearNamespaces in interface SailConnectionclearNamespaces in class SailConnectionWrapperStoreException - If the namespaces could not be removed.protected Lock getSharedConnectionLock() throws StoreException
StoreExceptionprotected Lock getExclusiveConnectionLock() throws StoreException
StoreExceptionprotected Lock getTransactionLock() throws StoreException
StoreException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||