Package org.intermine.objectstore.safe
Class ObjectStoreSafeImpl
- java.lang.Object
-
- org.intermine.objectstore.ObjectStorePassthruImpl
-
- org.intermine.objectstore.safe.ObjectStoreSafeImpl
-
- All Implemented Interfaces:
ObjectStore
public class ObjectStoreSafeImpl extends ObjectStorePassthruImpl
Provides a safe implementation of an objectstore - that is, an implementation that works correctly if passed a Query object that has been modified since being used previously.- Author:
- Matthew Wakeling
-
-
Field Summary
-
Fields inherited from class org.intermine.objectstore.ObjectStorePassthruImpl
os
-
Fields inherited from interface org.intermine.objectstore.ObjectStore
SEQUENCE_IGNORE
-
-
Constructor Summary
Constructors Constructor Description ObjectStoreSafeImpl(ObjectStore os)
Creates an instance, from another ObjectStore instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
count(Query q, java.util.Map<java.lang.Object,java.lang.Integer> sequence)
Counts the number of rows the query will produceResultsInfo
estimate(Query q)
Explain a Query (give estimate for execution time and number of rows).Results
execute(Query q)
Execute a Query on this ObjectStoreResults
execute(Query q, int batchSize, boolean optimise, boolean explain, boolean prefetch)
Execute a Query on this ObjectStorejava.util.List<ResultsRow<java.lang.Object>>
execute(Query q, int start, int limit, boolean optimise, boolean explain, java.util.Map<java.lang.Object,java.lang.Integer> sequence)
Execute a Query on this ObjectStore, asking for a certain range of rows to be returned.SingletonResults
executeSingleton(Query q)
Execute a Query on this ObjectStore, returning a SingletonResultsSingletonResults
executeSingleton(Query q, int batchSize, boolean optimise, boolean explain, boolean prefetch)
Execute a Query on this ObjectStore, returning a SingletonResultsjava.lang.String
toString()
-
Methods inherited from class org.intermine.objectstore.ObjectStorePassthruImpl
cacheObjectById, createClob, createObjectStoreBag, flushObjectById, getComponentsForQuery, getMaxLimit, getMaxOffset, getMaxTime, getModel, getNewWriter, getObjectByExample, getObjectById, getObjectById, getObjectsByExample, getObjectsByIds, getSequence, getSerial, invalidateObjectById, isMultiConnection, pilferObjectById, prefetchObjectById
-
-
-
-
Constructor Detail
-
ObjectStoreSafeImpl
public ObjectStoreSafeImpl(ObjectStore os)
Creates an instance, from another ObjectStore instance.- Parameters:
os
- an ObjectStore object to use
-
-
Method Detail
-
execute
public Results execute(Query q)
Execute a Query on this ObjectStore- Specified by:
execute
in interfaceObjectStore
- Overrides:
execute
in classObjectStorePassthruImpl
- Parameters:
q
- the Query to execute- Returns:
- the results of the Query
-
execute
public Results execute(Query q, int batchSize, boolean optimise, boolean explain, boolean prefetch)
Execute a Query on this ObjectStore- Specified by:
execute
in interfaceObjectStore
- Overrides:
execute
in classObjectStorePassthruImpl
- Parameters:
q
- the Query to executebatchSize
- the batch size to initialise the Results object withoptimise
- whether to optimise queriesexplain
- whether to explain queriesprefetch
- whether to use the PrefetchManager- Returns:
- the results of the Query
-
executeSingleton
public SingletonResults executeSingleton(Query q)
Execute a Query on this ObjectStore, returning a SingletonResults- Specified by:
executeSingleton
in interfaceObjectStore
- Overrides:
executeSingleton
in classObjectStorePassthruImpl
- Parameters:
q
- the Query to execute- Returns:
- the results of the Query
-
executeSingleton
public SingletonResults executeSingleton(Query q, int batchSize, boolean optimise, boolean explain, boolean prefetch)
Execute a Query on this ObjectStore, returning a SingletonResults- Specified by:
executeSingleton
in interfaceObjectStore
- Overrides:
executeSingleton
in classObjectStorePassthruImpl
- Parameters:
q
- the Query to executebatchSize
- the batch size to initialise the Results object withoptimise
- whether to optimise queriesexplain
- whether to explain queriesprefetch
- whether to use the PrefetchManager- Returns:
- the results of the Query
-
execute
public java.util.List<ResultsRow<java.lang.Object>> execute(Query q, int start, int limit, boolean optimise, boolean explain, java.util.Map<java.lang.Object,java.lang.Integer> sequence) throws ObjectStoreException
Execute a Query on this ObjectStore, asking for a certain range of rows to be returned. This will usually only be called by the Results object returned fromexecute(Query q)
.- Specified by:
execute
in interfaceObjectStore
- Overrides:
execute
in classObjectStorePassthruImpl
- Parameters:
q
- the Query to executestart
- the start rowlimit
- the maximum number of rows to returnoptimise
- true if it is expected that optimising the query will improve performanceexplain
- true if the ObjectStore should enforce maximum query running time constraintssequence
- an object representing the state of the database corresponding to when the action that resulted in this execute was started. This number must match the ObjectStore's internal sequence number or a DataChangedException is thrown. The sequence number is incremented each time the data in the objectstore is changed- Returns:
- a List of ResultRows
- Throws:
ObjectStoreException
- if an error occurs during the running of the Query
-
estimate
public ResultsInfo estimate(Query q) throws ObjectStoreException
Explain a Query (give estimate for execution time and number of rows).- Specified by:
estimate
in interfaceObjectStore
- Overrides:
estimate
in classObjectStorePassthruImpl
- Parameters:
q
- the query to estimate rows for- Returns:
- parsed results of EXPLAIN
- Throws:
ObjectStoreException
- if an error occurs explaining the query
-
count
public int count(Query q, java.util.Map<java.lang.Object,java.lang.Integer> sequence) throws ObjectStoreException
Counts the number of rows the query will produce- Specified by:
count
in interfaceObjectStore
- Overrides:
count
in classObjectStorePassthruImpl
- Parameters:
q
- InterMine Query on which to count rowssequence
- an object representing the state of the database corresponding to when the action that resulted in this execute was started. This number must match the ObjectStore's internal sequence number or a DataChangedException is thrown. The sequence number is incremented each time the data in the objectstore is changed- Returns:
- the number of rows that will be produced by query
- Throws:
ObjectStoreException
- if an error occurs counting the query
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-