in extensions/torque/src/java/org/apache/turbine/services/schedule/TurbineNonPersistentSchedulerService.java [97:160]
public void init()
throws InitializationException
{
Configuration conf = getConfiguration();
try
{
scheduleQueue = new JobQueue();
mainLoop = new MainLoop();
List jobProps = conf.getList("scheduler.jobs");
List jobs = new Vector();
// If there are scheduler.jobs defined then set up a job vector
// for the scheduleQueue
if (!jobProps.isEmpty())
{
for (int i = 0; i < jobProps.size(); i++)
{
String jobName = (String) jobProps.get(i);
String jobPrefix = "scheduler.job." + jobName;
String jobId = conf.getString(jobPrefix + ".ID", null);
if (StringUtils.isEmpty(jobId))
{
throw new Exception(
"There is an error in the TurbineResources.properties file. \n"
+ jobPrefix + ".ID is not found.\n");
}
int sec = conf.getInt(jobPrefix + ".SECOND", -1);
int min = conf.getInt(jobPrefix + ".MINUTE", -1);
int hr = conf.getInt(jobPrefix + ".HOUR", -1);
int wkday = conf.getInt(jobPrefix + ".WEEKDAY", -1);
int dayOfMonth = conf.getInt(jobPrefix + ".DAY_OF_MONTH", -1);
JobEntryTorque je = new JobEntryTorque(sec,
min,
hr,
wkday,
dayOfMonth,
jobName);
je.setJobId(Integer.parseInt(jobId));
jobs.add(je);
}
}
if (jobs != null && jobs.size() > 0)
{
scheduleQueue.batchLoad(jobs);
}
setEnabled(getConfiguration().getBoolean("enabled", true));
restart();
setInit(true);
}
catch (Exception e)
{
String errorMessage = "Could not initialize the scheduler service";
log.error(errorMessage, e);
throw new InitializationException(errorMessage, e);
}
}