Package org.pentaho.platform.api.scheduler2

Examples of org.pentaho.platform.api.scheduler2.IScheduler


    }
    throw new IllegalArgumentException();
  }

  public BlockStatusProxy getBlockStatus( JobScheduleRequest jobScheduleRequest ) throws SchedulerException {
    IJobTrigger trigger = convertScheduleRequestToJobTrigger( jobScheduleRequest );
    Boolean totallyBlocked = false;
    Boolean partiallyBlocked = getBlockoutManager().isPartiallyBlocked( trigger );
    if ( partiallyBlocked ) {
      totallyBlocked = !getBlockoutManager().willFire( trigger );
    }
View Full Code Here


    boolean runInBackground =
        scheduleRequest.getSimpleJobTrigger() == null && scheduleRequest.getComplexJobTrigger() == null
            && scheduleRequest.getCronJobTrigger() == null;

    // add 10 seconds to the RIB to ensure execution (see PPP-3264)
    IJobTrigger jobTrigger =
        runInBackground ? new SimpleJobTrigger( new Date( System.currentTimeMillis() + 10000 ), null, 0, 0 ) : scheduleRequest.getSimpleJobTrigger();

    if ( scheduleRequest.getSimpleJobTrigger() != null ) {
      SimpleJobTrigger simpleJobTrigger = scheduleRequest.getSimpleJobTrigger();
View Full Code Here

  @Test
  public void testBlockoutWillFire() throws Exception {
    JobScheduleRequest mockJobScheduleRequest = mock( JobScheduleRequest.class );

    IJobTrigger mockJobTrigger = mock( IJobTrigger.class );
    doReturn( mockJobTrigger ).when( schedulerResource ).convertScheduleRequestToJobTrigger( mockJobScheduleRequest );

    Boolean willFire = Boolean.FALSE;
    doReturn( willFire ).when( schedulerResource.schedulerService ).willFire( mockJobTrigger );
View Full Code Here

  @Override
  public IJobTrigger getBlockOut( String blockOutJobId ) {
    try {
      Job blockOutJob = this.scheduler.getJob( blockOutJobId );
      IJobTrigger blockOutJobTrigger = blockOutJob.getJobTrigger();
      blockOutJobTrigger.setDuration( ( (Number) blockOutJob.getJobParams().get( DURATION_PARAM ) ).longValue() );
      return blockOutJobTrigger;
    } catch ( SchedulerException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

    scheduler.fireJobCompleted( actionBean, actionUser, params, streamProvider );

    if ( requiresUpdate ) {
      log.warn( "Output path for job: " + context.getJobDetail().getName() + " has changed. Job requires update" );
      try {
        final IJobTrigger trigger = scheduler.getJob( context.getJobDetail().getName() ).getJobTrigger();
        final Class<IAction> iaction = (Class<IAction>) actionBean.getClass();

        // remove job with outdated/invalid output path
        scheduler.removeJob( context.getJobDetail().getName() );
View Full Code Here

    return true;
  }

  private void scheduleJob( int intervalInSeconds ) throws Exception {

    IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$
    JobTrigger trigger = new SimpleJobTrigger( new Date(), null, -1, intervalInSeconds );

    jobMap.put( "transFileName", getTransFileName() );
    scheduler.createJob( GatherStatsListener.JOB_NAME, GatherStatsAction.class, jobMap, trigger );
    logger.info( "Statistics gathering jop has been scheduled." );
  }
View Full Code Here

    return versionRequestFlags;
  }

  protected void scheduleJob( final int versionRequestFlags, final int repeatSeconds ) throws Exception {

    IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$

    deleteJobIfNecessary();

    Map<String, Serializable> parms = new HashMap<String, Serializable>();
    parms.put( VersionCheckerAction.VERSION_REQUEST_FLAGS, new Integer( versionRequestFlags ) );
    JobTrigger trigger = new SimpleJobTrigger( new Date(), null, -1, repeatSeconds );
    scheduler.createJob( EmbeddedVersionCheckSystemListener.VERSION_CHECK_JOBNAME, VersionCheckerAction.class, parms,
        trigger );
  }
View Full Code Here

    scheduler.createJob( EmbeddedVersionCheckSystemListener.VERSION_CHECK_JOBNAME, VersionCheckerAction.class, parms,
        trigger );
  }

  protected void deleteJobIfNecessary() throws SchedulerException {
    IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$
    IJobFilter filter = new IJobFilter() {
      public boolean accept( Job job ) {
        return job.getJobName().contains( EmbeddedVersionCheckSystemListener.VERSION_CHECK_JOBNAME );
      }
    };

    // Like old code - remove the existing job and replace it
    List<Job> matchingJobs = scheduler.getJobs( filter );
    if ( ( matchingJobs != null ) && ( matchingJobs.size() > 0 ) ) {
      for ( Job verCkJob : matchingJobs ) {
        scheduler.removeJob( verCkJob.getJobId() );
      }
    }
  }
View Full Code Here

    logger.debug( "Creating job with schedule " + trigger.toString() ); //$NON-NLS-1$

    Job job = null;
    try {
      IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$
      Map<String, Serializable> properJobParams = toProperMap( jobParams );
      job = scheduler.createJob( jobName, getDefaultActionId(), properJobParams, trigger );
    } catch ( SchedulerException e ) {
      logger.error( e.getMessage(), e ); // temporary error logging.. this needs to become an aspect
      throw e;
    }
    return job.getJobId();
View Full Code Here

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

TOP

Related Classes of org.pentaho.platform.api.scheduler2.IScheduler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.