Tabnine Logo
SchedulerPlugin.getScheduler
Code IndexAdd Tabnine to your IDE (free)

How to use
getScheduler
method
in
com.xpn.xwiki.plugin.scheduler.SchedulerPlugin

Best Java code snippets using com.xpn.xwiki.plugin.scheduler.SchedulerPlugin.getScheduler (Showing top 19 results out of 315)

origin: org.xwiki.platform/xwiki-platform-scheduler-api

private void onWikiDeletedEvent(String wikiId) throws SchedulerException
{
  Set<JobKey> keys = getScheduler().getJobKeys(GroupMatcher.anyJobGroup());
  String idPrefix = getWikiIdPrefix(wikiId);
  for (JobKey key : keys) {
    if (key.getName().startsWith(idPrefix)) {
      getScheduler().deleteJob(key);
    }
  }
}
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * 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);
  }
}
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * 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);
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * 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().getListenerManager().addSchedulerListener(listener);
    getScheduler().getListenerManager().addJobListener(listener);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(
      SchedulerPluginException.ERROR_SCHEDULERPLUGIN_INITIALIZE_STATUS_LISTENER,
      "Error while initializing the status listener", e);
  }
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * 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
{
  TriggerState state = getScheduler().getTriggerState(new TriggerKey(getObjectUniqueId(object, context)));
  return new JobState(state);
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

getScheduler().start();
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * Trigger a job (execute it now)
 * 
 * @param object the non-wrapped XObject Job to be triggered
 * @param context the XWiki context
 */
public void triggerJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  try {
    getScheduler().triggerJob(getObjectUniqueId(object, context), Scheduler.DEFAULT_GROUP);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_TRIGGER_JOB,
      "Error occured while trying to trigger job " + object.getStringValue("jobName"), e);
  }
}
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * Get Trigger object of the given job
 * 
 * @param object the unwrapped XObject to be retrieve the trigger for
 * @param context the XWiki context
 * @return the trigger object of the given job
 */
private Trigger getTrigger(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  String job = getObjectUniqueId(object, context);
  Trigger trigger;
  try {
    trigger = getScheduler().getTrigger(job, Scheduler.DEFAULT_GROUP);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_XCLASS_NOT_FOUND,
      "Error while getting trigger for job " + job, e);
  }
  if (trigger == null) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_DOES_NOT_EXITS,
      "Job does not exists");
  }
  return trigger;
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * Trigger a job (execute it now)
 * 
 * @param object the non-wrapped XObject Job to be triggered
 * @param context the XWiki context
 */
public void triggerJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  String job = getObjectUniqueId(object, context);
  try {
    getScheduler().triggerJob(new JobKey(job));
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_TRIGGER_JOB,
      "Error occured while trying to trigger job " + object.getStringValue("jobName"), e);
  }
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

getScheduler().addJob(jobBuilder.build(), true);
      LOGGER.debug("Reschedule Job: [{}]", object.getStringValue("jobName"));
    getScheduler().rescheduleJob(trigger.getKey(), trigger);
    break;
  case NONE:
    LOGGER.debug("Schedule Job: [{}]", object.getStringValue("jobName"));
    getScheduler().scheduleJob(trigger);
    LOGGER.info("XWiki Job Status: [{}]", object.getStringValue("status"));
    if (object.getStringValue("status").equals("Paused")) {
      getScheduler().pauseJob(new JobKey(xjob));
      saveStatus("Paused", object, context);
    } else {
  default:
    LOGGER.debug("Schedule Job: [{}]", object.getStringValue("jobName"));
    getScheduler().scheduleJob(trigger);
    saveStatus("Normal", object, context);
    break;
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

getScheduler().start();
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * Get Trigger object of the given job
 * 
 * @param object the unwrapped XObject to be retrieve the trigger for
 * @param context the XWiki context
 * @return the trigger object of the given job
 */
private Trigger getTrigger(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  String job = getObjectUniqueId(object, context);
  Trigger trigger;
  try {
    trigger = getScheduler().getTrigger(new TriggerKey(job));
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_XCLASS_NOT_FOUND,
      "Error while getting trigger for job " + job, e);
  }
  if (trigger == null) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_DOES_NOT_EXITS,
      "Job does not exists");
  }
  return trigger;
}
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

getScheduler().addJob(job, true);
      LOG.debug("Reschedule Job : " + object.getStringValue("jobName"));
    getScheduler().rescheduleJob(trigger.getName(), trigger.getGroup(), trigger);
    break;
  case Trigger.STATE_NONE:
    LOG.debug("Schedule Job : " + object.getStringValue("jobName"));
    getScheduler().scheduleJob(trigger);
    LOG.info("XWiki Job Status :" + object.getStringValue("status"));
    if (object.getStringValue("status").equals("Paused")) {
      getScheduler().pauseJob(xjob, Scheduler.DEFAULT_GROUP);
      saveStatus("Paused", object, context);
    } else {
  default:
    LOG.debug("Schedule Job : " + object.getStringValue("jobName"));
    getScheduler().scheduleJob(trigger);
    saveStatus("Normal", object, context);
    break;
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * Resume the job with the given name (un-pause)
 * 
 * @param object the non-wrapped XObject Job to be resumed
 */
public void resumeJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  try {
    getScheduler().resumeJob(getObjectUniqueId(object, context), Scheduler.DEFAULT_GROUP);
    saveStatus("Normal", object, context);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_RESUME_JOB,
      "Error occured while trying to resume job " + object.getStringValue("jobName"), e);
  } catch (XWikiException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_RESUME_JOB,
      "Error occured while trying to save status of job " + object.getStringValue("jobName"), e);
  }
}
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * Unschedule the given job
 * 
 * @param object the unwrapped XObject job to be unscheduled
 */
public void unscheduleJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  try {
    getScheduler().deleteJob(getObjectUniqueId(object, context), Scheduler.DEFAULT_GROUP);
    saveStatus("None", object, context);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_XCLASS_NOT_FOUND,
      "Error while unscheduling job " + object.getStringValue("jobName"), e);
  } catch (XWikiException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_XCLASS_NOT_FOUND,
      "Error while saving status of job " + object.getStringValue("jobName"), e);
  }
}
origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

/**
 * Pause the job with the given name by pausing all of its current triggers.
 * 
 * @param object the non-wrapped XObject Job to be paused
 */
public void pauseJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  try {
    getScheduler().pauseJob(getObjectUniqueId(object, context), Scheduler.DEFAULT_GROUP);
    saveStatus("Paused", object, context);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_PAUSE_JOB,
      "Error occured while trying to pause job " + object.getStringValue("jobName"), e);
  } catch (XWikiException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_PAUSE_JOB,
      "Error occured while trying to save status of job " + object.getStringValue("jobName"), e);
  }
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * Unschedule the given job
 * 
 * @param object the unwrapped XObject job to be unscheduled
 */
public void unscheduleJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  String job = getObjectUniqueId(object, context);
  try {
    getScheduler().deleteJob(new JobKey(job));
    saveStatus("None", object, context);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_XCLASS_NOT_FOUND,
      "Error while unscheduling job " + object.getStringValue("jobName"), e);
  } catch (XWikiException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_JOB_XCLASS_NOT_FOUND,
      "Error while saving status of job " + object.getStringValue("jobName"), e);
  }
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * Pause the job with the given name by pausing all of its current triggers.
 * 
 * @param object the non-wrapped XObject Job to be paused
 */
public void pauseJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  String job = getObjectUniqueId(object, context);
  try {
    getScheduler().pauseJob(new JobKey(job));
    saveStatus("Paused", object, context);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_PAUSE_JOB,
      "Error occured while trying to pause job " + object.getStringValue("jobName"), e);
  } catch (XWikiException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_PAUSE_JOB,
      "Error occured while trying to save status of job " + object.getStringValue("jobName"), e);
  }
}
origin: org.xwiki.platform/xwiki-platform-scheduler-api

/**
 * Resume the job with the given name (un-pause)
 * 
 * @param object the non-wrapped XObject Job to be resumed
 */
public void resumeJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
{
  String job = getObjectUniqueId(object, context);
  try {
    getScheduler().resumeJob(new JobKey(job));
    saveStatus("Normal", object, context);
  } catch (SchedulerException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_RESUME_JOB,
      "Error occured while trying to resume job " + object.getStringValue("jobName"), e);
  } catch (XWikiException e) {
    throw new SchedulerPluginException(SchedulerPluginException.ERROR_SCHEDULERPLUGIN_RESUME_JOB,
      "Error occured while trying to save status of job " + object.getStringValue("jobName"), e);
  }
}
com.xpn.xwiki.plugin.schedulerSchedulerPlugingetScheduler

Popular methods of SchedulerPlugin

  • scheduleJob
  • getDefaultSchedulerInstance
  • getJobStatus
    Retrieve the job's status of a given com.xpn.xwiki.plugin.scheduler.SchedulerPlugin#XWIKI_JOB_CLASS
  • getNextFireTime
    Get the next fire time for the given job name SchedulerJob
  • getObjectUniqueId
    Compute a cross-document unique com.xpn.xwiki.objects.BaseObject id, by concatenating its name (it's
  • getPreviousFireTime
    Give, for a BaseObject job in a JobState#STATE_NORMAL state, the previous date at which the job has
  • getTrigger
    Get Trigger object of the given job
  • pauseJob
    Pause the job with the given name by pausing all of its current triggers.
  • prepareJobStubContext
    Create and feed a stub context for the job execution thread. Stub context data are retrieved from jo
  • restoreExistingJobs
    Restore the existing job, by looking up for such job in the database and re-scheduling those accordi
  • resumeJob
    Resume the job with the given name (un-pause)
  • saveStatus
  • resumeJob,
  • saveStatus,
  • setScheduler,
  • setStatusListener,
  • triggerJob,
  • unscheduleJob,
  • getWikiIdPrefix,
  • onDocumentEvent,
  • onWikiDeletedEvent

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • getSystemService (Context)
  • getApplicationContext (Context)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now