DmdlParser parser = new DmdlParser();
DmdlAnalyzer analyzer = new DmdlAnalyzer(
ServiceLoader.load(TypeDriver.class, serviceClassLoader),
ServiceLoader.load(AttributeDriver.class, serviceClassLoader));
int count = 0;
Cursor cursor = source.createCursor();
try {
while (cursor.next()) {
URI name = cursor.getIdentifier();
LOG.info(Messages.getString("AnalyzeTask.monitorParseStarting"), name); //$NON-NLS-1$
Reader resource = cursor.openResource();
try {
AstScript script = parser.parse(resource, name);
for (AstModelDefinition<?> model : script.models) {
LOG.debug(Messages.getString("AnalyzeTask.monitorFoundModel"), model.name); //$NON-NLS-1$
analyzer.addModel(model);
count++;
}
} catch (DmdlSyntaxException e) {
LOG.error(MessageFormat.format(
Messages.getString("AnalyzeTask.monitorParseFailed"), //$NON-NLS-1$
name), e);
green = false;
} finally {
resource.close();
}
}
LOG.debug(Messages.getString("AnalyzeTask.monitorCountModel"), count); //$NON-NLS-1$
} finally {
cursor.close();
}
if (green == false) {
throw new IOException(MessageFormat.format(
Messages.getString("AnalyzeTask.errorParse"), //$NON-NLS-1$
processName));