Class WindowsRpcSystemFileCommandsHelper
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.rpc.sys.helper.SymbolicLinkHelper
-
- com.perforce.p4java.impl.mapbased.rpc.sys.helper.WindowsRpcSystemFileCommandsHelper
-
- All Implemented Interfaces:
ISystemFileCommandsHelper
public class WindowsRpcSystemFileCommandsHelper extends SymbolicLinkHelper
Windows specific implementation to help with file permissions.
-
-
Constructor Summary
Constructors Constructor Description WindowsRpcSystemFileCommandsHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canExecute(java.lang.String fileName)
Return true iff the file exists and is executable.boolean
isSymlink(java.lang.String fileName)
Return true iff the file exists and is a symbolic link.boolean
setExecutable(java.lang.String fileName, boolean executable, boolean ownerOnly)
Set the file's permissions to allow or disallow it to be executed.boolean
setOwnerReadOnly(java.lang.String fileName)
Set the file's read permissions only allow reading by owner.boolean
setReadable(java.lang.String fileName, boolean readable, boolean ownerOnly)
Set the file's permissions to allow or disallow reading from it.boolean
setWritable(java.lang.String fileName, boolean writable)
Set the file's permissions to allow or disallow writing to it.-
Methods inherited from class com.perforce.p4java.impl.mapbased.rpc.sys.helper.SymbolicLinkHelper
createSymbolicLink, exists, getLastModifiedTime, isSymbolicLink, isSymbolicLinkCapable, move, readSymbolicLink
-
-
-
-
Method Detail
-
canExecute
public boolean canExecute(java.lang.String fileName)
Description copied from interface:ISystemFileCommandsHelper
Return true iff the file exists and is executable.- Parameters:
fileName
- non-null path or name of the target file.- Returns:
- true iff the file existed and is executable.
-
setWritable
public boolean setWritable(java.lang.String fileName, boolean writable)
Description copied from interface:ISystemFileCommandsHelper
Set the file's permissions to allow or disallow writing to it.- Parameters:
fileName
- non-null path or name of the target file.writable
- if true, allow the file to be written to; if false, set the file read-only (or, more accurately, not writable).- Returns:
- true iff the set permission operation succeeded. May return false if the file didn't exist or the operation failed or an exception was caught, etc.
-
setReadable
public boolean setReadable(java.lang.String fileName, boolean readable, boolean ownerOnly)
Description copied from interface:ISystemFileCommandsHelper
Set the file's permissions to allow or disallow reading from it.- Parameters:
fileName
- non-null path or name of the target file. set the file read-only.readable
- if true, allow the file to be read; if false, set the file to not be readableownerOnly
- true to only set the read-only bit for the owner- Returns:
- true iff the set permission operation succeeded. May return false if the file didn't exist or the operation failed or an exception was caught, etc.
-
setOwnerReadOnly
public boolean setOwnerReadOnly(java.lang.String fileName)
Description copied from interface:ISystemFileCommandsHelper
Set the file's read permissions only allow reading by owner.- Parameters:
fileName
- non-null path or name of the target file. set the file read-only.- Returns:
- true iff the set permission operation succeeded. May return false if the file didn't exist or the operation failed or an exception was caught, etc.
-
setExecutable
public boolean setExecutable(java.lang.String fileName, boolean executable, boolean ownerOnly)
Description copied from interface:ISystemFileCommandsHelper
Set the file's permissions to allow or disallow it to be executed.- Parameters:
fileName
- non-null path or name of the target file.executable
- if true, allow the file to be executed; if false, set the file not executable.ownerOnly
- true to only set the executable bit for the owner- Returns:
- true iff the set permission operation succeeded. May return false if the file didn't exist or the operation failed or an exception was caught, etc.
-
isSymlink
public boolean isSymlink(java.lang.String fileName)
Description copied from interface:ISystemFileCommandsHelper
Return true iff the file exists and is a symbolic link.This method is guaranteed to only be called when we suspect a specific file may be a symbolic link (i.e. we've exhausted other possibilities) and it is safe for this method to return false if it can't implement the associated plumbing or it simply can't tell whether the file is a symlink or not.
- Parameters:
fileName
- non-null path or name of the target file.- Returns:
- true iff the file exists and is a symbolic link.
-
-