Package org.rhq.core.domain.measurement

Examples of org.rhq.core.domain.measurement.MeasurementDefinition


                alertCondBean.setActualValue(RequestUtils.message(request, "alert.current.list.ControlActualValue"));
            } else if ((category == AlertConditionCategory.THRESHOLD) || (category == AlertConditionCategory.BASELINE)
                || (category == AlertConditionCategory.CHANGE)) {

                // Format threshold and value.
                MeasurementDefinition definition = condLog.getCondition().getMeasurementDefinition();
                String firedValue;

                try {
                    firedValue = MeasurementConverter.format(Double.valueOf(condLog.getValue()), definition.getUnits(),
                        true);
                } catch (Exception e) {
                    // check if this is Calltime data
                    if (definition.getDataType() == DataType.CALLTIME)
                        firedValue = condLog.getValue();
                    else
                        firedValue = "??";
                }
View Full Code Here


    }

    private ResourceType createResourceType() {
        ResourceType resourceType = new ResourceType("ScriptingAPITestType", "dummy", ResourceCategory.PLATFORM, null);

        MeasurementDefinition measurement = new MeasurementDefinition("measurement", MeasurementCategory.PERFORMANCE,
            MeasurementUnits.BYTES,
            DataType.MEASUREMENT, true, 1, DisplayType.DETAIL);
        measurement.setDisplayName("measurement");

        resourceType.addMetricDefinition(measurement);

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

    public MeasurementConverterValidator() {
        definitionManager = LookupUtil.getMeasurementDefinitionManager();
    }

    public void exportProperties(Subject subject, ConditionBean fromBean, AlertCondition toCondition) {
        MeasurementDefinition definition = definitionManager.getMeasurementDefinition(subject, fromBean.getMetricId());
        toCondition.setMeasurementDefinition(definition);

        if (fromBean.getThresholdType().equals(TYPE_ABS)) {
            MeasurementNumericValueAndUnits valueAndUnits = MeasurementParser.parse(fromBean.getAbsoluteValue(),
                definition.getUnits());

            toCondition.setCategory(AlertConditionCategory.THRESHOLD);
            toCondition.setThreshold(valueAndUnits.getValue());
            toCondition.setComparator(fromBean.getAbsoluteComparator());
View Full Code Here

        // category-specific processing
        if (fromCondition.getCategory() == AlertConditionCategory.THRESHOLD) {
            toBean.setThresholdType(TYPE_ABS);

            MeasurementDefinition definition = fromCondition.getMeasurementDefinition();
            toBean.setMetricId(definition.getId());

            try {
                // this is coming from the backing store, so
                String formattedValue = MeasurementConverter.format(fromCondition.getThreshold(),
                    definition.getUnits(), true);
                toBean.setAbsoluteValue(formattedValue);
            } catch (MeasurementConversionException mce) {
                toBean.setAbsoluteValue("Conversion Error");
            }
View Full Code Here

    public CallTimeDataConverterValidator() {
        definitionManager = LookupUtil.getMeasurementDefinitionManager();
    }

    public void exportProperties(Subject subject, ConditionBean fromBean, AlertCondition toCondition) {
        MeasurementDefinition definition = definitionManager.getMeasurementDefinition(subject, fromBean
            .getCallTimeMetricId());
        toCondition.setMeasurementDefinition(definition);

        if (fromBean.getThresholdType().equals(TYPE_ABS)) {
            MeasurementNumericValueAndUnits valueAndUnits = MeasurementParser.parse(fromBean.getCtAbsoluteValue(),
                definition.getUnits());

            toCondition.setThreshold(valueAndUnits.getValue());
            toCondition.setCategory(AlertConditionCategory.THRESHOLD);
            toCondition.setOption(fromBean.getCalltimeAbsOption());
            toCondition.setComparator(fromBean.getCalltimeComparator());
View Full Code Here

        }
    }

    public void importProperties(Subject subject, AlertCondition fromCondition, ConditionBean toBean) {
        // shared measurement processing
        MeasurementDefinition definition = fromCondition.getMeasurementDefinition();
        toBean.setCallTimeMetricName(definition.getDisplayName());
        toBean.setCallTimeMetricId(definition.getId());

        toBean.setTrigger(getTriggerName());

        if (fromCondition.getCategory() == AlertConditionCategory.THRESHOLD) {
            toBean.setThresholdType(TYPE_ABS);
            toBean.setCalltimeAbsOption(fromCondition.getOption());
            toBean.setCalltimeAbsPattern(fromCondition.getName());

            try {
                // this is coming from the backing store, so
                String formattedValue = MeasurementConverter.format(fromCondition.getThreshold(),
                    definition.getUnits(), true);
                toBean.setCtAbsoluteValue(formattedValue);
            } catch (MeasurementConversionException mce) {
                toBean.setCtAbsoluteValue("Conversion Error");
            }
View Full Code Here

    public String decorate(Object columnValue) {
        if (!(columnValue instanceof MeasurementDefinition)) {
            throw new IllegalArgumentException("Input needs to be of type 'MeasurementDefinition'");
        }

        MeasurementDefinition def = (MeasurementDefinition) columnValue;
        DataType dataType = def.getDataType();

        if (null != dataType) {
            switch (dataType) {
            case TRAIT:
                return "Trait";
            case COMPLEX:
                return "Complex";
            }
        }

        MeasurementCategory category = def.getCategory();
        String cat = category.toString();

        // display category with first char as uppercase
        cat = cat.substring(0, 1).toUpperCase().concat(cat.substring(1));
View Full Code Here

    public TraitConverterValidator() {
        definitionManager = LookupUtil.getMeasurementDefinitionManager();
    }

    public void exportProperties(Subject subject, ConditionBean fromBean, AlertCondition toCondition) {
        MeasurementDefinition definition = definitionManager.getMeasurementDefinition(subject, fromBean.getTraitId());
        toCondition.setMeasurementDefinition(definition);

        toCondition.setCategory(AlertConditionCategory.TRAIT);
        toCondition.setName(fromBean.getTraitName());
    }
View Full Code Here

            }
        }

        PageList<CallTimeDataComposite> callTimeDataComposites;
        if (selectedSchedule != null) {
            MeasurementDefinition measurementDef = selectedSchedule.getDefinition();
            request.setAttribute("MeasurementDef", measurementDef);
            CallTimeDataManagerLocal callTimeDataManager = LookupUtil.getCallTimeDataManager();
            PageControl pageControl = WebUtility.getPageControl(request);
            callTimeDataComposites = callTimeDataManager.findCallTimeDataForResource(subject, selectedSchedule.getId(),
                range.getBegin(), range.getEnd(), pageControl);
View Full Code Here

        String metricName = metricProperty.getName();
        MetaType type = metricProperty.getMetaType();
        MetaValue value = metricProperty.getValue();
        if (value != null) {
            MeasurementAdapter measurementAdapter = MeasurementAdapterFactory.getMeasurementPropertyAdapter(type);
            MeasurementDefinition measurementDefinition = ResourceTypeUtils.getMeasurementDefinition(resourceType,
                metricName);
            if (measurementDefinition != null) {
                measurementAdapter.setMeasurementData(report, value, request, measurementDefinition);
            }
        } else {
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.measurement.MeasurementDefinition

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.