|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.sail.helpers.SailBase
org.openrdf.sail.helpers.NotifyingSailBase
org.openrdf.sail.memory.MemoryStore
public class MemoryStore
An implementation of the Sail interface that stores its data in main memory and that can use a file for persistent storage. This Sail implementation supports single, isolated transactions. This means that changes to the data are not visible until a transaction is committed and that concurrent transactions are not possible. When another transaction is active, calls to startTransaction() will block until the active transaction is committed or rolled back.
| Field Summary | |
|---|---|
protected static String |
DATA_FILE_NAME
|
protected static String |
SYNC_FILE_NAME
|
| Fields inherited from class org.openrdf.sail.helpers.SailBase |
|---|
connectionTimeOut, DEFAULT_CONNECTION_TIMEOUT, logger |
| Constructor Summary | |
|---|---|
MemoryStore()
Creates a new MemoryStore. |
|
MemoryStore(File dataDir)
Creates a new persistent MemoryStore. |
|
| Method Summary | ||
|---|---|---|
protected Statement |
addStatement(Resource subj,
URI pred,
Value obj,
Resource context,
boolean explicit)
|
|
protected void |
cancelSyncTask()
|
|
protected void |
cancelSyncTimer()
|
|
protected void |
cleanSnapshots()
Removes statements from old snapshots from the main statement list and resets the snapshot to 1 for the rest of the statements. |
|
protected void |
commit()
|
|
protected
|
createStatementIterator(Class<X> excClass,
Resource subj,
URI pred,
Value obj,
boolean explicitOnly,
int snapshot,
ReadMode readMode,
Resource... contexts)
Creates a StatementIterator that contains the statements matching the specified pattern of subject, predicate, object, context. |
|
protected NotifyingSailConnection |
getConnectionInternal()
returns a store-specific SailConnection object. |
|
protected int |
getCurrentSnapshot()
|
|
protected org.openrdf.sail.memory.MemNamespaceStore |
getNamespaceStore()
|
|
boolean |
getPersist()
|
|
protected MemStatementList |
getStatements()
|
|
protected Lock |
getStatementsReadLock()
|
|
long |
getSyncDelay()
Gets the currently configured sync delay. |
|
protected Lock |
getTransactionLock()
|
|
MemValueFactory |
getValueFactory()
Gets a ValueFactory object that can be used to create URI-, blank node-, literal- and statement objects. |
|
void |
initialize()
Initializes this repository. |
|
protected boolean |
isInitialized()
Checks whether the Sail has been initialized. |
|
boolean |
isWritable()
Checks whether this Sail object is writable. |
|
protected boolean |
removeStatement(MemStatement st,
boolean explicit)
|
|
protected void |
rollback()
|
|
protected void |
scheduleSnapshotCleanup()
|
|
protected void |
scheduleSyncTask()
|
|
void |
setDataDir(File dataDir)
|
|
void |
setPersist(boolean persist)
|
|
void |
setSyncDelay(long syncDelay)
Sets the time (in milliseconds) to wait after a transaction was commited before writing the changed data to file. |
|
protected void |
shutDownInternal()
Do store-specific operations to ensure proper shutdown of the store. |
|
protected int |
size()
|
|
protected void |
startTransaction()
|
|
void |
sync()
Synchronizes the contents of this repository with the data that is stored on disk. |
|
| Methods inherited from class org.openrdf.sail.helpers.NotifyingSailBase |
|---|
addSailChangedListener, getConnection, notifySailChanged, removeSailChangedListener |
| Methods inherited from class org.openrdf.sail.helpers.SailBase |
|---|
connectionClosed, debugEnabled, getDataDir, shutDown |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.openrdf.sail.Sail |
|---|
getDataDir, shutDown |
| Field Detail |
|---|
protected static final String DATA_FILE_NAME
protected static final String SYNC_FILE_NAME
| Constructor Detail |
|---|
public MemoryStore()
public MemoryStore(File dataDir)
dataDir - the data directory to be used for persistence.| Method Detail |
|---|
public void setDataDir(File dataDir)
setDataDir in interface SailsetDataDir in class SailBasepublic void setPersist(boolean persist)
public boolean getPersist()
public void setSyncDelay(long syncDelay)
The default value for this parameter is 0 (immediate synchronization).
syncDelay - The sync delay in milliseconds.public long getSyncDelay()
setSyncDelay(long)
public void initialize()
throws SailException
SailException - when initialization of the store failed.protected final boolean isInitialized()
protected void shutDownInternal()
throws SailException
SailBase
shutDownInternal in class SailBaseSailExceptionpublic boolean isWritable()
protected NotifyingSailConnection getConnectionInternal()
throws SailException
SailBase
getConnectionInternal in class NotifyingSailBaseSailExceptionpublic MemValueFactory getValueFactory()
Sail
protected org.openrdf.sail.memory.MemNamespaceStore getNamespaceStore()
protected MemStatementList getStatements()
protected int getCurrentSnapshot()
protected Lock getStatementsReadLock()
throws SailException
SailException
protected Lock getTransactionLock()
throws SailException
SailExceptionprotected int size()
protected <X extends Exception> CloseableIteration<MemStatement,X> createStatementIterator(Class<X> excClass,
Resource subj,
URI pred,
Value obj,
boolean explicitOnly,
int snapshot,
ReadMode readMode,
Resource... contexts)
protected Statement addStatement(Resource subj,
URI pred,
Value obj,
Resource context,
boolean explicit)
throws SailException
SailException
protected boolean removeStatement(MemStatement st,
boolean explicit)
throws SailException
SailException
protected void startTransaction()
throws SailException
SailException
protected void commit()
throws SailException
SailException
protected void rollback()
throws SailException
SailException
protected void scheduleSyncTask()
throws SailException
SailExceptionprotected void cancelSyncTask()
protected void cancelSyncTimer()
public void sync()
throws SailException
SailException
protected void cleanSnapshots()
throws InterruptedException
InterruptedExceptionprotected void scheduleSnapshotCleanup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||