* @param isDirty flag to mark the the definition as updated or not
* @return the definition object
*/
public static AspectWerkzDefinition parse(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_definition;
}
// updated definition, ready to be parsed
try {
Document document = createDocument(definitionFile.toURL());
s_definition = parse(document);
setParsingTimestamp();
isDirty = true;
return s_definition;
}
catch (MalformedURLException e) {
throw new DefinitionException(definitionFile + " does not exist");
}
catch (DocumentException e) {
e.printStackTrace();
throw new DefinitionException("XML definition file <" + definitionFile + "> has errors: " + e.getMessage());
}
}