Package org.quartz

Examples of org.quartz.SchedulerContext


    public void execute(JobExecutionContext context) throws JobExecutionException {
        String camelContextName = (String) context.getJobDetail().getJobDataMap().get(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME);
        String endpointUri = (String) context.getJobDetail().getJobDataMap().get(QuartzConstants.QUARTZ_ENDPOINT_URI);

        SchedulerContext schedulerContext;
        try {
            schedulerContext = context.getScheduler().getContext();
        } catch (SchedulerException e) {
            throw new JobExecutionException("Failed to obtain scheduler context for job " + context.getJobDetail().getName());
        }

        CamelContext camelContext = (CamelContext) schedulerContext.get(QuartzConstants.QUARTZ_CAMEL_CONTEXT + "-" + camelContextName);
        if (camelContext == null) {
            throw new JobExecutionException("No CamelContext could be found with name: " + camelContextName);
        }

        Trigger trigger = context.getTrigger();
View Full Code Here


            throw new JobExecutionException(e);
        }
    }

    protected CamelContext getCamelContext(JobExecutionContext context) throws JobExecutionException {
        SchedulerContext schedulerContext = getSchedulerContext(context);
        String camelContextName = context.getMergedJobDataMap().getString(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME);
        CamelContext result = (CamelContext)schedulerContext.get(QuartzConstants.QUARTZ_CAMEL_CONTEXT + "-" + camelContextName);
        if (result == null) {
            throw new JobExecutionException("No CamelContext could be found with name: " + camelContextName);
        }
        return result;
    }
View Full Code Here

    private static final long serialVersionUID = 26L;

    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        LOG.debug("Running ScheduledJob: jobExecutionContext={}", jobExecutionContext);

        SchedulerContext schedulerContext = getSchedulerContext(jobExecutionContext);
        ScheduledJobState state = (ScheduledJobState) schedulerContext.get(jobExecutionContext.getJobDetail().getKey().toString());
        Action storedAction = state.getAction();
        Route storedRoute = state.getRoute();
       
        List<RoutePolicy> policyList = storedRoute.getRouteContext().getRoutePolicyList();
        for (RoutePolicy policy : policyList) {
View Full Code Here

    /**
     * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
     */
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap mergedJobDataMap = context.getMergedJobDataMap();
        SchedulerContext schedCtxt = null;
        try {
            schedCtxt = context.getScheduler().getContext();
        } catch (SchedulerException e) {
            throw new JobExecutionException("Error obtaining scheduler context.", e, false);
        }
       
        String fileName = mergedJobDataMap.getString(FILE_NAME);
        String listenerName = mergedJobDataMap.getString(FILE_SCAN_LISTENER_NAME);
       
        if(fileName == null) {
            throw new JobExecutionException("Required parameter '" +
                    FILE_NAME + "' not found in merged JobDataMap");
        }
        if(listenerName == null) {
            throw new JobExecutionException("Required parameter '" +
                    FILE_SCAN_LISTENER_NAME + "' not found in merged JobDataMap");
        }

        FileScanListener listener = (FileScanListener)schedCtxt.get(listenerName);
       
        if(listener == null) {
            throw new JobExecutionException("FileScanListener named '" +
                    listenerName + "' not found in SchedulerContext");
        }
View Full Code Here

    /* (non-Javadoc)
     * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
     */
    public void execute(final JobExecutionContext context) throws JobExecutionException {

        SchedulerContext schedulerContext;
        try {
            schedulerContext = context.getScheduler().getContext();
        } catch (SchedulerException e) {
            throw new JobExecutionException("Failed to obtain scheduler context for job " + context.getJobDetail().getName());
        }

        CamelContext camelContext = (CamelContext) schedulerContext.get(QuartzEndpoint.CONTEXT_KEY);
        String endpointUri = (String) context.getJobDetail().getJobDataMap().get(QuartzEndpoint.ENDPOINT_KEY);
        QuartzEndpoint quartzEndpoint =    (QuartzEndpoint) camelContext.getEndpoint(endpointUri);
        quartzEndpoint.onJobExecute(context);
    }
View Full Code Here

    public void execute(JobExecutionContext context) throws JobExecutionException {
        String camelContextName = (String) context.getJobDetail().getJobDataMap().get(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME);
        String endpointUri = (String) context.getJobDetail().getJobDataMap().get(QuartzConstants.QUARTZ_ENDPOINT_URI);

        SchedulerContext schedulerContext;
        try {
            schedulerContext = context.getScheduler().getContext();
        } catch (SchedulerException e) {
            throw new JobExecutionException("Failed to obtain scheduler context for job " + context.getJobDetail().getName());
        }

        CamelContext camelContext = (CamelContext) schedulerContext.get(QuartzConstants.QUARTZ_CAMEL_CONTEXT + "-" + camelContextName);
        if (camelContext == null) {
            throw new JobExecutionException("No CamelContext could be found with name: " + camelContextName);
        }

        QuartzEndpoint endpoint = lookupQuartzEndpoint(camelContext, endpointUri);
View Full Code Here

    protected MuleContext getMuleContext(JobExecutionContext jobExecutionContext) throws JobExecutionException
    {
        try
        {
            SchedulerContext schedulerContext = jobExecutionContext.getScheduler().getContext();
            return (MuleContext) schedulerContext.get(MuleProperties.MULE_CONTEXT_PROPERTY);
        }
        catch (SchedulerException e)
        {
            throw new JobExecutionException("Failed to retrieve MuleContext from the Scheduler Context: " + e.getMessage(), e);
        }
View Full Code Here

  public void schedulerFactoryBeanWithApplicationContext() throws Exception {
    TestBean tb = new TestBean("tb", 99);
    StaticApplicationContext ac = new StaticApplicationContext();

    final Scheduler scheduler = mock(Scheduler.class);
    SchedulerContext schedulerContext = new SchedulerContext();
    given(scheduler.getContext()).willReturn(schedulerContext);

    SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
      @Override
      protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
View Full Code Here

        localObject1 = this.ref.invoke(this, $method_getSchedulerContext_21, null, 2814359591403475563L);
        return (SchedulerContext)localObject1;
      }
      Object localObject1 = this.ref.newCall(this, operations, 21, -426943571078592559L);
      this.ref.invoke((RemoteCall)localObject1);
      SchedulerContext localSchedulerContext;
      try
      {
        ObjectInput localObjectInput = ((RemoteCall)localObject1).getInputStream();
        localSchedulerContext = (SchedulerContext)localObjectInput.readObject();
      }
View Full Code Here

/*     */     throws JobExecutionException
/*     */   {
/*  59 */     Log log = LogFactory.getLog(getClass());
/*     */
/*  61 */     JobDataMap data = context.getJobDetail().getJobDataMap();
/*  62 */     SchedulerContext schedCtxt = null;
/*     */     try {
/*  64 */       schedCtxt = context.getScheduler().getContext();
/*     */     } catch (SchedulerException e) {
/*  66 */       throw new JobExecutionException("Error obtaining scheduler context.", e, false);
/*     */     }
/*     */
/*  69 */     String fileName = data.getString(FILE_NAME);
/*  70 */     String listenerName = data.getString(FILE_SCAN_LISTENER_NAME);
/*     */
/*  72 */     if (fileName == null) {
/*  73 */       throw new JobExecutionException("Required parameter '" + FILE_NAME + "' not found in JobDataMap");
/*     */     }
/*  75 */     if (listenerName == null) {
/*  76 */       throw new JobExecutionException("Required parameter '" + FILE_SCAN_LISTENER_NAME + "' not found in JobDataMap");
/*     */     }
/*     */
/*  79 */     FileScanListener listener = (FileScanListener)schedCtxt.get(listenerName);
/*     */
/*  81 */     if (listener == null) {
/*  82 */       throw new JobExecutionException("FileScanListener named '" + listenerName + "' not found in SchedulerContext");
/*     */     }
/*     */
View Full Code Here

TOP

Related Classes of org.quartz.SchedulerContext

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.