package a_quartz_test;
import java.io.Serializable;

import org.apache.log4j.PropertyConfigurator;
import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;


public class Quartz_test implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 838787841474257414L;
	Integer id = 3;
	public static void main(String[] args){
		PropertyConfigurator.configure("conf/log4j.properties");
		System.setProperty("org.quartz.properties", "conf/quartz.properties");
		//submitMySqlToSqlServerCopyJob(new Quartz_test());
	    try {
	        SchedulerFactory sf = new StdSchedulerFactory();
	        Scheduler sche = sf.getScheduler();
	        sche.start();
	      } catch (SchedulerException e) {
	 
	      }
	}
	public static void submitMySqlToSqlServerCopyJob(Quartz_test data){
//		JobDetail jobDetail = JobBuilder.newJob(Quartz_job.class)
//				.withIdentity("Quartz_test job_" + data.getId(), "Quartz_test")
//				.requestRecovery()
//				.build();
//		JobDataMap jobdata = jobDetail.getJobDataMap();
//		jobdata.put("jobdata", data);
//		String cronexp = "*/5 * * * * ?";
//		Trigger trigger = TriggerBuilder
//				.newTrigger().withIdentity("Quartz_test job_" + data.getId(), "Quartz_test")
//				.withSchedule(CronScheduleBuilder.cronSchedule(cronexp)
//						.withMisfireHandlingInstructionDoNothing())
//				.build();
//		SchedulerFactory sf = new StdSchedulerFactory(); 
//		Scheduler sched = null;
//		try {
//			sched = sf.getScheduler();
//			sched.scheduleJob(jobDetail, trigger);
//			sched.start();
//		} catch (SchedulerException e) {
//
//		} 
	}
	
	
	private String getId() {
		// TODO Auto-generated method stub
		return id.toString();
	}
}
