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 anSailSourcethat 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 SailSourcedelegateprivate booleanreleasing
-
Constructor Summary
Constructors Constructor Description DelegatingSailSource(SailSource delegate, boolean closing)Wraps thisSailSource, delegating all calls to it unlessclosingis false, in which caseclose()will not be delegated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this resource, relinquishing any underlying resources.SailDatasetdataset(IsolationLevel level)Create an observableSailDatasetof the current state of thisSailSource.voidflush()Apply all the changes to this branch to the backingSailSource, if applicable.SailSourcefork()Creates a new branch of this source.voidprepare()Check the consistency of this branch and throws aSailConflictExceptionifSailSource.flush()ing this branch would cause the backingSailSourceto be inconsistent, if applicable.SailSinksink(IsolationLevel level)Create aSailSinkthat when when itsSailSource.flush()is called, the changes are applied to this source.java.lang.StringtoString()
-
-
-
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 unlessclosingis false, in which caseclose()will not be delegated.- Parameters:
delegate-closing- ifclose()should be delegated
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
close
public void close() throws SailExceptionDescription copied from interface:SailClosableCloses this resource, relinquishing any underlying resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceSailClosable- Throws:
SailException- if this resource cannot be closed
-
fork
public SailSource fork()
Description copied from interface:SailSourceCreates a new branch of this source. When it'sSailSource.flush()is called the changes are applied to this backing source.- Specified by:
forkin interfaceSailSource- Returns:
- a branched
SailSource.
-
prepare
public void prepare() throws SailExceptionDescription copied from interface:SailSourceCheck the consistency of this branch and throws aSailConflictExceptionifSailSource.flush()ing this branch would cause the backingSailSourceto be inconsistent, if applicable. If this is the final backingSailSourcecalling this method has no effect.- Specified by:
preparein interfaceSailSource- Throws:
SailException
-
flush
public void flush() throws SailExceptionDescription copied from interface:SailSourceApply all the changes to this branch to the backingSailSource, if applicable. If this is the final backingSailSourcecalling this method has no effect.- Specified by:
flushin interfaceSailSource- Throws:
SailException
-
sink
public SailSink sink(IsolationLevel level) throws SailException
Description copied from interface:SailSourceCreate aSailSinkthat when when itsSailSource.flush()is called, the changes are applied to this source.- Specified by:
sinkin interfaceSailSource- Parameters:
level- If this level is compatible withIsolationLevels.SERIALIZABLEthen aSailSink.prepare()can throw aSailConflictException.- Returns:
- Newly created
SailSink - Throws:
SailException
-
dataset
public SailDataset dataset(IsolationLevel level) throws SailException
Description copied from interface:SailSourceCreate an observableSailDatasetof the current state of thisSailSource. Repeatedly calling with methods withIsolationLevels.SNAPSHOT(or higher) isolation levels will result inSailDatasets that are all derived from the same state of the backingSailSource(if applicable), that is the only difference between the states of theSailDatasetwill be from changes using thisSailSource.sink(IsolationLevel).- Specified by:
datasetin interfaceSailSource- Parameters:
level- If this is compatible withIsolationLevels.SNAPSHOT_READthe resultingSailDatasetwill observe a single state of thisSailSource.- Returns:
- an
SailDatasetof the current state - Throws:
SailException
-
-