package framework.sciql;

import framework.SystemController;
import java.io.IOException;
import util.IO;

/**
 *
 * @author George Merticariu
 */
public class SciQLSystemController extends SystemController {

    public static final String KEY_SCIQL_HOME = "sciql.home";
    public static final String KEY_SCIQL_DBFARM = "sciql.dbfarm";

    protected String sciqlHome;
    protected String sciqlDbfarm;

    public SciQLSystemController(String propertiesPath) throws IOException {
        super(propertiesPath);
        this.systemName = "SciQL";
        this.sciqlHome = getValue(KEY_SCIQL_HOME);
        this.sciqlDbfarm = getValue(KEY_SCIQL_DBFARM);
        String sciqlBinDir = IO.concatPaths(sciqlHome, "bin");
        this.startSystemCommand = new String[]{sciqlBinDir + "/monetdbd start " + sciqlDbfarm};
        this.stopSystemCommand = new String[]{sciqlBinDir + "/monetdbd stop " + sciqlDbfarm};
    }

    @Override
    public void restartSystem() throws Exception {
        if (executeShellCommand(stopSystemCommand) != 0) {
            throw new Exception("Failed to stop the system.");
        }

        if (executeShellCommand(startSystemCommand) != 0) {
            throw new Exception("Failed to start the system.");
        }
    }
}

@@ -785,18 +785,19 @@
 tdbd
- 
+%22, %22
 start
- %22 +
+%22,
  sci
@@ -881,17 +881,18 @@
 tdbd
- stop %22 +
+%22, %22stop%22,
  sci

fix restart