]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.impl/src/org/simantics/db/impl/ClusterSupport.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / ClusterSupport.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.impl;\r
13 \r
14 import java.io.InputStream;\r
15 \r
16 import org.simantics.db.Session;\r
17 import org.simantics.db.exception.DatabaseException;\r
18 import org.simantics.db.service.ClusterUID;\r
19 \r
20 public interface ClusterSupport {\r
21 \r
22     /**\r
23      * For cluster's constructor to get short cluster id for the lifetime of cluster in question.\r
24      *\r
25      * @param clusterUID\r
26      * @param clusterId\r
27      * @return\r
28      */\r
29     int createClusterKeyByClusterUID(ClusterUID clusterUID, long clusterId);\r
30 \r
31     ClusterBase getClusterByClusterUIDOrMake(ClusterUID clusterUID);\r
32     ClusterBase getClusterByClusterId(long clusterId);\r
33     ClusterBase getClusterByClusterKey(int clusterKey);\r
34     int getClusterKeyByClusterUIDOrMake(ClusterUID clusterUID);\r
35     int getClusterKeyByClusterUIDOrMake(long id1, long id2);\r
36     /**\r
37      * @param resourceKey\r
38      * @return cluster owning the given resource.\r
39      */\r
40     ClusterBase getClusterByResourceKey(int resourceKey);\r
41 \r
42     long getClusterIdOrCreate(ClusterUID clusterUID);\r
43 \r
44     void addStatement(Object cluster);\r
45     void cancelStatement(Object cluster);\r
46     void removeStatement(Object cluster);\r
47     void cancelValue(Object cluster);\r
48     void removeValue(Object cluster);\r
49     void setValue(Object cluster, long clusterId, byte[] bytes, int length);\r
50     void modiValue(Object cluster, long clusterId, long voffset, int length, byte[] bytes, int offset);\r
51     void setImmutable(Object cluster, boolean immutable);\r
52     void setDeleted(Object cluster, boolean deleted);\r
53     void createResource(Object cluster, short resourceIndex, long clusterId);\r
54     void addStatementIndex(Object cluster, int resourceKey, ClusterUID clusterUID, byte op);\r
55     void setStreamOff(boolean setOff);\r
56     boolean getStreamOff();\r
57 \r
58     InputStream getValueStreamEx(int resourceIndex, long clusterId)\r
59     throws DatabaseException;\r
60     byte[] getValueEx(int resourceIndex, long clusterId)\r
61     throws DatabaseException;\r
62     byte[] getValueEx(int resourceIndex, long clusterId, long voffset, int length)\r
63     throws DatabaseException;\r
64     long getValueSizeEx(int resourceIndex, long clusterId)\r
65     throws DatabaseException;\r
66     int wait4RequestsLess(int limit)\r
67     throws DatabaseException;\r
68 \r
69     Session getSession();\r
70     IClusterTable getClusterTable();\r
71 \r
72 }\r