Class Setup
- All Implemented Interfaces:
Profile.SetupConfiguration
This class is responsible for
- Collect all parameters (such as port numbers, root user credentials, ...)
- Copy the content of the template directory from the install path to the instance path
- Modify the config.ldif configuration template file
- Performs optional additional actions (configure replication, import sample data, start windows service...)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the JVM trust manager provider provided in the config template. -
Method Summary
Modifier and TypeMethodDescriptionadminPort(int adminPort) Specifies the administration port of the instance to setup.bootstrapReplicationServers(com.forgerock.opendj.util.HostPort... bootstrapReplicationServers) Specifies the addresses of replication servers to which the server will try to connect at startup time.bootstrapReplicationServers(String... bootstrapReplicationServers) Specifies the addresses of replication servers to which the server will try to connect at startup time.bootstrapReplicationServers(Collection<com.forgerock.opendj.util.HostPort> bootstrapReplicationServers) Specifies the addresses of replication servers to which the server will try to connect at startup time.checkPortAvailability(boolean checkPortAvailability) Specifies whether the port availability should be verified during the validation phase.Removes allbootstrapReplicationServers(HostPort...)bootstrap replication servers} registered in thisSetup.console(SetupConsole console) Specifies theSetupConsolewhich be used to print information issued during setup.deploymentId(String key, String password, Consumer<LocalizableMessage> warningHandler) Specifies theDeploymentIdwhich should be used for securing the deployment.deploymentId(DeploymentId deploymentId) Specifies theDeploymentIdwhich should be used for securing the deployment.Disables the HTTP connection handler.Disables the HTTPS connection handler.Disables the LDAP connection handler.Disables the LDAPS connection handler.Specifies that a monitor user must not be created in the DS server to be setup.enableCloudBackups(boolean enableCloudBackups) Specifies whether the OpenDJ Cloud Backup feature should be enabled.enableStartTls(boolean enableStartTls) Specifies whether start TLS should be enabled on the LDAP connection handler.enableWindowsService(boolean enableWindowsService) Specifies whether the OpenDJ windows service should be enabled.fullyQualifiedHostName(String fullyQualifiedHostName) Specifies the fully qualified hostname of the server to setup.Returns the deployment ID which will be used for securing the deployment.Returns the replication port set for this server ornullifreplicationPort(int)has not been called on this setup object.httpPort(int httpPort) Specifies that the http connection handler must be enabled and listening on the provided port.httpSecurePort(int httpSecurePort) Specifies that the https connection handler must be enabled and listening on the provided port.installDirectory(String installDirectory) Specifies the path of the OpenDJ archive to use to setup the server instance.installDirectory(Path installPath) Specifies the path of the OpenDJ archive to use to setup the server instance.Returns the setup install path.instanceDirectory(String instanceDirectory) Specifies the path of the OpenDJ instance to setup.instanceDirectory(Path instancePath) Specifies the path of the opendj instance to setup.Returns the setup instance path.Returns the name of the key manager provider configured for the server to setup.ldapPort(int ldapPort) Specifies that the ldap connection handler must be enabled and listening on the provided port.ldapPort(int ldapPort, boolean enableStartTls) Specifies that the ldap connection handler must be enabled and listening on the provided port and whether start TLS should be enabled.ldapSecurePort(int ldapSecurePort) Specifies that the ldaps connection handler must be enabled and listening on the provided port.monitorUserDn(String monitorUserDn) Specifies the DN of the monitor user, having access to monitor information.monitorUserDn(Dn monitorUserDn) Specifies the DN of the monitor user, having access to monitor information.monitorUserPassword(String monitorUserPassword) Specifies the password of the monitor user.static SetupnewSetup()Creates a newSetupobject to start adding setup parameters.replicationPort(int replicationPort) Specifies that the instance to setup will be configured with a replication server listening on the provided port number.rootUserDn(String rootUserDn) Specifies the user root distinguish name of the instance to setup.rootUserDn(Dn rootUserDn) Specifies the user root distinguish name of the instance to setup.rootUserPassword(String rootUserPassword) Specifies the user root password of the instance to setup.Specifies the server ID.voidsetup()Main method which will setup the server instance.startServer(boolean startServer) Specifies whether the server should start during the setup process.Returns the name of the trust manager provider configured for the server to setup.Specifies that peer-to-peer communications will be secured with certificates derived from the deployment ID.useExistingCertificatesForTls(Security.KeyStoreModel keyStore, Security.TrustStoreModel trustStore) Specifies that peer-to-peer communications will be secured with certificates located in the user-provided key and trust store.withProfiles(Collection<Profile> profilesToAdd) Specifies the setup profiles which will be run during the setup.withProfiles(Profile... profiles) Specifies the setup profiles which will be run during the setup.
-
Field Details
-
JVM_TRUST_MANAGER_PROVIDER
The name of the JVM trust manager provider provided in the config template.- See Also:
-
-
Method Details
-
newSetup
Creates a newSetupobject to start adding setup parameters.- Returns:
- a new
Setupobject to start adding setup parameters.
-
adminPort
Specifies the administration port of the instance to setup.This method must have been called with a non
nullparameter before that thesetup()method is called since the administration port is a mandatory parameter.- Parameters:
adminPort- The administration port number- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can be throws if the port is already in use on the running machine, this verification can be disabled usingcheckPortAvailability(boolean).
-
checkPortAvailability
Specifies whether the port availability should be verified during the validation phase.This option is enabled by default
- Parameters:
checkPortAvailability-falseif the port availability performed before setup should be disabled- Returns:
- This
Setupobject
-
enableWindowsService
public Setup enableWindowsService(boolean enableWindowsService) throws com.forgerock.opendj.cli.ArgumentException Specifies whether the OpenDJ windows service should be enabled.This option will only have effect if the running OS is windows. By default, the windows service is disabled
- Parameters:
enableWindowsService-trueif the windows service should be enabled- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the running operating system is not windows
-
fullyQualifiedHostName
public Setup fullyQualifiedHostName(String fullyQualifiedHostName) throws com.forgerock.opendj.cli.ArgumentException Specifies the fully qualified hostname of the server to setup.This method must have been called before that the
setup()method is called since the administration port is a mandatory parameter.- Parameters:
fullyQualifiedHostName- The fully qualified hostname of the server to setup- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided value is invalid
-
ldapPort
public Setup ldapPort(int ldapPort, boolean enableStartTls) throws com.forgerock.opendj.cli.ArgumentException Specifies that the ldap connection handler must be enabled and listening on the provided port and whether start TLS should be enabled. By default, the ldap connection handler will be disabled.- Parameters:
ldapPort- The ldap port to listenenableStartTls-trueif startTls must be enabled on the ldap connection handler- Returns:
- This
Setup - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can be throws if the port is already in use on the running machine, this verification can be disabled usingcheckPortAvailability(boolean).
-
ldapPort
Specifies that the ldap connection handler must be enabled and listening on the provided port. By default, the ldap connection handler will be disabled.- Parameters:
ldapPort- The ldap port to listen- Returns:
- This
Setup - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can be thrown if the port is already in use on the running machine. This verification can be disabled usingcheckPortAvailability(boolean).
-
enableStartTls
Specifies whether start TLS should be enabled on the LDAP connection handler.By default, the LDAP connection handler will be disabled.
- Parameters:
enableStartTls-trueif startTls must be enabled on the ldap connection handler- Returns:
- This
Setup - See Also:
-
disableLdapConnectionHandler
Disables the LDAP connection handler.By default, the LDAP connection handler is disabled.
- Returns:
- This
Setup - See Also:
-
ldapSecurePort
Specifies that the ldaps connection handler must be enabled and listening on the provided port. By default or if the provided port isnull, the ldaps connection handler will be disabled.- Parameters:
ldapSecurePort- The ldaps port to listen- Returns:
- This
Setup - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can be throws if the port is already in use on the running machine, this verification can be disabled usingcheckPortAvailability(boolean).
-
disableLdapSecureConnectionHandler
Disables the LDAPS connection handler.By default, the LDAPS connection handler is disabled
- Returns:
- This
Setup - See Also:
-
httpPort
Specifies that the http connection handler must be enabled and listening on the provided port.By default, the http connection handler will be disabled.
- Parameters:
httpPort- The http connection handler listen port- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can be throws if the port is already in use on the running machine, this verification can be disabled usingcheckPortAvailability(boolean).
-
disableHttpConnectionHandler
Disables the HTTP connection handler.By default, the HTTP connection handler is disabled.
- Returns:
- This
Setup - See Also:
-
httpSecurePort
Specifies that the https connection handler must be enabled and listening on the provided port.By default, the https connection handler will be disabled.
- Parameters:
httpSecurePort- The https connection handler listen port- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can be throws if the port is already in use on the running machine, this verification can be disabled usingcheckPortAvailability(boolean).
-
disableHttpSecureConnectionHandler
Disables the HTTPS connection handler.By default, the HTTPS connection handler is disabled.
- Returns:
- This
Setup - See Also:
-
installDirectory
public Setup installDirectory(String installDirectory) throws com.forgerock.opendj.cli.ArgumentException Specifies the path of the OpenDJ archive to use to setup the server instance.By default, the running directory is used
- Parameters:
installDirectory- Path of the OpenDJ archive to use to setup the server- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided path does not reference an existing directory
-
installDirectory
Specifies the path of the OpenDJ archive to use to setup the server instance.By default, the running directory is used
- Parameters:
installPath- Path of the OpenDJ archive to use to setup the server- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided path does not reference an existing directory
-
instanceDirectory
public Setup instanceDirectory(String instanceDirectory) throws com.forgerock.opendj.cli.ArgumentException Specifies the path of the OpenDJ instance to setup.By default, the install directory will be used
- Parameters:
instanceDirectory- Path of the instance to setup- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the instance path does not reference a directory or if the parent path is invalid.
-
instanceDirectory
Specifies the path of the opendj instance to setup.By default, the install directory will be used. If the instance directory does not exists, it will be created.
- Parameters:
instancePath- Path of the instance to setup- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the instance path does not reference a directory or if the parent path is invalid.
-
deploymentId
Specifies theDeploymentIdwhich should be used for securing the deployment. The deployment ID MUST be the same for all servers in the deployment. Create a new deployment ID for the first server, then re-use it for subsequent servers.- Parameters:
deploymentId- The deployment ID- Returns:
- This
Setupobject
-
deploymentId
public Setup deploymentId(String key, String password, Consumer<LocalizableMessage> warningHandler) throws com.forgerock.opendj.cli.ArgumentException Specifies theDeploymentIdwhich should be used for securing the deployment. The deployment ID MUST be the same for all servers in the deployment. The decoded deployment ID can be obtained by callinggetDeploymentId().- Parameters:
key- A string representing the deployment IDpassword- The deployment ID passwordwarningHandler- The handler for user messages- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the deployment ID cannot be decoded (i.e is invalid), if the running JVM does not support the security algorithms used by the DeploymentId class or if the password is incorrect- See Also:
-
useExistingCertificatesForTls
public Setup useExistingCertificatesForTls(Security.KeyStoreModel keyStore, Security.TrustStoreModel trustStore) throws com.forgerock.opendj.cli.ArgumentException Specifies that peer-to-peer communications will be secured with certificates located in the user-provided key and trust store. The default behavior is to use an SSL key-pair and CA certificate derived from the deployment ID.- Parameters:
keyStore- Akeystorein which the server certificate(s) must be storedtrustStore- Thetruststoreto use for trusting remote peer certificates- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If keystore can not be loaded or if aliases are wrong or ambiguous- See Also:
-
Security.jksKeyStore(String, Security.PasswordProvider)Security.jceksKeyStore(String, Security.PasswordProvider)Security.pkcs12KeyStore(String, Security.PasswordProvider)Security.pkcs11KeyStore(Security.PasswordProvider)Security.jksTrustStore(String, Security.PasswordProvider)Security.jceksTrustStore(String, Security.PasswordProvider)Security.pkcs12TrustStore(String, Security.PasswordProvider)Security.jvmTrustStore()Security.blindTrust()
-
useDeploymentIdForTls
Specifies that peer-to-peer communications will be secured with certificates derived from the deployment ID. This is the default behavior. Use theuseExistingCertificatesForTls(org.forgerock.opendj.setup.model.Security.KeyStoreModel, org.forgerock.opendj.setup.model.Security.TrustStoreModel)in order to configure custom SSL keys.- Returns:
- This
Setupobject
-
rootUserDn
Specifies the user root distinguish name of the instance to setup.By default, "uid=admin" will be used
-
rootUserDn
Specifies the user root distinguish name of the instance to setup.By default, "uid=admin" will be used
-
rootUserPassword
public Setup rootUserPassword(String rootUserPassword) throws com.forgerock.opendj.cli.ArgumentException Specifies the user root password of the instance to setup.This method must have been called before that the
setup()method is called since the root user password is a mandatory parameter.- Parameters:
rootUserPassword- The password of the user root of the instance to setup- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided value is not acceptable as a password
-
monitorUserDn
Specifies the DN of the monitor user, having access to monitor information.By default, "uid=Monitor" will be used
-
monitorUserDn
Specifies the DN of the monitor user, having access to monitor information.By default, "uid=Monitor" will be used
-
monitorUserPassword
public Setup monitorUserPassword(String monitorUserPassword) throws com.forgerock.opendj.cli.ArgumentException Specifies the password of the monitor user.- Parameters:
monitorUserPassword- The password of the monitor user- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided password is not acceptable as a password
-
disableMonitorUserCreation
Specifies that a monitor user must not be created in the DS server to be setup.- Returns:
- This
Setupobject
-
startServer
Specifies whether the server should start during the setup process.This attribute is
trueby default Note that depending on the setup options chosen, this parameter may be mandatory- Parameters:
startServer-falseif the server should not start during the setup process- Returns:
- This
Setupobject
-
bootstrapReplicationServers
public Setup bootstrapReplicationServers(String... bootstrapReplicationServers) throws com.forgerock.opendj.cli.ArgumentException Specifies the addresses of replication servers to which the server will try to connect at startup time.To enable replication in the instance to setup, at least one bootstrap server must have been provided before
setup()method is called.- Parameters:
bootstrapReplicationServers- Bootstrap replication server addresses. Addresses must be specified using the replication port of the remote replication server(s).- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If one of the provided cannot beHostPort.valueOf(String)as a validobject
-
clearBootstrapReplicationServers
Removes allbootstrapReplicationServers(HostPort...)bootstrap replication servers} registered in thisSetup.By default, replication is disabled so this method is intended to be used only by interactive applications (when a user can update his choices).
- Returns:
- This
Setupobject
-
bootstrapReplicationServers
public Setup bootstrapReplicationServers(com.forgerock.opendj.util.HostPort... bootstrapReplicationServers) Specifies the addresses of replication servers to which the server will try to connect at startup time.To enable replication in the instance to setup, at least one bootstrap server must have been provided before
setup()method is called.- Parameters:
bootstrapReplicationServers- Bootstrap replication server addresses. Addresses must be specified using the replication port of the remote replication server(s).- Returns:
- This
Setupobject
-
bootstrapReplicationServers
public Setup bootstrapReplicationServers(Collection<com.forgerock.opendj.util.HostPort> bootstrapReplicationServers) Specifies the addresses of replication servers to which the server will try to connect at startup time.To enable replication in the instance to setup, at least one bootstrap server must have been provided before
setup()method is called.- Parameters:
bootstrapReplicationServers- Bootstrap server addresses. Addresses must be specified using the replication port of the remote replication server(s).- Returns:
- This
Setupobject
-
replicationPort
Specifies that the instance to setup will be configured with a replication server listening on the provided port number.If this method is not called before
setup(), no replication server will be configured in the instance. In other words, the server will be configured as a standalone DS, changelog will be disabled so the server must connect to another server with a changelog in order to synchronize changes.- Parameters:
replicationPort- The replication port number- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided port number is invalid. This exception can also be thrown if the port is already in use, this verification can be disabled usingcheckPortAvailability(boolean).
-
serverId
Specifies the server ID.If not specified a server ID will be automatically generated.
- Parameters:
serverId- The server ID.- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If the provided serverId is invalid
-
console
Specifies theSetupConsolewhich be used to print information issued during setup.No console will be used by default
- Parameters:
console- The setup console- Returns:
- This
Setupobject
-
withProfiles
Specifies the setup profiles which will be run during the setup.Provided profiles
parametersvalues must have been resolved (with a call toProfile.resolveParameterValues(ExecutionContext, SetupConfiguration, ParameterValuesProvider)) before thesetup()method is used on this object.If this directory server object already contains some profiles with the same name(s) as the provided profiles, they will be replaced by the provided profiles.
- Parameters:
profiles- Thesetup profiles- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If a profile with the same name as one of the provided ones has already been registered to be setup
-
withProfiles
public Setup withProfiles(Collection<Profile> profilesToAdd) throws com.forgerock.opendj.cli.ArgumentException Specifies the setup profiles which will be run during the setup.Provided profiles
parametersvalues must have been resolved (with a call toProfile.resolveParameterValues(ExecutionContext, SetupConfiguration, ParameterValuesProvider)) before thesetup()method is used on this object.If this directory server object already contains some profiles with the same name(s) as the provided profiles, they will be replaced by the provided profiles.
- Parameters:
profilesToAdd- Thesetup profiles- Returns:
- This
Setupobject - Throws:
com.forgerock.opendj.cli.ArgumentException- If a profile with the same name as one of the provided ones has already been registered to be setup
-
clearProfiles
- Returns:
- This
Setupobject
-
enableCloudBackups
Specifies whether the OpenDJ Cloud Backup feature should be enabled. By default, this feature is enabled.- Parameters:
enableCloudBackups-trueif the cloud backup feature should be enabled- Returns:
- This
Setupobject
-
setup
Main method which will setup the server instance.Note that this method must be called only once all parameters have been set.
- Throws:
SetupException- If an error occurs while setting up the server
-
installPath
Description copied from interface:Profile.SetupConfigurationReturns the setup install path.- Specified by:
installPathin interfaceProfile.SetupConfiguration- Returns:
- The setup install
Path
-
instancePath
Description copied from interface:Profile.SetupConfigurationReturns the setup instance path.- Specified by:
instancePathin interfaceProfile.SetupConfiguration- Returns:
- The setup instance
Path
-
keyManagerProviderName
Description copied from interface:Profile.SetupConfigurationReturns the name of the key manager provider configured for the server to setup.- Specified by:
keyManagerProviderNamein interfaceProfile.SetupConfiguration- Returns:
- A string representing the name of the key manager provider configured for the server to setup
-
trustManagerProviderName
Description copied from interface:Profile.SetupConfigurationReturns the name of the trust manager provider configured for the server to setup.- Specified by:
trustManagerProviderNamein interfaceProfile.SetupConfiguration- Returns:
- A string representing the name of the trust manager provider configured for the server to setup
-
getDeploymentId
Returns the deployment ID which will be used for securing the deployment.- Returns:
- The deployment ID which will be used for securing the deployment
-
getReplicationPort
Returns the replication port set for this server ornullifreplicationPort(int)has not been called on this setup object.- Returns:
- An integer representing the replication port set for this server or
nullwhen not set
-