public class SimpleRuntimeContext extends TabularRuntimeContext
Usage: first, instantiate IIndexTable tables with this as the 'tableContext' argument, and call
TabularRuntimeContext.registerIndexTable(IIndexTable) manually to register them. Afterwards, they will be visible to the query
backends.
EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same.
| Constructor and Description |
|---|
SimpleRuntimeContext(IQueryMetaContext metaContext) |
| Modifier and Type | Method and Description |
|---|---|
<V> V |
coalesceTraversals(java.util.concurrent.Callable<V> callable)
The given callable will be executed, and all model traversals will be delayed until the execution is done.
|
void |
ensureIndexed(IInputKey key,
IndexingService service)
If the given (enumerable) input key is not yet indexed, the model will be traversed
(after the end of the outermost coalescing block, see
IQueryRuntimeContext.coalesceTraversals(Callable))
so that the index can be built. |
void |
ensureWildcardIndexing(IndexingService service)
Starts wildcard indexing for the given service.
|
void |
executeAfterTraversal(java.lang.Runnable runnable)
Execute the given runnable after traversal.
|
IQueryMetaContext |
getMetaContext()
Provides metamodel-specific info independent of the runtime instance model.
|
boolean |
isCoalescing() |
protected boolean |
isContainedInStatelessKey(IInputKey key,
ITuple seed)
Handles non-enumerable input keys that are not backed by a table
|
boolean |
isIndexed(IInputKey key,
IndexingService service)
Returns true if index is available for the given key providing the given service.
|
void |
logError(java.lang.String message)
Indicates that an error has occurred in maintaining an index table, e.g.
|
java.lang.Object |
unwrapElement(java.lang.Object internalElement)
Unwraps the internal representation of the element into its original form
|
Tuple |
unwrapTuple(Tuple internalElements)
Unwraps the tuple of internal representations of elements into their original forms
|
java.lang.Object |
wrapElement(java.lang.Object externalElement)
Wraps the external element into the internal representation that is to be used by the query backend
|
Tuple |
wrapTuple(Tuple externalElements)
Unwraps the tuple of elements into the internal representation that is to be used by the query backend
|
addUpdateListener, containsTuple, countTuples, enumerateTuples, enumerateValues, estimateCardinality, getIndexTable, handleUnregisteredTableRequest, peekIndexTable, registerIndexTable, removeUpdateListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitestimateAverageBucketSizepublic SimpleRuntimeContext(IQueryMetaContext metaContext)
public void logError(java.lang.String message)
ITableContextpublic IQueryMetaContext getMetaContext()
IQueryRuntimeContextpublic <V> V coalesceTraversals(java.util.concurrent.Callable<V> callable)
throws java.lang.reflect.InvocationTargetException
IQueryRuntimeContextCalls may be nested. A single coalesced traversal will happen at the end of the outermost call.
Caution: results returned by the runtime context may be incomplete during the coalescing period, to be corrected by notifications sent during the final coalesced traversal.
For example, if a certain input key is not cached yet, an empty relation may be reported during callable.call(); the cache will be constructed after the call terminates and notifications will deliver the entire content of the relation.
Non-incremental query backends should therefore never enumerate input keys while coalesced (verify using IQueryRuntimeContext.isCoalescing()).
java.lang.reflect.InvocationTargetExceptionpublic boolean isCoalescing()
IQueryRuntimeContext.coalesceTraversals(Callable)).public boolean isIndexed(IInputKey key, IndexingService service)
IQueryRuntimeContextpublic void ensureIndexed(IInputKey key, IndexingService service)
IQueryRuntimeContextIQueryRuntimeContext.coalesceTraversals(Callable))
so that the index can be built. It is possible that the base indexer will select a higher indexing level merging
multiple indexing requests to an appropriate level.
Postcondition: After invoking this method, #getIndexed(IInputKey, IndexingService) for the same key
and service will be guaranteed to return the requested or a highing indexing level as soon as IQueryRuntimeContext.isCoalescing() first returns false.
Precondition: the given key is enumerable, see IQueryMetaContext.isEnumerable(IInputKey).
public java.lang.Object wrapElement(java.lang.Object externalElement)
IQueryRuntimeContextmodel element -> internal object.
null must be mapped to null.
public java.lang.Object unwrapElement(java.lang.Object internalElement)
IQueryRuntimeContextinternal object -> model element
null must be mapped to null.
public Tuple wrapTuple(Tuple externalElements)
IQueryRuntimeContextmodel elements -> internal objects
null must be mapped to null.
public Tuple unwrapTuple(Tuple internalElements)
IQueryRuntimeContextinternal objects -> model elements
null must be mapped to null.
public void ensureWildcardIndexing(IndexingService service)
IQueryRuntimeContextIndexingService.
a previously set wildcard level cannot be lowered, only extended.public void executeAfterTraversal(java.lang.Runnable runnable)
throws java.lang.reflect.InvocationTargetException
IQueryRuntimeContextjava.lang.reflect.InvocationTargetExceptionprotected boolean isContainedInStatelessKey(IInputKey key, ITuple seed)
TabularRuntimeContextisContainedInStatelessKey in class TabularRuntimeContext