private boolean execute(String command) { Result<IValue> result = evaluator.eval(null, command, URIUtil.rootLocation("stdin")); if (result.getType().isBottom()) { return true; } if (result.getValue() == null) { return false; } if (result.getType() == TypeFactory.getInstance().boolType()) { return ((IBool) result.getValue()).getValue(); } return false; }
public void start(final int port, IRascalMonitor monitor) throws Exception { monitor.startJob("Loading Course Manager"); eval.eval(monitor, "import " + "CourseManager" + ";", URIUtil.rootScheme("stdin")); monitor.endJob(true); Log.setLog( new Logger() { @Override public String getName() { return "no logger"; } @Override public void warn(String msg, Object... args) {} @Override public void warn(Throwable thrown) {} @Override public void warn(String msg, Throwable thrown) {} @Override public void info(String msg, Object... args) {} @Override public void info(Throwable thrown) {} @Override public void info(String msg, Throwable thrown) {} @Override public boolean isDebugEnabled() { return false; } @Override public void setDebugEnabled(boolean enabled) {} @Override public void debug(String msg, Object... args) {} @Override public void debug(Throwable thrown) {} @Override public void debug(String msg, Throwable thrown) {} @Override public Logger getLogger(String name) { return this; } @Override public void ignore(Throwable ignored) {} }); monitor.startJob("Starting Webserver"); server = new Server(); SelectChannelConnector connector = new SelectChannelConnector(); connector.setPort(port); connector.setMaxIdleTime(30000); connector.setResponseHeaderSize(1000 * 1000); connector.setRequestBufferSize(1000 * 1000); connector.setConfidentialPort(8443); server.setConnectors(new Connector[] {connector}); server.setHandler(getTutorHandler()); server.start(); monitor.endJob(true); }