Package org.rhq.enterprise.server.configuration

Examples of org.rhq.enterprise.server.configuration.ConfigurationManagerLocal


        return "success";
    }

    public String delete() {
        Subject subject = EnterpriseFacesContextUtility.getSubject();
        ConfigurationManagerLocal manager = LookupUtil.getConfigurationManager();

        String[] selectedItems = FacesContextUtility.getRequest().getParameterValues("selectedItems");

        List<String> success = new ArrayList<String>();
        Map<String, String> failure = new HashMap<String, String>();

        String next = null;
        Integer doomed;
        for (int i = 0; i < selectedItems.length; i++) {
            try {
                next = selectedItems[i];
                doomed = Integer.valueOf(next);

                manager.purgeResourceConfigurationUpdate(subject, doomed, true);

                success.add(next);
            } catch (Exception e) {
                failure.put(next, ThrowableUtil.getAllMessages(e, true));
            }
View Full Code Here


        @Override
        public PageList<ResourceConfigurationUpdate> fetchPage(PageControl pc) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            Resource requestResource = EnterpriseFacesContextUtility.getResourceIfExists();
            ConfigurationManagerLocal manager = LookupUtil.getConfigurationManager();

            if (requestResource == null) {
                requestResource = resource; // request not associated with a resource - use the resource we used before
            } else {
                resource = requestResource; // request switched the resource this UI bean is using
            }

            PageList<ResourceConfigurationUpdate> result;
            result = manager.findResourceConfigurationUpdates(subject, requestResource.getId(), null, null, false, pc);

            return result;
        }
View Full Code Here

        request.setAttribute("noneDeleted", Constants.ALERT_CONDITION_NONE_DELETED);

        MeasurementScheduleManagerLocal scheduleManager = LookupUtil.getMeasurementScheduleManager();
        MeasurementDefinitionManagerLocal definitionManager = LookupUtil.getMeasurementDefinitionManager();
        ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();

        Subject subject = RequestUtils.getSubject(request);
        Resource resource = RequestUtils.getResource(request);
        ResourceGroup group = RequestUtils.getResourceGroupIfExists(request);

        ResourceType type = null;
        if (resource != null) {
            // resource alert definition
            type = resource.getResourceType();
        } else if (group != null) {
            // group alert definition
            type = group.getResourceType();
        } else {
            // template alert definition
            type = RequestUtils.getResourceType(request);
        }

        defForm.setResourceType(type.getId());

        List<MeasurementDefinition> dataDefinitions = definitionManager.findMeasurementDefinitionsByResourceType(
            subject, type.getId(), DataType.MEASUREMENT, null);

        List<MeasurementDefinition> calltimeDefinitions = definitionManager.findMeasurementDefinitionsByResourceType(
            subject, type.getId(), DataType.CALLTIME, null);

        List<MeasurementDefinition> traitDefinitions = definitionManager.findMeasurementDefinitionsByResourceType(
            subject, type.getId(), DataType.TRAIT, null);

        List<RelatedOptionBean> baselines = new ArrayList<RelatedOptionBean>();

        if (resource != null) {
            for (MeasurementDefinition definition : dataDefinitions) {
                MeasurementSchedule schedule = scheduleManager.getSchedule(subject, resource.getId(), definition
                    .getId(), false);

                RelatedOptionBean rob = new RelatedOptionBean(definition.getName(), String.valueOf(definition.getId()),
                    getBaselineList(schedule));
                baselines.add(rob);

                setDisabledName(schedule, definition);
            }

            for (MeasurementDefinition definition : traitDefinitions) {
                MeasurementSchedule schedule = scheduleManager.getSchedule(subject, resource.getId(), definition
                    .getId(), false);
                setDisabledName(schedule, definition);
            }
        } else {
            List<LabelValueBean> defaultBaselineLabels = getBaselineList(null);
            for (MeasurementDefinition definition : dataDefinitions) {
                RelatedOptionBean rob = new RelatedOptionBean(definition.getName(), String.valueOf(definition.getId()),
                    defaultBaselineLabels);
                baselines.add(rob);
            }
        }

        defForm.setMetrics(dataDefinitions);
        defForm.setCalltimeMetrics(calltimeDefinitions);
        defForm.setTraits(traitDefinitions);

        defForm.setBaselines(baselines);
        request.setAttribute("baselines", baselines); // need to duplicate this for the JavaScript on the page

        List<OptionItem> controlActions = new ArrayList<OptionItem>();
        OperationManagerLocal operationManager = LookupUtil.getOperationManager();
        // do not need to eagerly load the definitions because only name and displayName are needed
        for (OperationDefinition action : operationManager.findSupportedResourceTypeOperations(subject, type.getId(),
            false)) {
            OptionItem actionItem = new OptionItem(action.getDisplayName(), action.getName());
            controlActions.add(actionItem);
        }

        defForm.setControlActions(controlActions);

        ConfigurationDefinition configurationDefinition = configurationManager
            .getResourceConfigurationDefinitionForResourceType(subject, type.getId());
        defForm.setResourceConfigurationSupported(configurationDefinition != null);
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.configuration.ConfigurationManagerLocal

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.