]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.testing/src/org/simantics/db/testing/common/Server4Remote.java
Added missing org.simantics.db.{tests,testing} plug-ins.
[simantics/platform.git] / bundles / org.simantics.db.testing / src / org / simantics / db / testing / common / Server4Remote.java
1 package org.simantics.db.testing.common;
2
3
4 import org.simantics.db.ServerI;
5 import org.simantics.db.exception.DatabaseException;
6
7 public class Server4Remote implements ServerI {
8     private boolean active = false;
9     private String host = null;
10     private int port = 0;
11     public Server4Remote(String host, int port) {
12         this.host = host;
13         this.port = port;
14     }
15
16     @Override
17     public void start() throws DatabaseException {
18         active = true;
19     }
20
21     @Override
22     public void stop() throws DatabaseException {
23         active = false;
24     }
25
26     @Override
27     public boolean isActive() {
28         return active;
29     }
30
31     @Override
32     public String getAddress() throws DatabaseException {
33         return "" + host + ":" + port;
34     }
35
36 //    @Override
37 //    public synchronized ServerAddress getServerAddress()
38 //    throws DatabaseException {
39 //        return new ServerAddress(host, port);
40 //    }
41
42     @Override
43     public String execute(String command) throws DatabaseException {
44         throw new DatabaseException("Execute method not supported for remote server.");
45     }
46
47     @Override
48     public String executeAndDisconnect(String command) throws DatabaseException {
49         throw new DatabaseException("ExecuteAndDisconnect method not supported for remote server.");
50     }
51
52 }