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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.graph.db;
\r
14 import java.io.Closeable;
\r
15 import java.io.DataInput;
\r
16 import java.util.TreeMap;
\r
18 import org.simantics.databoard.binding.mutable.Variant;
\r
19 import org.simantics.databoard.container.DataContainer;
\r
20 import org.simantics.databoard.type.Datatype;
\r
21 import org.simantics.db.ReadGraph;
\r
22 import org.simantics.graph.representation.Identity;
\r
23 import org.simantics.graph.representation.Value;
\r
26 * NOTE: Current constraints
\r
28 * ยง1 The following methods shall be called exactly once in the following order:
\r
31 * -getStatementCount
\r
38 public interface TransferableGraphSource extends Closeable {
\r
40 public static final byte TAG_RAW_COPY_VARIANT_VALUE = 1;
\r
41 public static final byte TAG_POTENTIALLY_MODIFIED_VARIANT_VALUE = 2;
\r
43 @FunctionalInterface
\r
44 public interface TransferableGraphSourceProcedure<T> {
\r
45 void execute(T value) throws Exception;
\r
48 public interface TransferableGraphSourceValueProcedure {
\r
49 void execute(int resource, Datatype type, DataInput input) throws Exception;
\r
50 void rawCopy(int resource, int length, DataInput input) throws Exception;
\r
53 public DataContainer getHeader() throws Exception;
\r
55 public TreeMap<String, Variant> getExtensions() throws Exception;
\r
57 public int getResourceCount() throws Exception;
\r
59 public int getIdentityCount() throws Exception;
\r
60 public void forIdentities(ReadGraph graph, TransferableGraphSourceProcedure<Identity> procedure) throws Exception;
\r
62 public int getStatementCount() throws Exception;
\r
63 public void forStatements(ReadGraph graph, TransferableGraphSourceProcedure<int[]> procedure) throws Exception;
\r
65 public int getValueCount() throws Exception;
\r
66 public void forValues(ReadGraph graph, TransferableGraphSourceProcedure<Value> procedure) throws Exception;
\r
67 public void forValues2(ReadGraph graph, TransferableGraphSourceValueProcedure procedure) throws Exception;
\r
69 public void reset() throws Exception;
\r