Package com.ultikits.ultitools.manager
Class RemoteFileOperations.WriteDenial
java.lang.Object
com.ultikits.ultitools.manager.RemoteFileOperations.WriteDenial
- All Implemented Interfaces:
PosixAttributePreserver.ReplaceInPlaceListener
- Enclosing class:
RemoteFileOperations
private static final class RemoteFileOperations.WriteDenial
extends Object
implements PosixAttributePreserver.ReplaceInPlaceListener
Collects why
PosixAttributePreserver.replaceInPlace(java.io.File, byte[], com.ultikits.ultitools.utils.PosixAttributePreserver.ReplaceInPlaceListener) declined the replacement.
A permission-copy failure is not a refusal — the shared operation still proceeds — so it
leaves the reason unset.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidtargetexists and none of its POSIX write-permission bits (owner, group, or other) are set for the current process -- treated as a deliberate operator hardening signal, exactly like a symlinked target.voidonOwnershipCopyFailure(String ownerName, String groupName) target's owner/group could not be replicated onto the staging file; the replacement is abandoned.voidtarget's permission bits were read successfully but could not be applied to the staging file; best-effort only, the replacement still proceeds.voidA POSIX view exists fortargetbut reading its current attributes failed -- seePosixAttributePreserver.copyIfSupported(java.io.File, java.io.File, java.lang.Runnable, java.lang.Runnable, java.util.function.BiConsumer<java.lang.String, java.lang.String>)'s own javadoc for why this is distinct from "no POSIX view at all" and must also abandon the replacement.voidtargetis a symbolic link.voidonWriteFailure(IOException cause) The atomic write or move itself failed (e.g.private Stringreason()
-
Field Details
-
reason
-
-
Constructor Details
-
WriteDenial
private WriteDenial()
-
-
Method Details
-
reason
-
onOperatorPinnedReadOnly
public void onOperatorPinnedReadOnly()Description copied from interface:PosixAttributePreserver.ReplaceInPlaceListenertargetexists and none of its POSIX write-permission bits (owner, group, or other) are set for the current process -- treated as a deliberate operator hardening signal, exactly like a symlinked target. The replacement is refused;targetis left completely untouched.- Specified by:
onOperatorPinnedReadOnlyin interfacePosixAttributePreserver.ReplaceInPlaceListener
-
onSymbolicLink
public void onSymbolicLink()Description copied from interface:PosixAttributePreserver.ReplaceInPlaceListenertargetis a symbolic link.writeBytes's pre-existing contract (seePosixAttributePreserver.replaceInPlace(java.io.File, byte[], com.ultikits.ultitools.utils.PosixAttributePreserver.ReplaceInPlaceListener)'s own javadoc) is REFUSE, not write-through-to-target: the replacement is declined entirely, exactly like an operator-pinned read-only file, rather than either replacing the link itself (which would silently break an operator-managed shared layout) or resolving and writing through to the link's target (which this shared operation does not attempt, for the same relative-vs-absolute-link and shared-target reasonswriteBytes's own javadoc already gives).- Specified by:
onSymbolicLinkin interfacePosixAttributePreserver.ReplaceInPlaceListener
-
onSourceAttributesUnreadable
public void onSourceAttributesUnreadable()Description copied from interface:PosixAttributePreserver.ReplaceInPlaceListenerA POSIX view exists fortargetbut reading its current attributes failed -- seePosixAttributePreserver.copyIfSupported(java.io.File, java.io.File, java.lang.Runnable, java.lang.Runnable, java.util.function.BiConsumer<java.lang.String, java.lang.String>)'s own javadoc for why this is distinct from "no POSIX view at all" and must also abandon the replacement.- Specified by:
onSourceAttributesUnreadablein interfacePosixAttributePreserver.ReplaceInPlaceListener
-
onPermissionCopyFailure
public void onPermissionCopyFailure()Description copied from interface:PosixAttributePreserver.ReplaceInPlaceListenertarget's permission bits were read successfully but could not be applied to the staging file; best-effort only, the replacement still proceeds.- Specified by:
onPermissionCopyFailurein interfacePosixAttributePreserver.ReplaceInPlaceListener
-
onOwnershipCopyFailure
Description copied from interface:PosixAttributePreserver.ReplaceInPlaceListenertarget's owner/group could not be replicated onto the staging file; the replacement is abandoned.- Specified by:
onOwnershipCopyFailurein interfacePosixAttributePreserver.ReplaceInPlaceListener- Parameters:
ownerName- the owner nametargetis owned bygroupName- the group nametargetis owned by
-
onWriteFailure
Description copied from interface:PosixAttributePreserver.ReplaceInPlaceListenerThe atomic write or move itself failed (e.g. the filesystem filled up mid-write, or a transient I/O error during the rename).targetis guaranteed untouched -- the staging file is written and moved only after every guard above has already passed, and a failure here never truncates or partially overwritestargetitself.- Specified by:
onWriteFailurein interfacePosixAttributePreserver.ReplaceInPlaceListener- Parameters:
cause- the underlyingIOException
-