forked from geodmms/xdgnjobs

?? ?
2008-03-13 4232697d04382033c02cc51295da5d1be9e6978f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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);
        }
 
 
    }
}