]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/VirtualGraphContext.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / VirtualGraphContext.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db;
13
14 import org.simantics.databoard.binding.Binding;
15 import org.simantics.db.request.Write;
16 import org.simantics.db.request.WriteOnly;
17
18 /**
19  * An interface that VirtualGraphSource can use to manipulate the transient virtual graph.
20  * 
21  * @author Antti Villberg
22  */
23 public interface VirtualGraphContext {
24     
25         /**
26          * Creates a new transient resource.
27          * @return
28          */
29     int newResource(boolean lazy);
30     
31     void finish(int resource);
32     
33     /**
34      * Converts a transient or persistent resource to an integer id.
35      * @param resource
36      * @return
37      */
38     int getIndex(Resource resource);
39     /**
40      * Converts an integer id to a resource.
41      * @param index
42      * @return
43      */
44     Resource getResource(int index);
45     @Deprecated
46     void initialise(Write write);
47     void postModification(AsyncRequestProcessor processor, WriteOnly request);
48     /**
49      * Updates previously given result to getStatements.
50      * @param resource
51      * @param statements
52      */
53     void updateStatements(int resource, int[] statements);
54     /**
55      * Updates previously given result to getValue.
56      * @param resource
57      * @param value
58      * @param binding
59      */
60     void updateValue(int resource, Object value, Binding binding);
61 //    /**
62 //     * Makes a request to persistent graph in getStatements of getValue
63 //     * and updates the results.
64 //     * @param <T>
65 //     * @param read
66 //     * @param procedure
67 //     */
68 //    <T> void pending(AsyncRead<T> read, Procedure<T> procedure);
69
70 }