}
for (MeasurementScheduleRequest req : metrics) {
Invocable inv = (Invocable) engine;
if (req.getDataType()== DataType.MEASUREMENT) {
MeasurementDataNumeric res;
try {
Object ret = inv.invokeFunction("metric",req.getName());
if (ret instanceof Number) {
Double num = ((Number)ret).doubleValue();
res = new MeasurementDataNumeric(req,num);
report.addData(res);
}
else {
log.debug("Returned value " + ret.toString() + " is no number for metric " + req.getName());
}
}
catch (Exception e) {
log.debug(e.getMessage());
}
}
else if (req.getDataType()==DataType.TRAIT) {
MeasurementDataTrait res;
try {
Object ret = inv.invokeFunction("trait",req.getName());
if (ret instanceof String) {
String val = ((String)ret);
res = new MeasurementDataTrait(req,val);
report.addData(res);
}