]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/service/ClusterBuilder.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / service / ClusterBuilder.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.service;
13
14 import org.simantics.databoard.binding.Binding;
15 import org.simantics.databoard.serialization.Serializer;
16 import org.simantics.db.Resource;
17 import org.simantics.db.WriteOnlyGraph;
18 import org.simantics.db.exception.DatabaseException;
19
20
21
22 /**
23  * @author Antti Villberg
24  */
25 public interface ClusterBuilder {
26         
27         public interface ResourceHandle {
28                 void addStatement(StatementHandle handle);
29                 void addStatement(ResourceHandle predicate, ResourceHandle object);
30                 void addStatement(WriteOnlyGraph graph, ResourceHandle predicate, ResourceHandle object) throws DatabaseException;
31                 void addValue(WriteOnlyGraph graph, byte[] value) throws DatabaseException;
32                 void addValue(Object value, Binding binding);
33                 void addValue(Object value, Serializer serializer);
34                 void applyPredicate(Object change);
35                 void applyObject(Object change);
36                 Resource resource(SerialisationSupport support);
37         }
38         
39         public interface StatementHandle {
40                 void apply(Object change);
41         }
42         
43         void newCluster() throws DatabaseException;
44         ResourceHandle newResource() throws DatabaseException;
45 //      ResourceHandle newResource(ResourceHandle handle) throws DatabaseException;
46         ResourceHandle resource(Resource res) throws DatabaseException;
47 //      StatementHandle newStatement(Resource predicate, Resource object) throws DatabaseException;
48         StatementHandle newStatement(ResourceHandle predicate, ResourceHandle object) throws DatabaseException;
49         
50         
51
52 //      <T, I> T createMap(Class<I> clazz);
53 //      Set<Resource> createSet();
54 //      Collection<Resource> createList();
55 //      Collection<Statement> createStatementList();
56
57 }