if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Checking in Pairtree file system for: {}", aReferentID);
}
try {
final PairtreeRoot pairtree = new PairtreeRoot(myJP2Dir);
final PairtreeObject dir = pairtree.getObject(aReferentID);
final String filename = PairtreeUtils.encodeID(aReferentID);
final File file = new File(dir, filename);
if (file.exists()) {
image = new ImageRecord();
image.setIdentifier(aReferentID);
image.setImageFile(file.getAbsolutePath());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("JP2 found in Pairtree cache: {}", file.getAbsolutePath());
}
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Failed to find a JP2 in Pairtree cache: {}", pairtree.getAbsolutePath());
}
} catch (final IOException details) {
LOGGER.error("Failed to load file from cache", details);
}