]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.project/src/org/simantics/project/management/DatabaseSpec.java
Merge commit '728147df5d63a3333daff3d8c0e9bfd4f5597e3a'
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / management / DatabaseSpec.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.project.management;\r
12 \r
13 import java.util.ArrayList;\r
14 import java.util.List;\r
15 \r
16 import org.simantics.db.ReadGraph;\r
17 import org.simantics.db.exception.DatabaseException;\r
18 import org.simantics.db.request.Read;\r
19 \r
20 /**\r
21  * A description of database \r
22  *\r
23  * @author Toni Kalajainen <toni.kalajainen@vtt.fi>\r
24  */\r
25 public class DatabaseSpec {\r
26 \r
27         // Installed Ontologies\r
28         public List<OntologySpec> ontologies = new ArrayList<OntologySpec>();\r
29         \r
30         // Installed Projects   \r
31         public List<ProjectSpec> projects = new ArrayList<ProjectSpec>();       \r
32         \r
33         \r
34         /** A query that reads database spec, projects ordered by URI, ontologies ordered by versionedId */\r
35         static Read<DatabaseSpec> QUERY = new Read<DatabaseSpec>() {\r
36                 @Override\r
37                 public DatabaseSpec perform(ReadGraph g) throws DatabaseException {\r
38                         DatabaseSpec spec = new DatabaseSpec();\r
39                         spec.projects = g.syncRequest( ProjectSpec.QUERY );\r
40                         spec.ontologies = g.syncRequest( OntologySpec.QUERY );\r
41                         return spec;\r
42                 }\r
43         };\r
44         \r
45         \r
46 }\r
47 \r