Package org.forgerock.opendj.setup.model
Class SetupUtils
java.lang.Object
org.forgerock.opendj.setup.model.SetupUtils
Utility methods used by the
Setup class.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns a newly generated random server ID.static com.forgerock.opendj.util.HostPortValidates 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 Details
-
validateInstanceLocFileNotPresent
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
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
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
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.
-