public class InstallerHelper extends Object
Constructor and Description |
---|
InstallerHelper() |
Modifier and Type | Method and Description |
---|---|
org.opends.quicksetup.installer.ConfiguredReplication |
configureReplication(InitialLdapContext remoteCtx,
Map<String,Set<String>> replicationServers,
int replicationPort,
boolean useSecureReplication,
String serverDisplay,
Set<Integer> usedReplicationServerIds,
Set<Integer> usedServerIds)
Configures the replication on a given server.
|
void |
createBackend(DirContext ctx,
String backendName,
Set<String> baseDNs,
String serverDisplay,
ManagedObjectDefinition<? extends BackendCfgClient,? extends BackendCfg> backendType)
Creates a database backend on the server.
|
File |
createBaseEntryTempFile(String baseDn)
Creates a template LDIF file with an entry that has as dn the provided
baseDn.
|
void |
deleteBackend(InitialLdapContext ctx,
String backendName,
String serverDisplay)
Deletes a backend on the server.
|
void |
deleteBackend(String backendName)
Deletes a backend on the server.
|
void |
disableWindowsService()
This method disables this server as a Windows service.
|
void |
enableWindowsService()
This methods enables this server as a Windows service.
|
static String |
getDomainName(String[] existingDomains,
int newDomainId,
String baseDN)
Returns the name to be used for a new replication domain.
|
String |
getImportProgressMessage(String msg)
If the log message is of type "[03/Apr/2008:21:25:43 +0200] category=JEB
severity=NOTICE msgID=8847454 Processed 1 entries, imported 0, skipped 1,
rejected 0 and migrated 0 in 1 seconds (average rate 0.0/sec)" returns the
message part.
|
static int |
getReplicationId(Set<Integer> usedIds)
Returns the ID to be used for a new replication server or domain.
|
String |
getStartedId()
Returns the LocalizableMessage ID that corresponds to a successfully started server.
|
int |
invokeConfigureServer(String[] args)
Invokes the method ConfigureDS.configMain with the provided parameters.
|
int |
invokeImportLDIF(Application application,
String[] args)
Invokes the import-ldif command-line with the provided parameters.
|
boolean |
isCompletedWithErrors(String sState)
For the given state provided by a Task tells if the task is complete with
errors or not.
|
boolean |
isDone(String sState)
For the given state provided by a Task tells if the task is done or not.
|
boolean |
isPeersNotFoundError(String logMsg)
Tells whether the provided log message corresponds to a peers not found
error during the initialization of a replica or not.
|
boolean |
isStoppedByError(String sState)
For the given state provided by a Task tells if the task is stopped by
error or not.
|
boolean |
isSuccessful(String sState)
For the given state provided by a Task tells if the task is successful or
not.
|
void |
setBaseDns(InitialLdapContext ctx,
String backendName,
Set<String> baseDNs,
String serverDisplay)
Sets the base DNs on a given backend.
|
void |
unconfigureReplication(InitialLdapContext remoteCtx,
org.opends.quicksetup.installer.ConfiguredReplication replConf,
String serverDisplay)
Configures the replication on a given server.
|
void |
writeSetOpenDSJavaHome(UserData uData,
String installPath)
Writes the set-java-home file that is used by the scripts to set the java
home and the java arguments.
|
public InstallerHelper()
public int invokeConfigureServer(String[] args) throws ApplicationException
args
- the arguments to be passed to ConfigureDS.configMain.ApplicationException
- if something goes wrong.ConfigureDS.configMain(String[],
java.io.OutputStream, java.io.OutputStream)
public int invokeImportLDIF(Application application, String[] args) throws IOException, InterruptedException
application
- the application that is launching this.args
- the arguments to be passed to import-ldif.IOException
- if the process could not be launched.InterruptedException
- if the process was interrupted.public String getStartedId()
public void enableWindowsService() throws ApplicationException
ApplicationException
- if something goes wrong.public void disableWindowsService() throws ApplicationException
ApplicationException
- if something goes worong.public File createBaseEntryTempFile(String baseDn) throws ApplicationException
baseDn
- the dn of the entry that will be created in the LDIF file.ApplicationException
- if something goes wrong.public void deleteBackend(InitialLdapContext ctx, String backendName, String serverDisplay) throws ApplicationException
ctx
- the connection to the server.backendName
- the name of the backend to be deleted.serverDisplay
- the server display.ApplicationException
- if something goes wrong.public void deleteBackend(String backendName) throws ApplicationException
backendName
- the name of the backend to be deleted.ApplicationException
- if something goes wrong.public void createBackend(DirContext ctx, String backendName, Set<String> baseDNs, String serverDisplay, ManagedObjectDefinition<? extends BackendCfgClient,? extends BackendCfg> backendType) throws ApplicationException
ctx
- the connection to the server.backendName
- the name of the backend to be created.baseDNs
- the list of base DNs to be defined on the server.serverDisplay
- the server display.backendType
- the backend type.ApplicationException
- if something goes wrong.public void setBaseDns(InitialLdapContext ctx, String backendName, Set<String> baseDNs, String serverDisplay) throws ApplicationException
ctx
- the connection to the server.backendName
- the name of the backend where the base Dns must be
defined.baseDNs
- the list of base DNs to be defined on the server.serverDisplay
- the server display.ApplicationException
- if something goes wrong.public org.opends.quicksetup.installer.ConfiguredReplication configureReplication(InitialLdapContext remoteCtx, Map<String,Set<String>> replicationServers, int replicationPort, boolean useSecureReplication, String serverDisplay, Set<Integer> usedReplicationServerIds, Set<Integer> usedServerIds) throws ApplicationException
remoteCtx
- the connection to the server where we want to configure
the replication.replicationServers
- a Map where the key value is the base dn and
the value is the list of replication servers for that base dn (or domain).replicationPort
- the replicationPort of the server that is being
configured (it might not exist and the user specified it in the setup).useSecureReplication
- whether to encrypt connections with the
replication port or not.serverDisplay
- the server display.usedReplicationServerIds
- the list of replication server ids that
are already used.usedServerIds
- the list of server ids (domain ids) that
are already used.ApplicationException
- if something goes wrong.public void unconfigureReplication(InitialLdapContext remoteCtx, org.opends.quicksetup.installer.ConfiguredReplication replConf, String serverDisplay) throws ApplicationException
remoteCtx
- the connection to the server where we want to configure the
replication.replConf
- the object describing what was configured.serverDisplay
- the server display.ApplicationException
- if something goes wrong.public boolean isDone(String sState)
sState
- the String representing the task state.true
if the task is done and false
otherwise.public boolean isSuccessful(String sState)
sState
- the String representing the task state.true
if the task is successful and false
otherwise.public boolean isCompletedWithErrors(String sState)
sState
- the String representing the task state.true
if the task is complete with errors and
false
otherwise.public boolean isStoppedByError(String sState)
sState
- the String representing the task state.true
if the task is stopped by error and
false
otherwise.public boolean isPeersNotFoundError(String logMsg)
logMsg
- the log message.true
if the log message corresponds to a peers not
found error during initialization and false
otherwise.public static int getReplicationId(Set<Integer> usedIds)
usedIds
- the list of already used ids.public static String getDomainName(String[] existingDomains, int newDomainId, String baseDN)
existingDomains
- the existing domains names.newDomainId
- the new domain replication id.baseDN
- the base DN of the domain.public void writeSetOpenDSJavaHome(UserData uData, String installPath) throws IOException
uData
- the data provided by the user.installPath
- where the server is installed.IOException
- if an error occurred writing the file.public String getImportProgressMessage(String msg)
null
otherwise.msg
- the message to be parsed.Copyright © 2010-2016 ForgeRock AS. All Rights Reserved.