Search in sources :

Example 26 with SchedulerException

use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.

the class DefaultSchedulerService method start.

/**
 * {@inheritDoc}
 */
public void start() throws SchedulerException {
    // $NON-NLS-1$
    IScheduler scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
    scheduler.start();
}
Also used : IScheduler(org.pentaho.platform.api.scheduler2.IScheduler)

Example 27 with SchedulerException

use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.

the class DefaultSchedulerService method resumeJob.

/**
 * {@inheritDoc}
 */
public void resumeJob(String jobId) throws SchedulerException {
    // $NON-NLS-1$
    IScheduler scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
    scheduler.resumeJob(jobId);
}
Also used : IScheduler(org.pentaho.platform.api.scheduler2.IScheduler)

Example 28 with SchedulerException

use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.

the class DefaultSchedulerService method updateJob.

private void updateJob(String jobId, Map<String, ParamValue> jobParams, JobTrigger trigger) throws SchedulerException {
    // $NON-NLS-1$
    logger.debug("Creating job with schedule " + trigger.toString());
    try {
        // $NON-NLS-1$
        IScheduler scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
        Map<String, Serializable> properJobParams = toProperMap(jobParams);
        scheduler.updateJob(jobId, properJobParams, trigger);
    } catch (SchedulerException e) {
        // temporary error logging.. this needs to become an aspect
        logger.error(e.getMessage(), e);
        throw e;
    }
}
Also used : Serializable(java.io.Serializable) SchedulerException(org.pentaho.platform.api.scheduler2.SchedulerException) IScheduler(org.pentaho.platform.api.scheduler2.IScheduler)

Example 29 with SchedulerException

use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.

the class DefaultSchedulerService method removeJob.

/**
 * {@inheritDoc}
 */
public void removeJob(String jobId) throws SchedulerException {
    // $NON-NLS-1$
    IScheduler scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
    scheduler.removeJob(jobId);
}
Also used : IScheduler(org.pentaho.platform.api.scheduler2.IScheduler)

Example 30 with SchedulerException

use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.

the class GatherStatsListenerTest method testStartup_withExceptionFromScheduleJobCall.

@Test
public void testStartup_withExceptionFromScheduleJobCall() throws Exception {
    PentahoSystem.registerObject(scheduler);
    when(scheduler.createJob(eq("Gather Stats"), eq(GatherStatsAction.class), eq(gatherStatsListener.jobMap), any(JobTrigger.class))).thenThrow(new SchedulerException("error"));
    boolean startup = gatherStatsListener.startup(session);
    assertTrue(startup);
    assertEquals(1, gatherStatsListener.jobMap.size());
    assertEquals(gatherStatsListener.getTransFileName(), gatherStatsListener.jobMap.get("transFileName"));
    assertEquals(101, gatherStatsListener.getIntervalInSeconds());
    verify(scheduler).createJob(eq("Gather Stats"), eq(GatherStatsAction.class), eq(gatherStatsListener.jobMap), any(JobTrigger.class));
}
Also used : SchedulerException(org.pentaho.platform.api.scheduler2.SchedulerException) JobTrigger(org.pentaho.platform.api.scheduler2.JobTrigger) Test(org.junit.Test)

Aggregations

SchedulerException (org.pentaho.platform.api.scheduler2.SchedulerException)51 Test (org.junit.Test)49 Job (org.pentaho.platform.api.scheduler2.Job)43 IScheduler (org.pentaho.platform.api.scheduler2.IScheduler)23 ComplexJobTrigger (org.pentaho.platform.api.scheduler2.ComplexJobTrigger)18 SimpleJobTrigger (org.pentaho.platform.api.scheduler2.SimpleJobTrigger)16 Serializable (java.io.Serializable)15 IJobTrigger (org.pentaho.platform.api.scheduler2.IJobTrigger)11 Date (java.util.Date)10 JobTrigger (org.pentaho.platform.api.scheduler2.JobTrigger)9 Scheduler (org.quartz.Scheduler)9 ArrayList (java.util.ArrayList)8 IJobFilter (org.pentaho.platform.api.scheduler2.IJobFilter)8 IOException (java.io.IOException)6 Calendar (java.util.Calendar)6 HashMap (java.util.HashMap)6 CronTrigger (org.quartz.CronTrigger)6 SimpleTrigger (org.quartz.SimpleTrigger)6 Trigger (org.quartz.Trigger)6 Response (javax.ws.rs.core.Response)5