@Override
public ServerI getServer(String address, Properties properties) throws DatabaseException {
- return new ServerI() {
-
- @Override
- public void stop() throws DatabaseException {
- // nop
- }
-
- @Override
- public void start() throws DatabaseException {
- // nop
- }
-
- @Override
- public boolean isActive() throws DatabaseException {
- return true;
- }
-
- @Override
- public String getAddress() throws DatabaseException {
- return address;
- }
-
- @Override
- public String executeAndDisconnect(String command) throws DatabaseException {
- return "";
- }
-
- @Override
- public String execute(String command) throws DatabaseException {
- return "";
- }
- };
+ return new AcornServerI(address);
}
@Override
Path dbFolder = Paths.get(address);
return new AcornManagement(dbFolder, properties);
}
+
+ private static class AcornServerI implements ServerI {
+
+ private String address;
+
+ public AcornServerI(String address) {
+ this.address = address;
+ }
+
+ @Override
+ public void stop() throws DatabaseException {
+ AcornDatabaseManager.getDatabase(Paths.get(address)).tryToStop();
+ }
+
+ @Override
+ public void start() throws DatabaseException {
+ AcornDatabaseManager.getDatabase(Paths.get(address)).start();
+ }
+
+ @Override
+ public boolean isActive() throws DatabaseException {
+ return AcornDatabaseManager.getDatabase(Paths.get(address)).isRunning();
+ }
+
+ @Override
+ public String getAddress() throws DatabaseException {
+ return address;
+ }
+
+ @Override
+ public String executeAndDisconnect(String command) throws DatabaseException {
+ return "";
+ }
+
+ @Override
+ public String execute(String command) throws DatabaseException {
+ return "";
+ }
+ }
}