* @param sourceFormat source format from which we want to migrate
*/
public List<PreservationActionDefinition> getAvailableActions(FormatInfo sourceFormat)
throws PlatoServiceException {
FormatRegistry fr = FormatRegistryFactory.getFormatRegistry();
// we only want migration services
ServiceDescription sdQuery = new ServiceDescription.Builder(null, Migrate.class.getCanonicalName()).build();
ServiceDescription sdQueryViewer = new ServiceDescription.Builder(null, CreateView.class.getCanonicalName()).build();
// query all migration services
List<ServiceDescription> list = registry.query(sdQuery);
List<ServiceDescription> listViewers = registry.query(sdQueryViewer);
list.addAll(listViewers);
// the list of available preservation action services we want to offer the user
List<PreservationActionDefinition> services = new ArrayList<PreservationActionDefinition>();
// iterate through services list
for (ServiceDescription sd : list) {
// iterate through migration paths of found service
for( MigrationPath path : sd.getPaths() ) {
Format inputFormat = fr.getFormatForUri(path.getInputFormat());
// check if this is the input format we are looking for
if (false == inputFormat.getExtensions().contains(sourceFormat.getDefaultExtension())) {
continue;
}
// get the output format the service is able to migrate to
Format outputFormat = fr.getFormatForUri(path.getOutputFormat());
PreservationActionDefinition pad = new PreservationActionDefinition();
pad.setActionIdentifier("Planets-local");
pad.setTargetFormat(outputFormat.getUri().toString());