// artifacts are already setup, this call is a no-op.
try {
createResourceArtifacts(resource);
} catch (Exception exc) {
printer.print(exc);
throw new ResourceManagerException(
provider.error("filemgr.cantcreateresource",
resource.getAbsolutePath()));
}
// If the resource has changed obtain the new hash of the resources
// contents and generate diffs between the older versions of the
// resource and the latest version.
if (hasResourceChanged(resource)) {
provider.info(logger, "filemgr.resourcechanged",
resource.getAbsolutePath());
try {
String latestHash = readInAndCopyLatestVersion(resource, false);
// If the latest hash is not null, then the actual contents of
// the managed resource have changes, and new diffs must be
// generated.
if (latestHash != null) {
provider.info(logger, "filemgr.gendeltas",
resource.getAbsolutePath());
generateDeltas(resource, latestHash);
// Update the Diffable context so it can correctly identify
// the most recent version of this resource.
diffableCtx.setCurrentVersion(resource, latestHash);
}
} catch (Exception exc) {
printer.print(exc);
throw new ResourceManagerException(
provider.error("filemgr.cantloadlatest",
resource.getAbsolutePath()));
}
}
}