Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.PluginConfigurationUpdate


        List<PluginConfigurationUpdate> updates = query.getResultList();

        if ((updates == null) || (updates.size() == 0)) {
            // there is no configuration yet - get the latest from the agent, if possible
            updates = new ArrayList<PluginConfigurationUpdate>();
            PluginConfigurationUpdate latest = getLatestPluginConfigurationUpdate(subject, resourceId);
            if (latest != null) {
                updates.add(latest);
            }
        } else if (updates.size() > 0) {
            resource = updates.get(0).getResource();
View Full Code Here


     * @deprecated use criteria-based API
     */
    @Deprecated
    @Override
    public PluginConfigurationUpdate getPluginConfigurationUpdate(Subject subject, int configurationUpdateId) {
        PluginConfigurationUpdate update = entityManager.find(PluginConfigurationUpdate.class, configurationUpdateId);

        if (!authorizationManager.canViewResource(subject, update.getResource().getId())) {
            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to view plugin configuration update for [" + update.getResource() + "]");
        }

        update.getConfiguration(); // this is EAGER loaded, so this really doesn't do anything

        return update;
    }
View Full Code Here

        return update;
    }

    @Override
    public void purgePluginConfigurationUpdate(Subject subject, int configurationUpdateId, boolean purgeInProgress) {
        PluginConfigurationUpdate doomedRequest = entityManager.find(PluginConfigurationUpdate.class,
            configurationUpdateId);

        if (doomedRequest == null) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Asked to purge a non-existing config update request [" + configurationUpdateId + "]");
            }
            return;
        }

        if ((doomedRequest.getStatus() == ConfigurationUpdateStatus.INPROGRESS) && !purgeInProgress) {
            throw new IllegalStateException(
                "The update request is still in the in-progress state. Please wait for it to complete: "
                    + doomedRequest);
        }

        // make sure the user has the proper permissions to do this
        Resource resource = doomedRequest.getResource();
        if (!authorizationManager.hasResourcePermission(subject, Permission.MODIFY_RESOURCE, resource.getId())) {
            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to purge a plugin configuration update audit trail for resource ["
                + resource + "]");
        }
View Full Code Here

    }

    @Override
    public void rollbackPluginConfiguration(Subject subject, int resourceId, int configHistoryId)
        throws ConfigurationUpdateException {
        PluginConfigurationUpdate configurationUpdateHistory = entityManager.find(PluginConfigurationUpdate.class,
            configHistoryId);
        Configuration configuration = configurationUpdateHistory.getConfiguration();
        if (configuration == null) {
            throw new ConfigurationUpdateException("No plugin configuration history element exists with id = '"
                + configHistoryId + "'");
        }
View Full Code Here

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

            // agent is already updated to the new configuration. Instead we call the dedicated local method
            // supporting this use case.
            Configuration pluginConfig = upgradeRequest.getNewPluginConfiguration();
            if (null != pluginConfig) {
                pluginConfig = pluginConfig.deepCopy(false);
                PluginConfigurationUpdate update = configurationManager.upgradePluginConfiguration(
                    subjectManager.getOverlord(), resource.getId(), pluginConfig);
                ret.setUpgradedResourcePluginConfiguration(update.getResource().getPluginConfiguration());
            }

            // finally let's remove the potential previous upgrade error. we've now successfully
            // upgraded the resource.
            List<ResourceError> upgradeErrors = resourceManager.findResourceErrors(subjectManager.getOverlord(),
View Full Code Here

    public Configuration persistUpdatedPluginConfiguration(int resourceId, Configuration pluginConfiguration) {
        ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

        Subject overlord = subjectManager.getOverlord();
        PluginConfigurationUpdate update = configurationManager.upgradePluginConfiguration(overlord, resourceId,
            pluginConfiguration);

        return update.getResource().getPluginConfiguration();
    }
View Full Code Here

    public String update() {
        Subject subject = EnterpriseFacesContextUtility.getSubject();
        Resource resource = EnterpriseFacesContextUtility.getResource();
        Configuration newConfiguration = getConfiguration();

        PluginConfigurationUpdate update = this.configurationManager.updatePluginConfiguration(subject, resource
            .getId(), newConfiguration);

        String errorMessage = update.getErrorMessage();
        if (errorMessage == null) {
            FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Connection properties updated.");
            clearConfiguration();
            return SUCCESS_OUTCOME;
        } else {
View Full Code Here

        public ConfigurationDefinition getPluginConfigurationDefinition() {
            return resourceClientProxy.pluginConfigurationDefinition;
        }

        public PluginConfigurationUpdate updatePluginConfiguration(Configuration configuration) {
            PluginConfigurationUpdate update = remoteClient.getProxy(ConfigurationManagerRemote.class)
                .updatePluginConfiguration(remoteClient.getSubject(), resourceClientProxy.getId(), configuration);

            return update;
        }
View Full Code Here

public class GroupPluginConfigurationUpdateTest extends AbstractConfigurationUpdateTest {

    @Test
    public void serializationShouldCopyConfigurationUpdates() throws Exception {
        GroupPluginConfigurationUpdate update = new GroupPluginConfigurationUpdate();
        update.getConfigurationUpdates().add(new PluginConfigurationUpdate(new Resource(), new Configuration(),
            "rhqadmin"));

        GroupPluginConfigurationUpdate serializedUpdate = TestUtil.serializeAndDeserialize(update);

        assertEquals(
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.PluginConfigurationUpdate

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.