private void recursiveLoadScript(String toLoad, Map<String, RutaModule> additionalScripts,
Map<String, AnalysisEngine> additionalEngines, String viewName)
throws AnalysisEngineProcessException {
String location = locate(toLoad, scriptPaths, SCRIPT_FILE_EXTENSION);
RutaModule eachScript = null;
if (location == null) {
try {
String scriptPath = toLoad.replaceAll("\\.", "/") + SCRIPT_FILE_EXTENSION;
eachScript = loadScriptIS(scriptPath);
} catch (IOException e) {
throw new AnalysisEngineProcessException(new FileNotFoundException("Script [" + toLoad
+ "] cannot be found at [" + collectionToString(scriptPaths)
+ "] with extension .ruta"));
} catch (RecognitionException e) {
throw new AnalysisEngineProcessException(new FileNotFoundException("Script [" + toLoad
+ "] cannot be found at [" + collectionToString(scriptPaths)
+ "] with extension .ruta"));
}
} else {
try {
eachScript = loadScript(location);
} catch (IOException e) {
throw new AnalysisEngineProcessException(new FileNotFoundException("Script [" + toLoad
+ "] cannot be found at [" + collectionToString(scriptPaths)
+ "] with extension .ruta"));
} catch (RecognitionException e) {
throw new AnalysisEngineProcessException(new FileNotFoundException("Script [" + toLoad
+ "] cannot be found at [" + collectionToString(scriptPaths)
+ "] with extension .ruta"));
}
}
additionalScripts.put(toLoad, eachScript);
for (String add : eachScript.getScripts().keySet()) {
if (!additionalScripts.containsKey(add)) {
recursiveLoadScript(add, additionalScripts, additionalEngines, viewName);
}
}
Set<String> engineKeySet = eachScript.getEngines().keySet();
for (String eachEngineLocation : engineKeySet) {
if (!additionalEngines.containsKey(eachEngineLocation)) {
String engineLocation = locate(eachEngineLocation, descriptorPaths, ".xml");
if (engineLocation == null) {
String engineLocationIS = locateIS(eachEngineLocation, descriptorPaths, ".xml");