]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteSupport.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / graph / WriteSupport.java
diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteSupport.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteSupport.java
new file mode 100644 (file)
index 0000000..5e17579
--- /dev/null
@@ -0,0 +1,82 @@
+/*******************************************************************************\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.graph;\r
+\r
+import org.simantics.db.MetadataI;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.VirtualGraph;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.exception.ServiceException;\r
+import org.simantics.db.request.Write;\r
+import org.simantics.db.request.WriteOnly;\r
+import org.simantics.db.request.WriteResult;\r
+import org.simantics.db.request.WriteTraits;\r
+import org.simantics.db.service.ByteReader;\r
+\r
+public interface WriteSupport extends MetadataI {\r
+    \r
+    void claim(VirtualGraph provider, int subject, int predicate, int object)\r
+    throws ServiceException;\r
+\r
+    void claim(VirtualGraph provider, Resource subject, Resource predicate, Resource object)\r
+    throws ServiceException;\r
+\r
+    boolean removeStatement(VirtualGraph provider, Resource subject, Resource predicate, Resource object)\r
+    throws ServiceException;\r
+    \r
+    void claimValue(VirtualGraph provider, int resource, byte[] value, int length) throws DatabaseException;\r
+    void claimValue(VirtualGraph provider, Resource resource, byte[] value) throws DatabaseException;\r
+    void claimValue(VirtualGraph provider, Resource resource, ByteReader reader, int amount) throws DatabaseException;\r
+    \r
+    void denyValue(VirtualGraph provider, Resource resource) throws ServiceException;\r
+\r
+    void setValue(VirtualGraph provider, Resource resource, byte[] value) throws ServiceException;\r
+    \r
+    Resource createResource(VirtualGraph provider)\r
+    throws DatabaseException;\r
+    \r
+    Resource createResource(VirtualGraph provider, long clusterId)\r
+    throws DatabaseException;\r
+\r
+    Resource createResource(VirtualGraph provider, Resource clusterSet)\r
+    throws DatabaseException;\r
+\r
+    void createClusterSet(VirtualGraph provider, Resource clusterSet)\r
+    throws DatabaseException;\r
+\r
+    boolean hasClusterSet(VirtualGraph provider, Resource clusterSet)\r
+    throws ServiceException;\r
+\r
+    Resource setDefaultClusterSet(Resource clusterSet)\r
+    throws ServiceException;\r
+\r
+    void performWriteRequest(WriteGraph graph, Write request) throws DatabaseException;    \r
+    <T> T performWriteRequest(WriteGraph graph, WriteResult<T> request) throws DatabaseException;    \r
+    void performWriteRequest(WriteGraph graph, WriteOnly request) throws DatabaseException;    \r
+    \r
+    boolean writeOnly();\r
+\r
+    void flush(boolean intermediate);\r
+    void flushCluster();\r
+    void flushCluster(Resource r);\r
+\r
+    void gc();\r
+    \r
+    void commitDone(WriteTraits writeTraits, long csid);\r
+    void clearUndoList(WriteTraits writeTraits);\r
+    void startUndo();\r
+    /**\r
+     * @return size of meta data before clearing.\r
+     */\r
+    int clearMetadata();\r
+}\r