/**
* @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
*/
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap mergedJobDataMap = context.getMergedJobDataMap();
SchedulerContext schedCtxt = null;
try {
schedCtxt = context.getScheduler().getContext();
} catch (SchedulerException e) {
throw new JobExecutionException("Error obtaining scheduler context.", e, false);
}
String fileName = mergedJobDataMap.getString(FILE_NAME);
String listenerName = mergedJobDataMap.getString(FILE_SCAN_LISTENER_NAME);
if(fileName == null) {
throw new JobExecutionException("Required parameter '" +
FILE_NAME + "' not found in merged JobDataMap");
}
if(listenerName == null) {
throw new JobExecutionException("Required parameter '" +
FILE_SCAN_LISTENER_NAME + "' not found in merged JobDataMap");
}
FileScanListener listener = (FileScanListener)schedCtxt.get(listenerName);
if(listener == null) {
throw new JobExecutionException("FileScanListener named '" +
listenerName + "' not found in SchedulerContext");
}