]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/service/ClusterBuilder.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / service / ClusterBuilder.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.service;\r
13 \r
14 import org.simantics.databoard.binding.Binding;\r
15 import org.simantics.databoard.serialization.Serializer;\r
16 import org.simantics.db.Resource;\r
17 import org.simantics.db.WriteOnlyGraph;\r
18 import org.simantics.db.exception.DatabaseException;\r
19 \r
20 \r
21 \r
22 /**\r
23  * @author Antti Villberg\r
24  */\r
25 public interface ClusterBuilder {\r
26         \r
27         public interface ResourceHandle {\r
28                 void addStatement(StatementHandle handle);\r
29                 void addStatement(ResourceHandle predicate, ResourceHandle object);\r
30                 void addStatement(WriteOnlyGraph graph, ResourceHandle predicate, ResourceHandle object) throws DatabaseException;\r
31                 void addValue(WriteOnlyGraph graph, byte[] value) throws DatabaseException;\r
32                 void addValue(Object value, Binding binding);\r
33                 void addValue(Object value, Serializer serializer);\r
34                 void applyPredicate(Object change);\r
35                 void applyObject(Object change);\r
36                 Resource resource(SerialisationSupport support);\r
37         }\r
38         \r
39         public interface StatementHandle {\r
40                 void apply(Object change);\r
41         }\r
42         \r
43         void newCluster() throws DatabaseException;\r
44         ResourceHandle newResource() throws DatabaseException;\r
45 //      ResourceHandle newResource(ResourceHandle handle) throws DatabaseException;\r
46         ResourceHandle resource(Resource res) throws DatabaseException;\r
47 //      StatementHandle newStatement(Resource predicate, Resource object) throws DatabaseException;\r
48         StatementHandle newStatement(ResourceHandle predicate, ResourceHandle object) throws DatabaseException;\r
49         \r
50         \r
51 \r
52 //      <T, I> T createMap(Class<I> clazz);\r
53 //      Set<Resource> createSet();\r
54 //      Collection<Resource> createList();\r
55 //      Collection<Statement> createStatementList();\r
56 \r
57 }\r