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.db.service;
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;
23 * @author Antti Villberg
25 public interface ClusterBuilder {
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);
39 public interface StatementHandle {
40 void apply(Object change);
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;
52 // <T, I> T createMap(Class<I> clazz);
53 // Set<Resource> createSet();
54 // Collection<Resource> createList();
55 // Collection<Statement> createStatementList();