package com.ximple.eofms.jobs;
|
|
import java.io.File;
|
import java.util.Date;
|
|
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.LogFactory;
|
import org.quartz.Job;
|
import org.quartz.JobDataMap;
|
import org.quartz.JobDetail;
|
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionException;
|
|
/**
|
*
|
*/
|
public class ConvertDgn2ShpJob implements Job
|
{
|
static Log logger = LogFactory.getLog(ConvertDgn2ShpJob.class);
|
|
public void execute(JobExecutionContext context) throws JobExecutionException
|
{
|
// Every job has its own job detail
|
JobDetail jobDetail = context.getJobDetail();
|
|
// The name is defined in the job definition
|
String jobName = jobDetail.getName();
|
|
// Log the time the job started
|
logger.info(jobName + " fired at " + new Date());
|
|
// The directory to scan is stored in the job map
|
JobDataMap dataMap = jobDetail.getJobDataMap();
|
String dirName = dataMap.getString("SHPDATA_DIR");
|
|
// Validate the required input
|
if (dirName == null)
|
{
|
throw new JobExecutionException("Directory not configured");
|
}
|
|
// Make sure the directory exists
|
File dir = new File(dirName);
|
if (!dir.exists())
|
{
|
throw new JobExecutionException("Invalid Dir " + dirName);
|
}
|
|
|
}
|
}
|