@Override public void doAfterStart() { // default value is declared in CorePlugin String taskKey = StringUtils.defaultIfEmpty(taskProperties.get(CoreProperties.TASK), CoreProperties.SCAN_TASK); // Release memory taskProperties.clear(); 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"); } } }
@Override public void doAfterStart() { // default value is declared in CorePlugin String taskKey = StringUtils.defaultIfEmpty(taskProperties.get(CoreProperties.TASK), CoreProperties.SCAN_TASK); // Release memory taskProperties.clear(); TaskDefinition def = getComponentByType(Tasks.class).definition(taskKey); if (def == null) { throw MessageException.of("Task '" + taskKey + "' does not exist. Please use '" + ListTask.KEY + "' task to see all available tasks."); } Task task = getComponentByType(def.taskClass()); if (task != null) { task.execute(); } else { throw new IllegalStateException("Task " + taskKey + " is badly defined"); } } }