Package org.quartz

Examples of org.quartz.Job


    return aJob;
  }

  public static Job validateForSave(final ERQSJobDescription jobDescription) throws COJobInstanciationException
  {
    Job aJob = createJobInstance(jobDescription);
    if (aJob instanceof ERQSJob)
      ((ERQSJob)aJob).validateForSave(jobDescription);
    return aJob;
  }
View Full Code Here


    @Override
    public Job newJob(TriggerFiredBundle bundle) throws SchedulerException
    {
        JobDetail jobDetail = bundle.getJobDetail();
        Class<?> jobClass = jobDetail.getJobClass();
        Job job = (Job) guice.getInstance(jobClass);
        guice.injectMembers(job);
        return job;
    }
View Full Code Here

  @Override
  public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
    JobDetail detail = bundle.getJobDetail();
    Class<? extends Job> jobClass = detail.getJobClass();
    Job instance = injector.getInstance(jobClass);
    return instance;
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void registerJob(final Task task, final String jobClassName, final String cronExpression)
            throws ClassNotFoundException, SchedulerException, ParseException {

        final Class<?> jobClass = Class.forName(jobClassName);
        Job jobInstance = (Job) ApplicationContextProvider.getBeanFactory().
                createBean(jobClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
        if (jobInstance instanceof TaskJob) {
            ((TaskJob) jobInstance).setTaskId(task.getId());
        }
View Full Code Here

            registerJob(task, task.getJobClassName(), task.getCronExpression());
        }
    }

    public void registerJob(final Report report) throws SchedulerException, ParseException {
        Job jobInstance = (Job) ApplicationContextProvider.getBeanFactory().
                createBean(ReportJob.class, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
        ((ReportJob) jobInstance).setReportId(report.getId());

        registerJob(getJobName(report), jobInstance, report.getCronExpression());
    }
View Full Code Here

            JobSpec spec = (JobSpec) activationSpec;

            MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
            spec.setEndpoint(endpoint);

            Job job = (Job) endpoint;

            JobDataMap jobDataMap = spec.getDetail().getJobDataMap();
            jobDataMap.put(Data.class.getName(), new Data(job));

            scheduler.scheduleJob(spec.getDetail(), spec.getTrigger());
View Full Code Here

                JobDataMap jobDataMap = execution.getJobDetail().getJobDataMap();

                Data data = Data.class.cast(jobDataMap.get(Data.class.getName()));

                Job job = data.job;

                endpoint = (MessageEndpoint) job;

                if (null == method) {
                    method = Job.class.getMethod("execute", JobExecutionContext.class);
                }

                endpoint.beforeDelivery(method);

                job.execute(execution);

            } catch (NoSuchMethodException e) {
                throw new IllegalStateException(e);
            } catch (ResourceException e) {
                throw new JobExecutionException(e);
View Full Code Here

    JobExecutionContext context = runningTasks.get(taskId);
    if (context == null) { // there is no task run
      return false;
    }
    Job runningJob = context.getJobInstance();
    if (runningJob instanceof InterruptableJob) {
      try {
        log.info("Interrupting TaskRun " + taskRunId + " for Task " + taskId);
        setStatus(taskRun, Status.CANCELLING);
        taskRunDAO.save(taskRun);
View Full Code Here

   */
  private JobExecutionContext createJobExecutionContext(Task task) {
    JobDetail jobDetail = new JobDetail();
    JobDataMap jobDataMap = jobDetail.getJobDataMap();
    jobDataMap.put(SchedulerConstants.TASK_ID, task.getId());
    Job testJob = new NullJob();
    JobExecutionContext context = new JobExecutionContext(scheduler, new TriggerFiredBundle(jobDetail,
        new SimpleTrigger(), null, false, new Date(), null, null, null), testJob);
    return context;
  }
View Full Code Here

/*     */
/*     */   public void initialize(QuartzScheduler qs, TriggerFiredBundle firedBundle) throws SchedulerException
/*     */   {
/* 127 */     this.qs = qs;
/*     */
/* 129 */     Job job = null;
/* 130 */     JobDetail jobDetail = firedBundle.getJobDetail();
/*     */     try
/*     */     {
/* 133 */       job = qs.getJobFactory().newJob(firedBundle);
/*     */     } catch (SchedulerException se) {
View Full Code Here

TOP

Related Classes of org.quartz.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.