Package org.rhq.core.domain.measurement

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


    }

    protected void collectConfigTrait(MeasurementReport report, MeasurementScheduleRequest request) {
        String value = readEnvironmentAttribute(request);
        if (value != null) {
            MeasurementDataTrait data = new MeasurementDataTrait(request, new File(value).getName());
            report.addData(data);
        }
    }
View Full Code Here


                //    DateFormat.getDateInstance().parse(date);
                long currentTime = System.currentTimeMillis();
                for (MeasurementScheduleRequest request : metrics) {
                    try {
                        if (request.getName().equals("lastAnalysisTime") && lastAnalysisTime != null) {
                            report.addData(new MeasurementDataTrait(request, lastAnalysisTime.toString()));
                        } else if (request.getName().equals("lastAnalysisElapsedTime") && lastAnalysisTime != null) {
                            report.addData(new MeasurementDataNumeric(request, (currentTime - lastAnalysisTime
                                .getTime()) / 1000d));
                        }
View Full Code Here

    }

    protected void collectEnvironmentTrait(MeasurementReport report, MeasurementScheduleRequest request) {
        String value = readEnvironmentAttribute(request);
        if (value != null) {
            MeasurementDataTrait data = new MeasurementDataTrait(request, value);
            report.addData(data);
        }
    }
View Full Code Here

                        val = getStringValue(props.get("release-version"));
                    else if (LOG.isDebugEnabled()) {
                        LOG.debug("Value for " + realName + " was 'null' and no replacement found");
                    }
                }
                MeasurementDataTrait data = new MeasurementDataTrait(request, val);
                report.addData(data);
            }
        } else if (LOG.isDebugEnabled()) {
            LOG.debug("getSKMRequests failed: " + res.getFailureDescription());
        }
View Full Code Here

            Operation op = new ReadAttribute(address,"start-time");
            Result res = getASConnection().execute(op);

            if (res.isSuccess()) {
               Long startTime= (Long) res.getResult();
               MeasurementDataTrait data = new MeasurementDataTrait(request,new Date(startTime).toString());
               report.addData(data);
            }
         }
         else {
            leftovers.add(request);
View Full Code Here

                        Double val = ((Number) (eAttr.getValue())).doubleValue();

                        MeasurementDataNumeric ret = new MeasurementDataNumeric(metric, val);
                        report.addData(ret);
                    } else if (metric.getDataType() == DataType.TRAIT) {
                        MeasurementDataTrait ret = new MeasurementDataTrait(metric, String.valueOf(eAttr.getValue()));
                        report.addData(ret);
                    } else
                        log.warn("Unknown data type " + metric);
                } else if (log.isDebugEnabled())
                    log.debug("Bean " + bean + " not found ");
View Full Code Here

                if (result.isSuccess()) {
                    Map<String,Object> data = result.getResult();
                    if (data.containsKey("OPENSHIFT_APP_UUID")) {
                        String uid = (String) data.get("OPENSHIFT_APP_UUID");
                        MeasurementDataTrait res = new MeasurementDataTrait(req,uid);
                 report.addData(res);
                    }
                }
                else {
                    log.warn("Operation failed: " + result.getFailureDescription());
View Full Code Here

    @Override
    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
        for (MeasurementScheduleRequest request : metrics) {
            if (request.getName().equals("ipAddress")) {
                report.addData(new MeasurementDataTrait(request, componentConfiguration.getAddress().getHostAddress()));
            } else if (request.getName().equals("hostName")) {
                report.addData(new MeasurementDataTrait(request, componentConfiguration.getAddress()
                    .getCanonicalHostName()));
            } else if (request.getName().equals("connectTime")) {
                long start = System.currentTimeMillis();
                if (portReachable()) {
                    report.addData(new MeasurementDataNumeric(request, (double) (System.currentTimeMillis() - start)));
View Full Code Here

            if (request.getName().equals("_aliases")) {
                ReadAttribute op = new ReadAttribute(getAddress(), "alias");
                Result res = getASConnection().execute(op);
                if (res.isSuccess()) {
                    List<String> aliases = (List<String>) res.getResult();
                    MeasurementDataTrait data;
                    if (aliases != null) {
                        Collections.sort(aliases);
                        String trait = aliases.toString();
                        data = new MeasurementDataTrait(request, trait);
                    } else {
                        data = new MeasurementDataTrait(request, "-none-");
                    }
                    report.addData(data);
                } else
                    getLog().warn("Could not get aliases for " + getAddress() + ": " + res.getFailureDescription());
            } else {
View Full Code Here

                            displayValue = Arrays.deepToString((Object[]) value);
                        } else {
                            displayValue = String.valueOf(value);
                        }

                        report.addData(new MeasurementDataTrait(request, displayValue));
                    }
                }
            } else
                others.add(request);
        }
View Full Code Here

TOP

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

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.