]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db;\r
13 \r
14 import org.simantics.db.exception.DatabaseException;\r
15 \r
16 public interface ServerI {\r
17 \r
18         /**\r
19          * Start the server.\r
20          *\r
21          * @throws DatabaseException\r
22          */\r
23     void start() throws DatabaseException;\r
24 \r
25     /**\r
26      * Ask server to stop. Server has no obligation to stop.\r
27      * After this server is either running or not.\r
28      * You can not and should not make any assumptions on server behavior.\r
29      * Remember that server lifetime is not under our control.\r
30      *\r
31      * @throws DatabaseException if server did not receive our plead or had trouble responding.\r
32      */\r
33     void stop() throws DatabaseException;\r
34 \r
35     /**\r
36      * Verify if the server is in active and usable state.\r
37      *\r
38      * @return true if the server is alive and responsive.\r
39      */\r
40     boolean isActive()  throws DatabaseException;\r
41 \r
42     /**\r
43      * Get the server address. Can be used with {@link Driver#getSession()} and {@link Driver#getServer()} methods.\r
44      *\r
45      * @return address of the server as canonical string.\r
46      */\r
47     public String getAddress() throws DatabaseException;\r
48 \r
49 //    /**\r
50 //     * @return\r
51 //     * @throws DatabaseException\r
52 //     * @deprecated Was used for getting server address.\r
53 //     * Changed to string to remove dependency to ServerAddress structure.\r
54 //     * Use Use the {@link #getAddress()} method instead.\r
55 //     */\r
56 //    public ServerAddress getServerAddress() throws DatabaseException;\r
57 \r
58     /**\r
59      * Execute server command.\r
60      *\r
61      * @return command output.\r
62      */\r
63 \r
64     public String execute(String command) throws DatabaseException;\r
65 \r
66     /**\r
67      * Execute server command and disconnect after command has been executed.\r
68      *\r
69      * @return command output.\r
70      */\r
71     public String executeAndDisconnect(String command) throws DatabaseException;\r
72 }\r