]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.impl/src/org/simantics/db/impl/ClusterSupport.java
Disabled BOOKKEEPING flag for normal use
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / ClusterSupport.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;
13
14 import java.io.InputStream;
15
16 import org.simantics.db.Session;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.db.service.ClusterUID;
19
20 public interface ClusterSupport {
21
22     /**
23      * For cluster's constructor to get short cluster id for the lifetime of cluster in question.
24      *
25      * @param clusterUID
26      * @param clusterId
27      * @return
28      */
29     int createClusterKeyByClusterUID(ClusterUID clusterUID, long clusterId);
30
31     ClusterBase getClusterByClusterUIDOrMake(ClusterUID clusterUID);
32     ClusterBase getClusterByClusterId(long clusterId);
33     ClusterBase getClusterByClusterKey(int clusterKey);
34     int getClusterKeyByClusterUIDOrMake(ClusterUID clusterUID);
35     int getClusterKeyByClusterUIDOrMake(long id1, long id2);
36     /**
37      * @param resourceKey
38      * @return cluster owning the given resource.
39      */
40     ClusterBase getClusterByResourceKey(int resourceKey);
41
42     long getClusterIdOrCreate(ClusterUID clusterUID);
43
44     void addStatement(Object cluster);
45     void cancelStatement(Object cluster);
46     void removeStatement(Object cluster);
47     void cancelValue(Object cluster);
48     void removeValue(Object cluster);
49     void setValue(Object cluster, long clusterId, byte[] bytes, int length);
50     void modiValue(Object cluster, long clusterId, long voffset, int length, byte[] bytes, int offset);
51     void setImmutable(Object cluster, boolean immutable);
52     void setDeleted(Object cluster, boolean deleted);
53     void createResource(Object cluster, short resourceIndex, long clusterId);
54     void addStatementIndex(Object cluster, int resourceKey, ClusterUID clusterUID, byte op);
55     void setStreamOff(boolean setOff);
56     boolean getStreamOff();
57
58     InputStream getValueStreamEx(int resourceIndex, long clusterId)
59     throws DatabaseException;
60     byte[] getValueEx(int resourceIndex, long clusterId)
61     throws DatabaseException;
62     byte[] getValueEx(int resourceIndex, long clusterId, long voffset, int length)
63     throws DatabaseException;
64     long getValueSizeEx(int resourceIndex, long clusterId)
65     throws DatabaseException;
66     int wait4RequestsLess(int limit)
67     throws DatabaseException;
68
69     Session getSession();
70     IClusterTable getClusterTable();
71
72 }