Iterator jobs = csConfig.getJobDefinitions().iterator();
while (jobs.hasNext()) {
JobDefinition job = (JobDefinition) jobs.next();
String jobName = db.getDbReference() + "." + job.getName();
try {
Task task = null;
if (job.getType() == JobDefinition.TYPE_TMLSCRIPTMODULE) {
ScriptTask scriptTask = new ScriptTask();
scriptTask.setCancelJobOnFail(true);
scriptTask.setDatabase(db.getDbReference());
scriptTask.setModule(job.getResource());
task = scriptTask;
}
else if (job.getType() == JobDefinition.TYPE_JAVA) {
JavaTask javaTask = new JavaTask();
javaTask.setClassName(job.getResource());
task = javaTask;
}
else {
getLog().error("Error adding job '" + jobName + "'. Unknown job type: " + job.getType());
continue;
}
task.setDescription(job.getDescription());
JobSchedule schedule = null;
if (job.getSchedule() != null && !job.getSchedule().trim().equals("")) {
schedule = new JobSchedule();
schedule.setEnabled(true);