// Now prepare the result:
List<MeasurementImpl> stage_m = stage.getMeasurements();
// Invoke the service, timing it along the way:
boolean success = true;
CharacteriseResult result = null;
long msBefore = 0, msAfter = 0;
msBefore = System.currentTimeMillis();
try {
log.info("Characterising "+dob);
//FIXME this is a hack for disabling norm data for XCDL characterisation services
// as parameters are currently not definable for this expType
List<Parameter> parameterList = new ArrayList<Parameter>();
parameterList.add(new Parameter("disableNormDataInXCDL","-n"));
result = dp.characterise(dob, parameterList);
wr.logReport(result.getReport());
} catch( Exception e ) {
log.error("Characterisation failed with exception: "+e);
e.printStackTrace();
success = false;
}
msAfter = System.currentTimeMillis();
if( success ) {
log.info("Characterisation succeeded: "+result);
if( result != null ) {
// URGENT Formalise and refactor this logic.
log.info("Service Report: "+result.getReport().getMessage());
log.info("Service Report: "+result.getReport().getStatus());
log.info("Service Report: "+result.getReport().getType());
if( result.getReport().getStatus() == Status.INSTALLATION_ERROR
|| result.getReport().getStatus() == Status.TOOL_ERROR ) {
success = false;
}
}
}
// Compute the run time.
stage_m.add(new MeasurementImpl(TecRegMockup.PROP_SERVICE_TIME, ""+((msAfter-msBefore)/1000.0)) );
// Add the object size:
stage_m.add( new MeasurementImpl(TecRegMockup.PROP_DO_SIZE, ""+IdentifyWorkflow.getContentSize(dob) ) );
// Record results:
if( success ) {
stage_m.add( new MeasurementImpl( TecRegMockup.PROP_SERVICE_EXECUTION_SUCEEDED, "true"));
if( result != null && result.getProperties() != null ) {
log.info("Got "+result.getProperties().size()+" properties");
for( Property p : result.getProperties() ) {
log.info("Recording measurement: "+p.getUri()+":"+p.getName()+" = "+p.getValue());
stage_m.add(new MeasurementImpl( p.getUri(), p.getValue() ));
}
}
return;