Package org.rhq.core.domain.configuration.definition

Examples of org.rhq.core.domain.configuration.definition.ConfigurationDefinition


        query.setParameter("resourceId", resourceId);
        Configuration pluginConfiguration = (Configuration) query.getSingleResult();

        // Mask the configuration before returning it.
        Resource resource = resourceManager.getResourceById(subjectManager.getOverlord(), resourceId);
        ConfigurationDefinition pluginConfigurationDefinition = getPluginConfigurationDefinitionForResourceType(
            subjectManager.getOverlord(), resource.getResourceType().getId());
        // We do not want the masked configurations persisted, so detach all entities before masking the configurations.
        pluginConfiguration.getMap().size();
        entityManager.clear();
        ConfigurationMaskingUtility.maskConfiguration(pluginConfiguration, pluginConfigurationDefinition);
View Full Code Here


        // Make sure to unmask the configuration before persisting the update.
        Configuration existingPluginConfiguration = resource.getPluginConfiguration();
        ConfigurationMaskingUtility.unmaskConfiguration(newPluginConfiguration, existingPluginConfiguration);

        ConfigurationDefinition pluginConfigDef = getPluginConfigurationDefinitionForResourceType(overlord, resource
            .getResourceType().getId());
        List<String> validationErrors = ConfigurationUtility.validateConfiguration(newPluginConfiguration,
            existingPluginConfiguration, pluginConfigDef);
        if (!validationErrors.isEmpty()) {
            throw new BadArgumentException("Invalid newPluginConfiguration, configuration not updated: "
View Full Code Here

        Configuration resourceConfiguration = (Configuration) query.getSingleResult();

        // Mask the configuration before returning it.
        Resource resource = resourceManager.getResourceById(subjectManager.getOverlord(), resourceId);
        ConfigurationDefinition resourceConfigurationDefinition = getResourceConfigurationDefinitionForResourceType(
            subjectManager.getOverlord(), resource.getResourceType().getId());
        // We do not want the masked configurations persisted, so detach all entities before masking the configurations.
        resourceConfiguration.getMap().size();
        entityManager.clear();
        ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
View Full Code Here

                // Instead, simply return the most recent persisted config w/ a SUCCESS status (possibly null).
                if (current != null) {
                    // Fetch and mask the configuration before returning the update.
                    Configuration configuration = current.getConfiguration();
                    configuration.getMap().size();
                    ConfigurationDefinition configurationDefinition = getResourceConfigurationDefinitionForResourceType(
                        subjectManager.getOverlord(), resource.getResourceType().getId());
                    // We do not want the masked configuration persisted, so detach all entities before masking the configuration.
                    entityManager.clear();
                    ConfigurationMaskingUtility.maskConfiguration(configuration, configurationDefinition);
                }
                return current;
            }
        } catch (NoResultException nre) {
            // The resource hasn't been successfully configured yet - not a problem, we'll ask the agent for the live
            // config...
        }

        // ask the agent to get us the live, most up-to-date configuration for the resource,
        // then compare it to make sure what we think is the latest configuration is really the latest
        Configuration liveConfig = getLiveResourceConfiguration(resource, true, fromStructured);

        if (liveConfig != null) {
            Configuration currentConfig = (current != null) ? current.getConfiguration() : null;
            // Compare the live values and, if there is a difference with the current, store the live config as a new
            // update. Note that, if there is no current configuration stored, the live config is stored as the first
            // update.
            boolean theSame = (currentConfig != null && currentConfig.equals(liveConfig));

            // Someone dorked with the configuration on the agent side - save the live config as a new update.
            if (!theSame) {
                try {
                    current = persistNewAgentReportedResourceConfiguration(resource, liveConfig);
                } catch (ConfigurationUpdateStillInProgressException e) {
                    // This means a config update is INPROGRESS.
                    // Return the current in this case since it is our latest committed active config.
                    // Note that even though this application exception specifies "rollback=true", it will
                    // not effect our current transaction since the persist call was made with REQUIRES_NEW
                    // and thus only that new tx was rolled back
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Resource is currently in progress of changing its resource configuration - "
                            + "since it hasn't finished yet, will use the last successful resource configuration: " + e);
                    }
                }
            }
        } else {
            LOG.warn("Could not get live resource configuration for resource [" + resource
                + "]; will assume latest resource configuration update is the current resource configuration.");
        }

        if (current != null) {
            // Mask the configuration before returning the update.
            Configuration configuration = current.getConfiguration();
            configuration.getMap().size();
            ConfigurationDefinition configurationDefinition = getResourceConfigurationDefinitionForResourceType(
                subjectManager.getOverlord(), resource.getResourceType().getId());
            // We do not want the masked configuration persisted, so detach all entities before masking the configuration.
            // But before we detach the entities, let's flush the entity manager to persist any pending changes.
            // This will ensure that:
            // 1) All changes in the entity manager are persisted
View Full Code Here

            resource = current.getResource();

            // Mask the configuration before returning the update.
            Configuration configuration = current.getConfiguration();
            configuration.getMap().size();
            ConfigurationDefinition configurationDefinition = getPluginConfigurationDefinitionForResourceType(
                subjectManager.getOverlord(), resource.getResourceType().getId());
            // We do not want the masked configuration persisted, so detach all entities before masking the configuration.
            entityManager.clear();
            ConfigurationMaskingUtility.maskConfiguration(configuration, configurationDefinition);
        } catch (NoResultException nre) {
View Full Code Here

        // Mask the configurations before returning them.
        for (Configuration resourceConfiguration : currentPersistedConfigs.values()) {
            resourceConfiguration.getMap().size();
        }
        ConfigurationDefinition resourceConfigurationDefinition = getResourceConfigurationDefinitionForResourceType(
            subjectManager.getOverlord(), group.getResourceType().getId());
        // We do not want the masked configurations persisted, so detach all entities before masking the configurations.
        entityManager.clear();
        for (Configuration resourceConfiguration : currentPersistedConfigs.values()) {
            ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
View Full Code Here

        // Mask the configurations before returning them.
        for (Configuration pluginConfiguration : currentPersistedConfigs.values()) {
            pluginConfiguration.getMap().size();
        }
        ConfigurationDefinition pluginConfigurationDefinition = getPluginConfigurationDefinitionForResourceType(
            subjectManager.getOverlord(), group.getResourceType().getId());
        // We do not want the masked configurations persisted, so detach all entities before masking the configurations.
        entityManager.clear();
        for (Configuration pluginConfiguration : currentPersistedConfigs.values()) {
            ConfigurationMaskingUtility.maskConfiguration(pluginConfiguration, pluginConfigurationDefinition);
View Full Code Here

        return configService.validate(configuration, resourceId, isStructured);
    }

    private boolean isStructuredAndRawSupported(int resourceId) {
        Resource resource = entityManager.find(Resource.class, resourceId);
        ConfigurationDefinition configDef = resource.getResourceType().getResourceConfigurationDefinition();
        if (configDef == null) {
            return false;
        }
        return ConfigurationFormat.STRUCTURED_AND_RAW == configDef.getConfigurationFormat();
    }
View Full Code Here

        Subject overlord = subjectManager.getOverlord();
        Resource resource = resourceManager.getResource(overlord, resourceId);
        Configuration existingResourceConfiguration = resource.getResourceConfiguration();
        ConfigurationMaskingUtility.unmaskConfiguration(newResourceConfiguration, existingResourceConfiguration);

        ConfigurationDefinition resourceConfigDef = getResourceConfigurationDefinitionForResourceType(overlord,
            resource.getResourceType().getId());
        List<String> validationErrors = ConfigurationUtility.validateConfiguration(newResourceConfiguration,
            existingResourceConfiguration, resourceConfigDef);
        if (!validationErrors.isEmpty()) {
            throw new BadArgumentException("Invalid newResourceConfiguration, configuration not updated: "
View Full Code Here

    @Override
    public ConfigurationDefinition getPackageTypeConfigurationDefinition(Subject subject, int packageTypeId) {
        Query query = entityManager.createNamedQuery(ConfigurationDefinition.QUERY_FIND_DEPLOYMENT_BY_PACKAGE_TYPE_ID);
        query.setParameter("packageTypeId", packageTypeId);
        ConfigurationDefinition configurationDefinition = null;
        try {
            configurationDefinition = (ConfigurationDefinition) query.getSingleResult();
        } catch (NoResultException e) {
            PackageType packageType = entityManager.find(PackageType.class, packageTypeId);
            if (packageType == null) {
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.definition.ConfigurationDefinition

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.