Package org.quartz

Examples of org.quartz.JobDataMap


    private final Log log = LogFactory.getLog(MeasurementScheduleManagerBean.class);

    @Override
    public void executeJobCode(JobExecutionContext context) throws JobExecutionException {
        JobDataMap jobDataMap = context.getMergedJobDataMap();
        final String triggerName = (String) jobDataMap.get(MeasurementScheduleManagerBean.TRIGGER_NAME);
        final String triggerGroupName = (String) jobDataMap.get(MeasurementScheduleManagerBean.TRIGGER_GROUP_NAME);
        SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
        try {
            scheduler.unscheduleJob(triggerName, triggerGroupName);
        } catch (SchedulerException e) {
            log.error("Failed to unschedule Quartz trigger [" + triggerName + "].", e);
        }

        String scheduleSubQuery = (String) jobDataMap.get(MeasurementScheduleManagerBean.SCHEDULE_SUBQUERY);
        EntityContext entityContext = new EntityContext(
            Integer.parseInt((String) jobDataMap.get(MeasurementScheduleManagerBean.ENTITYCONTEXT_RESOURCEID)),
            Integer.parseInt((String) jobDataMap.get(MeasurementScheduleManagerBean.ENTITYCONTEXT_GROUPID)),
            Integer.parseInt((String) jobDataMap.get(MeasurementScheduleManagerBean.ENTITYCONTEXT_PARENT_RESOURCEID)),
            Integer.parseInt((String) jobDataMap.get(MeasurementScheduleManagerBean.ENTITYCONTEXT_RESOURCETYPEID))
        );
        MeasurementScheduleManagerLocal scheduleManager = LookupUtil.getMeasurementScheduleManager();
        scheduleManager.notifyAgentsOfScheduleUpdates(entityContext, scheduleSubQuery);
    }
View Full Code Here


        return jobDetail;
    }

    public void execute(JobExecutionContext jobContext) throws JobExecutionException {
        JobDetail jobDetail = jobContext.getJobDetail();
        JobDataMap jobDataMap = jobDetail.getJobDataMap();

        Integer configurationGroupUpdateId = jobDataMap.getIntFromString(DATAMAP_INT_CONFIG_GROUP_UPDATE_ID);

        Integer subjectId = jobDataMap.getIntFromString(DATAMAP_INT_SUBJECT_ID);
        Subject subject = LookupUtil.getSubjectManager().getSubjectById(subjectId);

        processGroupConfigurationUpdate(configurationGroupUpdateId, subject);
    }
View Full Code Here

            JobDetail jobDetail = context.getJobDetail();
            if (jobDetail == null) {
                throw new IllegalStateException("The job does not have any details");
            }

            JobDataMap dataMap = jobDetail.getJobDataMap();
            if (dataMap == null) {
                throw new IllegalStateException("The job does not have any data in its details");
            }

            String repoName = dataMap.getString(KEY_REPO_NAME);

            if (repoName == null) {
                throw new IllegalStateException("Missing repo name in details context");
            }
View Full Code Here

     * @return populated map used to drive a repo sync job; this will be the same map as what
     *         exists in the {@link JobDetail#getJobDataMap()} call of the details object if
     *         that call does not return <code>null</code>
     */
    public static JobDataMap createJobDataMap(JobDetail details, Repo repo) {
        JobDataMap dataMap;

        if (details != null) {
            dataMap = details.getJobDataMap();
        } else {
            dataMap = new JobDataMap();
        }

        dataMap.put(KEY_REPO_NAME, repo.getName());

        return dataMap;
    }
View Full Code Here

            JobDetail jobDetail = context.getJobDetail();
            if (jobDetail == null) {
                throw new IllegalStateException("The job does not have any details");
            }

            JobDataMap dataMap = jobDetail.getJobDataMap();
            if (dataMap == null) {
                throw new IllegalStateException("The job does not have any data in its details");
            }

            String name = dataMap.getString(DATAMAP_CONTENT_SOURCE_NAME);
            String typeName = dataMap.getString(DATAMAP_CONTENT_SOURCE_TYPE_NAME);
            boolean syncImportedRepos = dataMap.getBoolean(DATAMAP_SYNC_IMPORTED_REPOS);

            if (name == null) {
                throw new IllegalStateException("Missing the content source name in details data");
            }
View Full Code Here

     * @param details where the job's data map will be stored (may be <code>null</code>)
     *
     * @return the data map with the data necessary to execute a content sync job
     */
    public static JobDataMap createJobDataMap(ContentSource contentSource, JobDetail details) {
        JobDataMap dataMap;

        if (details != null) {
            dataMap = details.getJobDataMap();
        } else {
            dataMap = new JobDataMap();
        }

        dataMap.put(DATAMAP_CONTENT_SOURCE_NAME, contentSource.getName());
        dataMap.put(DATAMAP_CONTENT_SOURCE_TYPE_NAME, contentSource.getContentSourceType().getName());

        return dataMap;
    }
View Full Code Here

        }
    }

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        final JobDataMap jobDataMap = context.getMergedJobDataMap();

        unscheduleJob(jobDataMap);

        DiscoveryBossLocal discoveryBoss = LookupUtil.getDiscoveryBoss();
        discoveryBoss.updateAgentInventoryStatus(
                (String) jobDataMap.get(PLATFORMS_COMMA_LIST),
                (String) jobDataMap.get(SERVERS_COMMA_LIST));
    }
View Full Code Here

                memberPluginConfiguration, subject.getName());
            memberUpdate.setGroupConfigurationUpdate(groupUpdate);
            entityManager.persist(memberUpdate);
        }

        JobDataMap jobDataMap = new JobDataMap();
        jobDataMap.putAsString(AbstractGroupConfigurationUpdateJob.DATAMAP_INT_CONFIG_GROUP_UPDATE_ID, updateId);
        jobDataMap.putAsString(AbstractGroupConfigurationUpdateJob.DATAMAP_INT_SUBJECT_ID, subject.getId());

        /*
         * acquire quartz objects and schedule the group update, but deferred the execution for 10 seconds
         * because we need this transaction to complete so that the data is available when the quartz job triggers
         */
 
View Full Code Here

                memberResourceConfiguration, subject.getName());
            memberUpdate.setGroupConfigurationUpdate(groupUpdate);
            entityManager.persist(memberUpdate);
        }

        JobDataMap jobDataMap = new JobDataMap();
        jobDataMap.putAsString(AbstractGroupConfigurationUpdateJob.DATAMAP_INT_CONFIG_GROUP_UPDATE_ID, updateId);
        jobDataMap.putAsString(AbstractGroupConfigurationUpdateJob.DATAMAP_INT_SUBJECT_ID, subject.getId());

        /*
         * Acquire Quartz objects and schedule the group update, but defer the execution for 10 seconds,
         * because we need this transaction to complete so that the data is available when the Quartz job triggers.
         */
 
View Full Code Here

            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);
View Full Code Here

TOP

Related Classes of org.quartz.JobDataMap

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.