NamespaceHelper helper = SchedulerStore.getNamespaceHelper(document);
Element jobGroupElement =
helper.getFirstChild(schedulerElement, SchedulerStore.ELEMENT_JOB_GROUP);
if (jobGroupElement == null) {
throw new SchedulerException("No <job-group> element found!");
}
String jobGroupAttribute = jobGroupElement.getAttribute("name");
if (!jobGroupAttribute.equals(publication.getId())) {
throw new SchedulerException(
"The jobs.xml file contains a wrong job group: ["
+ jobGroupAttribute
+ "]");
} else {
jobElements = helper.getChildren(jobGroupElement, SchedulerStore.ELEMENT_JOB);
}
} else {
throw new SchedulerException(
"The jobs file [" + jobsFile.getAbsolutePath() + "] does not exist!");
}
} catch (SchedulerException e) {
throw e;
} catch (Exception e) {
throw new SchedulerException(e);
}
return jobElements;
}