]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/WriteSupport.java
Disabled BOOKKEEPING flag for normal use
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / graph / WriteSupport.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.impl.graph;
13
14 import org.simantics.db.MetadataI;
15 import org.simantics.db.Resource;
16 import org.simantics.db.VirtualGraph;
17 import org.simantics.db.WriteGraph;
18 import org.simantics.db.exception.DatabaseException;
19 import org.simantics.db.exception.ServiceException;
20 import org.simantics.db.request.Write;
21 import org.simantics.db.request.WriteOnly;
22 import org.simantics.db.request.WriteResult;
23 import org.simantics.db.request.WriteTraits;
24 import org.simantics.db.service.ByteReader;
25
26 public interface WriteSupport extends MetadataI {
27     
28     void claim(VirtualGraph provider, int subject, int predicate, int object)
29     throws ServiceException;
30
31     void claim(VirtualGraph provider, Resource subject, Resource predicate, Resource object)
32     throws ServiceException;
33
34     boolean removeStatement(VirtualGraph provider, Resource subject, Resource predicate, Resource object)
35     throws ServiceException;
36     
37     void claimValue(VirtualGraph provider, int resource, byte[] value, int length) throws DatabaseException;
38     void claimValue(VirtualGraph provider, Resource resource, byte[] value) throws DatabaseException;
39     void claimValue(VirtualGraph provider, Resource resource, ByteReader reader, int amount) throws DatabaseException;
40     
41     void denyValue(VirtualGraph provider, Resource resource) throws ServiceException;
42
43     void setValue(VirtualGraph provider, Resource resource, byte[] value) throws ServiceException;
44     
45     Resource createResource(VirtualGraph provider)
46     throws DatabaseException;
47     
48     Resource createResource(VirtualGraph provider, long clusterId)
49     throws DatabaseException;
50
51     Resource createResource(VirtualGraph provider, Resource clusterSet)
52     throws DatabaseException;
53
54     void createClusterSet(VirtualGraph provider, Resource clusterSet)
55     throws DatabaseException;
56
57     boolean hasClusterSet(VirtualGraph provider, Resource clusterSet)
58     throws ServiceException;
59
60     Resource setDefaultClusterSet(Resource clusterSet)
61     throws ServiceException;
62
63     void performWriteRequest(WriteGraph graph, Write request) throws DatabaseException;    
64     <T> T performWriteRequest(WriteGraph graph, WriteResult<T> request) throws DatabaseException;    
65     void performWriteRequest(WriteGraph graph, WriteOnly request) throws DatabaseException;    
66     
67     boolean writeOnly();
68
69     void flush(boolean intermediate);
70     void flushCluster();
71     void flushCluster(Resource r);
72
73     void gc();
74     
75     void commitDone(WriteTraits writeTraits, long csid);
76     void clearUndoList(WriteTraits writeTraits);
77     void startUndo();
78     /**
79      * @return size of meta data before clearing.
80      */
81     int clearMetadata();
82 }