aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IEngineContext.java
blob: 55060853641db46c5589018665bfdb328031364f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
 * Copyright (c) 2010-2014, Bergmann Gabor, Istvan Rath and Daniel Varro
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-v20.html.
 * 
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
package tools.refinery.viatra.runtime.api.scope;

import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException;
import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext;

/**
 * The context of the engine is instantiated by the scope, 
 * and provides information and services regarding the model the towards the engine.  
 * 
 * @author Bergmann Gabor
 *
 */
public interface IEngineContext {
    
    /**
     * Returns the base index. 
     * @throws ViatraQueryRuntimeException if the base index cannot be accessed 
     */	
    IBaseIndex getBaseIndex();

    /**
     * Disposes this context object. Resources in the index may now be freed up.
     * No more methods should be called after this one.
     * 
     * @throws IllegalStateException if there are any active listeners to the underlying index
     */
    void dispose();

    /**
     * Provides instance model information for pattern matching.
     * 
     * <p> Implementors note: must be reentrant. 
     * If called while index loading is already in progress, must return the single runtime context instance that will eventually index the model. 
     * When the runtime query context is invoked in such a case, incomplete indexes are tolerable, but change notifications must be correctly provided as loading commences. 
     * 
     * @return a runtime context for pattern matching
     * @since 1.2
     * @throws ViatraQueryRuntimeException if the runtime context cannot be initialized
     */
    public IQueryRuntimeContext getQueryRuntimeContext();
}