default void runScript(String scriptContent, Consumer<Exception> errorCallback) { runScript(scriptContent, () -> { }, errorCallback); }
@Override public void runScript(String scriptContent, Runnable doneCallback, Consumer<Exception> errorCallback) { executorService.execute(() -> delegated.runScript(scriptContent, doneCallback, errorCallback)); }
default void runScript(File scriptFile, Consumer<Exception> errorCallback) { try { runScript(IOUtils.toString(new FileInputStream(scriptFile), "UTF-8"), errorCallback); } catch (Exception e) { errorCallback.accept(e); } }
private void testScript(CategoryDTO categoryDTO, ApplicationDTO applicationDTO, ScriptDTO scriptDTO) { final ScriptInterpreter scriptInterpreter = applicationContext.getBean("nashornInterprpeter", ScriptInterpreter.class); System.out.print("| |-- " + scriptDTO.getScriptName()); try { scriptInterpreter.runScript(scriptDTO.getScript(), e -> { throw new TestException(e); }); System.out.println(" [OK] "); } catch (TestException e) { e.printStackTrace(); System.out.println(" [KO] "); } } }
@Option @LongSwitch("script") @ShortSwitch("s") @AllAvailableArguments public void runScript(List<String> arguments) { final String scriptPath = arguments.get(0); final File scriptFile = new File(scriptPath); final ScriptInterpreter scriptInterpreter = applicationContext.getBean("scriptInterpreter", ScriptInterpreter.class); scriptInterpreter.runScript(scriptFile, e -> { throw new IllegalStateException(e); }); }
@Option @LongSwitch("install") @ShortSwitch("i") @AllAvailableArguments public void installApp(List<String> arguments) { final String typeName = arguments.get(0); final String categoryName = arguments.get(1); final String appName = arguments.get(2); final String scriptName = arguments.get(3); final ScriptDTO scriptDTO = repositoryManager .getScript(Arrays.asList(typeName, categoryName, appName, scriptName)); scriptInterpreter.runScript(scriptDTO.getScript(), Throwable::printStackTrace); }
getControl().getScriptInterpreter().runScript(executeBuilder.toString(), e -> Platform.runLater(() -> {