]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/IndexedRelations.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / genericrelation / IndexedRelations.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.layer0.genericrelation;
13
14 import java.util.Collection;
15 import java.util.List;
16 import java.util.Map;
17
18 import org.eclipse.core.runtime.IProgressMonitor;
19 import org.simantics.db.RequestProcessor;
20 import org.simantics.db.Resource;
21 import org.simantics.db.layer0.adapter.GenericRelation;
22
23 /**
24  * TODO: how to use
25  * 
26  * TODO: make a statement about synchronization requirements imposed by the interface
27  * 
28  * TODO: what exceptions are the methods supposed to throw? any checked exceptions?
29  * 
30  * @author Antti Villberg
31  */
32 public interface IndexedRelations {
33
34     /**
35      * @param monitor
36      * @param search
37      * @param session
38      * @param relation
39      * @param input
40      * @param maxResultCount
41      * @return
42      * @throws IndexException
43      */
44     public List<Map<String, Object>> query(IProgressMonitor monitor, String search, RequestProcessor session,
45             Resource relation, Resource input, int maxResultCount) throws IndexException;
46
47     public List<Resource> queryResources(IProgressMonitor monitor, String search, RequestProcessor session,
48             Resource relation, Resource input, int maxResultCount) throws IndexException;
49
50     /**
51      * @param monitor
52      * @param processor
53      * @param relation
54      * @param resource
55      * @param input
56      * @param documents
57      * @throws IndexException
58      */
59     public void insert(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
60             Resource resource, Resource input, Collection<Object[]> documents)
61     throws IndexException;
62
63     /**
64      * @param monitor
65      * @param processor
66      * @param relation
67      * @param resource
68      * @param input
69      * @param key
70      * @param keyValues
71      * @throws IndexException
72      */
73     public void remove(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
74             Resource resource, Resource input, String key, Collection<Object> keyValues)
75     throws IndexException;
76
77     public void removeAll(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
78             Resource resource, Resource input)
79     throws IndexException;
80     
81     /**
82      * @param monitor
83      * @param processor
84      * @param relation
85      * @param resource
86      * @param input
87      * @param key
88      * @param keyValues
89      * @param documents
90      * @throws IndexException
91      */
92     public boolean replace(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
93             Resource resource, Resource input, String key, Collection<Object> keyValues, Collection<Object[]> documents)
94     throws IndexException;
95
96     public void reset(IProgressMonitor monitor, RequestProcessor processor, Resource resource, Resource input)
97     throws IndexException;
98
99     public void fullRebuild(IProgressMonitor monitor, RequestProcessor processor) throws IndexException;
100
101 }