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