1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.impl;
14 import java.io.InputStream;
16 import org.simantics.db.Session;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.db.service.ClusterUID;
20 public interface ClusterSupport {
23 * For cluster's constructor to get short cluster id for the lifetime of cluster in question.
29 int createClusterKeyByClusterUID(ClusterUID clusterUID, long clusterId);
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);
38 * @return cluster owning the given resource.
40 ClusterBase getClusterByResourceKey(int resourceKey);
42 long getClusterIdOrCreate(ClusterUID clusterUID);
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();
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;
70 IClusterTable getClusterTable();