OfflineInstaller.java revision cf364c082dfe5ea566abc3c20bc5546a4629c5eb
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2014 ForgeRock AS
*/
/**
* This is an implementation of the Installer class that is used to install
* the Directory Server from a zip file. The installer assumes that the zip
* file contents have been unzipped.
*
* It just takes a UserData object and based on that installs OpenDS.
*
* When there is an update during the installation it will notify the
* ProgressUpdateListener objects that have been added to it. The notification
* will send a ProgressUpdateEvent.
*
* This class is supposed to be fully independent of the graphical layout.
*
*/
public class OfflineInstaller extends Installer
{
/* This map contains the ratio associated with each step */
/* This map contains the summary associated with each step */
private ApplicationException runError;
/**
* Actually performs the install in this thread. The thread is blocked.
*
*/
public void run()
{
try
{
initMaps();
checkAbort();
checkAbort();
// create license accepted file
checkAbort() ;
createData();
checkAbort();
{
if (isVerbose())
{
}
checkAbort();
}
if (mustStart())
{
if (isStartVerbose())
{
}
if (!isStartVerbose())
{
pointAdder.start();
}
try
{
}
finally
{
if (!isStartVerbose())
{
pointAdder.stop();
}
}
if (!isStartVerbose())
{
}
else
{
}
checkAbort();
}
if (mustCreateAds())
{
if (isVerbose())
{
}
updateADS();
checkAbort();
}
if (mustConfigureReplication())
{
if (isVerbose())
{
}
checkAbort();
}
if (mustInitializeSuffixes())
{
if (isVerbose())
{
}
checkAbort();
}
if (mustStop())
{
if (isVerbose())
{
}
if (!isVerbose())
{
}
if (!isVerbose())
{
}
}
checkAbort();
} catch (ApplicationException ex)
{
uninstall();
} else {
// Stop the server if necessary
try {
if (!isVerbose())
{
}
if (!isVerbose())
{
}
} catch (Throwable t) {
}
}
}
}
catch (Throwable t)
{
// Stop the server if necessary
try {
if (!isVerbose())
{
}
if (!isVerbose())
{
}
}
}
}
finally
{
}
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Returns the exception from the run() method, if any.
* @return the ApplicationException raised during the run() method, if any.
* null otherwise.
*/
public ApplicationException getRunError()
{
return runError;
}
/**
* Called when the user elects to cancel this operation.
*/
protected void uninstall() {
if (!isVerbose())
{
}
else
{
}
// Stop the server if necessary
try {
if (!isVerbose())
{
}
if (!isVerbose())
{
}
} catch (ApplicationException e) {
}
}
// Revert to the base configuration
try {
/*overwrite=*/true);
} catch (ApplicationException ae) {
}
// Cleanup SSL if necessary
sec.getCertificateType())) {
try {
} catch (KeyStoreException e) {
}
}
"keystore");
try {
} catch (ApplicationException e) {
}
}
"keystore.pin");
if (keystorePin.exists()) {
try {
} catch (ApplicationException e) {
}
}
"truststore");
if (truststore.exists()) {
try {
} catch (ApplicationException e) {
}
}
}
// Remove the databases
try {
} catch (ApplicationException e) {
}
if (!isVerbose())
{
}
}
/**
* Initialize the different map used in this class.
*
*/
protected void initMaps()
{
initSummaryMap(hmSummary, true);
/*
* hmTime contains the relative time that takes for each task to be
* accomplished. For instance if downloading takes twice the time of
* extracting, the value for downloading will be the double of the value for
* extracting.
*/
int totalTime = 0;
new ArrayList<InstallProgressStep>();
if (createNotReplicatedSuffix())
{
{
case CREATE_BASE_ENTRY:
break;
case IMPORT_FROM_LDIF_FILE:
break;
break;
}
}
{
}
if (mustStart())
{
}
if (mustCreateAds())
{
}
if (mustConfigureReplication())
{
}
if (mustInitializeSuffixes())
{
}
if (mustStop())
{
}
int cumulatedTime = 0;
for (InstallProgressStep s : steps)
{
if (statusTime != null)
{
}
}
}
/**
* {@inheritDoc}
*/
public String getInstallationPath()
{
return Utils.getInstallPathFromClasspath();
}
/**
* {@inheritDoc}
*/
public String getInstancePath()
{
}
}