Package org.forgerock.opendj.setup.model
Class SetupUtils
- java.lang.Object
-
- org.forgerock.opendj.setup.model.SetupUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetNewServerId()Returns a newly generated random server ID.static com.forgerock.opendj.util.HostPorthostPort(String host, int port)Validates provided host and port and returns a newHostPortobject.static booleanserverAlreadyInstalled(Path instancePath)Returnstrueif there is already an OpenDJ instance set up in the providedPath.static voidvalidateInstanceLocFileNotPresent(Path installPath)Ensures that there is no existing instance.loc file.static voidwriteVersionsInConfigFile(Path configFile)Writes server binary and upgrade version in the provided LDIF config file.
-
-
-
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)
Returnstrueif there is already an OpenDJ instance set up in the providedPath.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:
trueif there is already an OpenDJ instance set up in the providedPath
-
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 newHostPortobject.- Parameters:
host- Hostname, must be a non blank stringport- Port number, must be in the port range- Returns:
- A new
HostPortobject - 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.
-
-