Search in sources :

Example 1 with CronExpression

use of org.apache.ode.utils.CronExpression in project carbon-business-process by wso2.

the class BPELServerConfiguration method getSystemCleanupCronJobs.

public List<ProcessConf.CronJob> getSystemCleanupCronJobs() {
    List<ProcessConf.CronJob> jobs = new ArrayList<ProcessConf.CronJob>();
    TSchedules schedules = bpsConfigDocument.getWSO2BPS().getSchedules();
    if (schedules != null && schedules.getScheduleArray() != null && schedules.getScheduleArray().length > 0) {
        for (TSchedule schedule : schedules.getScheduleArray()) {
            ProcessConf.CronJob job = new ProcessConf.CronJob();
            try {
                job.setCronExpression(new CronExpression(schedule.getWhen()));
                for (final TCleanup aCleanup : schedule.getCleanupArray()) {
                    ProcessConf.CleanupInfo cleanupInfo = new ProcessConf.CleanupInfo();
                    assert !(aCleanup.getFilterArray().length == 0);
                    cleanupInfo.setFilters(Arrays.asList(aCleanup.getFilterArray()));
                    processACleanup(cleanupInfo.getCategories(), Arrays.asList(aCleanup.getCategoryArray()));
                    Scheduler.JobDetails runnableDetails = new Scheduler.JobDetails();
                    runnableDetails.getDetailsExt().put(BPELConstants.ODE_DETAILS_EXT_CLEAN_UP_INFO, cleanupInfo);
                    runnableDetails.getDetailsExt().put(BPELConstants.ODE_DETAILS_EXT_TRANSACTION_SIZE, 10);
                    job.getRunnableDetailList().add(runnableDetails);
                    log.info("SYSTEM CRON configuration added a runtime data cleanup: " + runnableDetails);
                }
                jobs.add(job);
            } catch (ParseException e) {
                log.error("Exception during parsing the schedule cron expression: " + schedule.getWhen() + ", skipped the scheduled job.");
            }
        }
    }
    return jobs;
}
Also used : Scheduler(org.apache.ode.bpel.iapi.Scheduler) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) ArrayList(java.util.ArrayList) CronExpression(org.apache.ode.utils.CronExpression) ParseException(java.text.ParseException) TCleanup(org.wso2.carbon.bpel.config.TCleanup) TSchedules(org.wso2.carbon.bpel.config.TSchedules) TSchedule(org.wso2.carbon.bpel.config.TSchedule)

Example 2 with CronExpression

use of org.apache.ode.utils.CronExpression in project carbon-business-process by wso2.

the class ProcessConfigurationImpl method getCronJobs.

public List<CronJob> getCronJobs() {
    List<CronJob> jobs = new ArrayList<CronJob>();
    for (TSchedule schedule : processInfo.getScheduleList()) {
        CronJob job = new CronJob();
        try {
            job.setCronExpression(new CronExpression(schedule.getWhen()));
            for (final TCleanup aCleanup : schedule.getCleanupList()) {
                CleanupInfo cleanupInfo = new CleanupInfo();
                assert !aCleanup.getFilterList().isEmpty();
                cleanupInfo.setFilters(aCleanup.getFilterList());
                ProcessCleanupConfImpl.processACleanup(cleanupInfo.getCategories(), aCleanup.getCategoryList());
                Scheduler.JobDetails runnableDetails = new Scheduler.JobDetails();
                runnableDetails.getDetailsExt().put(BPELConstants.ODE_DETAILS_EXT_CLEAN_UP_INFO, cleanupInfo);
                runnableDetails.setProcessId(processId);
                runnableDetails.getDetailsExt().put(BPELConstants.ODE_DETAILS_EXT_TRANSACTION_SIZE, 10);
                job.getRunnableDetailList().add(runnableDetails);
            }
            jobs.add(job);
        } catch (ParseException pe) {
            log.error("Exception during parsing the schedule cron expression: " + schedule.getWhen() + ", skipped the scheduled job.", pe);
        }
    }
    return jobs;
}
Also used : Scheduler(org.apache.ode.bpel.iapi.Scheduler) ArrayList(java.util.ArrayList) CronExpression(org.apache.ode.utils.CronExpression) ParseException(java.text.ParseException) TCleanup(org.apache.ode.bpel.dd.TCleanup) TSchedule(org.apache.ode.bpel.dd.TSchedule)

Aggregations

ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 Scheduler (org.apache.ode.bpel.iapi.Scheduler)2 CronExpression (org.apache.ode.utils.CronExpression)2 TCleanup (org.apache.ode.bpel.dd.TCleanup)1 TSchedule (org.apache.ode.bpel.dd.TSchedule)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 TCleanup (org.wso2.carbon.bpel.config.TCleanup)1 TSchedule (org.wso2.carbon.bpel.config.TSchedule)1 TSchedules (org.wso2.carbon.bpel.config.TSchedules)1