]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/ServerI.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / ServerI.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/ServerI.java b/bundles/org.simantics.db/src/org/simantics/db/ServerI.java
new file mode 100644 (file)
index 0000000..cc202af
--- /dev/null
@@ -0,0 +1,72 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\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.db;\r
+\r
+import org.simantics.db.exception.DatabaseException;\r
+\r
+public interface ServerI {\r
+\r
+       /**\r
+        * Start the server.\r
+        *\r
+        * @throws DatabaseException\r
+        */\r
+    void start() throws DatabaseException;\r
+\r
+    /**\r
+     * Ask server to stop. Server has no obligation to stop.\r
+     * After this server is either running or not.\r
+     * You can not and should not make any assumptions on server behavior.\r
+     * Remember that server lifetime is not under our control.\r
+     *\r
+     * @throws DatabaseException if server did not receive our plead or had trouble responding.\r
+     */\r
+    void stop() throws DatabaseException;\r
+\r
+    /**\r
+     * Verify if the server is in active and usable state.\r
+     *\r
+     * @return true if the server is alive and responsive.\r
+     */\r
+    boolean isActive()  throws DatabaseException;\r
+\r
+    /**\r
+     * Get the server address. Can be used with {@link Driver#getSession()} and {@link Driver#getServer()} methods.\r
+     *\r
+     * @return address of the server as canonical string.\r
+     */\r
+    public String getAddress() throws DatabaseException;\r
+\r
+//    /**\r
+//     * @return\r
+//     * @throws DatabaseException\r
+//     * @deprecated Was used for getting server address.\r
+//     * Changed to string to remove dependency to ServerAddress structure.\r
+//     * Use Use the {@link #getAddress()} method instead.\r
+//     */\r
+//    public ServerAddress getServerAddress() throws DatabaseException;\r
+\r
+    /**\r
+     * Execute server command.\r
+     *\r
+     * @return command output.\r
+     */\r
+\r
+    public String execute(String command) throws DatabaseException;\r
+\r
+    /**\r
+     * Execute server command and disconnect after command has been executed.\r
+     *\r
+     * @return command output.\r
+     */\r
+    public String executeAndDisconnect(String command) throws DatabaseException;\r
+}\r