Examples of SchedulerContext


Examples of org.quartz.SchedulerContext

    public void execute(JobExecutionContext context) throws JobExecutionException {
       
        Log log = LogFactory.getLog(getClass());
       
        JobDataMap data = context.getJobDetail().getJobDataMap();
        SchedulerContext schedCtxt = null;
        try {
            schedCtxt = context.getScheduler().getContext();
        } catch (SchedulerException e) {
            throw new JobExecutionException("Error obtaining scheduler context.", e, false);
        }
       
        String fileName = data.getString(FILE_NAME);
        String listenerName = data.getString(FILE_SCAN_LISTENER_NAME);
       
        if(fileName == null)
            throw new JobExecutionException("Required parameter '" +
                    FILE_NAME + "' not found in JobDataMap");
        if(listenerName == null)
            throw new JobExecutionException("Required parameter '" +
                    FILE_SCAN_LISTENER_NAME + "' not found in JobDataMap");

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

Examples of org.quartz.SchedulerContext

    private void createAndInitScheduler() throws SchedulerException {
        LOG.info("Create and initializing scheduler.");
        scheduler = createScheduler();

        // Store CamelContext into QuartzContext space
        SchedulerContext quartzContext = scheduler.getContext();
        String camelContextName = getCamelContext().getManagementName();
        LOG.debug("Storing camelContextName={} into Quartz Context space.", camelContextName);
        quartzContext.put(QuartzConstants.QUARTZ_CAMEL_CONTEXT + "-" + camelContextName, getCamelContext());

        // Set camel job counts to zero. We needed this to prevent shutdown in case there are multiple Camel contexts
        // that has not completed yet, and the last one with job counts to zero will eventually shutdown.
        AtomicInteger number = (AtomicInteger) quartzContext.get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT);
        if (number == null) {
            number = new AtomicInteger(0);
            quartzContext.put(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT, number);
        }
    }
View Full Code Here

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);
        }
        QuartzEndpoint endpoint = camelContext.getEndpoint(endpointUri, QuartzEndpoint.class);
        if (endpoint == null) {
View Full Code Here

Examples of org.quartz.SchedulerContext

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

        SchedulerContext schedulerContext;
        try {
            schedulerContext = jobExecutionContext.getScheduler().getContext();
        } catch (SchedulerException e) {
            throw new JobExecutionException("Failed to obtain scheduler context for job " + jobExecutionContext.getJobDetail().getName());
        }
       
        Action storedAction = (Action) schedulerContext.get(SCHEDULED_ACTION);
        storedRoute = (Route) schedulerContext.get(SCHEDULED_ROUTE);
       
        ScheduledRoutePolicy policy = (ScheduledRoutePolicy) storedRoute.getRouteContext().getRoutePolicy();
        try {
            policy.onJobExecute(storedAction, storedRoute);
        } catch (Exception e) {
View Full Code Here

Examples of org.quartz.SchedulerContext

    /**
     * @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

Examples of org.quartz.SchedulerContext

    /**
     * @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

Examples of org.wso2.carbon.billing.core.scheduler.SchedulerContext

        this.dataAccessObject = dataAccessObject;
    }

    public void scheduleBilling() throws BillingException {
        // the logic to schedule the billing
        SchedulerContext schedulerContext = billingScheduler.createScheduleContext();
        billingScheduler.scheduleNextCycle(schedulerContext);
    }
View Full Code Here

Examples of org.wso2.carbon.billing.core.scheduler.SchedulerContext

        }*/
        boolean successful = false;
        try {
            beginTransaction();
            if (billingEngineContext.getSchedulerContext() == null) {
                SchedulerContext schedulerContext = billingScheduler.createScheduleContext();
                billingEngineContext.setSchedulerContext(schedulerContext);
            }

            billingEngineContext.setTaskConfiguration(billingTaskConfig);

View Full Code Here

Examples of org.wso2.carbon.billing.core.scheduler.SchedulerContext

        args.put("dayToTriggerOn", triggerOn);
        args.put("hourToTriggerOn", "0");
        MonthlyScheduleHelper monthlyTriggerCalculator = new MonthlyScheduleHelper();
        monthlyTriggerCalculator.init(args);

        SchedulerContext schedulerContext = new SchedulerContext();
        monthlyTriggerCalculator.invoke(schedulerContext, someDateTimeStamp);

        long nextMonthFirstTimeStampDuration = schedulerContext.getNextTriggerInterval();

        long durationStart = schedulerContext.getCurrentDurationStart();
        long durationEnd = schedulerContext.getCurrentDurationEnd();
        String realMonthStr = schedulerContext.getDurationString();

        Calendar nextMonthFirstCalendar = Calendar.getInstance(timeZone);
        nextMonthFirstCalendar.setTimeInMillis(someDateTimeStamp + nextMonthFirstTimeStampDuration);

        assertEquals("Year should be " + nextMonthFirstDateYear,
View Full Code Here

Examples of org.wso2.carbon.billing.core.scheduler.SchedulerContext

                }
                invoice.setStartDate(new Date(earliestSubscriptionStart));
            }
           
            Date currentDate = new Date();
            SchedulerContext schedulerContext = handlerContext.getSchedulerContext();
            if (schedulerContext != null && schedulerContext.getCurrentDurationEnd() != -1) {
                invoice.setEndDate(new Date(schedulerContext.getCurrentDurationEnd()));
            } else {
                invoice.setEndDate(currentDate);
            }
            // this is the date the billing is initialized, this can be probably overwritten
            invoice.setDate(currentDate);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.