--- /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.graph.db;\r
+\r
+import java.io.Closeable;\r
+import java.io.DataInput;\r
+import java.util.TreeMap;\r
+\r
+import org.simantics.databoard.binding.mutable.Variant;\r
+import org.simantics.databoard.container.DataContainer;\r
+import org.simantics.databoard.type.Datatype;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.graph.representation.Identity;\r
+import org.simantics.graph.representation.Value;\r
+\r
+/*\r
+ * NOTE: Current constraints\r
+ * \r
+ * ยง1 The following methods shall be called exactly once in the following order:\r
+ * -getIdentityCount\r
+ * -forIdentities\r
+ * -getStatementCount\r
+ * -forStatements\r
+ * -getValueCount\r
+ * -forValues\r
+ * \r
+ */\r
+\r
+public interface TransferableGraphSource extends Closeable {\r
+\r
+ public static final byte TAG_RAW_COPY_VARIANT_VALUE = 1;\r
+ public static final byte TAG_POTENTIALLY_MODIFIED_VARIANT_VALUE = 2;\r
+\r
+ @FunctionalInterface\r
+ public interface TransferableGraphSourceProcedure<T> {\r
+ void execute(T value) throws Exception;\r
+ }\r
+\r
+ public interface TransferableGraphSourceValueProcedure {\r
+ void execute(int resource, Datatype type, DataInput input) throws Exception;\r
+ void rawCopy(int resource, int length, DataInput input) throws Exception;\r
+ }\r
+\r
+ public DataContainer getHeader() throws Exception;\r
+ \r
+ public TreeMap<String, Variant> getExtensions() throws Exception;\r
+ \r
+ public int getResourceCount() throws Exception;\r
+\r
+ public int getIdentityCount() throws Exception;\r
+ public void forIdentities(ReadGraph graph, TransferableGraphSourceProcedure<Identity> procedure) throws Exception;\r
+\r
+ public int getStatementCount() throws Exception;\r
+ public void forStatements(ReadGraph graph, TransferableGraphSourceProcedure<int[]> procedure) throws Exception;\r
+ \r
+ public int getValueCount() throws Exception;\r
+ public void forValues(ReadGraph graph, TransferableGraphSourceProcedure<Value> procedure) throws Exception;\r
+ public void forValues2(ReadGraph graph, TransferableGraphSourceValueProcedure procedure) throws Exception;\r
+ \r
+ public void reset() throws Exception;\r
+ \r
+}\r