Package org.rhq.core.domain.configuration.group

Examples of org.rhq.core.domain.configuration.group.GroupPluginConfigurationUpdate


        return executeInTransaction(false, new TransactionCallbackReturnable<ConfigurationUpdateStatus>() {
            public ConfigurationUpdateStatus execute() throws Exception {
                try {
                    Query query = em.createNamedQuery(GroupPluginConfigurationUpdate.QUERY_FIND_LATEST_BY_GROUP_ID);
                    query.setParameter("groupId", groupId);
                    GroupPluginConfigurationUpdate latestConfigGroupUpdate = (GroupPluginConfigurationUpdate) query
                        .getSingleResult();
                    return latestConfigGroupUpdate.getStatus();
                } catch (NoResultException nre) {
                    // The group resource config history is empty, so there's obviously no update in progress.
                    return null;
                }
            }
View Full Code Here


                compatibleGroup.getId(), memberConfigs);

            // instead of sleeping, let's directly execute what would normally be scheduled
            //configurationManager.completeGroupPluginConfigurationUpdate(groupUpdateId);

            GroupPluginConfigurationUpdate update = configurationManager.getGroupPluginConfigurationById(groupUpdateId);

            assert update != null : "Group plugin configuration update should not have been null";

            int i = 0;
            for (PluginConfigurationUpdate childUpdate : update.getConfigurationUpdates()) {
                Configuration childUpdateConfiguration = childUpdate.getConfiguration();
                assert childUpdateConfiguration.equals(expectedGroupConfigurationResults) : "new updateChildConfig["
                    + i + "] was: " + childUpdateConfiguration + ", " + "expected was: "
                    + expectedGroupConfigurationResults;
                i++;
            }

            Configuration configurationAfterGroupUpdate1 = configurationManager.getPluginConfiguration(overlord,
                resource1.getId());
            Configuration configurationAfterGroupUpdate2 = configurationManager.getPluginConfiguration(overlord,
                resource2.getId());

            ConfigurationUpdateStatus expectedResultStatus = null;

            if (failOnChildUpdates) {
                expectedResultStatus = ConfigurationUpdateStatus.FAILURE;
            } else {
                expectedResultStatus = ConfigurationUpdateStatus.SUCCESS;
            }

            assert configurationAfterGroupUpdate1.equals(expectedGroupConfigurationResults) : "new config1 was: "
                + configurationAfterGroupUpdate1 + ", " + "expected was: " + expectedGroupConfigurationResults;

            assert configurationAfterGroupUpdate2.equals(expectedGroupConfigurationResults) : "new config2 was: "
                + configurationAfterGroupUpdate2 + ", " + "expected was: " + expectedGroupConfigurationResults;

            assert update.getStatus() == expectedResultStatus : "Group plugin configuration update "
                + "should have been marked as " + expectedResultStatus + ": " + update;

            /*  end group modification */
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    public boolean isGroupPluginConfigurationUpdateInProgress(Subject subject, int groupId) {
        boolean updateInProgress;
        try {
            Query query = entityManager.createNamedQuery(GroupPluginConfigurationUpdate.QUERY_FIND_LATEST_BY_GROUP_ID);
            query.setParameter("groupId", groupId);
            GroupPluginConfigurationUpdate latestConfigGroupUpdate = (GroupPluginConfigurationUpdate) query
                .getSingleResult();
            if (!authorizationManager.canViewGroup(subject, latestConfigGroupUpdate.getGroup().getId())) {
                throw new PermissionException("User [" + subject.getName()
                    + "] does not have permission to view group plugin configuration for ["
                    + latestConfigGroupUpdate.getGroup() + "]");
            }

            updateInProgress = (latestConfigGroupUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
        } catch (NoResultException nre) {
            // The group resource config history is empty, so there's obviously no update in progress.
            updateInProgress = false;
        }
View Full Code Here

         * processing of this method; if we try to create and attach the PluginConfigurationUpdate children
         * to the parent group before the group update is actually persisted, we'll get StaleStateExceptions
         * from Hibernate because of our use of flush/clear (we're trying to update it before it actually
         * actually exists)
         */
        GroupPluginConfigurationUpdate groupUpdate = new GroupPluginConfigurationUpdate(group, subject.getName());
        int updateId = -1;
        try {
            updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
        } catch (SchedulerException sche) {
            String message = "Error scheduling plugin configuration update for group[id=" + group.getId() + "]";
View Full Code Here

     * @deprecated use {@link #findGroupPluginConfigurationUpdatesByCriteria(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.criteria.GroupPluginConfigurationUpdateCriteria)}
     */
    @Deprecated
    @Override
    public GroupPluginConfigurationUpdate getGroupPluginConfigurationById(int configurationUpdateId) {
        GroupPluginConfigurationUpdate update = entityManager.find(GroupPluginConfigurationUpdate.class,
            configurationUpdateId);
        return update;
    }
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Subject subject,
        Integer groupPluginConfigurationUpdateId) {
        // this method will perform the CONFIGURE_READ security check for us, no need to keep reference to result
        GroupPluginConfigurationUpdate groupPluginConfigurationUpdate = getGroupPluginConfigurationUpdate(subject,
            groupPluginConfigurationUpdateId);

        Tuple<String, Object> groupIdParameter = new Tuple<String, Object>("groupConfigurationUpdateId",
            groupPluginConfigurationUpdateId);
        Map<Integer, Configuration> results = executeGetConfigurationMapQuery(
            Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_UPDATE_ID, 100, groupIdParameter);

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

    @Override
    @SuppressWarnings("unchecked")
    public ConfigurationUpdateStatus updateGroupPluginConfigurationUpdateStatus(int groupPluginConfigurationUpdateId,
        String errorMessages) {
        GroupPluginConfigurationUpdate groupPluginConfigUpdate = configurationManager
            .getGroupPluginConfigurationById(groupPluginConfigurationUpdateId);

        // NOTE: None of the individual updates should still be INPROGRESS at the time this method is called!
        Query query = entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_FIND_STATUS_BY_PARENT_UPDATE_ID);
        query.setParameter("groupConfigurationUpdateId", groupPluginConfigUpdate.getId());
        List<ConfigurationUpdateStatus> updateStatusTuples = query.getResultList();

        return completeGroupConfigurationUpdate(groupPluginConfigUpdate, updateStatusTuples, errorMessages);
    }
View Full Code Here

                // break the plugin configuration update links in order to preserve individual change history
                Query q = entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_DELETE_GROUP_UPDATE);
                q.setParameter("apcuId", apcuId);
                q.executeUpdate();

                GroupPluginConfigurationUpdate update = getGroupPluginConfigurationById(apcuId);
                entityManager.remove(update);
                removed++;
            } catch (Exception e) {
                LOG.error("Problem removing group plugin configuration update", e);
            }
View Full Code Here

        propertiesQuery.executeUpdate();
    }

    @Override
    public GroupPluginConfigurationUpdate getGroupPluginConfigurationUpdate(Subject subject, int configurationUpdateId) {
        GroupPluginConfigurationUpdate update = getGroupPluginConfigurationById(configurationUpdateId);

        int groupId = update.getGroup().getId();

        if (!authorizationManager.canViewGroup(subject, groupId)) {
            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to view group Resource configuration for [" + update.getGroup() + "]");

        }

        return update;
    }
View Full Code Here

    }

    @Test
    public void serializationShouldCopyGroupConfigurationUpdate() throws Exception {
        PluginConfigurationUpdate update = new PluginConfigurationUpdate();
        update.setGroupConfigurationUpdate(new GroupPluginConfigurationUpdate(new ResourceGroup("resourceGroup"),
            "rhqadmin"));

        PluginConfigurationUpdate serializedUpdate = TestUtil.serializeAndDeserialize(update);

        assertEquals(
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.group.GroupPluginConfigurationUpdate

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.