--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db.impl;\r
+\r
+import java.io.InputStream;\r
+\r
+import org.simantics.db.Session;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.service.ClusterUID;\r
+\r
+public interface ClusterSupport {\r
+\r
+ /**\r
+ * For cluster's constructor to get short cluster id for the lifetime of cluster in question.\r
+ *\r
+ * @param clusterUID\r
+ * @param clusterId\r
+ * @return\r
+ */\r
+ int createClusterKeyByClusterUID(ClusterUID clusterUID, long clusterId);\r
+\r
+ ClusterBase getClusterByClusterUIDOrMake(ClusterUID clusterUID);\r
+ ClusterBase getClusterByClusterId(long clusterId);\r
+ ClusterBase getClusterByClusterKey(int clusterKey);\r
+ int getClusterKeyByClusterUIDOrMake(ClusterUID clusterUID);\r
+ int getClusterKeyByClusterUIDOrMake(long id1, long id2);\r
+ /**\r
+ * @param resourceKey\r
+ * @return cluster owning the given resource.\r
+ */\r
+ ClusterBase getClusterByResourceKey(int resourceKey);\r
+\r
+ long getClusterIdOrCreate(ClusterUID clusterUID);\r
+\r
+ void addStatement(Object cluster);\r
+ void cancelStatement(Object cluster);\r
+ void removeStatement(Object cluster);\r
+ void cancelValue(Object cluster);\r
+ void removeValue(Object cluster);\r
+ void setValue(Object cluster, long clusterId, byte[] bytes, int length);\r
+ void modiValue(Object cluster, long clusterId, long voffset, int length, byte[] bytes, int offset);\r
+ void setImmutable(Object cluster, boolean immutable);\r
+ void setDeleted(Object cluster, boolean deleted);\r
+ void createResource(Object cluster, short resourceIndex, long clusterId);\r
+ void addStatementIndex(Object cluster, int resourceKey, ClusterUID clusterUID, byte op);\r
+ void setStreamOff(boolean setOff);\r
+ boolean getStreamOff();\r
+\r
+ InputStream getValueStreamEx(int resourceIndex, long clusterId)\r
+ throws DatabaseException;\r
+ byte[] getValueEx(int resourceIndex, long clusterId)\r
+ throws DatabaseException;\r
+ byte[] getValueEx(int resourceIndex, long clusterId, long voffset, int length)\r
+ throws DatabaseException;\r
+ long getValueSizeEx(int resourceIndex, long clusterId)\r
+ throws DatabaseException;\r
+ int wait4RequestsLess(int limit)\r
+ throws DatabaseException;\r
+\r
+ Session getSession();\r
+ IClusterTable getClusterTable();\r
+\r
+}\r