use of com.cognifide.cq.cqsm.api.actions.interfaces.DefinitionProvider in project APM by Cognifide.
the class ScriptManagerImpl method parseIncludeDescriptors.
private List<ActionDescriptor> parseIncludeDescriptors(Script script, Map<String, String> definitions, List<Script> includes, ResourceResolver resolver) throws ExecutionException {
final List<ActionDescriptor> descriptors = new LinkedList<>();
LineIterator lineIterator = IOUtils.lineIterator(new StringReader(script.getData()));
while (lineIterator.hasNext()) {
String line = lineIterator.next();
if (ScriptUtils.isAction(line)) {
final String command = ScriptUtils.parseCommand(line, definitions);
final ActionDescriptor descriptor = actionFactory.evaluate(command);
final Action action = descriptor.getAction();
descriptors.add(descriptor);
if (action instanceof DefinitionProvider) {
definitions.putAll(((DefinitionProvider) action).provideDefinitions(definitions));
} else if (action instanceof ScriptProvider) {
getIncludes(definitions, includes, resolver, descriptors, (ScriptProvider) action);
}
}
}
return descriptors;
}
Aggregations