]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QuerySupport.java
Multiple reader thread support for db client
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / query / QuerySupport.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.impl.query;
13
14 import java.io.InputStream;
15
16 import org.simantics.db.Resource;
17 import org.simantics.db.Session;
18 import org.simantics.db.VirtualGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.db.exception.ResourceNotFoundException;
21 import org.simantics.db.impl.graph.ReadGraphImpl;
22
23 public interface QuerySupport extends ResourceTranslator {
24
25         Session getSession();
26         
27         boolean isImmutable(int id);
28         long getClusterId(int id);
29         int getId(Resource resource);
30         Resource getResource(int id);
31         
32     boolean resume(ReadGraphImpl graph);
33         void dirtyPrimitives();
34         void aboutToRead();
35         
36         int getSingleInstance(int subject);
37         int getSingleSuperrelation(int subject);
38         int getFunctionalObject(int subject, int predicate);
39         boolean getObjects(ReadGraphImpl graph, int subject, int predicate, IntProcedure procedure) throws DatabaseException;
40     
41         org.simantics.db.DirectStatements getStatements(ReadGraphImpl graph, final int subject, QueryProcessor processor, boolean ignoreVirtual);
42     
43     void getPredicates(ReadGraphImpl graph, int subject, IntProcedure procedure) throws DatabaseException;
44     byte[] getValue(ReadGraphImpl graph, int resource);
45     InputStream getValueStream(ReadGraphImpl graph, int resource);
46     
47     void requestCluster(ReadGraphImpl graph, long clusterId, Runnable r);
48     
49     void ensureLoaded(final ReadGraphImpl graph, final int subject, final int predicate);
50     void ensureLoaded(final ReadGraphImpl graph, final int subject);
51     boolean isLoaded(int subject);
52     
53         int getBuiltin(String uri);
54
55         @Deprecated // Use SerialisationSupport instead
56         int getRandomAccessReference(String id) throws ResourceNotFoundException;
57
58     void checkTasks();
59     void ceased(int thread);
60     Object getLock();
61     
62     VirtualGraph getProvider(int subject, int predicate, int object);
63     VirtualGraph getProvider(int subject, int predicate);
64     VirtualGraph getValueProvider(int subject);
65     
66     void exit(Throwable t);
67     
68 }