protected void loadJobs() {
try {
ExtensionClassLoader ecl = new ExtensionClassLoader();
List<File> jobs = ecl.getJobs();
CustomScheduler scheduler = new CustomScheduler();
for (File job : jobs) {
Properties p = new Properties();
try {
p.load(new FileReader(job));
String _class = p.get("CLASS").toString();
Job plugin = (Job) Class.forName(_class).newInstance();
scheduler.addJob((int) plugin.getFrequency(),
plugin.getName(), plugin.getClass(),
plugin.getParameters(), plugin.getListenerList());
} catch (Throwable e) {
LOG.error(
"Error trying to load job " + job.getAbsolutePath(),
e);
}
}
scheduler.start();
} catch (Throwable t) {
LOG.error("Error trying to load jobs", t);
showError(t);
}
}