Class Setup
- java.lang.Object
-
- org.forgerock.opendj.setup.model.Setup
-
- All Implemented Interfaces:
Profile.SetupConfiguration
public final class Setup extends Object implements Profile.SetupConfiguration
Class used to install a new OpenDJ server instance.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
Fields Modifier and Type Field Description static StringJVM_TRUST_MANAGER_PROVIDERThe name of the JVM trust manager provider provided in the config template.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SetupadminPort(int adminPort)Specifies the administration port of the instance to setup.SetupbootstrapReplicationServers(com.forgerock.opendj.util.HostPort... bootstrapReplicationServers)Specifies the addresses of replication servers to which the server will try to connect at startup time.SetupbootstrapReplicationServers(String... bootstrapReplicationServers)Specifies the addresses of replication servers to which the server will try to connect at startup time.SetupbootstrapReplicationServers(Collection<com.forgerock.opendj.util.HostPort> bootstrapReplicationServers)Specifies the addresses of replication servers to which the server will try to connect at startup time.SetupcheckPortAvailability(boolean checkPortAvailability)Specifies whether the port availability should be verified during the validation phase.SetupclearBootstrapReplicationServers()Removes allbootstrapReplicationServers(HostPort...)bootstrap replication servers} registered in thisSetup.SetupclearProfiles()Setupconsole(SetupConsole console)Specifies theSetupConsolewhich be used to print information issued during setup.SetupdeploymentId(String key, String password)Specifies theDeploymentIdwhich should be used for securing the deployment.SetupdeploymentId(DeploymentId deploymentId)Specifies theDeploymentIdwhich should be used for securing the deployment.SetupdisableHttpConnectionHandler()Disables the HTTP connection handler.SetupdisableHttpSecureConnectionHandler()Disables the HTTPS connection handler.SetupdisableLdapConnectionHandler()Disables the LDAP connection handler.SetupdisableLdapSecureConnectionHandler()Disables the LDAPS connection handler.SetupdisableMonitorUserCreation()Specifies that a monitor user must not be created in the DS server to be setup.SetupenableCloudBackups(boolean enableCloudBackups)Specifies whether the OpenDJ Cloud Backup feature should be enabled.SetupenableStartTls(boolean enableStartTls)Specifies whether start TLS should be enabled on the LDAP connection handler.SetupenableWindowsService(boolean enableWindowsService)Specifies whether the OpenDJ windows service should be enabled.SetupfullyQualifiedHostName(String fullyQualifiedHostName)Specifies the fully qualified hostname of the server to setup.DeploymentIdgetDeploymentId()Returns the deployment ID which will be used for securing the deployment.IntegergetReplicationPort()Returns the replication port set for this server ornullifreplicationPort(int)has not been called on this setup object.SetuphttpPort(int httpPort)Specifies that the http connection handler must be enabled and listening on the provided port.SetuphttpSecurePort(int httpSecurePort)Specifies that the https connection handler must be enabled and listening on the provided port.SetupinstallDirectory(String installDirectory)Specifies the path of the OpenDJ archive to use to setup the server instance.SetupinstallDirectory(Path installPath)Specifies the path of the OpenDJ archive to use to setup the server instance.PathinstallPath()Returns the setup install path.SetupinstanceDirectory(String instanceDirectory)Specifies the path of the OpenDJ instance to setup.SetupinstanceDirectory(Path instancePath)Specifies the path of the opendj instance to setup.PathinstancePath()Returns the setup instance path.StringkeyManagerProviderName()Returns the name of the key manager provider configured for the server to setup.SetupldapPort(int ldapPort)Specifies that the ldap connection handler must be enabled and listening on the provided port.SetupldapPort(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.SetupldapSecurePort(int ldapSecurePort)Specifies that the ldaps connection handler must be enabled and listening on the provided port.SetupmonitorUserDn(String monitorUserDn)Specifies the DN of the monitor user, having access to monitor information.SetupmonitorUserDn(Dn monitorUserDn)Specifies the DN of the monitor user, having access to monitor information.SetupmonitorUserPassword(String monitorUserPassword)Specifies the password of the monitor user.static SetupnewSetup()Creates a newSetupobject to start adding setup parameters.SetupreplicationPort(int replicationPort)Specifies that the instance to setup will be configured with a replication server listening on the provided port number.SetuprootUserDn(String rootUserDn)Specifies the user root distinguish name of the instance to setup.SetuprootUserDn(Dn rootUserDn)Specifies the user root distinguish name of the instance to setup.SetuprootUserPassword(String rootUserPassword)Specifies the user root password of the instance to setup.SetupserverId(String serverId)Specifies the server ID.voidsetup()Main method which will setup the server instance.SetupstartServer(boolean startServer)Specifies whether the server should start during the setup process.StringtrustManagerProviderName()Returns the name of the trust manager provider configured for the server to setup.SetupuseDeploymentIdForTls()Specifies that peer-to-peer communications will be secured with certificates derived from the deployment ID.SetupuseExistingCertificatesForTls(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.SetupwithProfiles(Collection<Profile> profilesToAdd)Specifies the setup profiles which will be run during the setup.SetupwithProfiles(Profile... profiles)Specifies the setup profiles which will be run during the setup.
-
-
-
Field Detail
-
JVM_TRUST_MANAGER_PROVIDER
public static final String JVM_TRUST_MANAGER_PROVIDER
The name of the JVM trust manager provider provided in the config template.- See Also:
- Constant Field Values
-
-
Method Detail
-
newSetup
public static Setup newSetup()
Creates a newSetupobject to start adding setup parameters.- Returns:
- a new
Setupobject to start adding setup parameters.
-
adminPort
public Setup adminPort(int adminPort) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup checkPortAvailability(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
public Setup ldapPort(int ldapPort) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup enableStartTls(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:
ldapPort(int, boolean),ldapPort(int)
-
disableLdapConnectionHandler
public Setup disableLdapConnectionHandler()
Disables the LDAP connection handler.By default, the LDAP connection handler is disabled.
- Returns:
- This
Setup - See Also:
ldapPort(int, boolean)
-
ldapSecurePort
public Setup ldapSecurePort(int ldapSecurePort) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup disableLdapSecureConnectionHandler()
Disables the LDAPS connection handler.By default, the LDAPS connection handler is disabled
- Returns:
- This
Setup - See Also:
ldapSecurePort(int)
-
httpPort
public Setup httpPort(int httpPort) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup disableHttpConnectionHandler()
Disables the HTTP connection handler.By default, the HTTP connection handler is disabled.
- Returns:
- This
Setup - See Also:
httpPort(int)
-
httpSecurePort
public Setup httpSecurePort(int httpSecurePort) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup disableHttpSecureConnectionHandler()
Disables the HTTPS connection handler.By default, the HTTPS connection handler is disabled.
- Returns:
- This
Setup - See Also:
httpSecurePort(int)
-
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
public Setup installDirectory(Path installPath) 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:
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
public Setup instanceDirectory(Path instancePath) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup deploymentId(DeploymentId 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) 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 password- 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:
getDeploymentId()
-
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
public Setup 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
public Setup rootUserDn(String rootUserDn) throws com.forgerock.opendj.cli.ArgumentException
Specifies the user root distinguish name of the instance to setup.By default, "uid=admin" will be used
-
rootUserDn
public Setup rootUserDn(Dn rootUserDn) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup monitorUserDn(Dn monitorUserDn) throws com.forgerock.opendj.cli.ArgumentException
Specifies the DN of the monitor user, having access to monitor information.By default, "uid=Monitor" will be used
-
monitorUserDn
public Setup monitorUserDn(String monitorUserDn) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup disableMonitorUserCreation()
Specifies that a monitor user must not be created in the DS server to be setup.- Returns:
- This
Setupobject
-
startServer
public Setup startServer(boolean 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
public Setup 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
public Setup replicationPort(int replicationPort) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup serverId(String serverId) throws com.forgerock.opendj.cli.ArgumentException
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
public Setup console(SetupConsole 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
public Setup withProfiles(Profile... profiles) 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:
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
-
enableCloudBackups
public Setup enableCloudBackups(boolean 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
public void setup() throws SetupExceptionMain 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
public Path installPath()
Description copied from interface:Profile.SetupConfigurationReturns the setup install path.- Specified by:
installPathin interfaceProfile.SetupConfiguration- Returns:
- The setup install
Path
-
instancePath
public Path instancePath()
Description copied from interface:Profile.SetupConfigurationReturns the setup instance path.- Specified by:
instancePathin interfaceProfile.SetupConfiguration- Returns:
- The setup instance
Path
-
keyManagerProviderName
public String 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
public String 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
public DeploymentId 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
public Integer 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
-
-