String validatorsQuery = String.format(format, fileExtension, mimeType);
ServiceReference[] supportingValidators = bundleContext.getAllServiceReferences(
AlgorithmFactory.class.getName(), validatorsQuery);
if (supportingValidators == null) {
throw new FileLoadException(String.format(
"The file %s cannot be loaded as type %s.", file.getName(), mimeType));
} else {
AlgorithmFactory validator =
(AlgorithmFactory) bundleContext.getService(supportingValidators[0]);
return loadFileOfType(
bundleContext, ciShellContext, logger, progressMonitor, file, validator);
}
} catch (InvalidSyntaxException e) {
e.printStackTrace();
throw new FileLoadException(e.getMessage(), e);
}
}