public List<PreservationActionDefinition> getAvailableActions(
FormatInfo sourceFormat) throws PlatoServiceException {
List<PreservationActionService> services = registry.findServices(sourceFormat, null);
ArrayList<PreservationActionDefinition> result = new ArrayList<PreservationActionDefinition>();
PreservationActionDefinition def;
for (PreservationActionService service : services) {
def = new PreservationActionDefinition();
def.setShortname(service.getName());
if (service.getTargetFormat() != null) {
def.setTargetFormat(service.getTargetFormat().getDefaultExtension());
def.setTargetFormatInfo(service.getTargetFormat());
}
def.setInfo(service.getDescription());
def.setUrl(service.getUrl());
def.setDescriptor(service.getDescriptor());
if (service.isMigration())
def.setActionIdentifier("MiniMEE-migration");
else {
def.setEmulated(true);
def.setActionIdentifier("MiniMEE-emulation" );
// TODO: refine setting type according to sourceFormat
if ("avi".equals(sourceFormat.getDefaultExtension()) ||
"mpg".equals(sourceFormat.getDefaultExtension()) ||
"mpeg".equals(sourceFormat.getDefaultExtension())) {
def.setParamByName("filetype", "1");
}
else if ("jpg".equals(sourceFormat.getDefaultExtension()) ||
"gif".equals(sourceFormat.getDefaultExtension())||
"tif".equals(sourceFormat.getDefaultExtension())) {
def.setParamByName("filetype", "2");
}
else if ("pdf".equals(sourceFormat.getDefaultExtension()) ||
"sam".equals(sourceFormat.getDefaultExtension())) {
def.setParamByName("filetype", "3");
}
}
result.add(def);
}