]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.project/src/org/simantics/project/management/DatabaseSpec.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / management / DatabaseSpec.java
diff --git a/bundles/org.simantics.project/src/org/simantics/project/management/DatabaseSpec.java b/bundles/org.simantics.project/src/org/simantics/project/management/DatabaseSpec.java
new file mode 100644 (file)
index 0000000..481a6cb
--- /dev/null
@@ -0,0 +1,47 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.project.management;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.request.Read;\r
+\r
+/**\r
+ * A description of database \r
+ *\r
+ * @author Toni Kalajainen <toni.kalajainen@vtt.fi>\r
+ */\r
+public class DatabaseSpec {\r
+\r
+       // Installed Ontologies\r
+       public List<OntologySpec> ontologies = new ArrayList<OntologySpec>();\r
+       \r
+       // Installed Projects   \r
+       public List<ProjectSpec> projects = new ArrayList<ProjectSpec>();       \r
+       \r
+       \r
+       /** A query that reads database spec, projects ordered by URI, ontologies ordered by versionedId */\r
+       static Read<DatabaseSpec> QUERY = new Read<DatabaseSpec>() {\r
+               @Override\r
+               public DatabaseSpec perform(ReadGraph g) throws DatabaseException {\r
+                       DatabaseSpec spec = new DatabaseSpec();\r
+                       spec.projects = g.syncRequest( ProjectSpec.QUERY );\r
+                       spec.ontologies = g.syncRequest( OntologySpec.QUERY );\r
+                       return spec;\r
+               }\r
+       };\r
+       \r
+       \r
+}\r
+\r