use of org.phoenicis.scripts.Installer in project POL-POM-5 by PhoenicisOrg.
the class CLIController method installApp.
@Option
@LongSwitch("install")
@ShortSwitch("i")
@AllAvailableArguments
public void installApp(List<String> arguments) {
final String typeName = arguments.get(0);
final String typeId = typeName;
final String categoryName = arguments.get(1);
final String categoryId = typeId + "." + categoryName;
final String appName = arguments.get(2);
final String appId = categoryId + "." + appName;
final String scriptName = arguments.get(3);
final String scriptId = appId + "." + scriptName;
final ScriptDTO scriptDTO = repositoryManager.getScript(Arrays.asList(typeId, categoryId, appId, scriptId));
if (scriptDTO == null) {
LOGGER.error("Requested app does not exist: " + arguments);
return;
}
final StringBuilder executeBuilder = new StringBuilder();
executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", scriptDTO.getTypeId()));
executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", scriptDTO.getCategoryId()));
executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", scriptDTO.getApplicationId()));
executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", scriptDTO.getId()));
executeBuilder.append(scriptDTO.getScript());
executeBuilder.append("\n");
scriptInterpreter.createInteractiveSession().eval(executeBuilder.toString(), result -> {
Value installer = (Value) result;
installer.as(Installer.class).go();
}, Throwable::printStackTrace);
}
use of org.phoenicis.scripts.Installer in project POL-POM-5 by PlayOnLinux.
the class CLIController method installApp.
@Option
@LongSwitch("install")
@ShortSwitch("i")
@AllAvailableArguments
public void installApp(List<String> arguments) {
final String typeName = arguments.get(0);
final String typeId = typeName;
final String categoryName = arguments.get(1);
final String categoryId = typeId + "." + categoryName;
final String appName = arguments.get(2);
final String appId = categoryId + "." + appName;
final String scriptName = arguments.get(3);
final String scriptId = appId + "." + scriptName;
final ScriptDTO scriptDTO = repositoryManager.getScript(Arrays.asList(typeId, categoryId, appId, scriptId));
if (scriptDTO == null) {
LOGGER.error("Requested app does not exist: " + arguments);
return;
}
final StringBuilder executeBuilder = new StringBuilder();
executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", scriptDTO.getTypeId()));
executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", scriptDTO.getCategoryId()));
executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", scriptDTO.getApplicationId()));
executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", scriptDTO.getId()));
executeBuilder.append(scriptDTO.getScript());
executeBuilder.append("\n");
scriptInterpreter.createInteractiveSession().eval(executeBuilder.toString(), result -> {
Value installer = (Value) result;
installer.as(Installer.class).go();
}, Throwable::printStackTrace);
}
use of org.phoenicis.scripts.Installer in project POL-POM-5 by PlayOnLinux.
the class ApplicationInformationPanelSkin method installScript.
/**
* Install the given script
*
* @param script The script to be installed
*/
private void installScript(ScriptDTO script) {
final StringBuilder executeBuilder = new StringBuilder();
executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", script.getTypeId()));
executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId()));
executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId()));
executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId()));
executeBuilder.append(script.getScript());
executeBuilder.append("\n");
getControl().getScriptInterpreter().createInteractiveSession().eval(executeBuilder.toString(), result -> {
Value installer = (Value) result;
installer.as(Installer.class).go();
}, e -> Platform.runLater(() -> {
// no exception if installation is cancelled
if (!(e.getCause() instanceof InterruptedException)) {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("The script ended unexpectedly")).withException(e).build();
errorDialog.showAndWait();
}
}));
}
use of org.phoenicis.scripts.Installer in project POL-POM-5 by PhoenicisOrg.
the class ApplicationInformationPanelSkin method installScript.
/**
* Install the given script
*
* @param script The script to be installed
*/
private void installScript(ScriptDTO script) {
final StringBuilder executeBuilder = new StringBuilder();
executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", script.getTypeId()));
executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId()));
executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId()));
executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId()));
executeBuilder.append(script.getScript());
executeBuilder.append("\n");
getControl().getScriptInterpreter().createInteractiveSession().eval(executeBuilder.toString(), result -> {
Value installer = (Value) result;
installer.as(Installer.class).go();
}, e -> Platform.runLater(() -> {
// no exception if installation is cancelled
if (!(e.getCause() instanceof InterruptedException)) {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("The script ended unexpectedly")).withException(e).build();
errorDialog.showAndWait();
}
}));
}
Aggregations