/* (non-Javadoc)
* @see eu.planets_project.services.characterise.DetermineProperties#measure(eu.planets_project.services.datatypes.DigitalObject, eu.planets_project.services.datatypes.Properties, eu.planets_project.services.datatypes.Parameters)
*/
public CharacteriseResult characterise(DigitalObject dob, List<Parameter> params) {
/* Result properties are available here: */
CharacteriseResult characteriseResult = extractorCharacterise.characterise(dob, params);
List<Property> properties = characteriseResult.getProperties();
System.out.println(properties);
/* But the code below wants the XCDL as a DigitalObject, so we use Migrate: */
MigrateResult migrateResult = extractorMigrate.migrate(dob, null, null, params);
// FIXME Use the properties interface / generally update the invoker as this code is not needed now...
/*
for( Property p : characteriseResult.getProperties() ) {
log.info("Got p = "+p);
}
*/
List<MeasurementImpl> list;
try {
list = XCDLParser.parseXCDL(migrateResult.getDigitalObject().getContent().getInputStream());
} catch (Exception e) {
e.printStackTrace();
list = null;
}
List<Property> mprops = new Vector<Property>();
if( list != null ) {
for( MeasurementImpl m : list ) {
Property p;
try {
p = new Property( new URI( m.getIdentifier()), m.getIdentifier(), m.getValue() );
mprops.add(p);
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
}
// FIXME Interface is a problem! We really want to return simpler entities than full property descriptions.
ServiceReport report = new ServiceReport(Type.INFO, Status.SUCCESS, "OK");
return new CharacteriseResult(mprops, report);
}