Interface ResourceEntry
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractResourceEntry
,NullResourceEntry
,UnixFSResourceEntryBase
,UnixFSResourceEntryExisting
,UnixFSResourceEntryNew
Represents a node in the
Snapshot
. A Node contains all the known information of a Resource.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A Operational Strategy type for the suppliedResourceEntry
. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Closers thisResourceEntry
releasing any underlying resources associated with theResourceEntry
.boolean
delete()
Flags this entry for removal returning the entry to absent state.default Optional
<ResourceContents> Finds the original Resource contents.default Optional
<ResourceId> Finds theResourceId
associated with the node, or a result equivalent toOptional.empty()
if no such resource id exists.default Optional
<ResourceContents> Finds the Resource contents.Finds theResourceId
associated with the node, or a result equivalent toOptional.empty()
if no such resource id exists.void
flush
(TransactionJournal.MutableEntry mutableEntry) Flushes a copy of thisResourceEntry
to storage, identified with the supplied transaction ID.default ResourceId
Gets theResourceId
or throws an instance ofResourceNotFoundException
if no such resource exists with this entry.Gets the internal immutable list of reverse links.default ResourceId
Gets theResourceId
or throws an instance ofResourceNotFoundException
if no such resource exists with this entry.Gets the internal immutable list of reverse links.default boolean
isAbsent()
Returns true if the entry represents an absent entry.boolean
Return true if the content is the original content.boolean
Checks if the list of reverse links are the original set of reverse links.default boolean
Returns true if the entry represents a present entry.boolean
Links thisResourceEntry
for the suppliedPath
.default ReadableByteChannel
Loads the byte contents of the resource.boolean
Unlinks thisResourceEntry
for the suppliedPath
.Updates the contents of thisResourceEntry
by overriding the supplied
-
Method Details
-
isPresent
default boolean isPresent()Returns true if the entry represents a present entry.- Returns:
- true if nascent, false otherwise
-
isAbsent
default boolean isAbsent()Returns true if the entry represents an absent entry.- Returns:
- true if absent, false otherwise
-
isOriginalContents
boolean isOriginalContents()Return true if the content is the original content.- Returns:
- true if the content is original.
-
isOriginalReversePaths
boolean isOriginalReversePaths()Checks if the list of reverse links are the original set of reverse links.- Returns:
- true if the links are original
-
getResourceId
Gets theResourceId
or throws an instance ofResourceNotFoundException
if no such resource exists with this entry.- Returns:
- the
ResourceId
, never null
-
getOriginalResourceId
Gets theResourceId
or throws an instance ofResourceNotFoundException
if no such resource exists with this entry.- Returns:
- the
ResourceId
, never null
-
findResourceId
Optional<ResourceId> findResourceId()Finds theResourceId
associated with the node, or a result equivalent toOptional.empty()
if no such resource id exists.- Returns:
- an
Optional<ResourceId>
containing theResourceId
-
findOriginalResourceId
Finds theResourceId
associated with the node, or a result equivalent toOptional.empty()
if no such resource id exists.- Returns:
- an
Optional<ResourceId>
containing theResourceId
-
getReversePathsImmutable
Gets the internal immutable list of reverse links. Will always return an emptySet
if no links exist.- Returns:
- the reverse links, never null.
-
getOriginalReversePathsImmutable
Gets the internal immutable list of reverse links. Will always return an emptySet
if no links exist.- Returns:
- the reverse links, never null.
-
loadResourceContents
Loads the byte contents of the resource.- Returns:
- the contents as a
ReadableByteChannel
- Throws:
NullResourceException
- if no contents exist for the resource.IOException
-
findResourceContents
Finds the Resource contents.- Returns:
- the
Optional
ofResourceContents
-
findOriginalResourceContents
Finds the original Resource contents.- Returns:
- the
Optional
ofResourceContents
-
link
Links thisResourceEntry
for the suppliedPath
.- Parameters:
path
- thePath
to unlink- Returns:
- Throws:
DuplicateException
- if the entry is present at pathIllegalArgumentException
- if thePath
is a wildcard pathSnapshotMissException
- if the suppliedPath
is not in the current snapshot entry
-
unlink
Unlinks thisResourceEntry
for the suppliedPath
.- Parameters:
path
- thePath
to unlink- Returns:
- true if the collection changed as the result of this operation
- Throws:
IllegalStateException
- if the entry is nascentSnapshotMissException
- if the suppliedPath
is not in the current snapshot entry
-
updateResourceContents
ResourceContents updateResourceContents()Updates the contents of thisResourceEntry
by overriding the supplied- Returns:
- ResourceContents the contents
-
delete
boolean delete()Flags this entry for removal returning the entry to absent state. If this entry is absent this will have no effect and the method will return false. Additionally, the operational strategy associated with this entry may opt to do nothing and return false as well.- Returns:
- true if clearing this entry had any effect
-
flush
Flushes a copy of thisResourceEntry
to storage, identified with the supplied transaction ID.- Parameters:
mutableEntry
- the transaction id
-
close
default void close()Closers thisResourceEntry
releasing any underlying resources associated with theResourceEntry
.- Specified by:
close
in interfaceAutoCloseable
-