public class IncQueryEngineManager
extends java.lang.Object
Manages an IncQueryEngine
for each model (more precisely scope), that is created on demand. Managed engines are shared between
clients querying the same model.
It is also possible to create private, unmanaged engines that are not shared between clients.
Only weak references are retained on the managed engines. So if there are no other references to the matchers or the engine, they can eventually be GC'ed, and they won't block the model from being GC'ed either.
Modifier and Type | Method and Description |
---|---|
void |
addIncQueryEngineInitializationListener(IncQueryEngineInitializationListener listener)
Registers a listener for new engine initialization.
|
java.util.Set<IncQueryEngine> |
getExistingIncQueryEngines()
Collects all
IncQueryEngine instances that still exist. |
IncQueryEngine |
getIncQueryEngine(IncQueryScope scope)
Creates a managed IncQuery engine at a given scope (e.g.
|
IncQueryEngine |
getIncQueryEngineIfExists(IncQueryScope scope)
Retrieves an already existing managed IncQuery engine.
|
static IncQueryEngineManager |
getInstance() |
void |
removeIncQueryEngineInitializationListener(IncQueryEngineInitializationListener listener)
Removes a registered listener added with
addIncQueryEngineInitializationListener(org.eclipse.incquery.runtime.api.IncQueryEngineInitializationListener) |
public static IncQueryEngineManager getInstance()
public IncQueryEngine getIncQueryEngine(IncQueryScope scope) throws IncQueryException
EMFScope
)
or retrieves an already existing one. Repeated invocations for a single model root will return the same engine.
Consequently, the engine will be reused between different clients querying the same model, providing performance benefits.
The match set of any patterns will be incrementally refreshed upon updates from this scope.
scope
- the scope of query evaluation; the definition of the set of model elements that this engine is operates on.
Provide e.g. a EMFScope
for evaluating queries on an EMF model.IncQueryException
public IncQueryEngine getIncQueryEngineIfExists(IncQueryScope scope)
scope
- the scope of query evaluation; the definition of the set of model elements that this engine is operates on.
Provide e.g. a EMFScope
for evaluating queries on an EMF model.public java.util.Set<IncQueryEngine> getExistingIncQueryEngines()
IncQueryEngine
instances that still exist.public void addIncQueryEngineInitializationListener(IncQueryEngineInitializationListener listener)
removeIncQueryEngineInitializationListener(org.eclipse.incquery.runtime.api.IncQueryEngineInitializationListener)
listener
- the listener to registerpublic void removeIncQueryEngineInitializationListener(IncQueryEngineInitializationListener listener)
addIncQueryEngineInitializationListener(org.eclipse.incquery.runtime.api.IncQueryEngineInitializationListener)
listener
-