InstallerHelper.java revision 2f6d798e90520dd1b83ac30e53838ae6fd41a150
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License, Version 1.0 only 0N/A * (the "License"). You may not use this file except in compliance 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright 2006-2010 Sun Microsystems, Inc. 0N/A * Portions Copyright 2011-2015 ForgeRock AS * This is the only class that uses classes in org.opends.server (excluding the * case of DynamicConstants, SetupUtils and CertificateManager * which are already included in quicksetup.jar). * Important note: do not include references to this class until OpenDS.jar has * been loaded. These classes must be loaded during Runtime. * The code is written in a way that when we execute the code that uses these * classes the required jar files are already loaded. However these jar files * are not necessarily loaded when we create this class. * @throws ApplicationException if something goes wrong. * java.io.OutputStream, java.io.OutputStream) * Invokes the import-ldif command-line with the provided parameters. * the application that is launching this. * the arguments to be passed to import-ldif. * @return the return code of the import-ldif call. * if the process could not be launched. * @throws InterruptedException * if the process was interrupted. * Returns the LocalizableMessage ID that corresponds to a successfully started server. * @return the LocalizableMessage ID that corresponds to a successfully started server. * This methods enables this server as a Windows service. * @throws ApplicationException if something goes wrong. * This method disables this server as a Windows service. * @throws ApplicationException if something goes worong. // TODO: fix this message's format string * Creates a template LDIF file with an entry that has as dn the provided * @param baseDn the dn of the entry that will be created in the LDIF file. * @return the File object pointing to the created temporary file. * @throws ApplicationException if something goes wrong. * Deletes a backend on the server. * @param ctx the connection to the server. * @param backendName the name of the backend to be deleted. * @param serverDisplay the server display. * @throws ApplicationException if something goes wrong. * Deletes a backend on the server. It assumes the server is stopped. * @param backendName the name of the backend to be deleted. * @throws ApplicationException if something goes wrong. // Read the configuration file. * Creates a local database backend on the server. * @param ctx the connection to the server. * @param backendName the name of the backend to be created. * @param baseDNs the list of base DNs to be defined on the server. * @param serverDisplay the server display. * @throws ApplicationException if something goes wrong. * Sets the base DNs on a given backend. * @param ctx the connection to the server. * @param backendName the name of the backend where the base Dns must be * @param baseDNs the list of base DNs to be defined on the server. * @param serverDisplay the server display. * @throws ApplicationException if something goes wrong. * Configures the replication on a given server. * @param remoteCtx the connection to the server where we want to configure * @param 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). * @param replicationPort the replicationPort of the server that is being * configured (it might not exist and the user specified it in the setup). * @param useSecureReplication whether to encrypt connections with the * replication port or not. * @param serverDisplay the server display. * @param usedReplicationServerIds the list of replication server ids that * @param usedServerIds the list of server ids (domain ids) that * @throws ApplicationException if something goes wrong. * @return a ConfiguredReplication object describing what has been configured. * Configure Synchronization plugin. "Multimaster Synchronization",
* Configure the replication server. // Only mark as true if we actually change the configuration * Configures the replication on a given server. * the connection to the server where we want to configure the * the object describing what was configured. * @throws ApplicationException * if something goes wrong. // Unconfigure Synchronization plugin. * For the given state provided by a Task tells if the task is done or not. * the String representing the task state. * @return <CODE>true</CODE> if the task is done and <CODE>false</CODE> * For the given state provided by a Task tells if the task is successful or * the String representing the task state. * @return <CODE>true</CODE> if the task is successful and <CODE>false</CODE> * For the given state provided by a Task tells if the task is complete with * the String representing the task state. * @return <CODE>true</CODE> if the task is complete with errors and * <CODE>false</CODE> otherwise. * For the given state provided by a Task tells if the task is stopped by * the String representing the task state. * @return <CODE>true</CODE> if the task is stopped by error and * <CODE>false</CODE> otherwise. * Tells whether the provided log message corresponds to a peers not found * error during the initialization of a replica or not. * @return <CODE>true</CODE> if the log message corresponds to a peers not * found error during initialization and <CODE>false</CODE> otherwise. * Returns the ID to be used for a new replication server or domain. * @param usedIds the list of already used ids. * @return the ID to be used for a new replication server or domain. * Returns the name to be used for a new replication domain. * @param existingDomains the existing domains names. * @param newDomainId the new domain replication id. * @param baseDN the base DN of the domain. * @return the name to be used for a new replication domain. * Writes the set-java-home file that is used by the scripts to set the java * home and the java arguments. * the data provided by the user. * where the server is installed. * if an error occurred writing the file. // Try to transform things if necessary. The following map has as key // the original JavaArgument object and as value the 'transformed' JavaArgument. // The argument works, so just use it. // We have to fix it somehow: test separately memory and other // arguments to see if something works. // else, support is already checked. // Apply the following policy: overwrite the values in the file only // if the values provided by the user are not the default ones. * Tries to figure out a new JavaArguments object that works, based on the * provided JavaArguments. It is more efficient to call this method if we are * sure that the provided JavaArguments object does not work. * @param origJavaArguments * the java arguments that does not work. * the java home to be used to test the java arguments. * @return a working JavaArguments object. // Try to figure out a smaller amount of memory. * Writes the set-java-home file that is used by the scripts to set the java * home and the java arguments. Since the set-java-home file is created and * may be changed, it's created under the instancePath. * the install path of the server. * the java home to be used. * a Map containing as key the name of the script and as value, the * java arguments to be set for the script. * other properties that must be set in the file. * if an error occurred writing the file. // Create directory if it doesn't exist yet * Returns the java argument property for a given script. * @return the java argument property for a given script. * 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. Returns <CODE>null</CODE> otherwise. * the message to be parsed. * @return the parsed import message.