Class SetupUtils


  • public final class SetupUtils
    extends Object
    Utility methods used by the Setup class.
    • Method Detail

      • validateInstanceLocFileNotPresent

        public static void validateInstanceLocFileNotPresent​(Path installPath)
                                                      throws SetupException
        Ensures that there is no existing instance.loc file.

        Creation of the instance.loc file is the setup tool responsibility, if an instance.loc file exists it means that either the setup has already been ran or that the user wants to use old setup tool behavior (see OPENDJ-3588).

        Parameters:
        installPath - The install path of the server to setup
        Throws:
        SetupException - If an existing instance.loc has been found
      • serverAlreadyInstalled

        public static boolean serverAlreadyInstalled​(Path instancePath)
        Returns true if there is already an OpenDJ instance set up in the provided Path.

        A path is considered as OpenDJ instance if either a config or a db directory (or both) is present.

        Parameters:
        instancePath - The instance path to test
        Returns:
        true if there is already an OpenDJ instance set up in the provided Path
      • getNewServerId

        public static String getNewServerId()
        Returns a newly generated random server ID.
        Returns:
        a newly generated random server ID
      • hostPort

        public static com.forgerock.opendj.util.HostPort hostPort​(String host,
                                                                  int port)
                                                           throws com.forgerock.opendj.cli.ArgumentException
        Validates provided host and port and returns a new HostPort object.
        Parameters:
        host - Hostname, must be a non blank string
        port - Port number, must be in the port range
        Returns:
        A new HostPort object
        Throws:
        com.forgerock.opendj.cli.ArgumentException - If either provided hostname or port is invalid
      • writeVersionsInConfigFile

        public static void writeVersionsInConfigFile​(Path configFile)
                                              throws IOException
        Writes server binary and upgrade version in the provided LDIF config file.
        Parameters:
        configFile - Path to the configuration file to be written.
        Throws:
        IOException - If an I/O exception occurs during the operation.