@Override
public Map<String, Object> getContextMap(Map<String, Object> context) {
if (LOGGER.isDebugEnabled()) {
for (Entry<String, Object> entry : context.entrySet()) {
LOGGER.debug("Context contains entry " + entry.getKey() + " of type: "
+ entry.getValue().getClass().getName());
}
}
SonarConfiguration config = getSonarConfigurationFromJobs(SonarTaskUtils.getJobsWithSonarTasks((Plan) context.get("plan")));
context.put(SONAR_CONFIGURATION_CONTEXT_KEY, config);
try {
Sonar sonar = clientFactory.create(config.getSonarHost());
context.put(SONAR_SERVER_INFO_CONTEXT_KEY, sonar.find(new ServerQuery()));
} catch (Exception e) {
LOGGER.debug(e);
context.put(SONAR_SERVER_INFO_CONTEXT_KEY, new Server().setVersion("0.0"));
}
return context;
}