Package org.quartz

Examples of org.quartz.SimpleTrigger


            final String TRIGGER_PREFIX = "AgentInventoryUpdateTrigger";

            final String randomSuffix = UUID.randomUUID().toString();

            final String triggerName = TRIGGER_PREFIX + " - " + randomSuffix;
            SimpleTrigger trigger = new SimpleTrigger(triggerName, DEFAULT_JOB_GROUP, new Date());

            JobDataMap jobDataMap = new JobDataMap();
            jobDataMap.put(AgentInventoryStatusUpdateJob.KEY_TRIGGER_NAME, triggerName);
            jobDataMap.put(AgentInventoryStatusUpdateJob.KEY_TRIGGER_GROUP_NAME, DEFAULT_JOB_GROUP);
            AgentInventoryStatusUpdateJob.externalizeJobValues(jobDataMap,
                AgentInventoryStatusUpdateJob.PLATFORMS_COMMA_LIST, platforms);
            AgentInventoryStatusUpdateJob.externalizeJobValues(jobDataMap,
                AgentInventoryStatusUpdateJob.SERVERS_COMMA_LIST, servers);

            trigger.setJobName(DEFAULT_JOB_NAME);
            trigger.setJobGroup(DEFAULT_JOB_GROUP);
            trigger.setJobDataMap(jobDataMap);

            if (isJobScheduled(scheduler, DEFAULT_JOB_NAME, DEFAULT_JOB_GROUP)) {
                scheduler.scheduleJob(trigger);
            } else {
                JobDetail jobDetail = new JobDetail(DEFAULT_JOB_NAME, DEFAULT_JOB_GROUP,
View Full Code Here


            CONTENT_SRC_SYNC_JOB_GROUP_NAME, ContentProviderSyncJob.class, false, false, false);

        JobDataMap jobDataMap = ContentProviderSyncJob.createJobDataMap(contentSource, job);
        jobDataMap.putAsString(ContentProviderSyncJob.DATAMAP_SYNC_IMPORTED_REPOS, true);

        SimpleTrigger trigger = new SimpleTrigger(job.getName(), job.getGroup());
        trigger.setVolatility(false);

        SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
        Date next = scheduler.scheduleJob(job, trigger);

        getLog().info(
View Full Code Here

        RepoSyncJob.createJobDataMap(job, repo);
        Date nextExecution;
        SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
        Trigger trigger = scheduler.getTrigger(jobName, REPO_SYNC_JOB_IMMEDIATE_GROUP_NAME);
        if (trigger == null) {
            trigger = new SimpleTrigger(jobName, job.getGroup());
            trigger.setVolatility(false);
            nextExecution = scheduler.scheduleJob(job, trigger);
        } else {
            nextExecution = scheduler.rescheduleJob(jobName, REPO_SYNC_JOB_IMMEDIATE_GROUP_NAME, trigger);
        }
View Full Code Here

        JobDetail jobDetail = new JobDetail(RepoSyncJob.createJobName(repo), REPO_SYNC_JOB_IMMEDIATE_GROUP_NAME,
            RepoSyncJob.class, false, false, false);

        RepoSyncJob.createJobDataMap(jobDetail, repo);

        SimpleTrigger trigger = new SimpleTrigger(jobDetail.getName(), jobDetail.getGroup());
        trigger.setVolatility(false);

        SchedulerLocal scheduler = LookupUtil.getSchedulerBean();

        boolean cancelled = scheduler.interrupt(RepoSyncJob.createJobName(repo), REPO_SYNC_JOB_IMMEDIATE_GROUP_NAME);
View Full Code Here

            final String TRIGGER_PREFIX = "AgentRequestFullAvailabilityTrigger";

            final String randomSuffix = UUID.randomUUID().toString();

            final String triggerName = TRIGGER_PREFIX + " - " + randomSuffix;
            SimpleTrigger trigger = new SimpleTrigger(triggerName, DEFAULT_JOB_GROUP, new Date());

            JobDataMap jobDataMap = new JobDataMap();
            jobDataMap.put(AgentRequestFullAvailabilityJob.KEY_TRIGGER_NAME, triggerName);
            jobDataMap.put(AgentRequestFullAvailabilityJob.KEY_TRIGGER_GROUP_NAME, DEFAULT_JOB_GROUP);
            AgentRequestFullAvailabilityJob.externalizeJobValues(jobDataMap, AgentRequestFullAvailabilityJob.AGENTS,
                agents);

            trigger.setJobName(DEFAULT_JOB_NAME);
            trigger.setJobGroup(DEFAULT_JOB_GROUP);
            trigger.setJobDataMap(jobDataMap);

            if (isJobScheduled(scheduler, DEFAULT_JOB_NAME, DEFAULT_JOB_GROUP)) {
                scheduler.scheduleJob(trigger);
            } else {
                JobDetail jobDetail = new JobDetail(DEFAULT_JOB_NAME, DEFAULT_JOB_GROUP,
View Full Code Here

    public ResourceOperationSchedule scheduleResourceOperation(Subject subject, int resourceId, String operationName,
        long delay, long repeatInterval, int repeatCount, int timeout, Configuration parameters, String notes)
        throws ScheduleException {
        try {

            SimpleTrigger trigger = new SimpleTrigger();
            if (delay < 0L) {
                delay = 0L;
            }
            trigger.setRepeatCount((repeatCount < 0) ? SimpleTrigger.REPEAT_INDEFINITELY : repeatCount);
            trigger.setRepeatInterval((repeatInterval < 0L) ? 0L : repeatInterval);
            trigger.setStartTime(new Date(System.currentTimeMillis() + delay));

            // if the user set a timeout, add it to our configuration
            if (timeout > 0L) {
                if (null == parameters) {
                    parameters = new Configuration();
View Full Code Here

        boolean haltOnFailure, String operationName, Configuration parameters, long delay, long repeatInterval,
        int repeatCount, int timeout, String description) throws ScheduleException {

        try {

            SimpleTrigger trigger = new SimpleTrigger();
            if (delay < 0L) {
                delay = 0L;
            }
            trigger.setRepeatCount((repeatCount < 0) ? SimpleTrigger.REPEAT_INDEFINITELY : repeatCount);
            trigger.setRepeatInterval((repeatInterval < 0L) ? 0L : repeatInterval);
            trigger.setStartTime(new Date(System.currentTimeMillis() + delay));

            // if the user set a timeout, add it to our configuration
            if (timeout > 0L) {
                if (null == parameters) {
                    parameters = new Configuration();
View Full Code Here

    }

    private JobTrigger convertToJobTrigger(Trigger trigger) {
        JobTrigger schedule;
        if (trigger instanceof SimpleTrigger) {
            SimpleTrigger simpleTrigger = (SimpleTrigger) trigger;
            Date startTime = simpleTrigger.getStartTime();
            if (startTime != null) {
                // later
                int repeatCount = simpleTrigger.getRepeatCount();
                if (repeatCount == 0) {
                    // non-recurring
                    schedule = JobTrigger.createLaterTrigger(startTime);
                } else {
                    // recurring
                    long repeatInterval = simpleTrigger.getRepeatInterval();
                    if (repeatCount == SimpleTrigger.REPEAT_INDEFINITELY) {
                        Date endTime = simpleTrigger.getEndTime();
                        if (endTime != null) {
                            schedule = JobTrigger.createLaterAndRepeatTrigger(startTime, repeatInterval, endTime);
                        } else {
                            schedule = JobTrigger.createLaterAndRepeatTrigger(startTime, repeatInterval);
                        }
                    } else {
                        schedule = JobTrigger.createLaterAndRepeatTrigger(startTime, repeatInterval, repeatCount);
                    }
                }
            } else {
                // now
                int repeatCount = simpleTrigger.getRepeatCount();
                if (repeatCount == 0) {
                    // non-recurring
                    schedule = JobTrigger.createNowTrigger();
                } else {
                    // recurring
                    long repeatInterval = simpleTrigger.getRepeatInterval();
                    if (repeatCount == SimpleTrigger.REPEAT_INDEFINITELY) {
                        Date endTime = simpleTrigger.getEndTime();
                        if (endTime != null) {
                            schedule = JobTrigger.createNowAndRepeatTrigger(repeatInterval, endTime);
                        } else {
                            schedule = JobTrigger.createNowAndRepeatTrigger(repeatInterval);
                        }
View Full Code Here

            } catch (ParseException e) {
                throw new RuntimeException(e);
            }
            trigger = cronTrigger;
        } else {
            SimpleTrigger simpleTrigger = new SimpleTrigger();
            Date startTime = null;
            switch (jobTrigger.getStartType()) {
            case NOW:
                startTime = new Date();
                break;
            case DATETIME:
                startTime = jobTrigger.getStartDate();
                break;
            }
            simpleTrigger.setStartTime(startTime);
            if (jobTrigger.getRecurrenceType() == JobTrigger.RecurrenceType.REPEAT_INTERVAL) {
                simpleTrigger.setRepeatInterval(jobTrigger.getRepeatInterval());
                if (jobTrigger.getEndType() == JobTrigger.EndType.REPEAT_COUNT) {
                    simpleTrigger.setRepeatCount(jobTrigger.getRepeatCount());
                } else {
                    simpleTrigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);
                    if (jobTrigger.getEndType() == JobTrigger.EndType.DATETIME) {
                        simpleTrigger.setEndTime(jobTrigger.getEndDate());
                    }
                }
            }

            trigger = simpleTrigger;
View Full Code Here

            final String jobName = DEFAULT_AGENT_JOB + " - " + randomSuffix;
            JobDetail jobDetail = new JobDetail(jobName, DEFAULT_AGENT_GROUP, NotifyAgentsOfScheduleUpdatesJob.class);

            final String triggerName = DEFAULT_AGENT_TRIGGER + " - " + randomSuffix;
            SimpleTrigger simpleTrigger = new SimpleTrigger(triggerName, DEFAULT_AGENT_GROUP, new Date());

            JobDataMap jobDataMap = simpleTrigger.getJobDataMap();
            jobDataMap.put(TRIGGER_NAME, triggerName);
            jobDataMap.put(TRIGGER_GROUP_NAME, DEFAULT_AGENT_GROUP);
            jobDataMap.put(SCHEDULE_SUBQUERY, scheduleSubQuery);
            jobDataMap.put(ENTITYCONTEXT_RESOURCEID, Integer.toString(entityContext.getResourceId()));
            jobDataMap.put(ENTITYCONTEXT_GROUPID, Integer.toString(entityContext.getGroupId()));
            jobDataMap.put(ENTITYCONTEXT_PARENT_RESOURCEID, Integer.toString(entityContext.getParentResourceId()));
            jobDataMap.put(ENTITYCONTEXT_RESOURCETYPEID, Integer.toString(entityContext.getResourceTypeId()));

            if (isJobScheduled(scheduler, DEFAULT_AGENT_JOB, DEFAULT_AGENT_GROUP)) {
                simpleTrigger.setJobName(DEFAULT_AGENT_JOB);
                simpleTrigger.setJobGroup(DEFAULT_AGENT_GROUP);
                scheduler.scheduleJob(simpleTrigger);
            } else {
                scheduler.scheduleJob(jobDetail, simpleTrigger);
            }
        } catch (RuntimeException e) {
View Full Code Here

TOP

Related Classes of org.quartz.SimpleTrigger

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.