@Override
public void doAfterStart() {
// default value is declared in CorePlugin
String taskKey = StringUtils.defaultIfEmpty(taskProperties.get(CoreProperties.TASK), CoreProperties.SCAN_TASK);
TaskDefinition def = getComponentByType(Tasks.class).definition(taskKey);
if (def == null) {
throw MessageException.of("Task " + taskKey + " does not exist");
}
Task task = getComponentByType(def.taskClass());
if (task != null) {
task.execute();
} else {
throw new IllegalStateException("Task " + taskKey + " is badly defined");
}