checkNotEmpty(scriptEntry.getContent(), "scriptEntity content should be provided");
}
checkNotNull(user, "user should be provided");
// String result = checkSyntaxErrors(scriptEntry.getContent());
ScriptHandler handler = scriptHandlerFactory.getHandler(scriptEntry);
if (config.getControllerProperties().getPropertyBoolean(PROP_CONTROLLER_VALIDATION_SYNTAX_CHECK)) {
String result = handler.checkSyntaxErrors(scriptEntry.getPath(), scriptEntry.getContent());
LOGGER.info("Perform Syntax Check by {} for {}", user.getUserId(), scriptEntry.getPath());
if (result != null) {
return result;
}
}
File scriptDirectory = config.getHome().getScriptDirectory(user);
FileUtils.deleteDirectory(scriptDirectory);
Preconditions.checkTrue(scriptDirectory.mkdirs(), "Script directory {} creation is failed.");
ProcessingResultPrintStream processingResult = new ProcessingResultPrintStream(new ByteArrayOutputStream());
handler.prepareDist(0L, user, scriptEntry, scriptDirectory, config.getControllerProperties(), processingResult);
if (!processingResult.isSuccess()) {
return new String(processingResult.getLogByteArray());
}
File scriptFile = new File(scriptDirectory, FilenameUtils.getName(scriptEntry.getPath()));