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 interfaceA Operational Strategy type for the suppliedResourceEntry. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Closers thisResourceEntryreleasing any underlying resources associated with theResourceEntry.booleandelete()Flags this entry for removal returning the entry to absent state.default Optional<ResourceContents> Finds the original Resource contents.default Optional<ResourceId> Finds theResourceIdassociated with the node, or a result equivalent toOptional.empty()if no such resource id exists.default Optional<ResourceContents> Finds the Resource contents.Finds theResourceIdassociated with the node, or a result equivalent toOptional.empty()if no such resource id exists.voidflush(TransactionJournal.MutableEntry mutableEntry) Flushes a copy of thisResourceEntryto storage, identified with the supplied transaction ID.default ResourceIdGets theResourceIdor throws an instance ofResourceNotFoundExceptionif no such resource exists with this entry.Gets the internal immutable list of reverse links.default ResourceIdGets theResourceIdor throws an instance ofResourceNotFoundExceptionif no such resource exists with this entry.Gets the internal immutable list of reverse links.default booleanisAbsent()Returns true if the entry represents an absent entry.booleanReturn true if the content is the original content.booleanChecks if the list of reverse links are the original set of reverse links.default booleanReturns true if the entry represents a present entry.booleanLinks thisResourceEntryfor the suppliedPath.default ReadableByteChannelLoads the byte contents of the resource.booleanUnlinks thisResourceEntryfor the suppliedPath.Updates the contents of thisResourceEntryby 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 theResourceIdor throws an instance ofResourceNotFoundExceptionif no such resource exists with this entry.- Returns:
- the
ResourceId, never null
-
getOriginalResourceId
Gets theResourceIdor throws an instance ofResourceNotFoundExceptionif no such resource exists with this entry.- Returns:
- the
ResourceId, never null
-
findResourceId
Optional<ResourceId> findResourceId()Finds theResourceIdassociated with the node, or a result equivalent toOptional.empty()if no such resource id exists.- Returns:
- an
Optional<ResourceId>containing theResourceId
-
findOriginalResourceId
Finds theResourceIdassociated 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 emptySetif no links exist.- Returns:
- the reverse links, never null.
-
getOriginalReversePathsImmutable
Gets the internal immutable list of reverse links. Will always return an emptySetif 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
OptionalofResourceContents
-
findOriginalResourceContents
Finds the original Resource contents.- Returns:
- the
OptionalofResourceContents
-
link
Links thisResourceEntryfor the suppliedPath.- Parameters:
path- thePathto unlink- Returns:
- Throws:
DuplicateException- if the entry is present at pathIllegalArgumentException- if thePathis a wildcard pathSnapshotMissException- if the suppliedPathis not in the current snapshot entry
-
unlink
Unlinks thisResourceEntryfor the suppliedPath.- Parameters:
path- thePathto unlink- Returns:
- true if the collection changed as the result of this operation
- Throws:
IllegalStateException- if the entry is nascentSnapshotMissException- if the suppliedPathis not in the current snapshot entry
-
updateResourceContents
ResourceContents updateResourceContents()Updates the contents of thisResourceEntryby 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 thisResourceEntryto storage, identified with the supplied transaction ID.- Parameters:
mutableEntry- the transaction id
-
close
default void close()Closers thisResourceEntryreleasing any underlying resources associated with theResourceEntry.- Specified by:
closein interfaceAutoCloseable
-