コード例 #1
0
 public void inject(BoxContext context) {
   Lookup vars = context.getScriptVariables();
   vars.put("at", new MethodClosure(this, "at"));
   vars.put("every", new MethodClosure(this, "every"));
   vars.put("once", new MethodClosure(this, "once"));
   vars.put("enclosing", new MethodClosure(this, "enclosing"));
 }
コード例 #2
0
 private QuartzExecBlock createBlock(final Closure closure) throws Exception {
   QuartzExecBlock block = new QuartzExecBlock(plugin, BoxContext.getCurrentContext(), closure);
   ExecContext.with(
       block,
       new ExecRunnable() {
         public void run() throws Exception {
           closure.call();
         }
       });
   return block;
 }
コード例 #3
0
 public void inject(BoxContext context) {
   Lookup vars = context.getScriptVariables();
   vars.put("top", new MethodClosure(this, "top"));
 }
コード例 #4
0
 public void once(Closure closure) throws Exception {
   int cnt = plugin.getNextId();
   Trigger trigger = new SimpleTrigger("once " + cnt);
   plugin.configureJob(BoxContext.getCurrentContext(), cnt, trigger, createBlock(closure));
 }
コード例 #5
0
 public void every(int when, Closure closure) throws Exception {
   int cnt = plugin.getNextId();
   Trigger trigger = new SimpleTrigger("every " + cnt, SimpleTrigger.REPEAT_INDEFINITELY, when);
   plugin.configureJob(BoxContext.getCurrentContext(), cnt, trigger, createBlock(closure));
 }
コード例 #6
0
 public void at(String when, final Closure closure) throws Exception {
   int cnt = plugin.getNextId();
   CronTrigger trigger = new CronTrigger("at " + cnt);
   trigger.setCronExpression(new CronExpression(when));
   plugin.configureJob(BoxContext.getCurrentContext(), cnt, trigger, createBlock(closure));
 }