public class ViatraQueryEngineManager
extends java.lang.Object
Manages an ViatraQueryEngine
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.
public static ViatraQueryEngineManager getInstance()
public ViatraQueryEngine getQueryEngine(QueryScope scope) throws ViatraQueryException
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.ViatraQueryException
public ViatraQueryEngine getQueryEngine(QueryScope scope, ViatraQueryEngineOptions options) throws ViatraQueryException
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.ViatraQueryException
public ViatraQueryEngine getQueryEngineIfExists(QueryScope 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<ViatraQueryEngine> getExistingQueryEngines()
ViatraQueryEngine
instances that still exist.public void addQueryEngineInitializationListener(ViatraQueryEngineInitializationListener listener)
removeQueryEngineInitializationListener(org.eclipse.viatra.query.runtime.api.ViatraQueryEngineInitializationListener)
listener
- the listener to registerpublic void removeQueryEngineInitializationListener(ViatraQueryEngineInitializationListener listener)
addQueryEngineInitializationListener(org.eclipse.viatra.query.runtime.api.ViatraQueryEngineInitializationListener)
listener
- protected void notifyInitializationListeners(AdvancedViatraQueryEngine engine)
engine
- the initialized engine