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