Examples of PluginConfigurationUpdate


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

    public PluginConfigurationUpdate getPluginConfigurationUpdate(Resource updateTarget) {
        Configuration oldResourcePluginConfiguration = updateTarget.getPluginConfiguration();
        Configuration newResourcePluginConfiguration = getMergedConfiguration(oldResourcePluginConfiguration,
            this.configuration);
        PluginConfigurationUpdate update = new PluginConfigurationUpdate(updateTarget, newResourcePluginConfiguration,
            getSubjectName());
        return update;
    }
View Full Code Here

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

        current = configurationManager.getPluginConfiguration(overlord, resource.getId());
        assert current != null;
        assert current.getProperties().size() == 0 : current; // there is no plugin config settings yet

        PluginConfigurationUpdate update = configurationManager.updatePluginConfiguration(overlord, resource.getId(),
            configuration1);
        assert update.getErrorMessage() != null : "We should have simulated a failure, "
            + "but instead received no error.";

        // Even if a plugin container exception occurs, the plugin configuration should still be updated.
        current = configurationManager.getPluginConfiguration(overlord, resource.getId());
        assert current != null;
View Full Code Here

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

            Configuration configuration2 = new Configuration();
            configuration2.put(new PropertySimple("foo", "2"));
            configuration2.put(new PropertySimple("fail", "false"));

            /* begin simple checks */
            PluginConfigurationUpdate update1 = configurationManager.updatePluginConfiguration(overlord,
                resource1.getId(), configuration1);
            assert update1.getErrorMessage() == null : "We weren't expecting a failure here";

            PluginConfigurationUpdate update2 = configurationManager.updatePluginConfiguration(overlord,
                resource2.getId(), configuration2);
            assert update2.getErrorMessage() == null : "We weren't expecting a failure here";

            Configuration updatedConfiguration1 = configurationManager.getPluginConfiguration(overlord,
                resource1.getId());
            Configuration updatedConfiguration2 = configurationManager.getPluginConfiguration(overlord,
                resource2.getId());
View Full Code Here

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

    }

    @Override
    public PluginConfigurationUpdate getLatestPluginConfigurationUpdate(int resourceId) throws RuntimeException {
        try {
            PluginConfigurationUpdate update = configurationManager.getLatestPluginConfigurationUpdate(
                getSessionSubject(), resourceId);
            return SerialUtility.prepare(update, "ConfigurationService.getLatestPluginConfigurationUpdate");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

    @Override
    public PluginConfigurationUpdate updatePluginConfiguration(int resourceId, Configuration configuration)
        throws RuntimeException {
        try {
            PluginConfigurationUpdate update = configurationManager.updatePluginConfiguration(getSessionSubject(),
                resourceId, configuration);
            return SerialUtility.prepare(update, "ConfigurationService.updatePluginConfiguration");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

        return pluginConfiguration;
    }

    @Override
    public void completePluginConfigurationUpdate(Integer updateId) {
        PluginConfigurationUpdate update = entityManager.find(PluginConfigurationUpdate.class, updateId);
        configurationManager.completePluginConfigurationUpdate(update);
    }
View Full Code Here

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

            throw new BadArgumentException("Invalid newPluginConfiguration, configuration not updated: "
                + validationErrors);
        }

        // create our new update request and assign it to our resource - its status will initially be "in progress"
        PluginConfigurationUpdate update = new PluginConfigurationUpdate(resource, newPluginConfiguration,
            subject.getName());

        update.setStatus(ConfigurationUpdateStatus.SUCCESS);
        entityManager.persist(update);

        resource.addPluginConfigurationUpdates(update);

        // agent field is LAZY - force it to load because the caller will need it.
View Full Code Here

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

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

        // create our new update request and assign it to our resource - its status will initially be "in progress"
        PluginConfigurationUpdate update = new PluginConfigurationUpdate(resource, newPluginConfiguration,
            subject.getName());

        update.setStatus(ConfigurationUpdateStatus.SUCCESS);
        entityManager.persist(update);

        resource.addPluginConfigurationUpdates(update);
        resource.setPluginConfiguration(update.getConfiguration());

        entityManager.merge(update);

        return update;
    }
View Full Code Here

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

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

        PluginConfigurationUpdate current;
        // Get the latest configuration as known to the server (i.e. persisted in the DB).
        try {
            Query query = entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
            query.setParameter("resourceId", resourceId);
            current = (PluginConfigurationUpdate) query.getSingleResult();

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

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

    public boolean isPluginConfigurationUpdateInProgress(Subject subject, int resourceId) {
        boolean updateInProgress;
        try {
            Query query = entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_FIND_LATEST_BY_RESOURCE_ID);
            query.setParameter("resourceId", resourceId);
            PluginConfigurationUpdate latestConfigUpdate = (PluginConfigurationUpdate) query.getSingleResult();
            if (!authorizationManager.canViewResource(subject, latestConfigUpdate.getResource().getId())) {
                throw new PermissionException("User [" + subject.getName()
                    + "] does not have permission to view plugin configuration for ["
                    + latestConfigUpdate.getResource() + "]");
            }
            updateInProgress = (latestConfigUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
        } catch (NoResultException nre) {
            // The resource config history is empty, so there's obviously no update in progress.
            updateInProgress = false;
        }
        return updateInProgress;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.