Created
August 2, 2013 10:15
-
-
Save yusuke/6138861 to your computer and use it in GitHub Desktop.
指定時刻に #バルス とツイートする Groovy コード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.quartz.* | |
import org.quartz.impl.StdSchedulerFactory | |
import twitter4j.TwitterFactory | |
class バルスTask { | |
public void バルス() { | |
TwitterFactory.singleton.updateStatus("#バルス")) | |
} | |
} | |
public class バルスJob implements Job { | |
public void execute(JobExecutionContext context) | |
throws JobExecutionException { | |
Map dataMap = context.getJobDetail().getJobDataMap() | |
バルスTask task = (バルスTask) dataMap.get("バルスTask") | |
task.バルス() | |
} | |
} | |
バルスTask task = new バルスTask() | |
//specify your scheduler task details | |
JobDetail job = new JobDetail() | |
job.setName("バルスJob") | |
job.setJobClass(バルスJob.class) | |
Map dataMap = job.getJobDataMap() | |
dataMap.put("バルスTask", task) | |
//configure the scheduler time | |
CronTrigger trigger = new CronTrigger() | |
trigger.setName("runMeJobTesting") | |
trigger.setCronExpression("0 19 23 2 AUG FRI 2013") | |
//schedule it | |
Scheduler scheduler = new StdSchedulerFactory().getScheduler() | |
scheduler.start() | |
scheduler.scheduleJob(job, trigger) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment