Class UNIXUtils


  • public final class UNIXUtils
    extends java.lang.Object
    Utility class for UNIX user and file permissions.

    N.B. These are some old routines moved out from JobKickoffTask for reuse as part of V3 to V4 migration. This class is expected to be deleted once execution is delegated to Agent.

    Since:
    4.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void changeOwnershipOfDirectory​(java.lang.String dir, java.lang.String user, org.apache.commons.exec.Executor executor)
      Change the ownership of a directory (recursively).
      static void createUser​(java.lang.String user, java.lang.String group, org.apache.commons.exec.Executor executor)
      Create user on the system.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createUser

        public static void createUser​(java.lang.String user,
                                      @Nullable
                                      java.lang.String group,
                                      org.apache.commons.exec.Executor executor)
                               throws java.io.IOException
        Create user on the system.
        Parameters:
        user - user id
        group - group id
        executor - the command executor
        Throws:
        java.io.IOException - If the user or group could not be created.
      • changeOwnershipOfDirectory

        public static void changeOwnershipOfDirectory​(java.lang.String dir,
                                                      java.lang.String user,
                                                      org.apache.commons.exec.Executor executor)
                                               throws java.io.IOException
        Change the ownership of a directory (recursively).
        Parameters:
        dir - The directory to change the ownership of.
        user - Userid of the user.
        executor - the command executor
        Throws:
        java.io.IOException - if the operation fails