Package org.rhq.core.domain.operation

Examples of org.rhq.core.domain.operation.OperationDefinition


        return result;
    }

    @Override
    public OperationDefinition getOperationDefinition(Subject subject, int operationId) {
        OperationDefinition operationDefinition = entityManager.find(OperationDefinition.class, operationId);

        if (operationDefinition == null) {
            throw new OperationDefinitionNotFoundException("Cannot get operation definition - it does not exist: "
                + operationId);
        }
View Full Code Here


    }

    private OperationDefinition validateOperationNameAndParameters(ResourceType resourceType, String operationName,
        Configuration parameters) {
        Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions();
        OperationDefinition matchingOperationDefinition = null;
        for (OperationDefinition operationDefinition : operationDefinitions) {
            if (operationDefinition.getName().equals(operationName)) {
                matchingOperationDefinition = operationDefinition;
                break;
            }
        }
        if (matchingOperationDefinition == null) {
            throw new IllegalArgumentException("[" + operationName
                + "] is not a valid operation name for Resources of type [" + resourceType.getName() + "].");
        }
        ConfigurationDefinition parametersDefinition = matchingOperationDefinition
            .getParametersConfigurationDefinition();
        List<String> errors = ConfigurationUtility.validateConfiguration(parameters, parametersDefinition);
        if (!errors.isEmpty()) {
            throw new IllegalArgumentException("Parameters for [" + operationName + "] on Resource of type ["
                + resourceType.getName() + "] are not valid: " + errors);
View Full Code Here

    }

    protected ResourceOperationHistory createOperationHistory(String jobName, String jobGroup,
        ResourceOperationSchedule schedule, GroupOperationHistory groupHistory, OperationManagerLocal operationManager) {
        // we need the operation definition to fill in the history item
        OperationDefinition op;
        op = operationManager.getSupportedResourceOperation(schedule.getSubject(), schedule.getResource().getId(),
            schedule.getOperationName(), false);

        // first we need to create an INPROGRESS history item
        Configuration parameters = schedule.getParameters();
View Full Code Here

        AlertDefinition def = new AlertDefinition();
        def.setResource(r);
        Alert al = new Alert(def, System.currentTimeMillis());

        AlertTokenReplacer tr;
        OperationDefinition opDef = new OperationDefinition(123,"helloOps",null,"This is a test",0,"Just testing");
        tr = new AlertTokenReplacer(al,opDef, null);
        String res = tr.replaceTokens("<%operation.id%>");
        assert res!=null;
        assert res.equals("123") : "Result is " + res;
        res = tr.replaceTokens("<%operation.name%>");
View Full Code Here

                ordered.add(o.getDisplayName());
                definitionMap.put(o.getDisplayName(), o);
            }

            for (String displayName : ordered) {
                final OperationDefinition operationDefinition = definitionMap.get(displayName);

                MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
                operationItem.addClickHandler(new ClickHandler() {
                    public void onClick(MenuItemClickEvent event) {
                        String viewPath = LinkManager.getEntityTabLink(EntityContext.forGroup(group),
                            ResourceDetailView.Tab.Operations.NAME, "Schedules")
                            + "/0/"
                            + operationDefinition.getId();
                        CoreGUI.goToView(viewPath);
                    }
                });
                opSubMenu.addItem(operationItem);
            }
View Full Code Here

            Label title = new Label("<h4>" + MSG.view_operationHistoryDetails_results() + "</h4>");
            title.setHeight(27);
            resultsSection.addMember(title);

            OperationDefinition operationDefinition = operationHistory.getOperationDefinition();
            ConfigurationDefinition resultsConfigurationDefinition = operationDefinition
                .getResultsConfigurationDefinition();
            if (resultsConfigurationDefinition != null
                && !resultsConfigurationDefinition.getPropertyDefinitions().isEmpty()
                && operationHistory.getResults() != null) {
                ConfigurationEditor editor = new ConfigurationEditor(
                    operationDefinition.getResultsConfigurationDefinition(), operationHistory.getResults());
                editor.setPreserveTextFormatting(true);
                editor.setReadOnly(true);
                resultsSection.addMember(editor);
            } else {
                Label noResultsLabel = new Label(MSG.view_operationHistoryDetails_noResults());
View Full Code Here

        if (operationId <= 0) {
            operationId = Integer.valueOf(operationSelectItem.getValue().toString());
        }

        OperationDefinition def = ops.get(operationId);
        if (def != null) {
            ConfigurationDefinition paramDef = def.getParametersConfigurationDefinition();
            if (paramDef != null) {
                Configuration extraConfig = getExtraConfiguration();
                if (extraConfig == null) {
                    extraConfig = new Configuration();
                    setExtraConfiguration(extraConfig);
View Full Code Here

                }

                String operationName = cond.getName();
                OperationManagerLocal operationManager = LookupUtil.getOperationManager();

                OperationDefinition definition = operationManager.getOperationDefinitionByResourceTypeAndName(
                    resourceTypeId, operationName, false);
                textValue.append(definition.getDisplayName()).append(' ');
            } catch (Exception e) {
                textValue.append(cond.getName()).append(' ');
            }
        } else if (category == AlertConditionCategory.RESOURCE_CONFIG) {
            textValue.append(RequestUtils.message(request, "alert.config.props.CB.Content.ResourceConfiguration"))
View Full Code Here

        resourceType.addMetricDefinition(measurement);

        ConfigurationDefinition params = new ConfigurationDefinition("dummy", null);
        params.put(new PropertyDefinitionSimple("parameter", null, true, PropertySimpleType.BOOLEAN));

        OperationDefinition operation = new OperationDefinition(resourceType, "operation");
        operation.setDisplayName("operation");
        operation.setParametersConfigurationDefinition(params);

        resourceType.addOperationDefinition(operation);

        getEntityManager().persist(resourceType);
View Full Code Here

        GroupAlertDefinitionManagerLocal groupAlertDefinitionManager = LookupUtil.getGroupAlertDefinitionManager();

        Subject subject = RequestUtils.getSubject(request);
        AlertDefinition alertDefinition = AlertDefUtil.getAlertDefinition(request);

        OperationDefinition operationDefinition = null;

        if (selectedOperation.equals(EventConstants.CONTROL_ACTION_NONE) == false) {
            Integer operationId = Integer.parseInt(selectedOperation);

            operationDefinition = operationManager.getOperationDefinition(subject, operationId);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.operation.OperationDefinition

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.