/** * Return the trigger state as a ${@link JobState}, that holds both the integer trigger's inner value of the state * and a String as a human readable representation of that state */ public JobState getJobStatus(BaseObject object) throws SchedulerException { return getProtectedPlugin().getJobStatus(object, this.context); }
public JobState getJobStatus(Object object) throws SchedulerException, SchedulerPluginException { return getProtectedPlugin().getJobStatus(retrieveBaseObject(object), this.context); }
@Override public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) { return new SchedulerPluginApi((SchedulerPlugin) plugin, context); }
public Date getNextFireTime(BaseObject object) { try { return getProtectedPlugin().getNextFireTime(object, this.context); } catch (SchedulerPluginException e) { this.context.put("error", e.getMessage()); return null; } } }
/** * Give, for a BaseObject job in a {@link JobState#STATE_NORMAL} state, the previous date at which the job has been * executed. Note that this method does not compute a date from the CRON expression, it only returns a date value * which is set each time the job is executed. If the job has never been fired this method will return null. * * @param object the BaseObject for which to give the fire time * @return the date the job has been executed */ public Date getPreviousFireTime(BaseObject object) { try { return getProtectedPlugin().getPreviousFireTime(object, this.context); } catch (SchedulerPluginException e) { this.context.put("error", e.getMessage()); return null; } }
/** * Retrieve the job's status of a given {@link com.xpn.xwiki.plugin.scheduler.SchedulerPlugin#XWIKI_JOB_CLASS} job * XObject, by asking the actual job status to the quartz scheduler instance. It's the actual status, as the one * stored in the XObject may be changed manually by users. * * @param object the XObject to give the status of * @return the status of the Job inside the quartz scheduler, as {@link com.xpn.xwiki.plugin.scheduler.JobState} * instance */ public JobState getJobStatus(BaseObject object, XWikiContext context) throws SchedulerException { int state = getScheduler().getTriggerState(getObjectUniqueId(object, context), Scheduler.DEFAULT_GROUP); return new JobState(state); }
public boolean scheduleJob(BaseObject object) { try { getProtectedPlugin().scheduleJob(object, this.context); return true; } catch (Exception e) { this.context.put("error", e.getMessage()); return false; } }
/** * Associates the scheduler with a StatusListener * * @throws SchedulerPluginException if the status listener failed to be set properly */ private void setStatusListener() throws SchedulerPluginException { StatusListener listener = new StatusListener(); try { getScheduler().addSchedulerListener(listener); getScheduler().addGlobalJobListener(listener); } catch (SchedulerException e) { throw new SchedulerPluginException( SchedulerPluginException.ERROR_SCHEDULERPLUGIN_INITIALIZE_STATUS_LISTENER, "Error while initializing the status listener", e); } }
/** * Pause the given XObject job by pausing all of its current triggers. Can be called the same way as * {@link #scheduleJob(Object)} * * @param object the wrapped XObject Job to be paused * @return true on success, false on failure. */ public boolean pauseJob(Object object) { try { return pauseJob(retrieveBaseObject(object)); } catch (Exception e) { // we don't need to push the exception message in the context here // as it should already have been pushed by the throwing exception return false; } }
/** * Unschedule a XObject job by deleting it from the jobs table. Can be called the same way as * {@link #scheduleJob(Object)} * * @param object the wrapped XObject Job to be paused * @return true on success, false on failure. */ public boolean unscheduleJob(Object object) { try { return unscheduleJob(retrieveBaseObject(object)); } catch (Exception e) { // we don't need to push the exception message in the context here // as it should already have been pushed by the throwing exception return false; } }
/** * Trigger a XObject job (execute it now). * * @param object the wrapped XObject Job to be triggered * @return true on success, false on failure. */ public boolean triggerJob(Object object) { try { return triggerJob(retrieveBaseObject(object)); } catch (Exception e) { // we don't need to push the exception message in the context here // as it should already have been pushed by the throwing exception return false; } }
public JobState(int state) { setState(state); }
/** * Get the next fire time for the given job name SchedulerJob * * @param object unwrapped XObject job for which the next fire time will be given * @return the next Date the job will be fired at */ public Date getNextFireTime(BaseObject object, XWikiContext context) throws SchedulerPluginException { return getTrigger(object, context).getNextFireTime(); }
public JobState(TriggerState state) { setQuartzState(state); }
public Date getNextFireTime(BaseObject object) { try { return getProtectedPlugin().getNextFireTime(object, this.context); } catch (SchedulerPluginException e) { this.context.put("error", e.getMessage()); return null; } } }
public JobState getJobStatus(Object object) throws SchedulerException, SchedulerPluginException { return getProtectedPlugin().getJobStatus(retrieveBaseObject(object), this.context); }
/** * Give, for a BaseObject job in a {@link JobState#STATE_NORMAL} state, the previous date at which the job has been * executed. Note that this method does not compute a date from the CRON expression, it only returns a date value * which is set each time the job is executed. If the job has never been fired this method will return null. * * @param object the BaseObject for which to give the fire time * @return the date the job has been executed */ public Date getPreviousFireTime(BaseObject object) { try { return getProtectedPlugin().getPreviousFireTime(object, this.context); } catch (SchedulerPluginException e) { this.context.put("error", e.getMessage()); return null; } }
public boolean scheduleJob(BaseObject object) { try { getProtectedPlugin().scheduleJob(object, this.context); return true; } catch (Exception e) { this.context.put("error", e.getMessage()); return false; } }
/** * Return the trigger state as a ${@link JobState}, that holds both the integer trigger's inner value of the state * and a String as a human readable representation of that state */ public JobState getJobStatus(BaseObject object) throws SchedulerException, SchedulerPluginException { return getProtectedPlugin().getJobStatus(object, this.context); }
/** * {@inheritDoc} */ @Override public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) { return new SchedulerPluginApi((SchedulerPlugin) plugin, context); }