private ContentBlock getContent(final ContentClaim claim) throws ContentNotFoundException { final ContentBlock content = claimMap.get(claim); if (content == null) { throw new ContentNotFoundException(claim); } return content; }
private void ensureAllContentRead() throws ContentNotFoundException { if (bytesConsumed < flowFile.getSize()) { thrown = new ContentNotFoundException(claim, "Stream contained only " + bytesConsumed + " bytes but should have contained " + flowFile.getSize()); throw thrown; } }
private Path getPath(final ContentClaim claim, final boolean verifyExists) throws ContentNotFoundException { final ResourceClaim resourceClaim = claim.getResourceClaim(); final Path containerPath = containers.get(resourceClaim.getContainer()); if (containerPath == null) { if (verifyExists) { throw new ContentNotFoundException(claim); } else { return null; } } // Create the Path that points to the data Path resolvedPath = containerPath.resolve(resourceClaim.getSection()).resolve(resourceClaim.getId()); // If the data does not exist, create a Path that points to where the data would exist in the archive directory. if (!Files.exists(resolvedPath)) { resolvedPath = getArchivePath(claim.getResourceClaim()); if (verifyExists && !Files.exists(resolvedPath)) { throw new ContentNotFoundException(claim); } } return resolvedPath; }
return buffer; } catch (final ContentNotFoundException cnfe) { throw new ContentNotFoundException(currentFlowFile, cnfe.getMissingClaim(), cnfe.getMessage());
rawIn = contentRepository.read(flowFile.getContentClaim()); } catch (final ContentNotFoundException cnfe) { throw new ContentNotFoundException(flowFile, flowFile.getContentClaim(), cnfe.getMessage()); StreamUtils.skip(rawIn, flowFile.getContentClaimOffset()); } catch (final EOFException eof) { throw new ContentNotFoundException(flowFile, flowFile.getContentClaim(), "FlowFile has a Content Claim Offset of " + flowFile.getContentClaimOffset() + " bytes but the Content Claim does not have that many bytes");
throw cnfe; } catch (final EOFException eof) { throw new ContentNotFoundException(claim, eof); } catch (final IOException ioe) { throw new FlowFileAccessException("Failed to read content of " + flowFile, ioe);