Class RpcSystemFileCommandsHelper

java.lang.Object
com.perforce.p4java.impl.mapbased.rpc.sys.helper.SymbolicLinkHelper
com.perforce.p4java.impl.mapbased.rpc.sys.helper.RpcSystemFileCommandsHelper
All Implemented Interfaces:
ISystemFileCommandsHelper

public class RpcSystemFileCommandsHelper extends SymbolicLinkHelper
Default JDK 6 implementation of the ISystemFileCommandsHelper interface. Uses introspection so it can be compiled (if not actually work) on JDK 5 systems. Actual use of this on JDK 5 systems is OK to the extent that things like edit or sync may end up with the wrong permissions on the client, but much else will work just fine.
  • Constructor Details

    • RpcSystemFileCommandsHelper

      public RpcSystemFileCommandsHelper()
  • Method Details

    • setWritable

      public boolean setWritable(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(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 readable
      ownerOnly - 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(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(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.
    • canExecute

      public boolean canExecute(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.
    • isSymlink

      public boolean isSymlink(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.