Map<String, Object> variables = new HashMap<>();
// Add overall variables
for (String key : inputs.keySet()) {
variables.put(key, inputs.get(key));
}
ResourceLoader loader = new DefaultResourceLoader();
for (Script script : scripts) {
NamespacedBinding binding = create();
// Bind inputs.
for (String key : variables.keySet()) {
binding.setVariable(key, variables.get(key));
}
binding.startCapture();
String filename = Strings.isNullOrEmpty(scriptDirectory) ? script.getName() : scriptDirectory
+ File.separator + script.getName();
try (InputStream stream = loader.getResource(filename).getInputStream()) {
List<String> lines = IOUtils.readLines(stream);
String content = String.join("\n", lines);
transaction.exec(() -> execute(content, binding));
} catch (IOException e) {