public interface ContentRepository
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Performs any cleanup actions that may need to be taken upon system
restart.
|
ContentClaim |
clone(ContentClaim original,
boolean lossTolerant)
Clones the content for the given content claim and returns content claim
of the new object
|
ContentClaim |
create(boolean lossTolerant)
Creates a new content claim
|
int |
decrementClaimantCount(ContentClaim claim)
Reduces the number of claimants for the given claim.
|
long |
exportTo(ContentClaim claim,
OutputStream destination)
Exports the content of the given claim to the given destination.
|
long |
exportTo(ContentClaim claim,
OutputStream destination,
long offset,
long length)
Exports a subset of the content of the given claim, starting at offset
and copying length bytes, to the given destination.
|
long |
exportTo(ContentClaim claim,
Path destination,
boolean append)
Exports the content of the given claim to the given destination.
|
long |
exportTo(ContentClaim claim,
Path destination,
boolean append,
long offset,
long length)
Exports the content of the given claim to the given destination.
|
default Set<ResourceClaim> |
getActiveResourceClaims(String containerName)
Optional operation that returns a List of all Resource Claims that exist in the given Container that are considered "active" (i.e., not archived)
|
int |
getClaimantCount(ContentClaim claim)
Obtains the current number of claimants for the given claim
|
long |
getContainerCapacity(String containerName) |
String |
getContainerFileStoreName(String containerName)
Returns the name of the FileStore that the given container is stored on, or
null
if not applicable or unable to determine the file store name |
Set<String> |
getContainerNames() |
long |
getContainerUsableSpace(String containerName) |
long |
importFrom(InputStream content,
ContentClaim claim)
Imports content from the given stream creating a new content object and
claim within the repository.
|
long |
importFrom(Path content,
ContentClaim claim)
Imports content from the given path creating a new content object and
claim within the repository.
|
int |
incrementClaimaintCount(ContentClaim claim)
Increments the number of claimants for the given claim
|
void |
initialize(ContentRepositoryContext context)
Initializes the Content Repository, providing to it the
ContentRepositoryContext.
|
boolean |
isAccessible(ContentClaim contentClaim) |
default boolean |
isActiveResourceClaimsSupported()
Indicates whether or not the repository supports obtaining a list of active Resource Claims via the
getActiveResourceClaims(String) method |
default boolean |
isResourceClaimStreamSupported()
Indicates whether or not this Content Repository supports obtaining an InputStream for
an entire Resource Claim.
|
long |
merge(Collection<ContentClaim> claims,
ContentClaim destination,
byte[] header,
byte[] footer,
byte[] demarcator)
Deprecated.
|
void |
purge()
Purges the contents of the repository, as if the repository were newly
created.
|
InputStream |
read(ContentClaim claim)
Provides access to the input stream for the given claim
|
InputStream |
read(ResourceClaim claim)
Provides access ot the input stream for the entire Resource Claim
|
boolean |
remove(ContentClaim claim)
Removes the content indicated by the given claim
|
void |
shutdown()
Shuts down the Content Repository, freeing any resources that may be
held.
|
long |
size(ContentClaim claim) |
long |
size(ResourceClaim claim) |
OutputStream |
write(ContentClaim claim)
Obtains an OutputStream to the content for the given claim.
|
void initialize(ContentRepositoryContext context) throws IOException
context - to initialize repositoryIOException - if unable to initvoid shutdown()
Set<String> getContainerNames()
long getContainerCapacity(String containerName) throws IOException
containerName - name of container to check capacity onIOException - if unable to check capacityIllegalArgumentException - if no container exists with the given
namelong getContainerUsableSpace(String containerName) throws IOException
containerName - to check space onIOException - if unable to check spaceIllegalArgumentException - if no container exists with the given
nameString getContainerFileStoreName(String containerName)
null
if not applicable or unable to determine the file store namecontainerName - the name of the containerContentClaim create(boolean lossTolerant) throws IOException
lossTolerant - indicates whether the content for the new claim is
loss tolerant. If true the repository might choose more volatile storage
options which could increase performance for a tradeoff with reliabilityIOException - if unable to create claimint incrementClaimaintCount(ContentClaim claim)
claim - to incrementint getClaimantCount(ContentClaim claim)
claim - to get count ofint decrementClaimantCount(ContentClaim claim)
claim - to decrementboolean remove(ContentClaim claim)
claim - to removeContentClaim clone(ContentClaim original, boolean lossTolerant) throws IOException
original - to clonelossTolerant - if can be place in a loss tolerant repositoryIOException - if an IO error occurs. Any content written to the new
destination prior to the error will be destroyed@Deprecated long merge(Collection<ContentClaim> claims, ContentClaim destination, byte[] header, byte[] footer, byte[] demarcator) throws IOException
claims - the claims to merge which will be combined in order of
collection iterationdestination - the claim to write the merged content toheader - if supplied will be prepended to the outputfooter - if supplied will be appended to the outputdemarcator - if supplied will be placed in between each merged
objectIOException - if unable to mergeIllegalArgumentException - if the given destination is included in
the given claimslong importFrom(Path content, ContentClaim claim) throws IOException
content - to import fromclaim - the claim to write imported content toIOException - if failure to read given contentlong importFrom(InputStream content, ContentClaim claim) throws IOException
content - to import fromclaim - the claim to write imported content toIOException - if unable to read contentlong exportTo(ContentClaim claim, Path destination, boolean append) throws IOException
claim - to export fromdestination - where to export dataappend - if true appends to the destination; false overwritesIOException - if an IO error occurs. The state of the content for
the given destination is unknown and callers should consider whether they
should clean up any partially created pathslong exportTo(ContentClaim claim, Path destination, boolean append, long offset, long length) throws IOException
claim - to export fromdestination - where to export dataappend - if true appends to the destination; false overwritesoffset - the offset at which the claim should start being copiedlength - the number of bytes to copyIOException - if an IO error occurs. The state of the content for
the given destination is unknown and callers should consider whether they
should clean up any partially created pathslong exportTo(ContentClaim claim, OutputStream destination) throws IOException
claim - to export fromdestination - where to export dataIOException - if an IO error occurs.long exportTo(ContentClaim claim, OutputStream destination, long offset, long length) throws IOException
claim - to export fromdestination - where to export dataoffset - the offset into the claim at which the copy should beginlength - the number of bytes to copyIOException - if an IO error occurs.long size(ContentClaim claim) throws IOException
claim - to get size ofIOException - if size check failedlong size(ResourceClaim claim) throws IOException
claim - to get size ofIOException - if size check failedInputStream read(ContentClaim claim) throws IOException
claim - to read fromIOException - if unable to readInputStream read(ResourceClaim claim) throws IOException
claim - the resource claim to read fromIOException - if unable to readdefault boolean isResourceClaimStreamSupported()
false, the read(ResourceClaim) should not
be called and instead read(ContentClaim) should always be usedtrue if reading an entire Resource Claim is allowed, false otherwiseOutputStream write(ContentClaim claim) throws IOException
claim - to write toIOException - if unable to obtain streamvoid purge()
void cleanup()
boolean isAccessible(ContentClaim contentClaim) throws IOException
contentClaim - the Content Claim to checkfalseIOException - if unable to determine accessibilitydefault Set<ResourceClaim> getActiveResourceClaims(String containerName) throws IOException
containerName - the name of the containerIOException - if unable to obtain a listing due to an IO failureUnsupportedOperationException - if this repository does not implement this capability.isActiveResourceClaimsSupported()default boolean isActiveResourceClaimsSupported()
getActiveResourceClaims(String) methodtrue if the operation is supported, false otherwiseCopyright © 2023 Apache NiFi Project. All rights reserved.