Package org.eclipse.rdf4j.sail.base
Class DelegatingSailSource
- java.lang.Object
-
- org.eclipse.rdf4j.sail.base.DelegatingSailSource
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,SailClosable
,SailSource
class DelegatingSailSource extends java.lang.Object implements SailSource
A wrapper around anSailSource
that can suppress the call toclose()
. This is useful when the a shared branch is sometimes to be used and other times a dedicated branch is to be used.
-
-
Field Summary
Fields Modifier and Type Field Description private SailSource
delegate
private boolean
releasing
-
Constructor Summary
Constructors Constructor Description DelegatingSailSource(SailSource delegate, boolean closing)
Wraps thisSailSource
, delegating all calls to it unlessclosing
is false, in which caseclose()
will not be delegated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this resource, relinquishing any underlying resources.SailDataset
dataset(IsolationLevel level)
Create an observableSailDataset
of the current state of thisSailSource
.void
flush()
Apply all the changes to this branch to the backingSailSource
, if applicable.SailSource
fork()
Creates a new branch of this source.void
prepare()
Check the consistency of this branch and throws aSailConflictException
ifSailSource.flush()
ing this branch would cause the backingSailSource
to be inconsistent, if applicable.SailSink
sink(IsolationLevel level)
Create aSailSink
that when when itsSailSource.flush()
is called, the changes are applied to this source.java.lang.String
toString()
-
-
-
Field Detail
-
delegate
private final SailSource delegate
-
releasing
private final boolean releasing
-
-
Constructor Detail
-
DelegatingSailSource
public DelegatingSailSource(SailSource delegate, boolean closing)
Wraps thisSailSource
, delegating all calls to it unlessclosing
is false, in which caseclose()
will not be delegated.- Parameters:
delegate
-closing
- ifclose()
should be delegated
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
close
public void close() throws SailException
Description copied from interface:SailClosable
Closes this resource, relinquishing any underlying resources.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceSailClosable
- Throws:
SailException
- if this resource cannot be closed
-
fork
public SailSource fork()
Description copied from interface:SailSource
Creates a new branch of this source. When it'sSailSource.flush()
is called the changes are applied to this backing source.- Specified by:
fork
in interfaceSailSource
- Returns:
- a branched
SailSource
.
-
prepare
public void prepare() throws SailException
Description copied from interface:SailSource
Check the consistency of this branch and throws aSailConflictException
ifSailSource.flush()
ing this branch would cause the backingSailSource
to be inconsistent, if applicable. If this is the final backingSailSource
calling this method has no effect.- Specified by:
prepare
in interfaceSailSource
- Throws:
SailException
-
flush
public void flush() throws SailException
Description copied from interface:SailSource
Apply all the changes to this branch to the backingSailSource
, if applicable. If this is the final backingSailSource
calling this method has no effect.- Specified by:
flush
in interfaceSailSource
- Throws:
SailException
-
sink
public SailSink sink(IsolationLevel level) throws SailException
Description copied from interface:SailSource
Create aSailSink
that when when itsSailSource.flush()
is called, the changes are applied to this source.- Specified by:
sink
in interfaceSailSource
- Parameters:
level
- If this level is compatible withIsolationLevels.SERIALIZABLE
then aSailSink.prepare()
can throw aSailConflictException
.- Returns:
- Newly created
SailSink
- Throws:
SailException
-
dataset
public SailDataset dataset(IsolationLevel level) throws SailException
Description copied from interface:SailSource
Create an observableSailDataset
of the current state of thisSailSource
. Repeatedly calling with methods withIsolationLevels.SNAPSHOT
(or higher) isolation levels will result inSailDataset
s that are all derived from the same state of the backingSailSource
(if applicable), that is the only difference between the states of theSailDataset
will be from changes using thisSailSource.sink(IsolationLevel)
.- Specified by:
dataset
in interfaceSailSource
- Parameters:
level
- If this is compatible withIsolationLevels.SNAPSHOT_READ
the resultingSailDataset
will observe a single state of thisSailSource
.- Returns:
- an
SailDataset
of the current state - Throws:
SailException
-
-