Skip to content

Commit

Permalink
use DistributedExecutor libs from ISPN to get FixityResults
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Jun 7, 2013
1 parent b54a904 commit 5ce14e8
Show file tree
Hide file tree
Showing 19 changed files with 914 additions and 405 deletions.
Expand Up @@ -199,23 +199,16 @@ public Collection<FixityResult> runFixityAndFixProblems(final Datastream datastr
Set<FixityResult> goodEntries;
final URI digestUri = datastream.getContentDigest();
final long size = datastream.getContentSize();
MessageDigest digest;

fixityCheckCounter.inc();

try {
digest = getInstance(ContentDigest.getAlgorithm(digestUri));
} catch (final NoSuchAlgorithmException e) {
throw new RepositoryException(e.getMessage(), e);
}

final Timer.Context context = timer.time();

try {
fixityResults =
copyOf(getFixity(datastream.getNode().
getNode(JcrConstants.JCR_CONTENT),
digest, digestUri, size));
digestUri, size));

goodEntries = ImmutableSet.copyOf(Collections2.filter(fixityResults, new Predicate<FixityResult>() {
@Override
Expand Down Expand Up @@ -246,7 +239,7 @@ public boolean apply(org.fcrepo.utils.FixityResult input) {
result.getEntry()
.storeValue(anyGoodCacheEntry.getInputStream());
final FixityResult newResult =
result.getEntry().checkFixity(digestUri, size, digest);
result.getEntry().checkFixity(digestUri, size);
if (newResult.isSuccess()) {
result.setRepaired();
fixityRepairedCounter.inc();
Expand All @@ -267,20 +260,18 @@ public boolean apply(org.fcrepo.utils.FixityResult input) {
*
* @param resource
* @param digest
* @param dsChecksum
* @param dsChecksum -the checksum and algorithm represented as a URI
* @param dsSize
* @return
* @throws RepositoryException
*/
public Collection<FixityResult> getFixity(final Node resource,
final MessageDigest digest,
final URI dsChecksum,
final long dsSize)
throws RepositoryException {
logger.debug("Checking resource: " + resource.getPath());
Function<LowLevelCacheEntry, FixityResult> checkCacheFunc =
ServiceHelpers.getCheckCacheFixityFunction(digest,
dsChecksum, dsSize);
ServiceHelpers.getCheckCacheFixityFunction(dsChecksum, dsSize);
return llStoreService.
transformLowLevelCacheEntries(resource, checkCacheFunc);
}
Expand Down

0 comments on commit 5ce14e8

Please sign in to comment.