public static List parse(final ClassLoader loader, final File definitionFile, boolean isDirty) {
if (definitionFile == null) {
throw new IllegalArgumentException("definition file can not be null");
}
if (!definitionFile.exists()) {
throw new DefinitionException("definition file " + definitionFile.toString() + " does not exist");
}
// if definition is not updated; don't parse but return it right away
if (isNotUpdated(definitionFile)) {
isDirty = false;
return s_definitions;
}
// updated definition, ready to be parsed
try {
Document document = createDocument(definitionFile.toURL());
s_definitions = DocumentParser.parse(loader, document);
setParsingTimestamp();
isDirty = true;
return s_definitions;
}
catch (MalformedURLException e) {
throw new DefinitionException(definitionFile + " does not exist");
}
catch (DocumentException e) {
throw new DefinitionException("XML definition file <" + definitionFile + "> has errors: " + e.toString());
}
}