in taverna-maven-plugin/src/main/java/org/apache/taverna/mavenplugin/Utils.java [49:74]
public static String uploadFile(File file, String resourceName, Wagon wagon, Log log)
throws MojoExecutionException {
String resourceUrl = getResourceUrl(wagon, resourceName);
File digestFile = new File(file.getPath() + ".md5");
try {
String digestString = DigestUtils.md5Hex(new FileInputStream(file));
FileUtils.writeStringToFile(digestFile, digestString);
} catch (IOException e) {
throw new MojoExecutionException(
String.format("Error generating digest for %1$s", file), e);
}
try {
log.info(String.format("Uploading %1$s to %2$s", file, resourceUrl));
wagon.put(file, resourceName);
wagon.put(digestFile, resourceName + ".md5");
} catch (TransferFailedException e) {
throw new MojoExecutionException(String.format("Error transferring %1$s to %2$s", file,
resourceUrl), e);
} catch (ResourceDoesNotExistException e) {
throw new MojoExecutionException(String.format("%1$s does not exist", resourceUrl), e);
} catch (AuthorizationException e) {
throw new MojoExecutionException(String.format(
"Authentication error transferring %1$s to %2$s", file, resourceUrl), e);
}
return resourceUrl;
}