Package com.dianping.cat.report.page.externalError

Examples of com.dianping.cat.report.page.externalError.EventCollectManager$Job


  public Job unmarshal( JaxbSafeJob jaxbSafeJob ) throws Exception {
    if ( jaxbSafeJob == null ) {
      return null;
    }

    Job job = new Job();
    try {
      job.setJobTrigger( jaxbSafeJob.jobTrigger );
      job.setJobParams( toProperMap( jaxbSafeJob.jobParams ) );
      job.setLastRun( jaxbSafeJob.lastRun );
      job.setNextRun( jaxbSafeJob.nextRun );
      job.setSchedulableClass( jaxbSafeJob.schedulableClass );
      job.setJobId( jaxbSafeJob.jobId );
      job.setUserName( jaxbSafeJob.userName );
      job.setJobName( jaxbSafeJob.jobName );
      job.setState( jaxbSafeJob.state );
    } catch ( Throwable t ) {
      // no message bundle since this is a development error case
      logger.error( "Error unmarshalling job", t ); //$NON-NLS-1$
      return null;
    }
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

    if ( jobParams == null ) {
      jobParams = new HashMap<String, Serializable>();
    }

    jobParams.put( RESERVEDMAPKEY_ACTIONCLASS, action.getName() );
    Job ret = createJob( jobName, jobParams, trigger, outputStreamProvider );
    ret.setSchedulableClass( action.getName() );
    return ret;
  }
View Full Code Here

    if ( jobParams == null ) {
      jobParams = new HashMap<String, Serializable>();
    }

    jobParams.put( RESERVEDMAPKEY_ACTIONID, actionId );
    Job ret = createJob( jobName, jobParams, trigger, outputStreamProvider );
    ret.setSchedulableClass( "" ); //$NON-NLS-1$
    return ret;
  }
View Full Code Here

    } catch ( org.quartz.SchedulerException e ) {
      throw new SchedulerException( Messages.getInstance().getString(
          "QuartzScheduler.ERROR_0001_FAILED_TO_SCHEDULE_JOB", jobName ), e ); //$NON-NLS-1$
    }

    Job job = new Job();
    job.setJobParams( jobParams );
    job.setJobTrigger( (JobTrigger) trigger );
    job.setNextRun( quartzTrigger.getNextFireTime() );
    job.setLastRun( quartzTrigger.getPreviousFireTime() );
    job.setJobId( jobId.toString() );
    job.setJobName( jobName );
    job.setUserName( curUser );
    job.setState( JobState.NORMAL );

    return job;
  }
View Full Code Here

  private String createJob( String jobName, Map<String, ParamValue> jobParams, JobTrigger trigger )
    throws SchedulerException {

    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

    try {
      Scheduler scheduler = getQuartzScheduler();
      QuartzJobKey jobKey = QuartzJobKey.parse( jobId );
      String groupName = jobKey.getUserName();
      for ( Trigger trigger : scheduler.getTriggersOfJob( jobId, groupName ) ) {
        Job job = new Job();
        JobDetail jobDetail = scheduler.getJobDetail( jobId, groupName );
        if ( jobDetail != null ) {
          JobDataMap jobDataMap = jobDetail.getJobDataMap();
          if ( jobDataMap != null ) {
            Map<String, Serializable> wrappedMap = jobDataMap.getWrappedMap();
            job.setJobParams( wrappedMap );
          }
        }

        job.setJobId( jobId );
        setJobTrigger( scheduler, job, trigger );
        job.setUserName( jobDetail.getGroup() );
        return job;
      }
    } catch ( org.quartz.SchedulerException e ) {
      throw new SchedulerException( Messages.getInstance().getString(
          "QuartzScheduler.ERROR_0007_FAILED_TO_GET_JOB", jobId ), e ); //$NON-NLS-1$
View Full Code Here

    try {
      Scheduler scheduler = getQuartzScheduler();
      for ( String groupName : scheduler.getJobGroupNames() ) {
        for ( String jobId : scheduler.getJobNames( groupName ) ) {
          for ( Trigger trigger : scheduler.getTriggersOfJob( jobId, groupName ) ) {
            Job job = new Job();
            job.setGroupName( groupName );
            JobDetail jobDetail = scheduler.getJobDetail( jobId, groupName );
            if ( jobDetail != null ) {
              job.setUserName( jobDetail.getGroup() );
              JobDataMap jobDataMap = jobDetail.getJobDataMap();
              if ( jobDataMap != null ) {
                Map<String, Serializable> wrappedMap = jobDataMap.getWrappedMap();
                job.setJobParams( wrappedMap );
              }
            }

            job.setJobId( jobId );
            setJobTrigger( scheduler, job, trigger );
            job.setJobName( QuartzJobKey.parse( jobId ).getJobName() );
            job.setNextRun( trigger.getNextFireTime() );
            job.setLastRun( trigger.getPreviousFireTime() );
            if ( ( filter == null ) || filter.accept( job ) ) {
              jobs.add( job );
            }
          }
        }
View Full Code Here

    JobScheduleParam jobScheduleParam1 = mock( JobScheduleParam.class );
    doReturn( "name1" ).when( jobScheduleParam1 ).getName();
    doReturn( "value1" ).when( jobScheduleParam1 ).getValue();
    jobParameters.add( jobScheduleParam1 );

    Job job = mock( Job.class );

    JobScheduleRequest scheduleRequest = mock( JobScheduleRequest.class );
    doReturn( "className" ).when( scheduleRequest ).getActionClass();
    doReturn( "jobName" ).when( scheduleRequest ).getJobName();
    doReturn( jobParameters ).when( scheduleRequest ).getJobParameters();
View Full Code Here

    JobScheduleParam jobScheduleParam1 = mock( JobScheduleParam.class );
    doReturn( "name1" ).when( jobScheduleParam1 ).getName();
    doReturn( "value1" ).when( jobScheduleParam1 ).getValue();
    jobParameters.add( jobScheduleParam1 );

    Job job = mock( Job.class );

    JobScheduleRequest scheduleRequest = mock( JobScheduleRequest.class );
    doReturn( "className" ).when( scheduleRequest ).getActionClass();
    doReturn( "jobName" ).when( scheduleRequest ).getJobName();
    doReturn( jobParameters ).when( scheduleRequest ).getJobParameters();
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.page.externalError.EventCollectManager$Job

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.