Package org.rhq.enterprise.server.resource.group

Examples of org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException


        try {
            updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
        } catch (SchedulerException sche) {
            String message = "Error scheduling plugin configuration update for group[id=" + group.getId() + "]";
            LOG.error(message, sche);
            throw new ResourceGroupUpdateException(message + ": " + sche);
        }

        // Create and persist updates for each of the members.
        for (Integer resourceId : memberPluginConfigurations.keySet()) {
            Configuration memberPluginConfiguration = memberPluginConfigurations.get(resourceId);
            // Make sure to unmask the configuration before persisting the update.
            Resource resource = resourceManager.getResource(subjectManager.getOverlord(), resourceId);
            Configuration existingPluginConfiguration = resource.getPluginConfiguration();
            ConfigurationMaskingUtility.unmaskConfiguration(memberPluginConfiguration, existingPluginConfiguration);
            Resource flyWeight = new Resource(resourceId);
            PluginConfigurationUpdate memberUpdate = new PluginConfigurationUpdate(flyWeight,
                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
         */
        JobDetail jobDetail = GroupPluginConfigurationUpdateJob.getJobDetail(group, subject, jobDataMap);
        Trigger trigger = QuartzUtil.getFireOnceOffsetTrigger(jobDetail, 10000);
        try {
            scheduler.scheduleJob(jobDetail, trigger);
        } catch (SchedulerException e) {
            String message = "Error scheduling job named '" + jobDetail.getName() + "':";
            LOG.error(message, e);
            throw new ResourceGroupUpdateException(message + e.getMessage());
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Scheduled plugin configuration update against compatibleGroup[id=" + compatibleGroupId + "]");
        }
View Full Code Here


        try {
            updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
        } catch (SchedulerException sche) {
            String message = "Error scheduling resource configuration update for group[id=" + group.getId() + "]";
            LOG.error(message, sche);
            throw new ResourceGroupUpdateException(message + ": " + sche);
        }

        // Create and persist updates for each of the members.
        for (Integer resourceId : newResourceConfigurationMap.keySet()) {
            Configuration memberResourceConfiguration = newResourceConfigurationMap.get(resourceId);
            // Make sure to unmask the configuration before persisting the update.
            Resource resource = resourceManager.getResource(subjectManager.getOverlord(), resourceId);
            Configuration existingResourceConfiguration = resource.getResourceConfiguration();
            ConfigurationMaskingUtility.unmaskConfiguration(memberResourceConfiguration, existingResourceConfiguration);
            Resource flyWeight = new Resource(resourceId);
            ResourceConfigurationUpdate memberUpdate = new ResourceConfigurationUpdate(flyWeight,
                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.
         */
        JobDetail jobDetail = GroupResourceConfigurationUpdateJob.getJobDetail(group, subject, jobDataMap);
        Trigger trigger = QuartzUtil.getFireOnceOffsetTrigger(jobDetail, 10000);
        try {
            scheduler.scheduleJob(jobDetail, trigger);
        } catch (SchedulerException e) {
            String message = "Error scheduling job named '" + jobDetail.getName() + "':";
            LOG.error(message, e);
            throw new ResourceGroupUpdateException(message + e.getMessage());
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Scheduled Resource configuration update against compatible ResourceGroup[id="
                + compatibleGroupId + "].");
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException

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.