public void configure(AgentManager agentManager, ConfigurationData config) throws Exception {
assert this.agentManager == null;
this.agentManager = agentManager;
configureCheckstyle(config);
ConfigurationData sleepConfig = config.getSubElement("sleep");
if (sleepConfig != null) {
sleepInterval = Long.parseLong(sleepConfig.getSelfValue()) * 1000;
}
logger.debug("Agent sleep interval is: " + sleepInterval / 1000 + " seconds");
// ensure that the checkstyle author exists
AuthorManager manager = agentManager.getCollabReview().getAuthorManager();
Author author = manager.getAuthor(getProposedName());
if (author == null) {
logger.info("Registering a new author for the CheckstyleAgent: " + getProposedName());
author = manager.createAuthor(getProposedName());
if (manager.storeAuthor(author) == null) {
logger.error("Failed to register the new author");
} else {
manager.commit();
}
}
// input filter
ConfigurationData filterConfig = config.getSubElement("filter");
if (filterConfig != null) {
filter = Filter.readFilter(filterConfig);
}
// initialize recheck all flag
ConfigurationData recheckElement = config.getSubElement("recheck");
if (recheckElement != null) {
recheckAll = recheckElement.getSelfValue().toLowerCase().equals("true");
}
// initialize curesize
ConfigurationData curesizeElement = config.getSubElement("curesize");
if (curesizeElement != null) {
errorCureSize = Integer.parseInt(curesizeElement.getSelfValue());
}
// register the hook first so we won't miss any artifact update...
registerHooks();
// do the initial scan
initialScan();