digitalObjects.add(dob);
// Invoke the service, timing it along the way:
boolean success = true;
String exceptionReport = "";
CreateViewResult view = null;
long msBefore = 0, msAfter = 0;
msBefore = System.currentTimeMillis();
try {
view = viewMaker.createView(digitalObjects, null);
wr.logReport(view.getReport());
} catch( Exception e ) {
success = false;
exceptionReport = "<p>Service Invocation Failed!<br/>" + e + "</p>";
}
msAfter = System.currentTimeMillis();
// Record this one-stage experiment:
ExecutionStageRecordImpl idStage = new ExecutionStageRecordImpl(null, STAGE_CREATEVIEW);
wr.getStages().add( idStage );
// Record the endpoint of the service used for this stage. FIXME Can this be done more automatically, from above?
idStage.setEndpoint(serviceEndpoint);
List<MeasurementImpl> recs = idStage.getMeasurements();
recs.add(new MeasurementImpl(TecRegMockup.PROP_SERVICE_TIME, ""+((msAfter-msBefore)/1000.0) ));
// Now record
try {
if( success && view.getViewURL() != null ) {
recs.add( new MeasurementImpl( TecRegMockup.PROP_SERVICE_EXECUTION_SUCEEDED, "true"));
collectCreateViewResults(recs, view, dob);
wr.setMainEndpoint(serviceEndpoint);
wr.setResult(view);
wr.setResultType( WorkflowResult.RESULT_CREATEVIEW_RESULT );
return wr;
}
} catch( Exception e ) {
exceptionReport += "<p>Failed with exception: "+e+"</p>";
}
// Build in a 'service failed' property.
recs.add( new MeasurementImpl( TecRegMockup.PROP_SERVICE_EXECUTION_SUCEEDED, "false"));
// Create a ServiceReport from the exception.
// TODO can we distinguish tool and install error here?
ServiceReport sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
"No info");
if (view != null && view.getReport() != null) {
String info = view.getReport().toString();
sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, info);
}
wr.logReport(sr);
return wr;