metadata = null;
log.info("Processing file #" + (count + 1));
try {
// Identify
String[] types = runIdentification(dgo, wfResult);
log.info(new Message("Identification", new Parameter("File", dgo.getTitle()), new Parameter(
"Result", Arrays.asList(types).toString())));
// Extract metadata - will otherwise get lost between steps!
List<Metadata> mList = dgo.getMetadata();
if ((mList != null) && (mList.size() > 0)) {
metadata = mList.get(0).getContent();
}
if (metadata == null) {
log.warn("No metadata contained in DigitalObject!");
} else {
log.info("Extracted metadata: " + metadata);
}
// Modify - rotate
dgo = runRotateService(dgo, types[0], metadata, wfResult);
log.info(new Message("Rotation", new Parameter("Metadata", metadata)));
// Modify - crop
dgo = runCropService(dgo, types[0], metadata, wfResult);
log.info(new Message("Cropping", new Parameter("Metadata", metadata)));
// Migrate to JPEG
try {
FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
String ext = fr.getFirstExtension(new URI(types[0]));
log.info("Getting extension: " + ext);
if (ext != null) {
dgo = runMigrateService(dgo, fr.createExtensionUri(ext), wfResult);
objects.add(dgo);
log.info(new Message("Migration", new Parameter("Input", ext), new Parameter("Result", dgo
.getTitle())));
}
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}