From 2e08d2c0e9bede644be993ddaa28157c9f156c10 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Tue, 07 May 2013 13:50:59 +0000
Subject: [PATCH] svn merge https://svn.forgerock.org/opendj/trunk/opends@8851 https://svn.forgerock.org/opendj/branches/native-packaging@8851 .
---
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java | 22
opends/src/server/org/opends/server/tools/upgrade/FileManager.java | 606 +++
opends/src/quicksetup/org/opends/quicksetup/webstart/package-info.java | 4
opends/src/quicksetup/org/opends/quicksetup/installer/ui/GlobalAdministratorPanel.java | 3
opends/resource/bin/_mixed-script.sh | 6
opends/src/messages/messages/quicksetup_fr.properties | 19
opends/src/quicksetup/org/opends/quicksetup/JavaArguments.java | 8
opends/src/quicksetup/org/opends/quicksetup/ui/ProgressDialog.java | 17
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java | 45
opends/src/server/org/opends/server/tools/ImportLDIF.java | 14
opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java | 864 ++++
opends/src/quicksetup/org/opends/quicksetup/event/package-info.java | 3
opends/pom.xml | 4
opends/src/quicksetup/org/opends/quicksetup/images/package-info.java | 3
opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java | 7
opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java | 99
opends/resource/config/buildinfo | 1
opends/resource/bin/_script-util.sh | 49
opends/src/messages/messages/quicksetup_ko.properties | 18
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java | 22
opends/src/server/org/opends/server/tools/ToolConstants.java | 22
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java | 21
opends/src/quicksetup/org/opends/quicksetup/Installation.java | 988 ++--
opends/src/server/org/opends/server/tools/CreateRCScript.java | 15
opends/src/server/org/opends/server/tools/upgrade/UpgradeTask.java | 120
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 8
opends/src/quicksetup/org/opends/quicksetup/util/package-info.java | 3
opends/src/server/org/opends/server/tools/upgrade/Upgrade.java | 632 +++
opends/resource/upgrade | 130
opends/src/quicksetup/org/opends/quicksetup/Launcher.java | 21
opends/resource/bin/start-ds | 2
opends/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java | 15
opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java | 23
opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java | 13
opends/resource/bin/control-panel | 12
opends/src/quicksetup/org/opends/quicksetup/ReturnCode.java | 8
opends/src/server/org/opends/server/tools/upgrade/Installation.java | 166
opends/src/server/org/opends/server/util/BuildVersion.java | 318 +
opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java | 65
opends/src/quicksetup/org/opends/quicksetup/Status.java | 41
opends/resource/debian/control/control | 14
opends/src/server/org/opends/server/loggers/AsynchronousTextWriter.java | 11
opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java | 25
opends/src/server/org/opends/server/tools/ExportLDIF.java | 14
opends/src/server/org/opends/server/loggers/TextHTTPAccessLogPublisher.java | 24
opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java | 5
opends/resource/bin/make-ldif | 5
opends/src/messages/messages/quicksetup_es.properties | 19
opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 18
opends/resource/bin/dsjavaproperties.bat | 3
opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java | 16
opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java | 26
opends/resource/debian/control/prerm | 9
opends/src/server/org/opends/server/tools/upgrade/UpgradeContext.java | 304 +
opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java | 32
opends/src/quicksetup/org/opends/quicksetup/UserData.java | 55
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 60
opends/src/messages/messages/quicksetup_de.properties | 12
opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java | 26
opends/resource/bin/dsjavaproperties | 5
opends/build.xml | 182
opends/resource/debian/control/postrm | 20
opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java | 30
opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java | 5
opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java | 229 +
opends/src/server/org/opends/server/util/cli/ConsoleApplication.java | 940 +++-
opends/src/build-tools/org/opends/build/tools/GenerateRpm.java | 385 +
opends/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java | 4
opends/src/quicksetup/org/opends/quicksetup/installer/ui/RuntimeOptionsPanel.java | 31
opends/src/quicksetup/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java | 10
opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java | 32
opends/ext/ant/lib/jdeb-0.10.jar | 0
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java | 39
opends/src/messages/messages/utility.properties | 2
opends/src/server/org/opends/server/tools/RebuildIndex.java | 18
opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java | 12
opends/src/server/org/opends/server/tools/upgrade/UpgradeCli.java | 595 +++
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java | 81
opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java | 6
opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java | 31
opends/src/server/org/opends/server/tools/upgrade/ProgressNotificationCallback.java | 99
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java | 78
opends/src/quicksetup/org/opends/quicksetup/Constants.java | 20
opends/resource/bin/_script-util.bat | 38
opends/src/server/org/opends/server/tools/InstallDS.java | 137
opends/src/quicksetup/org/opends/quicksetup/installer/NewSuffixOptions.java | 7
opends/src/quicksetup/org/opends/quicksetup/util/UIKeyStore.java | 33
opends/src/server/org/opends/server/tools/BackUpDB.java | 19
opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java | 14
opends/src/build-tools/org/opends/build/tools/CreateVersionString.java | 35
opends/src/messages/messages/quicksetup_ja.properties | 19
opends/src/quicksetup/org/opends/quicksetup/installer/DataReplicationOptions.java | 5
opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java | 45
opends/tests/unit-tests-testng/src/server/org/opends/server/tools/UpgradeTestCase.java | 109
opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java | 11
opends/src/server/org/opends/server/tools/upgrade/UpgradeLog.java | 107
opends/src/quicksetup/org/opends/quicksetup/Application.java | 159
opends/src/server/org/opends/server/tools/upgrade/FormattedNotificationCallback.java | 89
opends/src/server/org/opends/server/tools/upgrade/package-info.java | 14
opends/resource/bin/_client-script.sh | 7
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 127
opends/src/server/org/opends/server/tools/ManageTasks.java | 17
opends/src/messages/messages/quicksetup_pl.properties | 3
opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java | 54
opends/src/server/org/opends/server/tools/upgrade/VerificationCallback.java | 113
opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java | 23
opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java | 10
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java | 169
opends/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java | 805 ++++
opends/resource/debian/control/postinst | 6
opends/resource/upgrade.bat | 65
opends/src/messages/messages/quicksetup_zh_TW.properties | 18
opends/src/messages/messages/quicksetup_zh_CN.properties | 19
opends/src/messages/messages/quicksetup.properties | 39
opends/src/messages/messages/tools.properties | 96
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallLicensePanel.java | 4
opends/src/server/org/opends/server/tools/RestoreDB.java | 14
opends/src/quicksetup/org/opends/quicksetup/Configuration.java | 70
opends/src/server/org/opends/server/tools/status/StatusCli.java | 13
opends/src/server/org/opends/server/core/DirectoryServer.java | 14
/dev/null | 31
opends/resource/debian/control/preinst | 6
opends/src/server/org/opends/server/tools/VerifyIndex.java | 19
opends/src/quicksetup/org/opends/quicksetup/package-info.java | 3
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java | 308 -
opends/src/server/org/opends/server/tools/DBTest.java | 22
opends/src/server/org/opends/server/tools/ListBackends.java | 13
opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java | 14
128 files changed, 7,510 insertions(+), 3,402 deletions(-)
diff --git a/opends/build.xml b/opends/build.xml
index 0b03924..fca91b0 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -24,6 +24,7 @@
!
! Copyright 2006-2010 Sun Microsystems, Inc.
! Portions Copyright 2011-2013 ForgeRock AS
+ ! Portions Copyright 2012 Delta Victor Consultants
! -->
<project name="Directory Server" basedir="." default="package"
@@ -433,6 +434,9 @@
<delete dir="${build.dir}" />
<delete file="${dynconstants.file}" />
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
</target>
@@ -782,11 +786,11 @@
<fileset dir="${quicksetup.src.dir}"
includes="**/*.properties, **/*.gif, **/*.png" />
</copy>
- <mkdir dir="${quicksetup.classes.dir}/messages" />
- <copy todir="${quicksetup.classes.dir}/messages">
- <fileset dir="${msg.prop.dir}"
- includes="**/quicksetup.properties" />
- </copy>
+ <mkdir dir="${quicksetup.classes.dir}/messages" />
+ <copy todir="${quicksetup.classes.dir}/messages">
+ <fileset dir="${msg.prop.dir}"
+ includes="**/quicksetup.properties" />
+ </copy>
</target>
@@ -1011,11 +1015,6 @@
<mkdir dir="${pdir}/bin" />
<mkdir dir="${pdir}/classes" />
<mkdir dir="${pdir}/config" />
- <mkdir dir="${pdir}/config/upgrade" />
- <mkdir dir="${pdir}/config/schema" />
- <mkdir dir="${pdir}/config/messages" />
- <mkdir dir="${pdir}/config/MakeLDIF" />
- <mkdir dir="${pdir}/config/snmp/security" />
<mkdir dir="${pdir}/db" />
<mkdir dir="${pdir}/import-tmp" />
<mkdir dir="${pdir}/changelogDb" />
@@ -1025,11 +1024,17 @@
<mkdir dir="${pdir}/lib/extensions" />
<mkdir dir="${pdir}/locks" />
<mkdir dir="${pdir}/logs" />
- <mkdir dir="${pdir}/bin/ControlPanel.app" />
- <mkdir dir="${pdir}/bin/ControlPanel.app/Contents" />
- <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/MacOS" />
- <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources" />
- <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources/Java" />
+ <mkdir dir="${pdir}/template" />
+ <mkdir dir="${pdir}/template/config" />
+ <mkdir dir="${pdir}/template/config/schema" />
+ <mkdir dir="${pdir}/template/config/messages" />
+ <mkdir dir="${pdir}/template/config/MakeLDIF" />
+ <mkdir dir="${pdir}/template/config/upgrade" />
+ <mkdir dir="${pdir}/bin/ControlPanel.app" />
+ <mkdir dir="${pdir}/bin/ControlPanel.app/Contents" />
+ <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/MacOS" />
+ <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources" />
+ <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources/Java"/>
<mkdir dir="${pdir}/QuickSetup.app" />
<mkdir dir="${pdir}/QuickSetup.app/Contents" />
<mkdir dir="${pdir}/QuickSetup.app/Contents/MacOS" />
@@ -1126,18 +1131,15 @@
<fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bat" excludes="_client-script.bat,_server-script.bat,_mixed-script.bat,_script-util.bat,setcp.bat" includes="*.bat" eol="crlf" />
<fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/lib" includes="_client-script.bat,_server-script.bat,_mixed-script.bat,_script-util.bat,setcp.bat" eol="crlf" />
- <copy todir="${pdir}/config">
+ <copy todir="${pdir}/template/config">
<fileset file="${config.dir}/*" />
</copy>
<antcall target="package-snmp" />
-
- <copy file="${pdir}/config/config.ldif"
- tofile="${pdir}/config/upgrade/config.ldif.${REVISION_NUMBER}" />
-
+
<!-- Create buildinfo files -->
<echo message="${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}.${REVISION_NUMBER}"
- file="${pdir}/config/buildinfo" />
+ file="${pdir}/template/config/buildinfo" />
<taskdef name="concatschema"
classname="org.opends.build.tools.ConcatSchema">
@@ -1149,17 +1151,17 @@
</taskdef>
<concatschema schemaDirectory="${resource.dir}/schema"
- toFile="${pdir}/config/upgrade/schema.ldif.${REVISION_NUMBER}" />
+ toFile="${pdir}/template/config/upgrade/schema.ldif.${REVISION_NUMBER}" />
- <copy todir="${pdir}/config/schema">
+ <copy todir="${pdir}/template/config/schema">
<fileset dir="${resource.dir}/schema" />
</copy>
- <copy todir="${pdir}/config/messages">
+ <copy todir="${pdir}/template/config/messages">
<fileset dir="${resource.dir}/messages" />
</copy>
- <copy todir="${pdir}/config/MakeLDIF">
+ <copy todir="${pdir}/template/config/MakeLDIF">
<fileset dir="${resource.dir}/MakeLDIF" />
</copy>
@@ -1234,6 +1236,9 @@
</fileset>
</path>
</foreach>
+ <chmod perm="444">
+ <fileset dir="${pdir}/template" />
+ </chmod>
</target>
@@ -1259,21 +1264,21 @@
<target name="package" depends="prepackage"
description="Package the Directory Server for distribution.">
<zip destfile="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}.zip">
- <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}"
- filemode="644" dirmode="700" />
- <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/**/*"
- excludes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/*,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
- filemode="644" dirmode="755" />
- <zipfileset dir="${package.dir}"
- includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh"
- filemode="755" dirmode="755" />
- <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/*"
- excludes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt"
- filemode="755" dirmode="755" />
- <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt"
- filemode="644" dirmode="755" />
- <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
- filemode="755" dirmode="755" />
+ <zipfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="**/*"
+ excludes="bin/*,template/**/*,lib/_client-script.sh,lib/_script-util.sh,lib/_server-script.sh,lib/_mixed-script.sh,setup,uninstall,upgrade,QuickSetup.app/Contents/MacOS/JavaApplicationStub,Uninstall.app/Contents/MacOS/JavaApplicationStub,bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
+ filemode="644" dirmode="755" prefix="opendj" />
+ <zipfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"
+ includes="lib/_client-script.sh,lib/_script-util.sh,lib/_server-script.sh,lib/_mixed-script.sh"
+ filemode="755" dirmode="755" prefix="opendj" />
+ <zipfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="bin/*"
+ excludes="bin/README_WINDOWS.txt"
+ filemode="755" dirmode="755" prefix="opendj" />
+ <zipfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="bin/README_WINDOWS.txt"
+ filemode="644" dirmode="755" prefix="opendj" />
+ <zipfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="setup,uninstall,upgrade,QuickSetup.app/Contents/MacOS/JavaApplicationStub,Uninstall.app/Contents/MacOS/JavaApplicationStub,bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
+ filemode="755" dirmode="755" prefix="opendj" />
+ <zipfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="template/**/*"
+ filemode="444" dirmode="744" prefix="opendj" />
</zip>
<property name="package.built" value="true"/>
@@ -1298,10 +1303,10 @@
<getversionnumber property="VERSION_NUMBER_STRING" />
- <property name="prefix" value="/opt/opends"/>
- <property name="release" value="0"/>
+ <property name="prefix" value="/opt/opendj"/>
+ <property name="release" value="2"/>
<taskdef name="genrpm"
- classname="org.opends.build.tools.GenerateRpm">
+ classname="org.opends.build.tools.GenerateRpm">
<classpath>
<fileset dir="${build.dir}/build-tools">
<include name="*.jar" />
@@ -1309,32 +1314,29 @@
</classpath>
</taskdef>
- <mkdir dir="${build.dir}/rpm/noarch" />
- <mkdir dir="${build.dir}/rpm/i486" />
- <mkdir dir="${build.dir}/rpm/i586" />
- <mkdir dir="${build.dir}/rpm/i686" />
<mkdir dir="${build.dir}/rpm/BUILD" />
<mkdir dir="${build.dir}/rpm/RPMS" />
- <mkdir dir="${build.dir}/rpm/SOURCES/${prefix}" />
- <mkdir dir="${build.dir}/rpm/i386" />
+ <mkdir dir="${build.dir}/rpm/SOURCES" />
<mkdir dir="${build.dir}/rpm/SPECS" />
<mkdir dir="${build.dir}/rpm/SRPMS" />
<genrpm
topDir="${build.dir}/rpm"
prefix="${prefix}"
+ productName="${PRODUCT_NAME}"
+ shortName="${SHORT_NAME}"
+ referenceURL="${DOC_REFERENCE_HOME}"
sourceDirName="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"
specFileName="${build.dir}/rpm/SPECS/specFile"
version="${VERSION_NUMBER_STRING}"
release="${release}"
- overwrite="true">
+ overwrite="true">
</genrpm>
- <rpm
- specfile="specFile"
- topdir="${build.dir}/rpm"
- quiet="true"
- />
+ <rpm specfile="specFile"
+ topdir="${build.dir}/rpm"
+ quiet="true">
+ </rpm>
<copy todir="${package.dir}">
<fileset dir="${build.dir}/rpm/RPMS/noarch">
@@ -1342,10 +1344,69 @@
</fileset>
</copy>
- <delete dir="${build.dir}/rpm"/>
</target>
+ <!-- Package the Directory Server for the DEB distribution. -->
+ <target name="package-DEB"
+ description="Package the Directory Server for DEB distribution.">
+ <taskdef name="getversionnumber"
+ classname="org.opends.build.tools.CreateVersionString">
+ <classpath>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+ <getversionnumber property="VERSION_NUMBER_STRING" />
+
+ <property name="prefix" value="/opt/opendj"/>
+ <property name="release" value="0"/>
+
+ <mkdir dir="${build.dir}/deb/control" />
+
+ <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask"/>
+
+ <copy todir="${build.dir}/deb/control">
+ <fileset dir="resource/debian/control"/>
+ <filterset begintoken="[[" endtoken="]]">
+ <filter token="version" value="${VERSION_NUMBER_STRING}"/>
+ <filter token="name" value="${SHORT_NAME}"/>
+ <filter token="homepage" value="${DOC_REFERENCE_HOME}"/>
+ <filter token="maintainer" value="opendj@forgerock.org"/>
+ <filter token="description" value="${PRODUCT_NAME}"/>
+ </filterset>
+ </copy>
+
+ <!-- Debian files for preinst/postinstall/preuninstall/postuninstall -->
+
+ <copy file="resource/debian/control/preinst" tofile="${build.dir}/deb/control" />
+ <copy file="resource/debian/control/postinst" tofile="${build.dir}/deb/control" />
+ <copy file="resource/debian/control/prerm" tofile="${build.dir}/deb/control" />
+ <copy file="resource/debian/control/postrm" tofile="${build.dir}/deb/control" />
+
+ <replace dir="${build.dir}/deb/control/" token="@prefix@" value="${prefix}" />
+
+ <deb destfile="${package.dir}/${SHORT_NAME}_${VERSION_NUMBER_STRING}-${release}_all.deb"
+ control="${build.dir}/deb/control">
+ <tarfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"
+ includes="**/*"
+ excludes="bin/*,template/**/*,lib/_client-script.sh,lib/_script-util.sh,lib/_server-script.sh,lib/_mixed-script.sh,setup,uninstall,upgrade,QuickSetup.app/Contents/MacOS/JavaApplicationStub,Uninstall.app/Contents/MacOS/JavaApplicationStub,bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
+ prefix="${prefix}" filemode="644" dirmode="755" />
+ <tarfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"
+ includes="lib/_client-script.sh,lib/_script-util.sh,lib/_server-script.sh,lib/_mixed-script.sh"
+ prefix="${prefix}" filemode="755" dirmode="755" />
+ <tarfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="bin/*"
+ excludes="bin/README_WINDOWS.txt"
+ prefix="${prefix}" filemode="755" dirmode="755" />
+ <tarfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="bin/README_WINDOWS.txt"
+ prefix="${prefix}" filemode="644" dirmode="755" />
+ <tarfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="setup,uninstall,upgrade,QuickSetup.app/Contents/MacOS/JavaApplicationStub,Uninstall.app/Contents/MacOS/JavaApplicationStub,bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub"
+ prefix="${prefix}" filemode="755" dirmode="755" />
+ <tarfileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" includes="template/**/*"
+ prefix="${prefix}" filemode="444" dirmode="744" />
+ </deb>
+ </target>
<!-- Prepare the Directory Server DSML library. -->
<target name="predsml" depends="prepackage"
@@ -2553,16 +2614,16 @@
<property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
<mkdir dir="${pdir}/lib/extensions" />
<mkdir dir="${pdir}/snmp/mib"/>
- <mkdir dir="${pdir}/config/snmp/security" />
+ <mkdir dir="${pdir}/template/config/snmp/security" />
<!-- Copy security template files -->
- <copy todir="${pdir}/config/snmp/security">
+ <copy todir="${pdir}/template/config/snmp/security">
<fileset dir="${snmp.security.dir}"/>
</copy>
<!-- Copy the mib -->
<copy todir="${pdir}/snmp/mib" file="${snmp.mib.dir}/rfc2605.txt"/>
<!-- Update the config.ldif file with snmp config -->
- <concat destfile="${pdir}/config/config.ldif" append="true">
+ <concat destfile="${pdir}/template/config/config.ldif" append="true">
<filelist dir="${snmp.config.dir}" files="config.snmp.ldif"/>
</concat>
@@ -2654,8 +2715,7 @@
<target name="clean-ivy-cache" depends="install-ivy" description="--> clean the ivy cache">
<ivy:cleancache/>
- </target>
-
+ </target>
<import file="build-svr4.xml"/>
<import file="build-pkg.xml"/>
diff --git a/opends/ext/ant/lib/jdeb-0.10.jar b/opends/ext/ant/lib/jdeb-0.10.jar
new file mode 100644
index 0000000..39eaf00
--- /dev/null
+++ b/opends/ext/ant/lib/jdeb-0.10.jar
Binary files differ
diff --git a/opends/pom.xml b/opends/pom.xml
index 57ac82d..c0f5f28 100644
--- a/opends/pom.xml
+++ b/opends/pom.xml
@@ -22,7 +22,7 @@
!
! CDDL HEADER END
!
- ! Copyright 2011-2012 ForgeRock AS
+ ! Copyright 2011-2013 ForgeRock AS
!
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -69,7 +69,7 @@
</notifier>
</notifiers>
</ciManagement>
-
+
<repositories>
<repository>
<id>forgerock-staging-repository</id>
diff --git a/opends/resource/bin/_client-script.sh b/opends/resource/bin/_client-script.sh
index 174aa12..4923429 100755
--- a/opends/resource/bin/_client-script.sh
+++ b/opends/resource/bin/_client-script.sh
@@ -24,7 +24,7 @@
#
#
# Copyright 2006-2010 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
+# Portions Copyright 2011-2013 ForgeRock AS
# This script is used to invoke various client-side processes. It should not
@@ -54,11 +54,6 @@
# Set environment variables
SCRIPT_UTIL_CMD=set-full-environment
export SCRIPT_UTIL_CMD
-if [ -z "$NO_CHECK" ]
-then
- NO_CHECK=1
- export NO_CHECK
-fi
. "${INSTALL_ROOT}/lib/_script-util.sh"
RETURN_CODE=$?
if test ${RETURN_CODE} -ne 0
diff --git a/opends/resource/bin/_mixed-script.sh b/opends/resource/bin/_mixed-script.sh
index fc49f7f..b25d666 100644
--- a/opends/resource/bin/_mixed-script.sh
+++ b/opends/resource/bin/_mixed-script.sh
@@ -24,7 +24,7 @@
#
#
# Copyright 2008-2010 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
+# Portions Copyright 2011-2013 ForgeRock AS
# This script is used to invoke processes that might be run on server or
@@ -64,8 +64,6 @@
# Set environment variables
SCRIPT_UTIL_CMD=set-full-environment
export SCRIPT_UTIL_CMD
-NO_CHECK=1
-export NO_CHECK
. "${INSTALL_ROOT}/lib/_script-util.sh"
RETURN_CODE=$?
if test ${RETURN_CODE} -ne 0
@@ -95,8 +93,6 @@
# Set the environment to use the offline properties
SCRIPT_NAME=${OLD_SCRIPT_NAME}.offline
export SCRIPT_NAME
- NO_CHECK=0
- export NO_CHECK
. "${INSTALL_ROOT}/lib/_script-util.sh"
RETURN_CODE=$?
if test ${RETURN_CODE} -ne 0
diff --git a/opends/resource/bin/_script-util.bat b/opends/resource/bin/_script-util.bat
index e5a8835..b46ce54 100644
--- a/opends/resource/bin/_script-util.bat
+++ b/opends/resource/bin/_script-util.bat
@@ -23,7 +23,7 @@
rem
rem
rem Copyright 2008-2010 Sun Microsystems, Inc.
-rem Portions Copyright 2011-2012 ForgeRock AS
+rem Portions Copyright 2011-2013 ForgeRock AS
set SET_JAVA_HOME_AND_ARGS_DONE=false
set SET_ENVIRONMENT_VARS_DONE=false
@@ -38,7 +38,7 @@
if "%SCRIPT_UTIL_CMD%" == "set_environment_vars" goto setEnvironmentVars
if "%SCRIPT_UTIL_CMD%" == "test-java" goto testJava
if "%SCRIPT_UTIL_CMD%" == "set-classpath" goto setClassPath
-goto prepareCheck
+goto end
:setInstanceRoot
setlocal
@@ -57,7 +57,7 @@
:setClassPath
-if "%SET_CLASSPATH_DONE%" == "true" goto prepareCheck
+if "%SET_CLASSPATH_DONE%" == "true" goto end
FOR %%x in ("%INSTALL_ROOT%\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
if "%INSTALL_ROOT%" == "%INSTANCE_ROOT%"goto setClassPathDone
FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
@@ -71,7 +71,7 @@
if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "false" goto setJavaHomeAndArgs
if "%SET_CLASSPATH_DONE%" == "false" goto setClassPath
if "%SET_ENVIRONMENT_VARS_DONE%" == "false" goto setEnvironmentVars
-goto prepareCheck
+goto end
:setFullEnvironmentAndTestJava
if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "false" goto setJavaHomeAndArgs
@@ -81,7 +81,7 @@
:setJavaHomeAndArgs
-if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto prepareCheck
+if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto end
if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto checkEnvJavaHome
call "%INSTANCE_ROOT%\lib\set-java-home.bat"
if "%OPENDJ_JAVA_BIN%" == "" goto checkEnvJavaHome
@@ -148,7 +148,7 @@
exit /B 1
:setEnvironmentVars
-if %SET_ENVIRONMENT_VARS_DONE% == "true" goto prepareCheck
+if %SET_ENVIRONMENT_VARS_DONE% == "true" goto end
set PATH=%SystemRoot%;%PATH%
set SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=%SCRIPT_NAME%
set SET_ENVIRONMENT_VARS_DONE=true
@@ -161,7 +161,7 @@
set RESULT_CODE=%errorlevel%
if %RESULT_CODE% == 13 goto notSupportedJavaHome
if not %RESULT_CODE% == 0 goto noValidJavaHome
-goto prepareCheck
+goto end
:checkLegacyArgs
if "%OPENDS_JAVA_ARGS%" == "" goto continueTestJava
@@ -213,29 +213,5 @@
pause
exit /B 1
-:isVersionOrHelp
-if [%1] == [] goto check
-if [%1] == [--help] goto end
-if [%1] == [-H] goto end
-if [%1] == [--version] goto end
-if [%1] == [-V] goto end
-if [%1] == [--fullversion] goto end
-if [%1] == [-F] goto end
-shift
-goto isVersionOrHelp
-
-:prepareCheck
-rem Perform check unless it is specified not to do it
-if "%NO_CHECK%" == "" set NO_CHECK=false
-goto isVersionOrHelp
-
-:check
-if "%NO_CHECK%" == "true" goto end
-if "%CHECK_VERSION%" == "true" set OPT_CHECK_VERSION=--checkVersion
-"%OPENDJ_JAVA_BIN%" %SCRIPT_NAME_ARG% -DINSTALL_ROOT="%INSTALL_ROOT%" -DINSTANCE_ROOT="%INSTANCE_ROOT%" org.opends.server.tools.configurator.CheckInstance %OPT_CHECK_VERSION%
-set RESULT_CODE=%errorlevel%
-if "%RESULT_CODE%" == "0" goto end
-exit /B 1
-
:end
exit /B 0
diff --git a/opends/resource/bin/_script-util.sh b/opends/resource/bin/_script-util.sh
index a931c9d..6d33056 100644
--- a/opends/resource/bin/_script-util.sh
+++ b/opends/resource/bin/_script-util.sh
@@ -24,7 +24,7 @@
#
#
# Copyright 2008-2010 Sun Microsystems, Inc.
-# Portions Copyright 2010-2011 ForgeRock AS
+# Portions Copyright 2010-2013 ForgeRock AS
#
# Display an error message
@@ -377,50 +377,3 @@
test_java
fi
-current_user()
-{
-USER=`id`
-CURRENT_IFS=${IFS}
-IFS="()"
-set -- ${USER}
-echo $2
-IFS=${CURRENT_IFS}
-}
-
-if [ "${SCRIPT_NAME}" != "configure" ] && [ "${SCRIPT_NAME}" != "unconfigure" ]
-then
- # Perform check unless it is specified not to do it
- if [ -z "$NO_CHECK" ]
- then
- NO_CHECK=0
- fi
- if [ ${NO_CHECK} -eq 0 ]
- then
- # No check for --version or --help option
- isVersionOrHelp $*
- if [ $? -eq 0 ]
- then
- NO_CHECK=1
- fi
- fi
- if [ ${NO_CHECK} -eq 0 ]
- then
- set_classpath
- # Check instance
- CURRENT_USER="`current_user`"
- if [ "${CHECK_VERSION}" = "yes" ]
- then
- OPT_CHECK_VERSION="--checkVersion"
- else
- OPT_CHECK_VERSION=""
- fi
- # Launch the CheckInstance process.
- "${OPENDJ_JAVA_BIN}" ${SCRIPT_NAME_ARG} "-DINSTALL_ROOT=${INSTALL_ROOT}" "-DINSTANCE_ROOT=${INSTANCE_ROOT}" org.opends.server.tools.configurator.CheckInstance --currentUser ${CURRENT_USER} ${OPT_CHECK_VERSION}
- # return part
- RETURN_CODE=$?
- if [ ${RETURN_CODE} -ne 0 ]
- then
- exit 1
- fi
- fi
-fi
diff --git a/opends/resource/bin/control-panel b/opends/resource/bin/control-panel
index 0d090ed..e14e531 100644
--- a/opends/resource/bin/control-panel
+++ b/opends/resource/bin/control-panel
@@ -24,7 +24,7 @@
#
#
# Copyright 2008 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
+# Portions Copyright 2011-2013 ForgeRock AS
# This script may be used to display the control panel.
@@ -34,15 +34,5 @@
SCRIPT_NAME="control-panel"
export SCRIPT_NAME
-NO_CHECK=0
-for i in $*
-do
- if [ "$i" == "-r" ] || [ "$i" == "--remote" ]
- then
- NO_CHECK=1
- fi
-done
-export NO_CHECK
-
SCRIPT_DIR=`dirname "${0}"`
"${SCRIPT_DIR}/../lib/_client-script.sh" "${@}"
diff --git a/opends/resource/bin/dsjavaproperties b/opends/resource/bin/dsjavaproperties
index b3678bc..9fd4922 100644
--- a/opends/resource/bin/dsjavaproperties
+++ b/opends/resource/bin/dsjavaproperties
@@ -24,7 +24,7 @@
#
#
# Copyright 2008 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
+# Portions Copyright 2011-2013 ForgeRock AS
# This script may be used to perform some replication specific operations.
@@ -34,8 +34,5 @@
SCRIPT_NAME="dsjavaproperties"
export SCRIPT_NAME
-NO_CHECK=0
-export NO_CHECK
-
SCRIPT_DIR=`dirname "${0}"`
"${SCRIPT_DIR}/../lib/_client-script.sh" "${@}"
diff --git a/opends/resource/bin/dsjavaproperties.bat b/opends/resource/bin/dsjavaproperties.bat
index 2f68f02..e31495e 100644
--- a/opends/resource/bin/dsjavaproperties.bat
+++ b/opends/resource/bin/dsjavaproperties.bat
@@ -24,11 +24,10 @@
rem
rem
rem Copyright 2008-2009 Sun Microsystems, Inc.
-rem Portions Copyright 2011 ForgeRock AS
+rem Portions Copyright 2011-2013 ForgeRock AS
setlocal
set OPENDJ_INVOKE_CLASS="org.opends.server.tools.JavaPropertiesTool"
set SCRIPT_NAME=dsjavaproperties
-set NO_CHECK=false
for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
diff --git a/opends/resource/bin/make-ldif b/opends/resource/bin/make-ldif
index c4bda97..8740bfc 100755
--- a/opends/resource/bin/make-ldif
+++ b/opends/resource/bin/make-ldif
@@ -24,7 +24,7 @@
#
#
# Copyright 2006-2008 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
+# Portions Copyright 2011-2013 ForgeRock AS
# This script may be used to generate LDIF data based on a provided template.
@@ -43,9 +43,6 @@
INSTALL_ROOT=`pwd`
export INSTALL_ROOT
-NO_CHECK=1
-export NO_CHECK
-
# Set environment variables
. "${INSTALL_ROOT}/lib/_script-util.sh"
RETURN_CODE=$?
diff --git a/opends/resource/bin/start-ds b/opends/resource/bin/start-ds
index e951cd2..00fe3e9 100755
--- a/opends/resource/bin/start-ds
+++ b/opends/resource/bin/start-ds
@@ -69,8 +69,6 @@
# Set environment variables
SCRIPT_UTIL_CMD=set-full-environment-and-test-java
export SCRIPT_UTIL_CMD
-CHECK_VERSION=yes
-export CHECK_VERSION
. "${INSTALL_ROOT}/lib/_script-util.sh"
RETURN_CODE=$?
if test ${RETURN_CODE} -ne 0
diff --git a/opends/resource/config/buildinfo b/opends/resource/config/buildinfo
new file mode 100644
index 0000000..e5193d4
--- /dev/null
+++ b/opends/resource/config/buildinfo
@@ -0,0 +1 @@
+2.5.0.8435
\ No newline at end of file
diff --git a/opends/resource/configure b/opends/resource/configure
deleted file mode 100755
index 8300b82..0000000
--- a/opends/resource/configure
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-#
-# 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
-# trunk/opends/resource/legal-notices/OpenDS.LICENSE
-# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-# 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
-# trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
-# Portions Copyright 2011-2012 ForgeRock AS
-
-
-# Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
-# root so that we can use them to create appropriate paths.
-WORKING_DIR=`pwd`
-
-cd "`dirname "${0}"`"
-SCRIPT_DIR=`pwd`
-
-INSTALL_ROOT=${SCRIPT_DIR}
-export INSTALL_ROOT
-
-SCRIPT_NAME=configure
-export SCRIPT_NAME
-
-case `uname -r` in
- *10)
- MANIFEST=/var/svc/manifest/network/ldap/opendj-manifest.xml
- IMPORTSVC="/usr/sbin/svccfg import $MANIFEST"
- ;;
- *11)
- MANIFEST=/lib/svc/manifest/network/ldap/opendj-manifest.xml
- IMPORTSVC="/usr/sbin/svcadm restart svc:/system/manifest-import:default"
- ;;
-esac
-
-# Check if running as root. This is required to be able to copy files and
-# enable SMF
-if [[ `id -u` -ne 0 ]]
-then
- echo "This script must be run as root" 1>&2
- exit 1
-fi
-
-cd "${WORKING_DIR}"
-
-# Set environment variables
-SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-# Launch the configure process.
-"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_NAME_ARG} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.server.tools.configurator.Configurator "${@}"
-
-# return part
-RETURN_CODE=$?
-if test ${RETURN_CODE} -eq 50 -o ${RETURN_CODE} -eq 51
-then
- # Version or help info was on requested
- exit 0
-else
-if test ${RETURN_CODE} -eq 10
-then
- # Syntax error
- exit 1
-else
- if test ${RETURN_CODE} -eq 0
- then
- # Retrieve INSTANCE_ROOT
- INSTANCE_ROOT=`cat /etc/opendj/instance.loc`
- # Now update SMF manifest, cp it to the right place and import it
- OWNER=`ls -ld ${INSTANCE_ROOT}`
- CURRENT_IFS=${IFS}
- IFS=" "
- set -- ${OWNER}
- USERNAME=`echo $3`
- GROUPNAME=`echo $4`
- IFS=${CURRENT_IFS}
- if test "${USERNAME}" = "ldap" -a "$GROUPNAME" = "ldap"
- then
- cp ${INSTALL_ROOT}/resources/opendj-manifest.xml $MANIFEST
- else
- cat ${INSTALL_ROOT}/resources/opendj-manifest.xml | sed -e "s/user='ldap/user='${USERNAME}/;s/group='ldap/group='${GROUPNAME}/" > /tmp/opendj-manifest.$$
- cp /tmp/opendj-manifest.$$ $MANIFEST
- rm /tmp/opendj-manifest.$$
- fi
- $IMPORTSVC
- fi
- exit ${RETURN_CODE}
-fi
-fi
diff --git a/opends/resource/debian/control/control b/opends/resource/debian/control/control
new file mode 100644
index 0000000..1e020d1
--- /dev/null
+++ b/opends/resource/debian/control/control
@@ -0,0 +1,14 @@
+Package: [[name]]
+Version: [[version]]
+Section: misc
+Priority: low
+Architecture: all
+Depends: default-jre | java5-runtime | java6-runtime
+Homepage: [[homepage]]
+Maintainer: [[maintainer]]
+Description: [[description]]
+ OpenDJ is an LDAPv3 compliant directory service, developed for the Java
+ platform, providing a high performance, highly available and secure store
+ for the identities managed by enterprises. Its easy installation process,
+ combined with the power of the Java platform makes OpenDJ one of the
+ simplest and fastest directory servers to deploy and manage.
diff --git a/opends/resource/debian/control/postinst b/opends/resource/debian/control/postinst
new file mode 100644
index 0000000..3509f46
--- /dev/null
+++ b/opends/resource/debian/control/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+# Post install script
+# Insert your post installation code here.
+# End post install script
+echo
\ No newline at end of file
diff --git a/opends/resource/debian/control/postrm b/opends/resource/debian/control/postrm
new file mode 100644
index 0000000..8fd5368
--- /dev/null
+++ b/opends/resource/debian/control/postrm
@@ -0,0 +1,20 @@
+#!/bin/bash
+set -e
+# POSTRM - Upgrade or remove script
+if [ $1 == "remove" ] ; then
+# Removing the remaining files
+ echo *OpenDJ successfully removed
+fi
+if [ "$1" = "upgrade" ] ; then
+ echo *Starting upgrade...
+ @prefix@/./upgrade -n
+# Upgrade ok, restarts the server.
+ if [ "$?" -eq 0 ] ; then
+ @prefix@/./bin/start-ds
+ fi
+# Upgrade fails - Needs user interaction
+ if [ "$?" -eq 2 ] ; then
+ exit 0
+ fi
+fi
+echo
\ No newline at end of file
diff --git a/opends/resource/debian/control/preinst b/opends/resource/debian/control/preinst
new file mode 100644
index 0000000..b8105c5
--- /dev/null
+++ b/opends/resource/debian/control/preinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+# Pre installation section
+# Insert your pre installation code here.
+echo
+# End of the pre installation section
\ No newline at end of file
diff --git a/opends/resource/debian/control/prerm b/opends/resource/debian/control/prerm
new file mode 100644
index 0000000..21935f1
--- /dev/null
+++ b/opends/resource/debian/control/prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+# PRERM - Upgrade or remove script
+if [ $1 = "upgrade" -o $1 = "remove" ] ; then
+ echo *Stopping OpenDJ server...
+ @prefix@/bin/stop-ds
+fi
+echo
+# End prem - upgrade or remove script
\ No newline at end of file
diff --git a/opends/resource/unconfigure b/opends/resource/unconfigure
deleted file mode 100755
index facc0fc..0000000
--- a/opends/resource/unconfigure
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/bin/sh
-#
-# 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
-# trunk/opends/resource/legal-notices/OpenDS.LICENSE
-# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-# 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
-# trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2009 Sun Microsystems, Inc.
-# Portions Copyright 2011-2012 ForgeRock AS
-
-
-# Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
-# root so that we can use them to create appropriate paths.
-WORKING_DIR=`pwd`
-
-cd "`dirname "${0}"`"
-SCRIPT_DIR=`pwd`
-
-INSTALL_ROOT=${SCRIPT_DIR}
-export INSTALL_ROOT
-
-SCRIPT_NAME=unconfigure
-export SCRIPT_NAME
-
-# Check if running as root. This is required to be able to copy files and
-# enable SMF
-if [[ `id -u` -ne 0 ]]
-then
- echo "This script must be run as root" 1>&2
- exit 1
-fi
-
-cd "${WORKING_DIR}"
-
-# Set environment variables
-SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-# Check options
-# An exit code of 0 means options are correct => continue unconfiguration
-# An exit code of 51 means --help or --version option has been specified => do not unconfigure
-# An exit code of 10 means syntax error => do not unconfigure
-"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_NAME_ARG} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.server.tools.configurator.Unconfigurator --checkOptions "${@}"
-EC=${?}
-if test ${EC} -eq 10
-then
- exit 1
-fi
-if test ${EC} -eq 51
-then
- exit 0
-fi
-
-# Launch the unconfiguration
-# Stop the server if needed
-# Check server status: an exit code of 98 means that the server is running
-${OPENDJ_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
- --configClass org.opends.server.extensions.ConfigFileHandler \
- --configFile "${CONFIG_FILE}" --checkStartability "${@}" > /dev/null 2>&1
-EC=${?}
-if test ${EC} -eq 98
-then
- echo "Stopping the server ..."
- ${INSTALL_ROOT}/bin/stop-ds
- EC=${?}
- if test ${EC} -eq 0
- then
- EC=98
- while test ${EC} -eq 98
- do
- ${OPENDJ_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
- --configClass org.opends.server.extensions.ConfigFileHandler \
- --configFile "${CONFIG_FILE}" --checkStartability "${@}" > /dev/null 2>&1
- EC=${?}
- sleep 1
- done
- else
- echo "Unable to stop the server: ${EC}"
- exit ${EC}
- fi
-fi
-
-echo "Disabling SMF service ..."
-if [ `uname -r` = "5.10" ]; then
- # Now update SMF manifest, delete it and remove the file from /var/svc/manifest
- echo select network/ldap/server > /tmp/opendj-unconfigure.$$
- echo delete opendj >> /tmp/opendj-unconfigure.$$
- /usr/sbin/svccfg -f /tmp/opendj-unconfigure.$$
- rm /tmp/opendj-unconfigure.$$
- rm /var/svc/manifest/network/ldap/opendj-manifest.xml
-else
- rm /lib/svc/manifest/network/ldap/opendj-manifest.xml
- /usr/sbin/svcadm restart svc:/system/manifest-import:default
-fi
-
-echo "Resetting instance location ..."
-# Launch the unconfigure process.
-"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_NAME_ARG} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.server.tools.configurator.Unconfigurator "${@}"
-EC=${?}
-if test ${EC} -eq 10
-then
- exit 1
-fi
-
diff --git a/opends/resource/upgrade b/opends/resource/upgrade
index 8cf842b..a45710c 100644
--- a/opends/resource/upgrade
+++ b/opends/resource/upgrade
@@ -23,131 +23,15 @@
# CDDL HEADER END
#
#
-# Copyright 2006-2008 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
+# Copyright 2013 ForgeRock AS
-# Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
-# root so that we can use them to create appropriate paths.
-WORKING_DIR=`pwd`
-cd "`dirname "${0}"`"
-SCRIPT_DIR=`pwd`
+# This script may be used to perform a backup of a Directory Server backend.
+OPENDJ_INVOKE_CLASS="org.opends.server.tools.upgrade.UpgradeCli"
+export OPENDJ_INVOKE_CLASS
-INSTALL_ROOT=${SCRIPT_DIR}
-export INSTALL_ROOT
-
-SCRIPT_NAME=upgrade
+SCRIPT_NAME="upgrade"
export SCRIPT_NAME
-cd "${WORKING_DIR}"
-
-# Set java home
-SCRIPT_UTIL_CMD=set-java-home-and-args
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-# Set environment variables
-SCRIPT_UTIL_CMD=set-environment-vars
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-# Configure the appropriate CLASSPATH to test.
-for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
-do
- CLASSPATH=${CLASSPATH}:${JAR}
-done
-CLASSPATH=${CLASSPATH}:${INSTANCE_ROOT}/classes
-for JAR in ${INSTALL_ROOT}/lib/*.jar
-do
- CLASSPATH=${CLASSPATH}:${JAR}
-done
-export CLASSPATH
-
-# Test the java installation
-SCRIPT_UTIL_CMD=test-java
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-if [ -r "${INSTANCE_ROOT}/tmp/upgrade" ]
-then
- rm -fr "${INSTANCE_ROOT}/tmp/upgrade"
-fi
-
-# Launch the build extractor.
-# Configure the appropriate CLASSPATH.
-# BuildExtractor uses the existing install's
-# jars
-CLASSPATH=${INSTANCE_ROOT}/classes
-for JAR in ${INSTALL_ROOT}/lib/*.jar
-do
- CLASSPATH=${CLASSPATH}:${JAR}
-done
-export CLASSPATH
-
-# Run the build extractor first. An exit code of 99 from the extractor
-# means that this is indeed an upgrade (as opposed to a reversion) and
-# that the upgrade should continue. An exit code of 98 means that this
-# operation is a reversion. An exit code of 50 means that the usage
-# statement was printed and there is nothing else to do
-
-"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} org.opends.quicksetup.upgrader.BuildExtractor "${@}"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -eq 99
-then
- # Configure the appropriate CLASSPATH.
- # Unlike BuildExtractor, the Upgrader uses
- # the newly extracted build's jars.
- CLASSPATH=${INSTANCE_ROOT}/tmp/upgrade/classes
- for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
- do
- CLASSPATH=${JAR}:${CLASSPATH}
- done
- # Launch the upgrade process.
- "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
-elif test ${RETURN_CODE} -eq 98
-then
- # Copy jars to a temporary place from which to run the reverter
- # in order to avoid potential file lock issues.
- mkdir -p ${INSTANCE_ROOT}/tmp/revert
- cp -R ${INSTALL_ROOT}/lib ${INSTANCE_ROOT}/tmp/revert
- if test ${?} -ne 0
- then
- echo "ERROR: Failed to initialize reversion."
- exit 101
- else
- CLASSPATH=${INSTANCE_ROOT}/tmp/revert/classes
- for JAR in ${INSTANCE_ROOT}/tmp/revert/lib/*.jar
- do
- CLASSPATH=${JAR}:${CLASSPATH}
- done
- # Launch the upgrade process.
- "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
- fi
-elif test ${RETURN_CODE} -eq 50
-then
- # Version info was on requested
- exit 0
-elif test ${RETURN_CODE} -eq 0
-then
- # Usage printed
- exit 0
-else
- # Some unknown return code returned
- exit 101
-fi
+SCRIPT_DIR=`dirname "${0}"`
+"${SCRIPT_DIR}/lib/_server-script.sh" "${@}"
diff --git a/opends/resource/upgrade.bat b/opends/resource/upgrade.bat
index df37efb..31074ec 100644
--- a/opends/resource/upgrade.bat
+++ b/opends/resource/upgrade.bat
@@ -23,70 +23,11 @@
rem CDDL HEADER END
rem
rem
-rem Copyright 2006-2008 Sun Microsystems, Inc.
-rem Portions Copyright 2011-2012 ForgeRock AS
+rem Copyright 2013 ForgeRock AS
setlocal
-for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
-set INSTALL_ROOT=%DIR_HOME%
-set INSTANCE_DIR=
-for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
- set INSTANCE_DIR=%%a
-)
-set CUR_DIR=%CD%
-cd /d %INSTALL_ROOT%
-cd /d %INSTANCE_DIR%
-set INSTANCE_ROOT=%CD%
-cd /d %CUR_DIR%
-
-:checkNewVersion
-if exist "upgrade.bat.NEW" goto newVersion
-
+set OPENDJ_INVOKE_CLASS="org.opends.server.tools.upgrade.UpgradeCli"
set SCRIPT_NAME=upgrade
+for %%i in (%~sf0) do call "%%~dPsi\lib\_server-script.bat" %*
-rem Set environment variables and test java
-set SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-call "%INSTALL_ROOT%\lib\_script-util.bat"
-if NOT %errorlevel% == 0 exit /B %errorlevel%
-
-:callExtractor
-if EXIST "%INSTANCE_ROOT%\tmp\upgrade" rd "%INSTANCE_ROOT%\tmp\upgrade" /s /q
-set CLASSPATH=""
-FOR %%x in ("%INSTALL_ROOT%\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
-set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH%
-"%OPENDJ_JAVA_BIN%" %SCRIPT_NAME_ARG% org.opends.quicksetup.upgrader.BuildExtractor %*
-if %errorlevel% == 99 goto upgrader
-if %errorlevel% == 98 goto reverter
-if %errorlevel% == 50 goto version
-if %errorlevel% == 0 goto end
-goto error
-
-:newVersion
-echo A new version of this script was made available by the last upgrade
-echo operation. Delete this old version and rename file 'upgrade.bat.NEW'
-echo to 'upgrade.bat' before continuing.
-goto end
-
-:upgrader
-set CLASSPATH=""
-FOR %%x in ("%INSTANCE_ROOT%\tmp\upgrade\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
-"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% -DINSTALL_ROOT=%INSTALL_ROOT% org.opends.quicksetup.upgrader.UpgradeLauncher %*
-goto end
-
-:reverter
-if EXIST "%INSTANCE_ROOT%\tmp\revert" rd "%INSTANCE_ROOT%\tmp\revert" /s /q
-xcopy "%INSTALL_ROOT%\lib\*.*" "%INSTANCE_ROOT%\tmp\revert\lib\" /E /Q /Y
-set CLASSPATH=""
-FOR %%x in ("%INSTANCE_ROOT%\tmp\revert\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
-"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% -DINSTALL_ROOT=%INSTALL_ROOT% org.opends.quicksetup.upgrader.ReversionLauncher %*
-goto end
-
-:version
-rem version information was requested. Return code should be 0.
-exit /B 0
-
-:error
-exit /B 101
-
-:end
diff --git a/opends/resource/upgrade_svr4 b/opends/resource/upgrade_svr4
deleted file mode 100755
index 2d941a2..0000000
--- a/opends/resource/upgrade_svr4
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-#
-# 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
-# trunk/opends/resource/legal-notices/OpenDS.LICENSE
-# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-# 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
-# trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
-# Portions Copyright 2011 ForgeRock AS
-
-# Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
-# root so that we can use them to create appropriate paths.
-WORKING_DIR=`pwd`
-
-cd "`dirname "${0}"`"
-SCRIPT_DIR=`pwd`
-
-INSTALL_ROOT=${SCRIPT_DIR}
-export INSTALL_ROOT
-
-SCRIPT_NAME=upgrade
-export SCRIPT_NAME
-
-cd "${WORKING_DIR}"
-
-# Set java home
-SCRIPT_UTIL_CMD=set-java-home-and-args
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-# Set environment variables
-SCRIPT_UTIL_CMD=set-environment-vars
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-# Configure the appropriate CLASSPATH to test.
-#for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
-#do
-# CLASSPATH=${CLASSPATH}:${JAR}
-#done
-CLASSPATH=${CLASSPATH}:${INSTANCE_ROOT}/classes
-for JAR in ${INSTALL_ROOT}/lib/*.jar
-do
- CLASSPATH=${CLASSPATH}:${JAR}
-done
-export CLASSPATH
-
-# Test the java installation
-SCRIPT_UTIL_CMD=test-java
-export SCRIPT_UTIL_CMD
-. "${INSTALL_ROOT}/lib/_script-util.sh"
-RETURN_CODE=$?
-if test ${RETURN_CODE} -ne 0
-then
- exit ${RETURN_CODE}
-fi
-
-if [ -r "${INSTANCE_ROOT}/tmp/upgrade" ]
-then
- rm -fr "${INSTANCE_ROOT}/tmp/upgrade"
-fi
-
-# Launch the upgrade process.
-"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.quicksetup.upgrader.UpgradeSvr4Launcher "${@}"
diff --git a/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java b/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java
index b23b2da..4aaf9380 100644
--- a/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java
+++ b/opends/src/build-tools/org/opends/build/tools/CreateVersionString.java
@@ -23,49 +23,42 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.build.tools;
-
-
import java.text.DecimalFormat;
import org.apache.tools.ant.Task;
-
-
/**
- * This class provides an implemenation of an Ant task that may be used to
+ * This class provides an implementation of an Ant task that may be used to
* construct the full version number string that the Directory Server should
- * use. The value of the version number string will be stored in an Ant
+ * use. The value of the version number string will be stored in an Ant
* property.
*/
-public class CreateVersionString
- extends Task
+public class CreateVersionString extends Task
{
// The name of the property in which the revision number should be set.
private String propertyName = null;
-
-
/**
* Specifies the name of the Ant property into which the Subversion revision
* number will be stored.
*
- * @param propertyName The name of the Ant property into which the
- * Subversion revision number will be stored.
+ * @param propertyName
+ * The name of the Ant property into which the Subversion revision
+ * number will be stored.
*/
public void setProperty(String propertyName)
{
this.propertyName = propertyName;
}
-
-
/**
- * Performs the appropriate processing needed for this task. In this case,
- * it uses SVNKit to identify the current revision number for the local
- * workspace and store it in a specified property.
+ * Performs the appropriate processing needed for this task. In this case, it
+ * uses SVNKit to identify the current revision number for the local workspace
+ * and store it in a specified property.
*/
@Override()
public void execute()
@@ -84,15 +77,17 @@
try
{
int buildNumber =
- Integer.parseInt(getProject().getProperty("BUILD_NUMBER"));
+ Integer.parseInt(getProject().getProperty("BUILD_NUMBER"));
if (buildNumber > 0)
{
versionString.append("-build");
versionString.append(new DecimalFormat("000").format(buildNumber));
}
- } catch (NumberFormatException nfe) {}
+ }
+ catch (NumberFormatException nfe)
+ {
+ }
getProject().setNewProperty(propertyName, versionString.toString());
}
}
-
diff --git a/opends/src/build-tools/org/opends/build/tools/GenerateRpm.java b/opends/src/build-tools/org/opends/build/tools/GenerateRpm.java
index d839f85..fea21f4 100644
--- a/opends/src/build-tools/org/opends/build/tools/GenerateRpm.java
+++ b/opends/src/build-tools/org/opends/build/tools/GenerateRpm.java
@@ -23,6 +23,8 @@
*
*
* Copyright 2007-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2012 Delta-Victor Consultants
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.build.tools;
@@ -32,86 +34,139 @@
import static org.opends.build.tools.Utilities.*;
import java.io.File;
+import java.io.FileFilter;
import java.io.PrintWriter;
/**
* Generates an RPM spec file.
*/
-public class GenerateRpm extends Task {
+public class GenerateRpm extends Task
+{
private File topDir;
private String topDirAbsolutePath;
private String sourceDirName;
private File destFile;
private String prefix;
+ private String productName;
+ private String referenceURL;
+ private String shortName;
private String version;
private String release;
private boolean overwrite;
private StringBuilder sb;
- private final String filePrefix="%{_prefix}";
- private final String dirPrefix="%dir %{_prefix}";
-
+ private final String filePrefix = "%{_prefix}";
+ private final String dirPrefix = "%dir %{_prefix}";
/**
* Sets the top directory for the rpm build.
- * @param topDir File representing top directory for rpm build directory
+ *
+ * @param topDir
+ * File representing top directory for rpm build directory
*/
- public void setTopDir(File topDir) {
+ public void setTopDir(File topDir)
+ {
this.topDir = topDir;
topDirAbsolutePath = topDir.getAbsolutePath();
}
/**
* Sets the prefix for the RPM.
- * @param prefix Used for package relocation
+ *
+ * @param prefix
+ * Used for package relocation
*/
- public void setPrefix(String prefix) {
+ public void setPrefix(String prefix)
+ {
this.prefix = prefix;
}
/**
- * Sets the name of the source directory.
- * @param sourceDirName name of the source directory.
+ * Sets the short description for the RPM.
+ *
+ * @param productName
+ * The RPM short description
*/
- public void setSourceDirName(String sourceDirName) {
+ public void setproductName(String productName)
+ {
+ this.productName = productName;
+ }
+
+ /**
+ * Sets the application name for the RPM.
+ *
+ * @param shortName
+ * The RPM application name
+ */
+ public void setshortName(String shortName)
+ {
+ this.shortName = shortName;
+ }
+
+ /**
+ * Sets the reference URL for the RPM.
+ *
+ * @param referenceURL
+ * The RPM reference URL
+ */
+ public void setreferenceURL(String referenceURL)
+ {
+ this.referenceURL = referenceURL;
+ }
+
+ /**
+ * Sets the name of the source directory.
+ *
+ * @param sourceDirName
+ * name of the source directory.
+ */
+ public void setSourceDirName(String sourceDirName)
+ {
this.sourceDirName = sourceDirName;
}
-
/**
* Sets the RPM spec file that will be generated.
- * @param dest The spec file
*
+ * @param dest
+ * The spec file
*/
- public void setSpecFileName(File dest) {
+ public void setSpecFileName(File dest)
+ {
this.destFile = dest;
}
/**
* Sets the version number.
- * @param version The version number
*
+ * @param version
+ * The version number
*/
- public void setVersion(String version) {
+ public void setVersion(String version)
+ {
this.version = version;
}
/**
* Sets the release number.
- * @param release The release number
*
+ * @param release
+ * The release number
*/
- public void setRelease(String release) {
+ public void setRelease(String release)
+ {
this.release = release;
}
/**
- * Indicates when true that an existing destination
- * file will be overwritten.
- * @param o boolean where true means overwrite
+ * Indicates when true that an existing destination file will be overwritten.
+ *
+ * @param o
+ * boolean where true means overwrite
*/
- public void setOverwrite(boolean o) {
+ public void setOverwrite(boolean o)
+ {
this.overwrite = o;
}
@@ -119,110 +174,202 @@
* {@inheritDoc}
*/
@Override
- public void execute() throws BuildException {
+ public void execute() throws BuildException
+ {
- try {
- if (!topDir.exists()) {
+ try
+ {
+ if (!topDir.exists())
+ {
throw new BuildException("directory " + topDir.getName()
+ " does not exist");
}
- if (!topDir.isDirectory()) {
+ if (!topDir.isDirectory())
+ {
throw new BuildException(topDir.getName() + " is not a directory");
}
- if (destFile.exists()) {
- if (this.overwrite) {
+ if (destFile.exists())
+ {
+ if (this.overwrite)
+ {
destFile.delete();
log("Regenerating " + destFile.getName() + " from "
+ topDir.getName());
- } else {
+ }
+ else
+ {
log(destFile.getName() + " has not been regenerated");
}
}
sb = new StringBuilder();
- File rootDir = new File(sourceDirName);
- String opendsDir = rootDir.getName();
+ final File rootDir = new File(sourceDirName);
+ final String opendsDir = rootDir.getName();
+ final File[] listFiles = rootDir.listFiles(new PkgFileFilter());
// Generate the package information
- sb.append("Summary : OpenDS Directory Server" + EOL);
- sb.append("Name : opends" + EOL);
- sb.append("Version : " + version + EOL);
- sb.append("Release : " + release + EOL);
- sb.append("License : CDDL" + EOL);
- sb.append("Group : Applications/Network" + EOL);
- sb.append("URL : https://opends.org" + EOL);
- sb.append( EOL);
- sb.append("BuildArchitectures : noarch" + EOL);
- sb.append("BuildRoot : " + topDirAbsolutePath + "/SOURCES"+ EOL);
- sb.append("Prefix : " + prefix + EOL);
- sb.append( EOL);
- sb.append("%define _prefix " + prefix + EOL);
- sb.append( EOL);
- sb.append("%Description" + EOL);
- sb.append("OpenDS Directory Server" + EOL);
- sb.append( EOL);
- sb.append("# =========================" + EOL);
- sb.append("# pre/post installation" + EOL);
- sb.append("# =========================" + EOL);
- sb.append("# The order is:" + EOL);
- sb.append("# 1. %pre new" + EOL);
- sb.append("# 2. install new" + EOL);
- sb.append("# 3. %post new" + EOL);
- sb.append("# 4. %preun old" + EOL);
- sb.append("# 5. delete old" + EOL);
- sb.append("# 6. %postun old" + EOL);
- sb.append("# Note: \"$1 equals \"1\" it means \"fresh install\"" + EOL);
- sb.append( EOL);
- sb.append("# PRE INSTALL" + EOL);
- sb.append("%pre" + EOL);
- sb.append("if [ \"$1\" != \"1\" ]; then" + EOL);
- sb.append("echo \" This version of the OpenDS RPM does not work\""+ EOL);
- sb.append("echo \" with the standard RPM upgrade mechanism\"" + EOL);
- sb.append("echo \" (rpm -U or rpm -F).\"" + EOL);
- sb.append("echo \" To perform an upgrade, use the OpenDS upgrade\""+ EOL);
- sb.append("echo \" tool included in the package delivery.\"" + EOL);
- sb.append("echo \" For more information about the upgrade process\""+ EOL);
- sb.append("echo \" with RPM see https://www.opends.org/wiki//page/OpendsRPM.\""+ EOL);
- sb.append("exit 1" + EOL);
- sb.append("fi" + EOL);
- sb.append( EOL);
- sb.append("# POST INSTALL" + EOL);
- sb.append("%post" + EOL);
- sb.append( EOL);
- sb.append("# PRE UNINSTALL" + EOL);
- sb.append("%preun" + EOL);
- sb.append("${RPM_INSTALL_PREFIX}/OpenDS-1.0.0/bin/stop-ds" + EOL);
- sb.append( EOL);
- sb.append("# POST UNINSTALL" + EOL);
- sb.append("%postun" + EOL);
- sb.append("rm -rf ${RPM_INSTALL_PREFIX}/" + opendsDir + EOL);
- sb.append("rmdir --ignore-fail-on-non-empty ${RPM_INSTALL_PREFIX}" + EOL);
- sb.append( EOL);
- sb.append("# =========================" + EOL);
- sb.append("# Prepare, Build, Install" + EOL);
- sb.append("# =========================" + EOL);
- sb.append("%prep" + EOL);
- sb.append("cd "+ topDirAbsolutePath +"/SOURCES" + prefix +
- " ; cp -r " + sourceDirName + " ." + EOL);
- sb.append("%build" + EOL);
- sb.append("%install" + EOL);
- sb.append( EOL);
- sb.append("# =========================" + EOL);
- sb.append("# FILES LAYOUT" + EOL);
- sb.append("# =========================" + EOL);
- sb.append("%files" + EOL);
- sb.append(dirPrefix + EOL);
- generatedLevel("", rootDir);
+ sb.append("%define _topdir " + topDirAbsolutePath + EOL);
+ sb.append("%define _arch noarch" + EOL);
+ sb.append("%define _prefix " + prefix + EOL);
+ sb.append("%define _pre " + opendsDir + EOL);
+ sb.append("%define __os_install_post %{nil}" + EOL);
+ sb.append(EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# Header" + EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# Short Description" + EOL);
+ sb.append("Summary: " + productName + EOL);
+ sb.append("# Application Name" + EOL);
+ sb.append("Name: " + shortName + EOL);
+ sb.append("# Application Version" + EOL);
+ sb.append("Version: " + version + EOL);
+ sb.append("# Packaging Revision" + EOL);
+ sb.append("Release: " + release + EOL);
+ sb.append("# Software Licenced Under" + EOL);
+ sb.append("License: CDDL" + EOL);
+ sb.append("# RPM Group" + EOL);
+ sb.append("Group: Applications/Network" + EOL);
+ sb.append("# Link to Application web site" + EOL);
+ sb.append("URL: " + referenceURL + EOL);
+ sb.append("# Distributing Organisation" + EOL);
+ sb.append("Vendor: ForgeRock AS" + EOL);
+ sb.append("# Build Architecture" + EOL);
+ sb.append("BuildArch: noarch" + EOL);
+ sb.append(EOL);
+ sb.append("Requires: jre >= 1.6" + EOL);
+ sb.append(EOL);
+ sb.append("# Long Description" + EOL);
+ sb.append("%Description" + EOL);
+ sb.append("OpenDJ LDAP Server" + EOL);
+ sb.append("OpenDJ is an LDAPv3 compliant directory service, developed for the Java"
+ + EOL);
+ sb.append("platform, providing a high performance, highly available and secure store"
+ + EOL);
+ sb.append("for the identities managed by enterprises. Its easy installation process,"
+ + EOL);
+ sb.append("combined with the power of the Java platform makes OpenDJ one of the"
+ + EOL);
+ sb.append("simplest and fastest directory servers to deploy and manage."
+ + EOL);
+ sb.append(EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# Pre & Post Install" + EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# If the first argument to %pre is 1, the RPM operation is an initial"
+ + EOL);
+ sb.append("# installation. If the argument to %pre is 2, the operation is an upgrade"
+ + EOL);
+ sb.append("# from an existing version to a new one." + EOL);
+ sb.append("# Similarly, the arguments to a %post are 1 and 2 for a new installation"
+ + EOL);
+ sb.append("# and upgrade, respectively. (%pre and %post aren't executed during"
+ + EOL);
+ sb.append("# an uninstallation.)" + EOL);
+ sb.append(EOL);
+ sb.append("# Pre Install" + EOL);
+ sb.append("%pre" + EOL);
+ sb.append("if [ \"$1\" == \"1\" ]; then" + EOL);
+ sb.append(" echo \"Pre Install - initial install\"" + EOL);
+ sb.append("else if [ \"$1\" == \"2\" ] ; then" + EOL);
+ sb.append(" echo \"Pre Install - upgrade install\"" + EOL);
+ sb.append(" %{_prefix}/bin/stop-ds" + EOL);
+ sb.append(" echo \"\"" + EOL);
+ sb.append(" fi" + EOL);
+ sb.append("fi" + EOL);
+ sb.append(EOL);
+ sb.append("# Post Install" + EOL);
+ sb.append("%post" + EOL);
+ sb.append("if [ \"$1\" == \"1\" ] ; then" + EOL);
+ sb.append(" echo \"Post Install - initial install\"" + EOL);
+ sb.append(" [[ `java -version 2>&1 | /bin/sed 's/java version \"\\(.*\\)\\.\\(.*\\)\\.\\(.*\\)\\_\\(.*\\)\\.*\"/\\1\\2\\3\\4/; 1q'` < 16022 ]] && echo \"WARNING - For best server performance, use at least Java 1.6.0_22, which includes a major security fix for TLS.\""
+ + EOL);
+ sb.append(" echo \"\"" + EOL);
+ sb.append("else if [ \"$1\" == \"2\" ] ; then" + EOL);
+ sb.append(" echo \"Post Install - upgrade install\"" + EOL);
+ // Starts the upgrade. The new files are automatically imported
+ // by rpm manager, which compares files between last & actual version.
+ // Copies / deletes files depending of new package.
+ sb.append(" %{_prefix}/./upgrade -n" + EOL);
+ sb.append("# Upgrade ok, restarts the server" + EOL);
+ sb.append(" if [ \"$?\" == \"0\" ] ; then " + EOL);
+ sb.append(" %{_prefix}/./bin/start-ds " + EOL);
+ sb.append(" fi" + EOL);
+ sb.append("# Upgrade fails, needs user interaction (eg. manual mode)" + EOL);
+ sb.append(" if [ \"$?\" == \"2\" ] ; then " + EOL);
+ sb.append(" exit \"0\" " + EOL);
+ sb.append(" fi " + EOL);
+ sb.append(" fi " + EOL);
+ sb.append("fi" + EOL);
+ sb.append(EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# Pre & Post Uninstall" + EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# If the first argument to %preun and %postun is 0, the action is"
+ + EOL);
+ sb.append("# uninstallation." + EOL);
+ sb.append("# If the first argument to %preun and %postun is 1, the action is an upgrade."
+ + EOL);
+ sb.append("# Pre Uninstall" + EOL);
+ sb.append("%preun" + EOL);
+ sb.append("if [ \"$1\" == \"0\" ] ; then" + EOL);
+ sb.append(" echo \"Pre Uninstall - uninstall\"" + EOL);
+ sb.append(" %{_prefix}/bin/stop-ds" + EOL);
+ sb.append("else if [ \"$1\" == \"1\" ] ; then" + EOL);
+ sb.append(" echo \"Pre Uninstall - upgrade uninstall\"" + EOL);
+ sb.append(" fi" + EOL);
+ sb.append("fi" + EOL);
+ sb.append("# Post Uninstall" + EOL);
+ sb.append("%postun" + EOL);
+ sb.append("if [ \"$1\" == \"0\" ] ; then" + EOL);
+ sb.append(" echo \"Post Uninstall - uninstall\"" + EOL);
+ sb.append(" echo \"OpenDJ successfully removed.\"" + EOL);
+ sb.append("else if [ \"$1\" == \"1\" ] ; then" + EOL);
+ sb.append(" echo \"Post Uninstall - upgrade uninstall\"" + EOL);
+ sb.append(" fi" + EOL);
+ sb.append("fi" + EOL);
+ sb.append(EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# Prepare, Build, Install" + EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# %prep" + EOL);
+ sb.append(EOL);
+ sb.append("# %build" + EOL);
+ sb.append(EOL);
+ sb.append("%install" + EOL);
+ sb.append("mkdir -p $RPM_BUILD_ROOT%{_prefix}" + EOL);
+ sb.append("cd $RPM_BUILD_ROOT%{_prefix}" + EOL);
+ for (final File f : listFiles)
+ {
+ sb.append("cp -r " + f.getPath() + " ." + EOL);
+ }
+ sb.append(EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("# Files Layout" + EOL);
+ sb.append("# =========================" + EOL);
+ sb.append("%files" + EOL);
+ sb.append(dirPrefix + EOL);
+ // In order to handle upgrades, we need to start
+ // with the contents of the rootDir rather than
+ // the actual directory, because the
+ // rootDir has the OpenDJ version number included
+ // into it
+ for (final File build : listFiles)
+ {
+ generatedLevel("", build);
+ }
// flush the spec file.
PrintWriter destWriter = new PrintWriter(destFile);
destWriter.print(sb.toString());
destWriter.close();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// Don't leave a malformed file laying around. Delete
// it so it will be forced to be regenerated.
- if (destFile.exists()) {
+ if (destFile.exists())
+ {
destFile.deleteOnExit();
}
e.printStackTrace();
@@ -231,21 +378,47 @@
}
}
- private void generatedLevel (String parent, File source )
+ private void generatedLevel(String parent, File source)
{
if (source.isDirectory())
{
- sb.append(dirPrefix + parent + "/" +source.getName());
+ sb.append(dirPrefix + parent + "/" + source.getName());
sb.append(EOL);
for (File child : source.listFiles())
{
- generatedLevel( parent + "/" +source.getName(), child);
+ generatedLevel(parent + "/" + source.getName(), child);
}
}
else
{
- sb.append(filePrefix + parent + "/" +source.getName());
+ sb.append(filePrefix + parent + "/" + source.getName());
sb.append(EOL);
}
}
+
+ /**
+ * A file filter for the rpm. Excludes all '.bat' and '.app' files.
+ */
+ static final class PkgFileFilter implements FileFilter
+ {
+ /** {@inheritDoc} */
+ public boolean accept(File file)
+ {
+ final String fileName = file.getName().toLowerCase();
+ if (file.isDirectory()
+ && (fileName.equals("bat") || fileName.endsWith(".app") || fileName
+ .endsWith(".bat")))
+ {
+ return false;
+ }
+ else if (file.isFile())
+ {
+ if (fileName.endsWith(".app") || fileName.endsWith(".bat"))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java b/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
index 198e714..a3f1be8 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
@@ -30,6 +30,8 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
+import static org.opends.server.util.StaticUtils.wrapText;
import java.io.File;
import java.io.PrintStream;
@@ -43,6 +45,8 @@
import org.opends.messages.Message;
import org.opends.quicksetup.ui.UIFactory;
import org.opends.quicksetup.util.Utils;
+import org.opends.server.types.InitializationException;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.args.ArgumentException;
@@ -98,6 +102,24 @@
System.exit(ErrorReturnCode.ERROR_PARSING_ARGS.getReturnCode());
}
+
+ // If we should just display usage or version information,
+ // then print it and exit.
+ if (argParser.usageOrVersionDisplayed()) {
+ System.exit(ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode());
+ }
+
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ System.err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ System.exit(ErrorReturnCode.ERROR_UNEXPECTED.getReturnCode());
+ }
+
if (!argParser.usageOrVersionDisplayed())
{
int exitCode = launchControlPanel(args);
diff --git a/opends/src/messages/messages/quicksetup.properties b/opends/src/messages/messages/quicksetup.properties
index c883fa9..5f8fe9e 100644
--- a/opends/src/messages/messages/quicksetup.properties
+++ b/opends/src/messages/messages/quicksetup.properties
@@ -70,10 +70,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=File %s is not a .zip file.
INFO_BUILD_EXTRACTOR_FILE_INVALID=Could not extract a valid server \
installation from %s because: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=Downloading Build...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=Finished Downloading Build
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=Downloading Build: %s%% \
- Completed
INFO_CANCEL_BUTTON_LABEL=Cancel
INFO_CANCEL_BUTTON_TOOLTIP=Cancel the currently running operation
INFO_CANNOT_BIND_PORT=Cannot bind to port %s.%n%nThe port could be already in \
@@ -1178,34 +1174,13 @@
above location
INFO_UPGRADE_BUILD_ID_UNKNOWN=Unknown
INFO_UPGRADE_CANCELED=Upgrade canceled.
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>Error Accessing Build \
- Information.</b><br>Unable to retrieve the list of builds from %s due to: \
- %s.<br>Possible Causes:<br><ul><li>Need to specify a \
- proxy.<br><table><tr><td><input value="Specify Proxy" \
- type="submit"></input></td><td>Current Proxy: \
- %s<td></tr></table><br></li><li>%s is down or experiencing \
- difficulty.</li></ul><br>You can still continue with upgrade but will need to \
- download a build separately and then point to it in the wizard.
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=Loading remote build \
- information...
-INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=Upgrade Based on Downloaded Weekly \
- Build (.zip)
+INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=Upgrade Based on Downloaded Build (.zip)
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=Path:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=Upgrade to a build whose .zip file \
you have already downloaded.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=Choose a new version or \
reference build to use for the upgrading.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=Choose New Version
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=Reading remote build \
- information...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=Choose New Version from \
- www.forgerock.org/opendj.html
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=Nightly Builds
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=Download and upgrade to a build \
- publicly available on the OpenDJ website.
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=Weekly Builds
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=Unable to access \
- remote build information.
INFO_UPGRADE_OPERATION_PROMPT=Would you like to upgrade this installation to \
a newer version or revert to an older version?
INFO_UPGRADE_OPERATION_REVERSION=Revert to a previous version
@@ -1328,13 +1303,6 @@
INFO_WARNING_ICON_TOOLTIP=Warning
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=Authentication:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=Required by proxy
-INFO_WEB_PROXY_DLG_HOST_LABEL=Host:
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=Password:
-INFO_WEB_PROXY_DLG_PORT_LABEL=Port:
-INFO_WEB_PROXY_DLG_TITLE=Web Proxy Configuration
-INFO_WEB_PROXY_DLG_USER_LABEL=User:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=The %s QuickSetup tool will ask \
you for some basic server and data configuration settings and will get your \
server up and running quickly.<br><br> %s requires a Java SE 6.0 or \
@@ -1380,11 +1348,6 @@
OPENDJ_JAVA_HOME to the root of a compatible Java installation or edit the \
java.properties file and then run the dsjavaproperties script to specify the \
java version to be used.
-SEVERE_ERR_INVALID_JAVA_ARGS=The java arguments used in the server \
- installation in '%s' do not seem to be compatible with the Java virtual \
- machine used to run the upgrader (%s).%n%nTo fix this problem delete the file \
- %s and click on 'Next' again.%nOnce the upgrader finishes you will have to \
- set again the java arguments by running the command-line %s.
INFO_ADS_CONTEXT_EXCEPTION_MSG=Registration information error. Error type: \
'%s'.
INFO_ADS_CONTEXT_EXCEPTION_WITH_DETAILS_MSG=Registration information error. \
diff --git a/opends/src/messages/messages/quicksetup_de.properties b/opends/src/messages/messages/quicksetup_de.properties
index c9f63b4..c4f66f1 100644
--- a/opends/src/messages/messages/quicksetup_de.properties
+++ b/opends/src/messages/messages/quicksetup_de.properties
@@ -66,9 +66,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=Datei %s ist nicht vorhanden.
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=Datei %s ist keine ZIP-Datei.
INFO_BUILD_EXTRACTOR_FILE_INVALID=Es konnte keine g\u00fcltige Server-Installation aus %s extrahiert werden. Grund: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=Build wird heruntergeladen...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=Herunterladen des Builds abgeschlossen
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=Herunterladen des Builds: %s%% abgeschlossen
INFO_CANCEL_BUTTON_LABEL=Abbrechen
INFO_CANCEL_BUTTON_TOOLTIP=Laufenden Vorgang abbrechen
INFO_CANNOT_BIND_PORT=Verbindung mit Port %s nicht m\u00f6glich.%n%nM\u00f6glicherweise wird der Port bereits von einer anderen Anwendung verwendet, oder Sie haben kein Zugriffsrecht.
@@ -783,19 +780,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=Die ID der am obigen Speicherort installierten Build-Version
INFO_UPGRADE_BUILD_ID_UNKNOWN=Unbekannt
INFO_UPGRADE_CANCELED=Aktualisierung abgebrochen.
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>Fehler beim Zugriff auf Build-Informationen.</b><br>Die Liste mit Builds kann nicht von %s abgerufen werden. Grund: %s.<br>M\u00f6gliche Ursachen:<br><ul><li>Proxy muss angegeben werden.<br><table><tr><td><input value="Proxy angeben" type="submit"></input></td><td>Aktueller Proxy: %s<td></tr></table><br></li><li>%s ist heruntergefahren oder hat Schwierigkeiten.</li></ul><br>Sie k\u00f6nnen eine Aktualisierung fortsetzen, m\u00fcssen dann aber einen Build separat herunterladen und anschlie\u00dfend im Assistenten auf diesen Build verweisen.
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=Remote-Build-Informationen werden geladen...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=Aktualisierung basierend auf heruntergeladenem w\u00f6chentlichem Build (ZIP)
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=Pfad:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=Aktualisierung auf einen Build, dessen ZIP-Datei Sie bereits heruntergeladen haben.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=W\u00e4hlen Sie eine neue Version, oder verweisen Sie auf einen Build f\u00fcr die Aktualisierung.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=Neue Version w\u00e4hlen
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=Remote-Build-Informationen werden gelesen...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=Neue Version von www.forgerock.org/opendj.html w\u00e4hlen
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=N\u00e4chtliche Builds
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=Herunterladen und auf einen Build aktualisieren, der \u00f6ffentlich auf der OpenDJ-Website verf\u00fcgbar ist.
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=W\u00f6chentliche Builds
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=Kein Zugriff auf Remote-Build-Informationen m\u00f6glich.
INFO_UPGRADE_OPERATION_PROMPT=M\u00f6chten Sie diese Installation auf eine neuere Version aktualisieren oder auf eine \u00e4ltere Version wiederherstellen?
INFO_UPGRADE_OPERATION_REVERSION=Auf \u00e4ltere Version wiederherstellen
INFO_UPGRADE_OPERATION_UPGRADE=Auf neuere Version aktualisieren
@@ -899,7 +888,6 @@
INFO_NEW_UPGRADE_SCRIPT_AVAILABLE=Es wurde eine neue Version von '%s' verf\u00fcgbar gemacht. Nach diesem Vorgang sollten Sie dieses Skript l\u00f6schen und '%s' in '%1$s' umbenennen.
MILD_ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS=Fehler beim Aktualisieren von Skripts mit Java-Eigenschaften. Fehlercode: %d
SEVERE_ERR_INCOMPATIBLE_VERSION=Die mindestens erforderliche Java-Version ist %s.%n%nDie erkannte Version ist %s.%nDie erkannte bin\u00e4re ist %s%n%nBitte setzen Sie OPENDJ_JAVA_HOME auf die Root einer kompatiblen Java-Installation oder bearbeiten Sie die Datei java.properties und f\u00fchren Sie dann das Skript dsjavaproperties aus, um die Java-Version anzugeben, die verwendet werden soll.
-SEVERE_ERR_INVALID_JAVA_ARGS=Die in der Serverinstallation in '%s' verwendeten Java-Argumente sind offenbar nicht kompatibel mit der Java Virtual Machine, die zum Ausf\u00fchren des Updatemoduls (%s) verwendet wird.%n%nZum Beheben dieses Problems l\u00f6schen Sie die Datei %s und klicken auf erneut auf 'Weiter'.%nSobald das Updatemodul beende wurde, m\u00fcssen Sie die Java-Argumente erneut einrichten, indem Sie die Befehlszeile %s ausf\u00fchren.
INFO_ADS_CONTEXT_EXCEPTION_MSG=Fehler bei den Registrierungsinformationen. Fehlertyp: '%s'.
INFO_ADS_CONTEXT_EXCEPTION_WITH_DETAILS_MSG=Fehler bei den Registrierungsinformationen. Fehlertyp: '%s'. Details: %s
FATAL_ERR_ADS_MERGE=Die Registrierungsinformationen von Server %s und Server %s konnten nicht zusammengef\u00fchrt werden. Ursachen:%n%s
diff --git a/opends/src/messages/messages/quicksetup_es.properties b/opends/src/messages/messages/quicksetup_es.properties
index fb2646a..c53ea3e 100644
--- a/opends/src/messages/messages/quicksetup_es.properties
+++ b/opends/src/messages/messages/quicksetup_es.properties
@@ -66,9 +66,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=El archivo %s no existe.
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=El archivo %s no es un archivo .zip.
INFO_BUILD_EXTRACTOR_FILE_INVALID=No se ha podido extraer una instalaci\u00f3n de servidor v\u00e1lida desde %s debido a: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=Descargando versi\u00f3n...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=Se ha terminado de descargar la versi\u00f3n
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=Descargando versi\u00f3n: %s%% completado
INFO_CANCEL_BUTTON_LABEL=Cancelar
INFO_CANCEL_BUTTON_TOOLTIP=Cancelar la operaci\u00f3n actualmente en ejecuci\u00f3n
INFO_CANNOT_BIND_PORT=No se puede enlazar al puerto %s.%n%nEs posible que otra aplicaci\u00f3n ya est\u00e9 utilizando el puerto o que no disponga de derecho de acceso.
@@ -783,19 +780,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=El Id. de la versi\u00f3n instalada en la ubicaci\u00f3n anterior
INFO_UPGRADE_BUILD_ID_UNKNOWN=Desconocido
INFO_UPGRADE_CANCELED=Actualizaci\u00f3n cancelada.
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>Error al acceder a la informaci\u00f3n de versi\u00f3n.</b><br>No se ha podido recuperar la lista de versiones de %s debido a: %s.<br>Causas posibles:<br><ul><li>es necesario especificar un proxy.<br><table><tr><td><input value="Especificar proxy" type="submit"></input></td><td>Proxy actual: %s<td></tr></table><br></li><li>%s est\u00e1 inactivo o tiene dificultades.</li></ul><br>Puede continuar con la actualizaci\u00f3n pero necesitar\u00e1 descargar una versi\u00f3n por separado y, a continuaci\u00f3n, se\u00f1alarla en el asistente.
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=Cargando informaci\u00f3n de versi\u00f3n remota...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=Actualizaci\u00f3n basada en versi\u00f3n semanal descargada (.zip)
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=Ruta:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=Actualizar a una versi\u00f3n cuyo archivo .zip ya ha descargado.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=Seleccionar una versi\u00f3n nueva o versi\u00f3n de referencia que utilizar para la actualizaci\u00f3n.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=Seleccionar nueva versi\u00f3n
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=Leyendo informaci\u00f3n de versi\u00f3n remota...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=Seleccionar versi\u00f3n nueva desde www.forgerock.org/opendj.html
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=Versiones nocturnas
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=Descargar y actualizar una versi\u00f3n disponible p\u00fablicamente en el sitio web de OpenDJ.
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=Versiones semanales
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=No se ha podido acceder a la informaci\u00f3n de versi\u00f3n remota.
INFO_UPGRADE_OPERATION_PROMPT=\u00bfDesea actualizar esta instalaci\u00f3n a una versi\u00f3n m\u00e1s nueva o revertirla a una versi\u00f3n m\u00e1s antigua?
INFO_UPGRADE_OPERATION_REVERSION=Revertir a una versi\u00f3n anterior
INFO_UPGRADE_OPERATION_UPGRADE=Actualizar a una versi\u00f3n m\u00e1s nueva
@@ -872,13 +861,6 @@
INFO_WARNING_ICON_TOOLTIP=Advertencia
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=Autenticaci\u00f3n:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=Requerido por el proxy
-INFO_WEB_PROXY_DLG_HOST_LABEL=Host:
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=Contrase\u00f1a:
-INFO_WEB_PROXY_DLG_PORT_LABEL=Puerto:
-INFO_WEB_PROXY_DLG_TITLE=Configuraci\u00f3n de proxy web
-INFO_WEB_PROXY_DLG_USER_LABEL=Usuario:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=La herramienta de configuraci\u00f3n r\u00e1pida %s QuickSetup le pedir\u00e1 algunos ajustes b\u00e1sicos de configuraci\u00f3n del servidor y de datos y har\u00e1 que su servidor funcione r\u00e1pidamente.<br><br> %s requiere un tiempo de ejecuci\u00f3n Java SE 6.0 o superior.<br><br> Dispone de informaci\u00f3n adicional sobre la Configuraci\u00f3n r\u00e1pida en el <a href="%s"> sitio de documentaci\u00f3n de %s</a>.
INFO_WELCOME_PANEL_TITLE=Bienvenido
INFO_WELCOME_PANEL_WEBSTART_INSTRUCTIONS=La herramienta Configuraci\u00f3n r\u00e1pida de %s le solicitar\u00e1 algunos valores de configuraci\u00f3n b\u00e1sicos de datos y del servidor y pondr\u00e1 en marcha su servidor r\u00e1pidamente.<br><br>Tambi\u00e9n puede utilizar la Configuraci\u00f3n r\u00e1pida para configurar una versi\u00f3n de %s que haya descargado manualmente. Para ejecutar la Configuraci\u00f3n r\u00e1pida en este caso, utilice el comando %s en el nivel superior del directorio OpenDJ. Esta instancia de Configuraci\u00f3n r\u00e1pida utilizar\u00e1 la siguiente versi\u00f3n de %s: %s (Id. de versi\u00f3n: %s) <br><br> %s requiere un tiempo de ejecuci\u00f3n Java SE 6.0 o superior.<br><br> Hay informaci\u00f3n disponible sobre la Configuraci\u00f3n r\u00e1pida en el <a href="http://opendj.forgerock.org/doc/install-guide/OpenDJ-Install-Guide.html#chap-install-gui">manual de instalaci\u00f3n de %s</a>.
@@ -899,7 +881,6 @@
INFO_NEW_UPGRADE_SCRIPT_AVAILABLE=Hay disponible una nueva versi\u00f3n de '%s'. Despu\u00e9s de esta operaci\u00f3n debe eliminar esta secuencia de comandos y cambiar el nombre de '%s' a '%1$s'.
MILD_ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS=Error al actualizar secuencias de comandos con propiedades java. C\u00f3digo de error: %d
SEVERE_ERR_INCOMPATIBLE_VERSION=La versi\u00f3n m\u00ednima requerida de Java es %s.%n%nLa versi\u00f3n detectada es %s.%nEl binario detectado es %s%n%nConfigure OPENDJ_JAVA_HOME en la ra\u00edz de una instalaci\u00f3n de Java compatible o edite el archivo java.properties y, a continuaci\u00f3n, ejecute la secuencia de comandos dsjavaproperties para especificar la versi\u00f3n de Java que va a usar.
-SEVERE_ERR_INVALID_JAVA_ARGS=Los argumentos Java utilizados en la instalacion del servidor en '%s' no parecen ser compatibles con la m\u00e1quina virtual Java utilizada para ejecutar el actualizador (%s).%n%nPara corregir este problema borra el archivo %s y presiona en 'siguiente' de nuevo.%nUna vez que el actualizador termine tendra que definir de nuevo los argumentos de Java corriendo la linea de comandos %s.
INFO_ADS_CONTEXT_EXCEPTION_MSG=Error de informaci\u00f3n de registro. Tipo de error: '%s'.
INFO_ADS_CONTEXT_EXCEPTION_WITH_DETAILS_MSG=Error de informaci\u00f3n de registro. Tipo de error: '%s'. Detalles: %s
FATAL_ERR_ADS_MERGE=No pudo combinarse la informaci\u00f3n de registro del servidor %s y del servidor %s. Razones:%n%s
diff --git a/opends/src/messages/messages/quicksetup_fr.properties b/opends/src/messages/messages/quicksetup_fr.properties
index 952f6b5..9391e93 100644
--- a/opends/src/messages/messages/quicksetup_fr.properties
+++ b/opends/src/messages/messages/quicksetup_fr.properties
@@ -66,9 +66,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=Le fichier %s n'existe pas.
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=Le fichier %s n'est pas un fichier .zip.
INFO_BUILD_EXTRACTOR_FILE_INVALID=Impossible d'extraire une installation de serveur valide de %s, car\u00a0: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=T\u00e9l\u00e9chargement de la version...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=T\u00e9l\u00e9chargement de la version termin\u00e9
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=T\u00e9l\u00e9chargement de la version\u00a0: %s%% effectu\u00e9
INFO_CANCEL_BUTTON_LABEL=Annuler
INFO_CANCEL_BUTTON_TOOLTIP=Annuler l'op\u00e9ration en cours d'ex\u00e9cution
INFO_CANNOT_BIND_PORT=Impossible de cr\u00e9er une liaison avec le port %s.%n%nCe port est peut-\u00eatre d\u00e9j\u00e0 utilis\u00e9 par une autre application ou vous ne disposez \u00e9ventuellement pas des droits d'acc\u00e8s.
@@ -783,19 +780,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=ID de la version install\u00e9e \u00e0 l'emplacement ci-dessus
INFO_UPGRADE_BUILD_ID_UNKNOWN=Inconnu
INFO_UPGRADE_CANCELED=Mise \u00e0 niveau annul\u00e9e.
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>Erreur lors de l'acc\u00e8s aux informations de version.</b><br>Impossible de r\u00e9cup\u00e9rer la liste de versions depuis %s en raison de\u00a0: %s.<br>Causes possibles\u00a0:<br><ul><li>Besoin de sp\u00e9cifier un proxy.<br><table><tr><td><input value="Sp\u00e9cifier le Proxy" type="submit"></input></td><td>Proxy actuel\u00a0: %s<td></tr></table><br></li><li>%s ne fonctionne pas ou rencontre des probl\u00e8mes.</li></ul><br>Vous pouvez toujours poursuivre la mise \u00e0 niveau, mais vous devrez t\u00e9l\u00e9charger une version s\u00e9par\u00e9ment, puis pointer vers celle-ci dans l'assistant.
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=Chargement d'informations de version \u00e0 distance...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=Mise \u00e0 niveau bas\u00e9e sur une version hebdomadaire t\u00e9l\u00e9charg\u00e9e (.zip)
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=Chemin\u00a0:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=Mise \u00e0 niveau vers une version dont vous avez d\u00e9j\u00e0 t\u00e9l\u00e9charg\u00e9 le fichier .zip.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=Choisir une nouvelle version ou une version de r\u00e9f\u00e9rence \u00e0 utiliser pour la mise \u00e0 niveau.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=Choisir une nouvelle version
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=Lecture d'informations de version \u00e0 distance...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=Choisir une nouvelle version depuis www.forgerock.org/opendj.html
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=Versions nocturnes
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=T\u00e9l\u00e9charger et mettre \u00e0 niveau en une version disponible publiquement sur le site Web OpenDJ.
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=Versions hebdomadaires
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=Impossible d'acc\u00e9der aux informations de version \u00e0 distance.
INFO_UPGRADE_OPERATION_PROMPT=Voulez-vous mettre \u00e0 niveau cette installation en une version plus r\u00e9cente ou r\u00e9tablir une version ant\u00e9rieure\u00a0?
INFO_UPGRADE_OPERATION_REVERSION=R\u00e9tablir une version ant\u00e9rieure
INFO_UPGRADE_OPERATION_UPGRADE=Mettre \u00e0 niveau en une version plus r\u00e9cente
@@ -872,13 +861,6 @@
INFO_WARNING_ICON_TOOLTIP=Avertissement
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=Authentification\u00a0:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=Requis par le proxy
-INFO_WEB_PROXY_DLG_HOST_LABEL=H\u00f4te\u00a0:
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=Mot de passe\u00a0:
-INFO_WEB_PROXY_DLG_PORT_LABEL=Port\u00a0:
-INFO_WEB_PROXY_DLG_TITLE=Configuration de proxy Web
-INFO_WEB_PROXY_DLG_USER_LABEL=Utilisateur\u00a0:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=L\u2019outil %s QuickSetup vous invite \u00e0 d\u00e9finir quelques param\u00e8tres de configuration de base pour le serveur, puis rendre rapidement votre serveur op\u00e9rationnel.<br><br> %s requiert Java\u00a0SE\u00a06.0 ou version sup\u00e9rieure.<br><br> Pour plus d\u2019informations sur QuickSetup, consultez le <a href="%s">site de documentation de %s</a>.
INFO_WELCOME_PANEL_TITLE=Bienvenue
INFO_WELCOME_PANEL_WEBSTART_INSTRUCTIONS=L'outil %s QuickSetup va vous demander quelques param\u00e8tres de configuration de base pour le serveur et les donn\u00e9es, puis rendre rapidement votre serveur op\u00e9rationnel.<br><br>Vous pouvez \u00e9galement utiliser QuickSetup pour configurer une autre version de %s que vous avez t\u00e9l\u00e9charg\u00e9 manuellement. Pour ex\u00e9cuter QuickSetup dans ce cas, utiliser la commande %s \u00e0 partir du niveau sup\u00e9rieur du r\u00e9pertoire OpenDJ. Cette instance de QuickSetup va utiliser la version de %s suivante : %s (ID version : %s) <br><br> %s n\u00e9cessite Java SE version 6.0 ou sup\u00e9rieure.<br><br> Des informations suppl\u00e9mentaires sur QuickSetup sont disponibles dans le <a href="http://opendj.forgerock.org/doc/install-guide/OpenDJ-Install-Guide.html#chap-install-gui"> guide d'installation de %s</a>.
@@ -899,7 +881,6 @@
INFO_NEW_UPGRADE_SCRIPT_AVAILABLE=Une nouvelle version de '%s' est maintenant disponible. Apr\u00e8s cette op\u00e9ration, vous devez supprimer ce script et renommer '%s' en '%1$s'.
MILD_ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS=Erreur lors de la mise \u00e0 ce jour des scripts avec des propri\u00e9t\u00e9s java. Code d'erreur\u00a0: %d
SEVERE_ERR_INCOMPATIBLE_VERSION=La version Java minimale requise est %s.%n%nLa version d\u00e9tect\u00e9e est %s.%nLe binaire d\u00e9tect\u00e9 est %s%n%nConfigurez OPENDJ_JAVA_HOME \u00e0 la racine d'une installation Java compatible ou modifiez le fichier java.properties, puis ex\u00e9cutez le script dsjavaproperties pour sp\u00e9cifier la version java \u00e0 utiliser.
-SEVERE_ERR_INVALID_JAVA_ARGS=Les arguments Java utilis\u00e9s dans l'installation du serveur dans '%s' ne semblent pas compatibles avec la machine virtuelle Java servant \u00e0 ex\u00e9cuter le programme de mise \u00e0 niveau (%s).%n%nPour r\u00e9soudre le probl\u00e8me, supprimez le fichier %s et cliquez de nouveau sur 'Suivant'.%nApr\u00e8s l'ex\u00e9cution du programme de mise \u00e0 niveau, vous devez \u00e0 nouveau d\u00e9finir les arguments Java en ex\u00e9cutant la ligne de commande %s.
INFO_ADS_CONTEXT_EXCEPTION_MSG=Erreur sur les informations d'enregistrement. Type d'erreur : '%s'.
INFO_ADS_CONTEXT_EXCEPTION_WITH_DETAILS_MSG=Erreur sur les informations d'enregistrement. Type d'erreur : '%s'. D\u00e9tails\u00a0: %s
FATAL_ERR_ADS_MERGE=Impossible de fusionner les informations d'enregistrement des serveurs %s et %s. Raisons\u00a0:%n%s
diff --git a/opends/src/messages/messages/quicksetup_ja.properties b/opends/src/messages/messages/quicksetup_ja.properties
index f0fd9fa..053cfa8 100644
--- a/opends/src/messages/messages/quicksetup_ja.properties
+++ b/opends/src/messages/messages/quicksetup_ja.properties
@@ -66,9 +66,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=\u30d5\u30a1\u30a4\u30eb %s \u304c\u5b58\u5728\u3057\u307e\u305b\u3093\u3002
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=\u30d5\u30a1\u30a4\u30eb %s \u306f .zip \u30d5\u30a1\u30a4\u30eb\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
INFO_BUILD_EXTRACTOR_FILE_INVALID=%s \u304b\u3089\u6709\u52b9\u306a\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u62bd\u51fa\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u539f\u56e0: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=\u30d3\u30eb\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3044\u307e\u3059...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=\u30d3\u30eb\u30c9\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=\u30d3\u30eb\u30c9\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u4e2d: %s%% \u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f
INFO_CANCEL_BUTTON_LABEL=\u53d6\u6d88\u3057
INFO_CANCEL_BUTTON_TOOLTIP=\u73fe\u5728\u5b9f\u884c\u4e2d\u306e\u64cd\u4f5c\u3092\u53d6\u308a\u6d88\u3057\u307e\u3059
INFO_CANNOT_BIND_PORT=\u30dd\u30fc\u30c8 %s \u306b\u30d0\u30a4\u30f3\u30c9\u3067\u304d\u307e\u305b\u3093\u3002%n%n\u3053\u306e\u30dd\u30fc\u30c8\u306f\u5225\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308a\u3059\u3067\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u304b\u3001\u30dd\u30fc\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u6a29\u9650\u304c\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002
@@ -783,19 +780,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=\u4e0a\u8a18\u306e\u5834\u6240\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u30d3\u30eb\u30c9\u30d0\u30fc\u30b8\u30e7\u30f3\u306e ID
INFO_UPGRADE_BUILD_ID_UNKNOWN=\u4e0d\u660e
INFO_UPGRADE_CANCELED=\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u304c\u53d6\u308a\u6d88\u3055\u308c\u307e\u3057\u305f\u3002
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>\u30d3\u30eb\u30c9\u60c5\u5831\u3078\u306e\u30a2\u30af\u30bb\u30b9\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002</b><br>%s \u304b\u3089\u30d3\u30eb\u30c9\u306e\u30ea\u30b9\u30c8\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002\u7406\u7531: %s\u3002<br>\u8003\u3048\u3089\u308c\u308b\u539f\u56e0:<br><ul><li>\u30d7\u30ed\u30ad\u30b7\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br><table><tr><td><input value="\u30d7\u30ed\u30ad\u30b7\u306e\u6307\u5b9a" type="submit"></input></td><td>\u73fe\u5728\u306e\u30d7\u30ed\u30ad\u30b7: %s<td></tr></table><br></li><li>%s \u306f\u30c0\u30a6\u30f3\u3057\u3066\u3044\u308b\u304b\u3001\u969c\u5bb3\u304c\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002</li></ul><br>\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3092\u7d9a\u884c\u3067\u304d\u307e\u3059\u304c\u3001\u30d3\u30eb\u30c9\u3092\u5225\u500b\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30a6\u30a3\u30b6\u30fc\u30c9\u5185\u3067\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=\u30ea\u30e2\u30fc\u30c8\u30d3\u30eb\u30c9\u60c5\u5831\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u6e08\u307f\u306e\u9031\u6b21\u30d3\u30eb\u30c9 (.zip) \u306b\u57fa\u3065\u3044\u3066\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3059\u308b
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=\u30d1\u30b9:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u6e08\u307f\u306e .zip \u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3080\u30d3\u30eb\u30c9\u306b\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3057\u307e\u3059\u3002
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u306b\u4f7f\u7528\u3059\u308b\u65b0\u898f\u30d0\u30fc\u30b8\u30e7\u30f3\u307e\u305f\u306f\u53c2\u7167\u30d3\u30eb\u30c9\u3092\u9078\u629e\u3057\u307e\u3059\u3002
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u9078\u629e
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=\u30ea\u30e2\u30fc\u30c8\u30d3\u30eb\u30c9\u60c5\u5831\u3092\u8aad\u307f\u53d6\u3063\u3066\u3044\u307e\u3059...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=www.forgerock.org/opendj.html \u304b\u3089\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u9078\u629e\u3059\u308b
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=\u30ca\u30a4\u30c8\u30ea\u30fc\u30d3\u30eb\u30c9
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=OpenDJ Web \u30b5\u30a4\u30c8\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30d3\u30eb\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3057\u307e\u3059\u3002
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=\u9031\u6b21\u30d3\u30eb\u30c9
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=\u30ea\u30e2\u30fc\u30c8\u30d3\u30eb\u30c9\u60c5\u5831\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002
INFO_UPGRADE_OPERATION_PROMPT=\u3053\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3057\u307e\u3059\u304b\u3001\u305d\u308c\u3068\u3082\u4ee5\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u623b\u3057\u307e\u3059\u304b ?
INFO_UPGRADE_OPERATION_REVERSION=\u4ee5\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u623b\u3059
INFO_UPGRADE_OPERATION_UPGRADE=\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3059\u308b
@@ -872,13 +861,6 @@
INFO_WARNING_ICON_TOOLTIP=\u8b66\u544a
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=\u8a8d\u8a3c:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=\u30d7\u30ed\u30ad\u30b7\u3067\u5fc5\u8981
-INFO_WEB_PROXY_DLG_HOST_LABEL=\u30db\u30b9\u30c8:
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=\u30d1\u30b9\u30ef\u30fc\u30c9:
-INFO_WEB_PROXY_DLG_PORT_LABEL=\u30dd\u30fc\u30c8:
-INFO_WEB_PROXY_DLG_TITLE=Web \u30d7\u30ed\u30ad\u30b7\u69cb\u6210
-INFO_WEB_PROXY_DLG_USER_LABEL=\u30e6\u30fc\u30b6\u30fc:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=%s QuickSetup \u30c4\u30fc\u30eb\u306b\u3088\u308a\u3001\u57fa\u672c\u30b5\u30fc\u30d0\u30fc\u304a\u3088\u3073\u30c7\u30fc\u30bf\u69cb\u6210\u306e\u8a2d\u5b9a\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u8d77\u52d5\u3068\u7a3c\u50cd\u304c\u3059\u307f\u3084\u304b\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br><br> %s \u306b\u306f Java SE 6.0 \u4ee5\u964d\u306e\u30e9\u30f3\u30bf\u30a4\u30e0\u304c\u5fc5\u8981\u3067\u3059\u3002<br><br> QuickSetup \u306b\u3064\u3044\u3066\u306f\u3001<a href="%s"> %s \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30b5\u30a4\u30c8</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002
INFO_WELCOME_PANEL_TITLE=\u3088\u3046\u3053\u305d
INFO_WELCOME_PANEL_WEBSTART_INSTRUCTIONS=%s QuickSetup \u30c4\u30fc\u30eb\u306b\u3088\u308a\u3001\u57fa\u672c\u30b5\u30fc\u30d0\u30fc\u304a\u3088\u3073\u30c7\u30fc\u30bf\u69cb\u6210\u306e\u8a2d\u5b9a\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u30b5\u30fc\u30d0\u30fc\u306e\u8d77\u52d5\u3068\u7a3c\u50cd\u304c\u3059\u307f\u3084\u304b\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br><br>QuickSetup \u3092\u4f7f\u7528\u3057\u3066\u3001\u624b\u52d5\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d3\u30eb\u30c9\u3092 %s \u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 \u3053\u306e\u5834\u5408\u306b QuickSetup \u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001OpenDJ \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u6700\u4e0a\u4f4d\u3067 %s \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002 \u3053\u306e QuickSetup \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u6b21\u306e %s \u30d3\u30eb\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059: %s (\u30d3\u30eb\u30c9 ID: %s) <br><br> %s \u306b\u306f Java SE 6.0 \u4ee5\u964d\u306e\u30e9\u30f3\u30bf\u30a4\u30e0\u304c\u5fc5\u8981\u3067\u3059\u3002<br><br> QuickSetup \u306e\u8ffd\u52a0\u60c5\u5831\u306b\u3064\u3044\u3066\u306f\u3001<a href="http://opendj.forgerock.org/doc/install-guide/OpenDJ-Install-Guide.html#chap-install-gui">%s installation guide</a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002
@@ -899,7 +881,6 @@
INFO_NEW_UPGRADE_SCRIPT_AVAILABLE='%s' \u306e\u65b0\u898f\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u3053\u306e\u64cd\u4f5c\u306e\u3042\u3068\u3067\u3001\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u524a\u9664\u3057\u3001'%s' \u306e\u540d\u524d\u3092 '%1$s' \u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002
MILD_ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS=java \u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u3092\u4f7f\u7528\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 \u30a8\u30e9\u30fc\u30b3\u30fc\u30c9: %d
SEVERE_ERR_INCOMPATIBLE_VERSION=The minimum Java version required is %s.%n%nThe detected version is %s.%nThe binary detected is %s%n%nPlease set OPENDJ_JAVA_HOME to the root of a compatible Java installation or edit the java.properties file and then run the dsjavaproperties script to specify the java version to be used.
-SEVERE_ERR_INVALID_JAVA_ARGS='%s' \u3067\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u4f7f\u7528\u3055\u308c\u305f Java \u5f15\u6570\u306f\u3001\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u64cd\u4f5c\u306e\u5b9f\u884c\u306b\u4f7f\u7528\u3055\u308c\u305f Java \u4eee\u60f3\u30de\u30b7\u30f3\u3068\u4e92\u63db\u6027\u304c\u306a\u3044\u3088\u3046\u3067\u3059 (%s)\u3002%n%n\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u306b\u306f\u3001\u30d5\u30a1\u30a4\u30eb %s \u3092\u524a\u9664\u3057\u3001\u300c\u6b21\u3078\u300d\u3092\u3082\u3046\u4e00\u5ea6\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002%n\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u64cd\u4f5c\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u30b3\u30de\u30f3\u30c9\u884c %s \u3092\u5b9f\u884c\u3057\u3066 Java \u5f15\u6570\u3092\u8a2d\u5b9a\u3057\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002
INFO_ADS_CONTEXT_EXCEPTION_MSG=\u767b\u9332\u60c5\u5831\u30a8\u30e9\u30fc\u3002\u30a8\u30e9\u30fc\u306e\u30bf\u30a4\u30d7: '%s'\u3002
INFO_ADS_CONTEXT_EXCEPTION_WITH_DETAILS_MSG=\u767b\u9332\u60c5\u5831\u30a8\u30e9\u30fc\u3002\u30a8\u30e9\u30fc\u306e\u30bf\u30a4\u30d7: '%s'\u3002\u8a73\u7d30: %s
FATAL_ERR_ADS_MERGE=\u30b5\u30fc\u30d0\u30fc %s \u3068\u30b5\u30fc\u30d0\u30fc %s \u306e\u767b\u9332\u60c5\u5831\u3092\u30de\u30fc\u30b8\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u7406\u7531:%n%s
diff --git a/opends/src/messages/messages/quicksetup_ko.properties b/opends/src/messages/messages/quicksetup_ko.properties
index 22bbf92..644b9f1 100644
--- a/opends/src/messages/messages/quicksetup_ko.properties
+++ b/opends/src/messages/messages/quicksetup_ko.properties
@@ -65,9 +65,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=%s \ud30c\uc77c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=%s \ud30c\uc77c\uc774 .zip \ud30c\uc77c\uc774 \uc544\ub2d9\ub2c8\ub2e4.
INFO_BUILD_EXTRACTOR_FILE_INVALID=Could not extract a valid server installation from %s because: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=\ube4c\ub4dc\ub97c \ub2e4\uc6b4\ub85c\ub4dc\ud558\ub294 \uc911...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=\ube4c\ub4dc \ub2e4\uc6b4\ub85c\ub4dc\ub97c \uc644\ub8cc\ud588\uc2b5\ub2c8\ub2e4.
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=\ube4c\ub4dc \ub2e4\uc6b4\ub85c\ub4dc \uc911: %s%% \uc644\ub8cc\ub428
INFO_CANCEL_BUTTON_LABEL=\ucde8\uc18c
INFO_CANCEL_BUTTON_TOOLTIP=\ud604\uc7ac \uc2e4\ud589 \uc911\uc778 \uc791\uc5c5\uc744 \ucde8\uc18c\ud569\ub2c8\ub2e4.
INFO_CANNOT_BIND_PORT=%s \ud3ec\ud2b8\uc5d0 \ubc14\uc778\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.%n%n\ud3ec\ud2b8\ub97c \ub2e4\ub978 \uc751\uc6a9 \ud504\ub85c\uadf8\ub7a8\uc5d0\uc11c \uc774\ubbf8 \uc0ac\uc6a9\ud558\uace0 \uc788\uac70\ub098 \ud3ec\ud2b8\uc5d0 \uc561\uc138\uc2a4\ud560 \uc218 \uc788\ub294 \uad8c\ud55c\uc774 \uc5c6\ub294 \uac83 \uac19\uc2b5\ub2c8\ub2e4.
@@ -760,19 +757,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=\uc704\uc758 \uc704\uce58\uc5d0 \uc124\uce58\ub41c \ube4c\ub4dc \ubc84\uc804\uc758 \uc544\uc774\ub514\uc785\ub2c8\ub2e4.
INFO_UPGRADE_BUILD_ID_UNKNOWN=\uc54c \uc218 \uc5c6\uc74c
INFO_UPGRADE_CANCELED=\uc5c5\uadf8\ub808\uc774\ub4dc\uac00 \ucde8\uc18c\ub418\uc5c8\uc2b5\ub2c8\ub2e4.
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>\ube4c\ub4dc \uc815\ubcf4\ub97c \uc561\uc138\uc2a4\ud558\ub294 \ub3d9\uc548 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4.</b><br>\ub2e4\uc74c\uacfc \uac19\uc740 \uc774\uc720\ub85c %s\uc5d0\uc11c \ube4c\ub4dc \ubaa9\ub85d\uc744 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4: %s.<br>\uac00\ub2a5\ud55c \uc6d0\uc778:<br><ul><li>\ud504\ub85d\uc2dc\ub97c \uc9c0\uc815\ud574\uc57c \ud569\ub2c8\ub2e4.<br><table><tr><td><input value="Specify Proxy" type="submit"></input></td><td>\ud604\uc7ac \ud504\ub85d\uc2dc: %s<td></tr></table><br></li><li>%s\uc774(\uac00) \uc885\ub8cc\ub418\uc5c8\uac70\ub098 \ubb38\uc81c\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4.</li></ul><br>\uc5c5\uadf8\ub808\uc774\ub4dc\ub97c \uacc4\uc18d\ud560 \uc218 \uc788\uc9c0\ub9cc \ube4c\ub4dc\ub97c \ubcc4\ub3c4\ub85c \ub2e4\uc6b4\ub85c\ub4dc\ud55c \ub2e4\uc74c \ub9c8\ubc95\uc0ac\uc5d0\uc11c \uc774 \ube4c\ub4dc\ub97c \uac00\ub9ac\ucf1c\uc57c \ud569\ub2c8\ub2e4.
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=\uc6d0\uaca9 \ube4c\ub4dc \uc815\ubcf4\ub97c \ub85c\ub4dc\ud558\ub294 \uc911...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=\ub2e4\uc6b4\ub85c\ub4dc\ud55c \uc8fc \ub2e8\uc704 \ube4c\ub4dc(.zip)\ub97c \uae30\ubc18\uc73c\ub85c \uc5c5\uadf8\ub808\uc774\ub4dc
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=\uacbd\ub85c:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=\uc774\ubbf8 \ub2e4\uc6b4\ub85c\ub4dc\ud55c .zip \ud30c\uc77c\uc774 \uc788\ub294 \ube4c\ub4dc\ub85c \uc5c5\uadf8\ub808\uc774\ub4dc\ud569\ub2c8\ub2e4.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=\uc5c5\uadf8\ub808\uc774\ub4dc\uc5d0 \uc0ac\uc6a9\ud560 \uc0c8 \ubc84\uc804 \ub610\ub294 \ucc38\uc870 \ube4c\ub4dc\ub97c \uc120\ud0dd\ud569\ub2c8\ub2e4.
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=\uc0c8 \ubc84\uc804 \uc120\ud0dd
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=\uc6d0\uaca9 \ube4c\ub4dc \uc815\ubcf4\ub97c \uc77d\ub294 \uc911...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=www.forgerock.org/opendj.html\uc5d0\uc11c \uc0c8 \ubc84\uc804\uc744 \uc120\ud0dd\ud569\ub2c8\ub2e4.
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=\uc57c\uac04 \ube4c\ub4dc
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=\ub2e4\uc6b4\ub85c\ub4dc\ud558\uc5ec OpenDJ \uc6f9 \uc0ac\uc774\ud2b8\uc5d0\uc11c \uacf5\uac1c\uc801\uc73c\ub85c \uc0ac\uc6a9 \uac00\ub2a5\ud55c \ube4c\ub4dc\ub85c \uc5c5\uadf8\ub808\uc774\ub4dc\ud569\ub2c8\ub2e4.
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=\uc8fc \ub2e8\uc704 \ube4c\ub4dc
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=\uc6d0\uaca9 \ube4c\ub4dc \uc815\ubcf4\ub97c \uc561\uc138\uc2a4\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.
INFO_UPGRADE_OPERATION_PROMPT=\uc774 \uc124\uce58\ub97c \ucd5c\uc2e0 \ubc84\uc804\uc73c\ub85c \uc5c5\uadf8\ub808\uc774\ub4dc\ud558\uac70\ub098 \uc774\uc804 \ubc84\uc804\uc73c\ub85c \ubcc0\ud658\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?
INFO_UPGRADE_OPERATION_REVERSION=\uc774\uc804 \ubc84\uc804\uc73c\ub85c \ubcc0\ud658\ud569\ub2c8\ub2e4.
INFO_UPGRADE_OPERATION_UPGRADE=\ucd5c\uc2e0 \ubc84\uc804\uc73c\ub85c \uc5c5\uadf8\ub808\uc774\ub4dc\ud569\ub2c8\ub2e4.
@@ -848,13 +837,6 @@
INFO_WARNING_ICON_TOOLTIP=\uacbd\uace0
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=\uc778\uc99d:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=\ud504\ub85d\uc2dc\uc5d0\uc11c \uc694\uad6c\ud568
-INFO_WEB_PROXY_DLG_HOST_LABEL=\ud638\uc2a4\ud2b8:
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=\ube44\ubc00\ubc88\ud638:
-INFO_WEB_PROXY_DLG_PORT_LABEL=\ud3ec\ud2b8:
-INFO_WEB_PROXY_DLG_TITLE=\uc6f9 \ud504\ub85d\uc2dc \uad6c\uc131
-INFO_WEB_PROXY_DLG_USER_LABEL=\uc0ac\uc6a9\uc790:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=%s \ube60\ub978 \uc124\uce58 \ub3c4\uad6c\ub294 \uc0ac\uc6a9\uc790\uc5d0\uac8c \uae30\ubcf8 \uc11c\ubc84 \ubc0f \ub370\uc774\ud130 \uad6c\uc131 \uc124\uc815\uc5d0 \ub300\ud55c \uba87 \uac00\uc9c0 \uc9c8\ubb38\uc744 \ud55c \ud6c4 \uc11c\ubc84\ub97c \uc2e0\uc18d\ud558\uac8c \uc2dc\uc791 \ubc0f \uc2e4\ud589\ud558\ub3c4\ub85d \ud569\ub2c8\ub2e4.<br><br> %s \uc5d0\ub294 Java SE 6.0 \uc774\uc0c1\uc758 \ub7f0\ud0c0\uc784\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.<br><br> \ube60\ub978 \uc124\uce58\uc5d0 \ub300\ud55c \ucd94\uac00 \uc815\ubcf4\ub294 <a href="%s"> OpenDJ \uc124\uba85\uc11c </a>\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.
INFO_WELCOME_PANEL_TITLE=\uc2dc\uc791
INFO_WELCOME_PANEL_WEBSTART_INSTRUCTIONS=%s \ube60\ub978 \uc124\uce58 \ub3c4\uad6c\ub294 \uc0ac\uc6a9\uc790\uc5d0\uac8c \uae30\ubcf8 \uc11c\ubc84 \ubc0f \ub370\uc774\ud130 \uad6c\uc131 \uc124\uc815\uc5d0 \ub300\ud55c \uba87 \uac00\uc9c0 \uc9c8\ubb38\uc744 \ud55c \ud6c4 \uc11c\ubc84\ub97c \uc2e0\uc18d\ud558\uac8c \uc2dc\uc791 \ubc0f \uc2e4\ud589\ud558\ub3c4\ub85d \ud569\ub2c8\ub2e4.<br><br>\ube60\ub978 \uc124\uce58\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc218\ub3d9\uc73c\ub85c \ub2e4\uc6b4\ub85c\ub4dc\ud55c \uc8fc\uac04 \ube4c\ub4dc\ub97c \uc124\uce58\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uacbd\uc6b0 \ube60\ub978 \uc124\uce58\ub97c \uc2e4\ud589\ud558\ub824\uba74 %s \ub514\ub809\ud1a0\ub9ac\uc758 \ucd5c\uc0c1\uc704 \uc218\uc900\uc5d0\uc11c %s \uba85\ub839\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4. \ube60\ub978 \uc124\uce58\uc758 \uc774 \uc778\uc2a4\ud134\uc2a4\uc5d0\uc11c \ub2e4\uc74c %s \ube4c\ub4dc\ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4: %s(\ube4c\ub4dc \uc544\uc774\ub514: %s) <br><br> %s \uc5d0\ub294 Java SE 6.0 \uc774\uc0c1\uc758 \ub7f0\ud0c0\uc784\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.<br><br> \ube60\ub978 \uc124\uce58\uc5d0 \ub300\ud55c \ucd94\uac00 \uc815\ubcf4\ub294 <a href="http://opendj.forgerock.org/doc/install-guide/OpenDJ-Install-Guide.html#chap-install-gui"> %s \uc124\uce58 \ub9e4\ub274\uc5bc</a>\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.
diff --git a/opends/src/messages/messages/quicksetup_pl.properties b/opends/src/messages/messages/quicksetup_pl.properties
index 0a4adde..94cb5f7 100644
--- a/opends/src/messages/messages/quicksetup_pl.properties
+++ b/opends/src/messages/messages/quicksetup_pl.properties
@@ -77,7 +77,6 @@
INFO_UPGRADE_BUILD_ID_UNKNOWN=Nieznany
INFO_SUMMARY_INSTALL_FINISHED_WITH_ERROR=<b>Error</b><br>An error occurred. Sprawd\u017a pole tekstowe 'Szczeg\u00f3\u0142y' aby uzyska\u0107 wi\u0119cej informacji.<br>The server is %s.<br>To see server configuration status and to perform basic administration tasks on the server, click Launch Control Panel. Note that you can launch this tool later using %s.<br><INPUT type="submit" value="Launch Control Panel"></INPUT>
SEVERE_ERR_CANNOT_CONNECT_TO_REMOTE_COMMUNICATION=Could not connect to the remote server %s. Check that the server is running and that is accessible from the local machine. Szczeg\u00f3\u0142y: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=Pobieranie Build...
SEVERE_ERR_CANNOT_CONNECT_TO_LOCAL_PERMISSIONS=You do not have enough access rights to read the configuration in the server. %nProvide credentials with enough rights. Szczeg\u00f3\u0142y: %s
INFO_CERTIFICATE_DIALOG_DO_NOT_ACCEPT_BUTTON_TOOLTIP=Zamknij to okienko i nie akceptuj certyfikatu.
INFO_BROWSE_BUTTON_TOOLTIP=Kliknij aby wu\u015bwietli\u0107 przegl\u0105dark\u0119 systemu plik\u00f3w
@@ -86,7 +85,6 @@
INFO_CONFIRM_QUIT_INSTALL_TITLE=Wymagane potwierdzenie
INFO_CANNOT_CONNECT_TO_REMOTE_PERMISSIONS=You do not have enough access rights to read the configuration in %s. %nProvide credentials with enough rights. Szczeg\u00f3\u0142y: %s
INFO_CERTIFICATE_DIALOG_ACCEPT_PERMANENTLY_BUTTON_LABEL=Zaakceptuj na sta\u0142e
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=Zako\u0144czono Pobieranie Build
INFO_CERTIFICATE_ISSUED_BY_LABEL=Wydany przez:
INFO_CERTIFICATE_LABEL=Certyfikat:
SEVERE_ERR_CANNOT_CONNECT_TO_LOCAL_GENERIC=Could not connect to the server. Check that the server is running and that the provided credentials are valid.%nSzczeg\u00f3\u0142y b\u0142\u0119du:%n%s
@@ -94,7 +92,6 @@
INFO_SETUP_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS=%n%nThe graphical Setup launch failed. Sprawd\u017a plik %s aby uzyska\u0107 szczeg\u00f3\u0142owe informacje.%n%nLaunching command line setup...
INFO_CANCEL_BUTTON_LABEL=Anuluj
INFO_CERTIFICATE_DIALOG_ACCEPT_PERMANENTLY_BUTTON_TOOLTIP=Zamknij to okienko i zaakceptuj certyfikat na sta\u0142e.
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=Pobieranie Build: pobrano %s%%
INFO_CANNOT_USE_DEFAULT_ADMIN_CONNECTOR_PORT=Nie mo\u017cna u\u017cy\u0107 4444. Port w u\u017cyciu lub nieautoryzowany u\u017cytkownik.
INFO_HOST_NAME_LABEL=Nazwa Hosta:
INFO_SHUTDOWN_DIRECTORY_MANAGER_DIALOG_TITLE=Wymagana Autentykacja
diff --git a/opends/src/messages/messages/quicksetup_zh_CN.properties b/opends/src/messages/messages/quicksetup_zh_CN.properties
index 1637775..b200a25 100644
--- a/opends/src/messages/messages/quicksetup_zh_CN.properties
+++ b/opends/src/messages/messages/quicksetup_zh_CN.properties
@@ -66,9 +66,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=\u6587\u4ef6 %s \u4e0d\u5b58\u5728\u3002
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=\u6587\u4ef6 %s \u4e0d\u662f .zip \u6587\u4ef6\u3002
INFO_BUILD_EXTRACTOR_FILE_INVALID=\u65e0\u6cd5\u4ece %s \u4e2d\u63d0\u53d6\u6709\u6548\u7684\u670d\u52a1\u5668\u5b89\u88c5\uff0c\u539f\u56e0\u4e3a: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=\u6b63\u5728\u4e0b\u8f7d\u6784\u5efa\u7248\u672c...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=\u5df2\u5b8c\u6210\u6784\u5efa\u7248\u672c\u7684\u4e0b\u8f7d
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=\u6b63\u5728\u4e0b\u8f7d\u6784\u5efa\u7248\u672c\uff1a\u5df2\u5b8c\u6210 %s%%
INFO_CANCEL_BUTTON_LABEL=\u53d6\u6d88
INFO_CANCEL_BUTTON_TOOLTIP=\u53d6\u6d88\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u64cd\u4f5c
INFO_CANNOT_BIND_PORT=\u65e0\u6cd5\u7ed1\u5b9a\u5230\u7aef\u53e3 %s\u3002%n%n\u53ef\u80fd\u7684\u539f\u56e0\u4e3a\uff1a\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u5df2\u5728\u4f7f\u7528\u8be5\u7aef\u53e3\uff0c\u6216\u8005\u60a8\u6ca1\u6709\u8be5\u7aef\u53e3\u7684\u8bbf\u95ee\u6743\u9650\u3002
@@ -783,19 +780,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=\u5728\u4e0a\u8ff0\u4f4d\u7f6e\u5b89\u88c5\u7684\u6784\u5efa\u7248\u672c\u7684 ID
INFO_UPGRADE_BUILD_ID_UNKNOWN=\u672a\u77e5
INFO_UPGRADE_CANCELED=\u5df2\u53d6\u6d88\u5347\u7ea7\u3002
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>\u5728\u8bbf\u95ee\u6784\u5efa\u7248\u672c\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef\u3002</b><br>\u7531\u4e8e\u4ee5\u4e0b\u539f\u56e0\uff0c\u65e0\u6cd5\u4ece %s \u4e2d\u68c0\u7d22\u6784\u5efa\u7248\u672c\u5217\u8868: %s\u3002<br>\u53ef\u80fd\u7684\u539f\u56e0\u4e3a:<br><ul><li>\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u4ee3\u7406\u3002<br><table><tr><td><input value="\u6307\u5b9a\u4ee3\u7406" type="submit"></input></td><td>\u5f53\u524d\u4ee3\u7406: %s</td></tr></table><br></li><li>%s \u5df2\u5173\u95ed\u6216\u9047\u5230\u95ee\u9898\u3002</li></ul><br>\u60a8\u4ecd\u53ef\u4ee5\u7ee7\u7eed\u8fdb\u884c\u5347\u7ea7\uff0c\u4f46\u9700\u8981\u5355\u72ec\u4e0b\u8f7d\u4e00\u4e2a\u6784\u5efa\u7248\u672c\uff0c\u7136\u540e\u5728\u5411\u5bfc\u4e2d\u6307\u5411\u8be5\u7248\u672c\u3002
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=\u6b63\u5728\u52a0\u8f7d\u8fdc\u7a0b\u6784\u5efa\u7248\u672c\u4fe1\u606f...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=\u57fa\u4e8e\u4e0b\u8f7d\u7684\u6bcf\u5468\u6784\u5efa\u7248\u672c (.zip) \u8fdb\u884c\u5347\u7ea7
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=\u8def\u5f84:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=\u5347\u7ea7\u5230\u5df2\u4e0b\u8f7d\u5176 .zip \u6587\u4ef6\u7684\u6784\u5efa\u7248\u672c\u3002
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=\u9009\u62e9\u4e00\u4e2a\u65b0\u7248\u672c\uff0c\u6216\u8005\u5f15\u7528\u7528\u4e8e\u5347\u7ea7\u7684\u6784\u5efa\u7248\u672c\u3002
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=\u9009\u62e9\u65b0\u7248\u672c
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=\u6b63\u5728\u8bfb\u53d6\u8fdc\u7a0b\u6784\u5efa\u7248\u672c\u4fe1\u606f...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=\u4ece www.forgerock.org/opendj.html \u4e2d\u9009\u62e9\u65b0\u7248\u672c
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=\u6bcf\u665a\u6784\u5efa\u7248\u672c
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=\u4e0b\u8f7d OpenDJ Web \u7ad9\u70b9\u4e0a\u516c\u5f00\u53d1\u5e03\u7684\u6784\u5efa\u7248\u672c\u5e76\u8fdb\u884c\u5347\u7ea7\u3002
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=\u6bcf\u5468\u6784\u5efa\u7248\u672c
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=\u65e0\u6cd5\u8bbf\u95ee\u8fdc\u7a0b\u6784\u5efa\u7248\u672c\u4fe1\u606f\u3002
INFO_UPGRADE_OPERATION_PROMPT=\u662f\u8981\u5c06\u6b64\u5b89\u88c5\u5347\u7ea7\u5230\u8f83\u65b0\u7248\u672c\uff0c\u8fd8\u662f\u8fd8\u539f\u81f3\u8f83\u65e7\u7248\u672c\uff1f
INFO_UPGRADE_OPERATION_REVERSION=\u8fd8\u539f\u81f3\u4ee5\u524d\u7248\u672c
INFO_UPGRADE_OPERATION_UPGRADE=\u5347\u7ea7\u5230\u8f83\u65b0\u7248\u672c
@@ -872,13 +861,6 @@
INFO_WARNING_ICON_TOOLTIP=\u8b66\u544a
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=\u9a8c\u8bc1:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=\u4ee3\u7406\u6240\u5fc5\u9700\u7684
-INFO_WEB_PROXY_DLG_HOST_LABEL=\u4e3b\u673a:
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=\u5bc6\u7801:
-INFO_WEB_PROXY_DLG_PORT_LABEL=\u7aef\u53e3:
-INFO_WEB_PROXY_DLG_TITLE=Web \u4ee3\u7406\u914d\u7f6e
-INFO_WEB_PROXY_DLG_USER_LABEL=\u7528\u6237:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=%s \u5feb\u901f\u5b89\u88c5\u5de5\u5177\u5c06\u8981\u6c42\u60a8\u8fdb\u884c\u4e00\u4e9b\u57fa\u672c\u7684\u670d\u52a1\u5668\u548c\u6570\u636e\u914d\u7f6e\u8bbe\u7f6e\uff0c\u800c\u4e14\u4f1a\u5feb\u901f\u542f\u52a8\u5e76\u8fd0\u884c\u670d\u52a1\u5668\u3002<br><br>%s \u9700\u8981 Java SE 6.0 \u6216\u66f4\u9ad8\u7248\u672c\u7684\u8fd0\u884c\u65f6\u73af\u5883\u3002<br><br>\u5173\u4e8e\u5feb\u901f\u5b89\u88c5\u7684\u9644\u52a0\u4fe1\u606f\u4f4d\u4e8e<a href="%s"> %s \u6587\u6863\u7ad9\u70b9</a>\u4e0a\u3002
INFO_WELCOME_PANEL_TITLE=\u6b22\u8fce\u4f7f\u7528
INFO_WELCOME_PANEL_WEBSTART_INSTRUCTIONS=%s \u5feb\u901f\u5b89\u88c5\u5de5\u5177\u5c06\u8981\u6c42\u60a8\u8fdb\u884c\u4e00\u4e9b\u57fa\u672c\u7684\u670d\u52a1\u5668\u548c\u6570\u636e\u914d\u7f6e\u8bbe\u7f6e\uff0c\u800c\u4e14\u4f1a\u5feb\u901f\u542f\u52a8\u5e76\u8fd0\u884c\u670d\u52a1\u5668\u3002<br><br>\u60a8\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5feb\u901f\u5b89\u88c5\u6765\u5bf9\u624b\u52a8\u4e0b\u8f7d\u7684\u6bcf\u5468\u6784\u5efa\u7248\u672c\u8fdb\u884c\u5b89\u88c5\u3002\u8981\u5728\u6b64\u60c5\u51b5\u4e0b\u8fd0\u884c\u5feb\u901f\u5b89\u88c5\uff0c\u8bf7\u4f7f\u7528 %s \u76ee\u5f55\u9876\u5c42\u7684 %s \u547d\u4ee4\u3002\u6b64\u5feb\u901f\u5b89\u88c5\u5b9e\u4f8b\u5c06\u4f7f\u7528\u4ee5\u4e0b %s \u6784\u5efa\u7248\u672c: %s\uff08\u7248\u672c ID: %s\uff09<br><br>%s \u9700\u8981 Java SE 6.0 \u6216\u66f4\u9ad8\u7248\u672c\u7684\u8fd0\u884c\u65f6\u73af\u5883\u3002<br><br>\u6709\u5173\u5feb\u901f\u5b89\u88c5\u7684\u5176\u4ed6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605 <a href="http://opendj.forgerock.org/doc/install-guide/OpenDJ-Install-Guide.html#chap-install-gui">%s \u5b89\u88dd\u6307\u5357</a>\u3002
@@ -899,7 +881,6 @@
INFO_NEW_UPGRADE_SCRIPT_AVAILABLE=\u5df2\u53d1\u5e03\u65b0\u7684 '%s' \u7248\u672c\u3002\u5728\u6267\u884c\u6b64\u64cd\u4f5c\u540e\uff0c\u5e94\u5220\u9664\u8be5\u811a\u672c\uff0c\u5e76\u5c06 '%s' \u91cd\u547d\u540d\u4e3a '%1$s'\u3002
MILD_ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS=\u5728\u4f7f\u7528 Java \u5c5e\u6027\u66f4\u65b0\u811a\u672c\u65f6\u51fa\u73b0\u9519\u8bef\u3002\u9519\u8bef\u4ee3\u7801: %d
SEVERE_ERR_INCOMPATIBLE_VERSION=\u6240\u9700\u7684\u6700\u4f4e Java \u7248\u672c\u4e3a %s\u3002%n%n\u68c0\u6d4b\u5230\u7684\u7248\u672c\u4e3a %s\u3002%n\u68c0\u6d4b\u5230\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u4e3a %s%n%n\\u8bf7\u5c06 OPENDJ_JAVA_HOME \u8bbe\u7f6e\u4e3a\u517c\u5bb9 Java \u5b89\u88c5\u7684\u6839\u76ee\u5f55\uff1b\u6216\u8005\u7f16\u8f91 java.properties \u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884c dsjavaproperties \u811a\u672c\u4ee5\u6307\u5b9a\u8981\u4f7f\u7528\u7684 Java \u7248\u672c\u3002
-SEVERE_ERR_INVALID_JAVA_ARGS='%s' \u4e2d\u7684\u670d\u52a1\u5668\u5b89\u88c5\u4e2d\u4f7f\u7528\u7684 Java \u53c2\u6570\u4f3c\u4e4e\u4e0d\u4e0e\u7528\u4e8e\u8fd0\u884c\u5347\u7ea7\u7a0b\u5e8f (%s) \u7684 Java \u865a\u62df\u673a\u517c\u5bb9\u3002%n%n \u5982\u679c\u9700\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u8bf7\u5220\u9664%s\u6587\u4ef6\u5e76\u91cd\u65b0\u70b9\u51fb'\u4e0b\u4e00\u6b65'.%n\u5f53\u5347\u7ea7\u5b8c\u6210\u540e\uff0c\u4f60\u9700\u8981\u91cd\u65b0\u8fd0\u884c%s\u547d\u4ee4\u6765\u8bbe\u7f6eJAVA\u7684\u53c2\u6570.
INFO_ADS_CONTEXT_EXCEPTION_MSG=\u6ce8\u518c\u4fe1\u606f\u9519\u8bef\u3002\u9519\u8bef\u7c7b\u578b: '%s'\u3002
INFO_ADS_CONTEXT_EXCEPTION_WITH_DETAILS_MSG=\u6ce8\u518c\u4fe1\u606f\u9519\u8bef\u3002\u9519\u8bef\u7c7b\u578b: '%s'\u3002\u8be6\u7ec6\u4fe1\u606f: %s
FATAL_ERR_ADS_MERGE=\u4e0d\u80fd\u5408\u5e76\u670d\u52a1\u5668 %s \u4e0e\u670d\u52a1\u5668 %s \u7684\u6ce8\u518c\u4fe1\u606f\u3002\u539f\u56e0:%n%s
diff --git a/opends/src/messages/messages/quicksetup_zh_TW.properties b/opends/src/messages/messages/quicksetup_zh_TW.properties
index 0eb38f7..a263d4a 100644
--- a/opends/src/messages/messages/quicksetup_zh_TW.properties
+++ b/opends/src/messages/messages/quicksetup_zh_TW.properties
@@ -66,9 +66,6 @@
INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST=\u6a94\u6848 %s \u4e0d\u5b58\u5728\u3002
INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP=\u6a94\u6848 %s \u4e0d\u662f .zip \u6a94\u3002
INFO_BUILD_EXTRACTOR_FILE_INVALID=Could not extract a valid server installation from %s because: %s
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD=\u6b63\u5728\u4e0b\u8f09\u5efa\u7f6e...
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE=\u5efa\u7f6e\u4e0b\u8f09\u5df2\u5b8c\u6210
-INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS=\u6b63\u5728\u4e0b\u8f09\u5efa\u7f6e: %s%% \u5df2\u5b8c\u6210
INFO_CANCEL_BUTTON_LABEL=\u53d6\u6d88
INFO_CANCEL_BUTTON_TOOLTIP=\u53d6\u6d88\u76ee\u524d\u57f7\u884c\u7684\u4f5c\u696d
INFO_CANNOT_BIND_PORT=\u7121\u6cd5\u9023\u7d50\u81f3\u9023\u63a5\u57e0 %s\u3002%n%n\u53ef\u80fd\u5df2\u6709\u5176\u4ed6\u61c9\u7528\u7a0b\u5f0f\u4f7f\u7528\u8a72\u9023\u63a5\u57e0\uff0c\u6216\u60a8\u6c92\u6709\u8a72\u9023\u63a5\u57e0\u7684\u5b58\u53d6\u6b0a\u9650\u3002
@@ -761,19 +758,11 @@
INFO_UPGRADE_BUILD_ID_TOOLTIP=\u5b89\u88dd\u5728\u4e0a\u8ff0\u4f4d\u7f6e\u4e2d\u7684\u5efa\u7f6e\u7248\u672c ID
INFO_UPGRADE_BUILD_ID_UNKNOWN=\u4e0d\u660e
INFO_UPGRADE_CANCELED=\u5347\u7d1a\u5df2\u53d6\u6d88\u3002
-INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR=<b>\u5b58\u53d6\u5efa\u7f6e\u8cc7\u8a0a\u6642\u767c\u751f\u932f\u8aa4\u3002</b><br>\u7121\u6cd5\u5f9e %s \u64f7\u53d6\u5efa\u7f6e\u6e05\u55ae\uff0c\u539f\u56e0\u70ba: %s\u3002<br>\u53ef\u80fd\u7684\u539f\u56e0:<br><ul><li>\u5fc5\u9808\u6307\u5b9a\u4ee3\u7406\u4f3a\u670d\u5668\u3002<br><table><tr><td><input value="Specify Proxy" type="submit"></input></td><td>\u76ee\u524d\u7684\u4ee3\u7406\u4f3a\u670d\u5668: %s<td></tr></table><br></li><li>%s \u5df2\u6545\u969c\u6216\u767c\u751f\u554f\u984c\u3002</li></ul><br>\u60a8\u4ecd\u53ef\u7e7c\u7e8c\u9032\u884c\u5347\u7d1a\uff0c\u4f46\u5c07\u5fc5\u9808\u500b\u5225\u4e0b\u8f09\u5efa\u7f6e\uff0c\u7136\u5f8c\u5728\u7cbe\u9748\u4e2d\u6307\u5411\u8a72\u5efa\u7f6e\u3002
-INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO=\u6b63\u5728\u8f09\u5165\u9060\u7aef\u5efa\u7f6e\u8cc7\u8a0a...
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL=\u4ee5\u4e0b\u8f09\u7684\u6bcf\u9031\u66f4\u65b0\u7248 (.zip) \u70ba\u57fa\u790e\u7684\u5347\u7d1a
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH=\u8def\u5f91:
INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP=\u5347\u7d1a\u70ba\u60a8\u5df2\u4e0b\u8f09\u4e4b .zip \u6a94\u6240\u542b\u7684\u5efa\u7f6e\u3002
INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS=\u9078\u64c7\u65b0\u7248\u672c\u6216\u53c3\u7167\u5efa\u7f6e\uff0c\u7528\u4ee5\u9032\u884c\u5347\u7d1a\u3002
INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE=\u9078\u64c7\u65b0\u7248\u672c
-INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO=\u6b63\u5728\u8b80\u53d6\u9060\u7aef\u5efa\u7f6e\u8cc7\u8a0a...
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL=\u5f9e www.forgerock.org/opendj.html \u9078\u64c7\u65b0\u7248\u672c
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_NIGHTLY=\u6bcf\u65e5\u66f4\u65b0\u7248
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP=\u4e0b\u8f09 OpenDJ \u7db2\u7ad9\u4e0a\u516c\u958b\u63d0\u4f9b\u7684\u5efa\u7f6e\uff0c\u4e26\u9032\u884c\u5347\u7d1a\u3002
-INFO_UPGRADE_CHOOSE_VERSION_REMOTE_WEEKLY=\u6bcf\u9031\u66f4\u65b0\u7248
-INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO=\u7121\u6cd5\u5b58\u53d6\u9060\u7aef\u5efa\u7f6e\u8cc7\u8a0a\u3002
INFO_UPGRADE_OPERATION_PROMPT=\u60a8\u8981\u5c07\u6b64\u5b89\u88dd\u5347\u7d1a\u70ba\u8f03\u65b0\u7684\u7248\u672c\uff0c\u6216\u5fa9\u539f\u70ba\u820a\u7248\u672c\u55ce\uff1f
INFO_UPGRADE_OPERATION_REVERSION=\u5fa9\u539f\u70ba\u820a\u7248
INFO_UPGRADE_OPERATION_UPGRADE=\u5347\u7d1a\u70ba\u65b0\u7248
@@ -850,13 +839,6 @@
INFO_WARNING_ICON_TOOLTIP=\u8b66\u544a
# Only translate if the image is specific to the local
INFO_WARNING_LARGE_ICON=images/warning_large.gif
-INFO_WEB_PROXY_DLG_AUTH_LABEL=\u8a8d\u8b49:
-INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL=\u4ee3\u7406\u4f3a\u670d\u5668\u7684\u5fc5\u8981\u9805\u76ee
-INFO_WEB_PROXY_DLG_HOST_LABEL=\u4e3b\u6a5f\uff1a
-INFO_WEB_PROXY_DLG_PASSWORD_LABEL=\u5bc6\u78bc:
-INFO_WEB_PROXY_DLG_PORT_LABEL=\u9023\u63a5\u57e0:
-INFO_WEB_PROXY_DLG_TITLE=Web \u4ee3\u7406\u4f3a\u670d\u5668\u914d\u7f6e
-INFO_WEB_PROXY_DLG_USER_LABEL=\u4f7f\u7528\u8005:
INFO_WELCOME_PANEL_OFFLINE_INSTRUCTIONS=%s QuickSetup \u5de5\u5177\u6703\u8981\u6c42\u60a8\u63d0\u4f9b\u67d0\u4e9b\u57fa\u672c\u4f3a\u670d\u5668\u8207\u8cc7\u6599\u914d\u7f6e\u8a2d\u5b9a\uff0c\u4e26\u6703\u5feb\u901f\u555f\u52d5\u4e26\u57f7\u884c\u60a8\u7684\u4f3a\u670d\u5668\u3002<br><br>%s \u9700\u8981 Java SE 6.0 \u6216\u66f4\u9ad8\u7684\u57f7\u884c\u968e\u6bb5\u3002<br><br>\u95dc\u65bc\u5feb\u901f\u5b89\u88dd\u7684\u9644\u52a0\u4fe1\u606f\u4f4d\u65bc<a href="%s">%s \u6587\u6863\u7ad9\u70b9</a>\u3002
INFO_WELCOME_PANEL_TITLE=\u6b61\u8fce\u4f7f\u7528
INFO_WELCOME_PANEL_WEBSTART_INSTRUCTIONS=%s QuickSetup \u5de5\u5177\u6703\u8981\u6c42\u60a8\u63d0\u4f9b\u67d0\u4e9b\u57fa\u672c\u4f3a\u670d\u5668\u8207\u8cc7\u6599\u914d\u7f6e\u8a2d\u5b9a\uff0c\u4e26\u6703\u5feb\u901f\u555f\u52d5\u4e26\u57f7\u884c\u60a8\u7684\u4f3a\u670d\u5668\u3002<br><br>\u60a8\u4e5f\u53ef\u4ee5\u4f7f\u7528 QuickSetup \u8a2d\u5b9a\u60a8\u624b\u52d5\u4e0b\u8f09\u7684\u6bcf\u9031\u66f4\u65b0\u7248\u3002\u82e5\u8981\u57f7\u884c\u6b64\u6848\u4f8b\u4e2d\u7684 QuickSetup\uff0c\u8acb\u5728 %s \u76ee\u9304\u7684\u9802\u5c64\u4f7f\u7528 %s \u6307\u4ee4\u3002\u6b64 QuickSetup \u5be6\u4f8b\u6703\u4f7f\u7528\u4e0b\u5217 %s \u5efa\u7f6e: %s (\u5efa\u7f6e ID: %s) <br><br> %s \u9700\u8981 Java SE 6.0 \u6216\u66f4\u9ad8\u7684\u57f7\u884c\u968e\u6bb5\u3002<br><br>\u5982\u9700 QuickSetup \u7684\u5176\u4ed6\u8cc7\u8a0a\uff0c\u8acb\u53c3\u95b1 <a href="http://opendj.forgerock.org/doc/install-guide/OpenDJ-Install-Guide.html#chap-install-gui">%s \u5b89\u88dd\u6307\u5357</a>\u3002
diff --git a/opends/src/messages/messages/tools.properties b/opends/src/messages/messages/tools.properties
index 861e82e..77563f2 100644
--- a/opends/src/messages/messages/tools.properties
+++ b/opends/src/messages/messages/tools.properties
@@ -2604,4 +2604,98 @@
INFO_LDIFDIFF_DESCRIPTION_USE_COMPARE_RESULT_1735=Use the LDAP compare result \
as an exit code for reporting differences between the two LDIF files
INFO_LDAPCOMPARE_DESCRIPTION_USE_COMPARE_RESULT_1736=Use the LDAP compare result \
-as an exit code for the LDAP compare operations
\ No newline at end of file
+as an exit code for the LDAP compare operations
+SEVERE_ERR_BUILDVERSION_NOT_FOUND_1737=The version of the installed OpenDJ could not be determined \
+because the version file '%s' could not be found. Restore it from backup before continuing
+SEVERE_ERR_BUILDVERSION_MALFORMED_1738=The version of the installed OpenDJ could not be determined \
+because the version file '%s' exists but contains invalid data. \
+Restore it from backup before continuing
+SEVERE_ERR_BUILDVERSION_MISMATCH_1739=The OpenDJ binary version '%s' does not match the installed \
+version '%s'. Please run upgrade before continuing
+INFO_UPGRADE_OPTION_IGNORE_ERRORS_1740=Ignores any errors which occur during the upgrade. This option \
+should be used with caution and may be useful in automated deployments where potential errors are \
+known in advance and resolved after the upgrade has completed
+INFO_UPGRADE_OPTION_FORCE_1741=Forces a non-interactive upgrade to continue even if it requires user \
+interaction. In particular, long running or critical upgrade tasks, such as re-indexing, which \
+require user confirmation will be skipped. This option may only be used with the '%s' option
+SEVERE_ERR_UPGRADE_USER_INTERACTION_REQUIRED_1742=The upgrade cannot be performed non-interactively \
+because one or more upgrade tasks are critical and require user interaction in order to complete. \
+Please re-run upgrade interactively by removing the '%s' option, or force the upgrade to complete \
+by specifying the '%s' option
+INFO_UPGRADE_DESCRIPTION_CLI_1743=Upgrades OpenDJ configuration and application data so that it is \
+compatible with the installed binaries.%n%nThis tool should be run immediately after upgrading \
+the OpenDJ binaries and before restarting the server.%n%nNOTE: this tool does not provide backup \
+or restore capabilities. Therefore, it is the responsibility of the OpenDJ administrator to take \
+necessary precautions before performing the upgrade
+SEVERE_ERR_UPGRADE_MAIN_UPGRADE_PROCESS_1800=The upgrade failed to complete for the following reason: %s
+INFO_UPGRADE_SUCCESSFUL_1802=OpenDJ was successfully upgraded from version %s to %s
+INFO_UPGRADE_PERFORMING_TASKS_1804=Performing upgrade
+INFO_UPGRADE_TITLE_1805=OpenDJ Upgrade Utility
+INFO_UPGRADE_SUMMARY_1806=OpenDJ will be upgraded from version %s to %s
+SEVERE_ERR_UPGRADE_REQUIRES_SERVER_OFFLINE_1811=OpenDJ cannot be upgraded because the server is currently \
+running. Please stop the server and try again
+SEVERE_ERR_UPGRADE_VERSION_UP_TO_DATE_1812=OpenDJ has already been upgraded to version %s
+SEVERE_ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR_1813=An unexpected error occurred \
+while attempting to display a notification: %s
+SEVERE_ERR_UPGRADE_DISPLAY_CONFIRM_ERROR_1814=An unexpected error occurred \
+while attempting to display a confirmation : %s
+SEVERE_ERR_UPGRADE_DISPLAY_CHECK_ERROR_1815=An unexpected error occurred \
+while attempting to check a user's option: %s
+SEVERE_ERR_UPGRADE_INVALID_USER_OPTIONS_SELECTED_1816=Invalid user's \
+options selected
+INFO_UPGRADE_CHANGE_DONE_IN_SPECIFIC_FILE_1817=...Change(s) done in %s (x%s)
+INFO_UPGRADE_NO_CHANGE_DONE_IN_SPECIFIC_FILE_1818=...No change applied in %s
+SEVERE_ERR_UPGRADE_TASKS_FAIL_1827=\nAn error occurred while performing an upgrade task: %s
+INFO_UPGRADE_TASK_NEEDS_USER_CONFIRM_1828=%s.%nDo you want to make this configuration change?
+INFO_UPGRADE_DISPLAY_CONFIRM_START_1829=The upgrade is ready to proceed. Do you \
+wish to continue?
+INFO_UPGRADE_ABORTED_BY_USER_1830=The upgrade has been canceled
+SEVERE_ERR_UPGRADE_UNKNOWN_OC_ATT_1831=The %s %s doesn't exist \
+in the template configuration
+SEVERE_ERR_UPGRADE_CONFIG_ERROR_UPGRADE_FOLDER_1832=An error occurred when \
+trying to upgrade the config/upgrade folder: %s
+INFO_UPGRADE_REQUIREMENTS_1833=Preparing to upgrade
+INFO_UPGRADE_VERSION_IS_NOT_SUPPORTED_1836=This tool cannot be used for \
+upgrading versions of OpenDJ which are older than '%s'. Please upgrade to \
+'%s' first before attempting further upgrades
+INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE_1837=Invalid response
+INFO_LICENSE_DETAILS_CLI_LABEL_1838=Please read the License Agreement above.%n\
+ You must accept the terms of the agreement before continuing with the \
+ installation
+INFO_LICENSE_ACCEPT_1839=Do you accept the License Agreement?
+INFO_ERROR_COPYING_FILE_1840=An error occurred while copying the file '%s' to '%s'
+INFO_ERROR_DELETING_DIRECTORY_1841=An error occurred while deleting directory '%s'. \
+ Check that you have the rights to delete this directory and that there is no other \
+ application using it
+INFO_ERROR_DELETING_FILE_1843=An error occurred while deleting file '%s'. Check \
+that you have the rights to delete this file and that there is no other application using it
+INFO_ERROR_RENAMING_FILE_1844=An error occurred while renaming file '%s' to '%s'
+SEVERE_ERR_UPGRADE_FAILS_1846=The upgrade failed because %d errors were \
+encountered. Please check log for further details
+SEVERE_ERR_UPGRADE_COPYSCHEMA_FAILS_1847=An error occurred while copying \
+the schema file '%s': %s
+SEVERE_ERR_UPGRADE_ADDATTRIBUTE_FAILS_1848=An error occurred while adding \
+one or more attributes to the schema file '%s': %s
+SEVERE_ERR_UPGRADE_ADDOBJECTCLASS_FAILS_1849=An error occurred while adding \
+one or more object classes to the schema file '%s': %s
+INFO_UPGRADE_GENERAL_SEE_FOR_DETAILS_1850=See '%s' for a detailed log of this operation
+INFO_UPGRADE_TASK_REPLACE_SCHEMA_FILE_1851=Replacing schema file '%s'
+INFO_UPGRADE_TASK_REFRESH_UPGRADE_DIRECTORY_1852=Archiving concatenated schema
+
+# Upgrade tasks
+INFO_UPGRADE_TASK_6869_SUMMARY_10000=Fixing de-DE collation matching rule OID
+INFO_UPGRADE_TASK_7192_SUMMARY_10001=Updating password policy configurations
+INFO_UPGRADE_TASK_7364_SUMMARY_10002=Updating audit log publisher configuration
+INFO_UPGRADE_TASK_7748_1_SUMMARY_10003=Adding 'etag' virtual attribute schema
+INFO_UPGRADE_TASK_7748_2_SUMMARY_10004=Configuring 'etag' virtual attribute
+INFO_UPGRADE_TASK_7834_SUMMARY_10005=Configuring 'ds-pwp-password-expiration-time' virtual attribute
+INFO_UPGRADE_TASK_7979_SUMMARY_10006=Updating certificate syntax configuration
+INFO_UPGRADE_TASK_8124_SUMMARY_10007=Updating JPEG syntax configuration
+INFO_UPGRADE_TASK_8133_SUMMARY_10008=Updating country string syntax configuration
+INFO_UPGRADE_TASK_8214_SUMMARY_10009=Modifying filter in 'isMemberOf' virtual attribute configuration
+INFO_UPGRADE_TASK_8214_DESCRIPTION_10010=OpenDJ 2.5.0 modified the default configuration of the 'isMemberOf' \
+virtual attribute so that it is included with group entries. This was done in order to make it easier \
+for users to determine which groups a 'nested' group belongs to
+INFO_UPGRADE_TASK_8387_SUMMARY_10011=Updating dictionary password validator configuration
+INFO_UPGRADE_TASK_8389_SUMMARY_10012=Updating attribute value password validator configuration
+INFO_UPGRADE_TASK_8487_SUMMARY_10013=Adding PBKDF2 password storage scheme configuration
diff --git a/opends/src/messages/messages/utility.properties b/opends/src/messages/messages/utility.properties
index ceb96b7..bff46ff 100644
--- a/opends/src/messages/messages/utility.properties
+++ b/opends/src/messages/messages/utility.properties
@@ -624,4 +624,4 @@
was received when reading its attributes: %s
SEVERE_ERR_LDAP_CONN_BAD_INTEGER_302=Invalid integer number "%s". Please \
enter a valid integer
-
+SEVERE_ERR_ARG_SUBCOMMAND_INVALID_303=Invalid subcommand
\ No newline at end of file
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opends/src/quicksetup/org/opends/quicksetup/Application.java
index 375e9f0..0dccca2 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -40,7 +40,6 @@
import org.opends.admin.ads.util.ServerLoader;
import org.opends.quicksetup.event.ProgressNotifier;
import org.opends.quicksetup.event.ProgressUpdateListener;
-import org.opends.quicksetup.util.ServerController;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.UIKeyStore;
import org.opends.quicksetup.ui.GuiApplication;
@@ -52,7 +51,6 @@
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.logging.Level;
@@ -63,8 +61,7 @@
/**
* This class represents an application that can be run in the context of
- * QuickSetup. Examples of applications might be 'installer', 'uninstaller'
- * and 'upgrader'.
+ * QuickSetup. Examples of applications might be 'installer' and 'uninstaller'.
*/
public abstract class Application implements ProgressNotifier, Runnable {
@@ -78,8 +75,6 @@
private Installation installation;
- private ServerController serverController;
-
private ApplicationTrustManager trustManager;
private boolean notifyListeners = true;
@@ -174,7 +169,7 @@
}
/**
- * Gets the OpenDS installation associated with the execution of this
+ * Gets the OpenDJ installation associated with the execution of this
* command.
* @return Installation object representing the current OpenDS installation
*/
@@ -204,16 +199,6 @@
this.installation = installation;
}
- /**
- * Gets a server controller for use by this application.
- * @return ServerController that can be used to start and stop the server.
- */
- public ServerController getServerController() {
- if (serverController == null) {
- serverController = new ServerController(this);
- }
- return serverController;
- }
/**
* Returns the UserData object representing the parameters provided by
@@ -321,15 +306,6 @@
}
/**
- * Returns the formatted text string 'Error' with a line break at the end.
- * @return formatted 'Error'
- */
- protected Message getFormattedErrorWithLineBreak() {
- return new MessageBuilder(formatter.getFormattedError())
- .append(formatter.getLineBreak()).toMessage();
- }
-
- /**
* Returns the formatted representation of an error for a given text.
* @param text the source text from which we want to get the formatted
* representation
@@ -341,39 +317,6 @@
}
/**
- * Returns the formatted representation of an error message for a given
- * exception.
- * This method applies a margin if the applyMargin parameter is
- * <CODE>true</CODE>.
- * @param m the exception.
- * @param b specifies whether we apply a margin or not to the
- * resulting formatted text.
- * @return the formatted representation of an error message for the given
- * exception.
- */
- protected Message getFormattedErrorWithLineBreak(Message m, boolean b) {
- return new MessageBuilder(formatter.getFormattedError(m,b))
- .append(formatter.getLineBreak()).toMessage();
- }
-
- /**
- * Returns the formatted representation of an error message for a given
- * exception.
- * This method applies a margin if the applyMargin parameter is
- * <CODE>true</CODE>.
- * @param t the exception.
- * @param b specifies whether we apply a margin or not to the
- * resulting formatted text.
- * @return the formatted representation of an error message for the given
- * exception.
- */
- protected Message getFormattedErrorWithLineBreak(Throwable t, boolean b) {
- return new MessageBuilder(formatter.getFormattedError(t,b))
- .append(formatter.getLineBreak()).toMessage();
- }
-
-
- /**
* Returns the formatted representation of an warning for a given text.
* @param text the source text from which we want to get the formatted
* representation
@@ -495,22 +438,6 @@
}
/**
- * Returns the formatted representation of an error message for a given
- * exception.
- * This method applies a margin if the applyMargin parameter is
- * <CODE>true</CODE>.
- * @param m the message.
- * @param applyMargin specifies whether we apply a margin or not to the
- * resulting formatted text.
- * @return the formatted representation of an error message for the given
- * exception.
- */
- protected Message getFormattedError(Message m, boolean applyMargin)
- {
- return formatter.getFormattedError(m, applyMargin);
- }
-
- /**
* Returns the line break formatted.
* @return the line break formatted.
*/
@@ -660,17 +587,6 @@
}
/**
- * Makes available a <code>UserInteraction</code> class that can be used
- * by the application to interact with the user. If the user has requested
- * a quiet session this method returns null.
- * @return UserInteraction object
- */
- public UserInteraction userInteraction() {
- // Note: overridden in GuiApplication
- return new CliUserInteraction(getUserData());
- }
-
- /**
* Conditionally notifies listeners of the log file if it
* has been initialized.
*/
@@ -697,59 +613,6 @@
}
/**
- * Writes an initial record in the installation's historical
- * log describing moving from one version to another.
- * @param fromVersion from with install will be migrated
- * @param toVersion to which install will be migrated
- * @return Long ID for this session
- * @throws ApplicationException if something goes wrong
- */
- protected Long writeInitialHistoricalRecord(
- BuildInformation fromVersion,
- BuildInformation toVersion)
- throws ApplicationException {
- Long id;
- try {
- HistoricalLog log =
- new HistoricalLog(getInstallation().getHistoryLogFile());
- id = log.append(fromVersion, toVersion,
- HistoricalRecord.Status.STARTED,
- "log file '" + QuickSetupLog.getLogFile().getPath() + "'");
- } catch (IOException e) {
- Message msg = INFO_ERROR_LOGGING_OPERATION.get();
- throw ApplicationException.createFileSystemException(
- msg, e);
- }
- return id;
- }
-
- /**
- * Writes a record into this installation's historical log.
- * @param id obtained from calling <code>writeInitialHistoricalRecord</code>
- * @param from version from with install will be migrated
- * @param to version to which install will be migrated
- * @param status of the operation
- * @param note string with additional information
- * @throws ApplicationException if something goes wrong
- */
- protected void writeHistoricalRecord(
- Long id,
- BuildInformation from,
- BuildInformation to,
- HistoricalRecord.Status status,
- String note)
- throws ApplicationException {
- try {
- HistoricalLog log =
- new HistoricalLog(getInstallation().getHistoryLogFile());
- log.append(id, from, to, status, note);
- } catch (IOException e) {
- Message msg = INFO_ERROR_LOGGING_OPERATION.get();
- throw ApplicationException.createFileSystemException(msg, e);
- }
- }
-
- /**
* Returns a localized representation of a TopologyCacheException object.
* @param e the exception we want to obtain the representation from.
* @return a localized representation of a TopologyCacheException object.
@@ -789,7 +652,7 @@
ServerLoader loader = new ServerLoader(adsProperties, dn, pwd,
trustManager, timeout, cnx, filter);
- InitialLdapContext ctx = null;
+ InitialLdapContext ctx;
try
{
ctx = loader.createContext();
@@ -847,18 +710,6 @@
}
-
- /**
- * Notifies the progress update listeners of the application of the message
- * we received.
- * @return <CODE>true</CODE> if we must notify the application listeners
- * of the message and <CODE>false</CODE> otherwise.
- */
- public boolean isNotifyListeners()
- {
- return notifyListeners;
- }
-
/**
* Tells whether we must notify the listeners or not of the message
* received.
@@ -1067,6 +918,7 @@
}
catch (Throwable t)
{
+ // do nothing
}
}
}
@@ -1088,6 +940,7 @@
}
catch (Throwable t)
{
+ // do nothing
}
}
pointAdderStopped = true;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java b/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
index 8dbad79..f3583e0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup;
@@ -39,8 +39,6 @@
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.regex.Pattern;
@@ -330,15 +328,6 @@
}
/**
- * Gets the version qualifier.
- *
- * @return String reprenting the version qualifier
- */
- public String getVersionQualifier() {
- return values.get(VERSION_QUALIFIER);
- }
-
- /**
* Gets the SVN revision number.
*
* @return Integer representing the SVN revision number
@@ -348,58 +337,6 @@
}
/**
- * Gets the SVN URL repository.
- *
- * @return String representing the SVN URL repository
- */
- public String getURLRepository() {
- return values.get(URL_REPOSITORY);
- }
-
- /**
- * Gets the set of IDs representing <code>IncompatibleVersionEvents</code>.
- * @return set of integers representing events
- * @see org.opends.server.util.VersionCompatibilityIssue
- */
- public Set<Integer> getIncompatibilityEventIds() {
- HashSet<Integer> ids = null;
- String idString = values.get(INCOMPATIBILITY_EVENTS);
- if (idString != null) {
- ids = new HashSet<Integer>();
- String[] sa = idString.split(",");
- for (String s : sa) {
- try {
- ids.add(Integer.parseInt(s));
- } catch (NumberFormatException nfe) {
- LOG.log(Level.INFO, "invalid upgrade incompatibility ID " + s);
- }
- }
- }
- return ids;
- }
-
- /**
- * Returns a build string representation of this object. A build
- * number is a string formatted MAJOR.MINOR.POINT.REVISION where
- * MAJOR, MINOR, POINT and REVISION are integers.
- * @return String representation of a build number
- */
- public String getBuildString() {
- // -------------------------------------------------------
- // NOTE: if you change this be sure to change fromBuildString()
- // -------------------------------------------------------
- StringBuilder sb = new StringBuilder();
- sb.append(getMajorVersion());
- sb.append(".");
- sb.append(getMinorVersion());
- sb.append(".");
- sb.append(getPointVersion());
- sb.append(".");
- sb.append(getRevisionNumber());
- return sb.toString();
- }
-
- /**
* {@inheritDoc}
*/
@Override
diff --git a/opends/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java b/opends/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
index 95de7fd..43c5f80 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -57,21 +57,14 @@
private final boolean isForceOnError;
/**
- * Creates an instance that will use standard streams for interaction.
- */
- public CliUserInteraction() {
- this(null);
- }
-
- /**
* Creates an instance that will use standard streams for interaction and with
* the provided CLI arguments.
* @param ud The CLI arguments.
*/
public CliUserInteraction(UserData ud) {
super(System.in, System.out, System.err);
- isInteractive = ud != null ? ud.isInteractive() : true;
- isForceOnError = ud != null ? ud.isForceOnError() : false;
+ isInteractive = ud == null || ud.isInteractive();
+ isForceOnError = ud != null && ud.isForceOnError();
}
/**
@@ -125,7 +118,7 @@
Object returnValue = null;
boolean menuDisplayed = false;
while (returnValue == null) {
- int respInt = -1;
+ int respInt;
try
{
if (menuDisplayed)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Configuration.java b/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
index c976104..eb8bfd0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -163,58 +164,45 @@
return getConfigurationValues("ds-cfg-log-file");
}
- private int getLDAPPort(String portAttr) throws IOException {
+ private int extractPort(String portAttr, int index)
+ {
int port = -1;
- String contents = getLowerCaseContents();
- int index = contents.indexOf("cn=ldap connection handler");
-
- if (index != -1) {
- String attrWithPoints = portAttr + ":";
- int index1 = contents.indexOf(attrWithPoints, index);
- if (index1 != -1) {
- int index2 =
- contents.indexOf(Constants.LINE_SEPARATOR, index1);
- if (index2 != -1) {
- String sPort =
- contents.substring(attrWithPoints.length() +
- index1,
- index2).trim();
- try {
- port = Integer.parseInt(sPort);
- } catch (NumberFormatException nfe) {
- // do nothing;
- }
+ String attrWithPoints = portAttr + ":";
+ int index1 = contents.indexOf(attrWithPoints, index);
+ if (index1 != -1) {
+ int index2 =
+ contents.indexOf(Constants.LINE_SEPARATOR, index1);
+ if (index2 != -1) {
+ String sPort =
+ contents.substring(attrWithPoints.length() +
+ index1, index2).trim();
+ try {
+ port = Integer.parseInt(sPort);
+ } catch (NumberFormatException nfe) {
+ // do nothing;
}
}
}
return port;
}
+
+ private int getLDAPPort(String portAttr) throws IOException {
+ String contents = getLowerCaseContents();
+ int index = contents.indexOf("cn=ldap connection handler");
+ if (index != -1) {
+ return extractPort (portAttr, index);
+ }
+ return -1;
+ }
+
private int getAdminConnectorPort(String portAttr) throws IOException {
- int port = -1;
String contents = getLowerCaseContents();
int index = contents.indexOf("cn=administration connector");
-
if (index != -1) {
- String attrWithPoints = portAttr + ":";
- int index1 = contents.indexOf(attrWithPoints, index);
- if (index1 != -1) {
- int index2 =
- contents.indexOf(Constants.LINE_SEPARATOR, index1);
- if (index2 != -1) {
- String sPort =
- contents.substring(attrWithPoints.length() +
- index1,
- index2).trim();
- try {
- port = Integer.parseInt(sPort);
- } catch (NumberFormatException nfe) {
- // do nothing;
- }
- }
- }
+ return extractPort(portAttr, index);
}
- return port;
+ return -1;
}
/**
@@ -235,7 +223,7 @@
// Note: a better way might be to diff this file with
// /config/ldif/upgrade/config.ldif.<svn rev>
isConfigFileModified =
- getLowerCaseContents().indexOf("# cddl header start") == -1;
+ !getLowerCaseContents().contains("# cddl header start");
}
return isConfigFileModified;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Constants.java b/opends/src/quicksetup/org/opends/quicksetup/Constants.java
index 9443022..2b1581c 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Constants.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Constants.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup;
@@ -48,24 +48,6 @@
/** HTML bold close tag. */
public static final String HTML_BOLD_CLOSE = "</b>";
- /** HTML italics open tag. */
- public static final String HTML_ITALICS_OPEN = "<i>";
-
- /** HTML italics close tag. */
- public static final String HTML_ITALICS_CLOSE = "</i>";
-
- /** HTML unordered list open tag. */
- public static final Object HTML_UNORDERED_LIST_OPEN = "<ul>";
-
- /** HTML unordered list close tag. */
- public static final Object HTML_UNORDERED_LIST_CLOSE = "</ul>";
-
- /** HTML unordered list open tag. */
- public static final Object HTML_ORDERED_LIST_OPEN = "<ol>";
-
- /** HTML unordered list close tag. */
- public static final Object HTML_ORDERED_LIST_CLOSE = "</ol>";
-
/** HTML list item open tag. */
public static final String HTML_LIST_ITEM_OPEN = "<li>";
diff --git a/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java b/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
index 27f9060..315db5c 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -73,7 +73,6 @@
} else
{
Installation installation = Installation.getLocal();
- boolean dbFileExists = false;
ArrayList<Message> msgs = new ArrayList<Message>();
if (installation.getStatus().isServerRunning())
@@ -84,17 +83,17 @@
if (dbFilesExist())
{
- dbFileExists = true;
+ canOverwriteCurrentInstall = true;
msgs.add(INFO_INSTALLSTATUS_DBFILEEXIST.get());
}
- if (archivedConfigsExist())
+ if (configExists())
{
+ canOverwriteCurrentInstall = false;
+ isInstalled = true;
msgs.add(INFO_INSTALLSTATUS_CONFIGFILEMODIFIED.get());
}
- canOverwriteCurrentInstall = (msgs.size() == 1) && dbFileExists;
- isInstalled = msgs.size() > 0;
if (canOverwriteCurrentInstall)
{
installationMsg = !Utils.isCli()?
@@ -110,7 +109,7 @@
for (Message msg : msgs)
{
buf.append(Constants.LINE_SEPARATOR);
- buf.append("- "+msg);
+ buf.append("- ").append(msg);
}
String cmd = Utils.isWindows() ?
Installation.WINDOWS_SETUP_FILE_NAME :
@@ -202,15 +201,15 @@
/**
- * Indicates whether there are archived config files under this installation.
+ * Indicates whether there are config files under this installation.
*
- * @return <CODE>true</CODE> if there are archived config files, or
+ * @return <CODE>true</CODE> if there are configuration files, or
* <CODE>false</CODE> if not.
*/
- private boolean archivedConfigsExist()
+ private boolean configExists()
{
- File archDir = Installation.getLocal().getArchivedConfigsDirectory();
- File[] children = archDir.listFiles();
+ File configDir = Installation.getLocal().getConfigurationDirectory();
+ File[] children = configDir.listFiles();
return ((children != null) && (children.length > 0));
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/DataOptions.java b/opends/src/quicksetup/org/opends/quicksetup/DataOptions.java
deleted file mode 100644
index b32910a..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/DataOptions.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-
-package org.opends.quicksetup;
-
-/**
- * This class is used to provide a data model for the Data Options panel of the
- * installer.
- *
- */
-public class DataOptions
-{
- /**
- * This enumeration is used to know what the user wants to do for the data
- * (import data or not, what use as source of the data...).
- *
- */
- public enum Type
- {
- /**
- * Do nothing.
- */
- NOTHING,
-
- /**
- * Create base entry.
- */
- CREATE_BASE_ENTRY,
- /**
- * Do not add any entry to the suffix.
- */
- LEAVE_DATABASE_EMPTY,
- /**
- * Import data from an LDIF file.
- */
- IMPORT_FROM_LDIF_FILE,
- /**
- * Generate data and import it to the suffix.
- */
- IMPORT_AUTOMATICALLY_GENERATED_DATA
- }
-
- private Type type = Type.NOTHING;
-
- private String baseDn;
-
- private String ldifPath;
-
- private int numberEntries;
-
- /**
- * Constructor for the DataOptions object.
- *
- * If the Data Options is IMPORT_FROM_LDIF_FILE the args are the baseDn and
- * a String with the ldif location.
- *
- * If the Data Options is IMPORT_AUTOMATICALLY_GENERATED_DATA the args
- * are the baseDn and an Integer with the number of entries.
- *
- * For the rest of the types the args are just the baseDn.
- *
- * @param type the Type of DataOptions.
- * @param args the different argument objects (depending on the Type
- * specified)
- */
- public DataOptions(Type type, Object... args)
- {
- this.type = type;
- baseDn = (String) args[0];
-
- switch (type)
- {
- case IMPORT_FROM_LDIF_FILE:
- ldifPath = (String) args[1];
- break;
-
- case IMPORT_AUTOMATICALLY_GENERATED_DATA:
- numberEntries = ((Integer) args[1]).intValue();
- break;
- }
- }
-
- /**
- * Returns the type of DataOptions represented by this object (import data or
- * not, what use as source of the data...).
- *
- * @return the type of DataOptions.
- */
- public Type getType()
- {
- return type;
- }
-
- /**
- * Returns the path of the LDIF file used to import data.
- * @return the path of the LDIF file used to import data.
- */
- public String getLDIFPath()
- {
- return ldifPath;
- }
-
- /**
- * Returns the number of entries that will be automatically generated.
- *
- * @return the number of entries that will be automatically generated.
- */
- public int getNumberEntries()
- {
- return numberEntries;
- }
-
- /**
- * Returns the base DN of the suffix that will be created in the server.
- *
- * @return the base DN of the suffix that will be created in the server.
- */
- public String getBaseDn()
- {
- return baseDn;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/HistoricalLog.java b/opends/src/quicksetup/org/opends/quicksetup/HistoricalLog.java
deleted file mode 100644
index ec72363..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/HistoricalLog.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup;
-
-import org.opends.quicksetup.util.Utils;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.io.*;
-
-/**
- * Log of past upgrade/reversion events that is backed by the file
- * [install root]/history/log.
- */
-public class HistoricalLog {
-
- private File file;
-
- /**
- * Creates a historical log backed by <code>file</code>. If file
- * does not exist an attempt will be made to create it.
- * @param file File containing the historical record
- * @throws IOException if something goes wrong attempting to create
- * a new historical record file
- */
- public HistoricalLog(File file) throws IOException {
- this.file = file;
- if (!file.exists()) {
- Utils.createFile(file);
- }
- }
-
- /**
- * Gets a list of the historical records in the file.
- * @return List of HistoricalRecord
- * @throws IOException if there was an error reading the records file
- */
- public List<HistoricalRecord> getRecords() throws IOException {
- List<HistoricalRecord> records = new ArrayList<HistoricalRecord>();
- BufferedReader br = new BufferedReader(new FileReader(file));
- String s;
- while (null != (s = br.readLine())) {
- records.add(HistoricalRecord.fromString(s));
- }
- return Collections.unmodifiableList(records);
- }
-
- /**
- * Creates a new historical log record and appends a new log record to the
- * log. A new operation ID is generated and returned so that future calls
- * can use the same ID.
- * @param from current version
- * @param to version to upgrade to
- * @param status of the upgrade
- * @param note optional string with additional information
- * @return Long operation ID that can be used in writing future logs
- * @throws IOException if there is a problem appending the log to the file
- */
- public Long append(BuildInformation from, BuildInformation to,
- HistoricalRecord.Status status, String note)
- throws IOException
- {
- HistoricalRecord record = new HistoricalRecord(from, to, status, note);
- Long id = record.getOperationId();
- append(record);
- return id;
- }
-
- /**
- * Creates a new historical log record and appends a new log record to the
- * log.
- * @param id Long ID obtained from a call to
- {@link org.opends.quicksetup.HistoricalLog#
- append(Integer, Integer,
- org.opends.quicksetup.upgrader.HistoricalRecord.Status)}
- * @param from current version
- * @param to version to upgrade to
- * @param status of the upgrade
- * @param note optional string with additional information
- * @throws IOException if there is a problem appending the log to the file
- */
- public void append(Long id, BuildInformation from, BuildInformation to,
- HistoricalRecord.Status status, String note)
- throws IOException
- {
- HistoricalRecord record = new HistoricalRecord(id, from, to, status, note);
- append(record);
- }
-
- /**
- * Appends a historical record to the log.
- * @param record to append to the log file
- * @throws IOException if there is a problem appending the record to the file
- */
- private void append(HistoricalRecord record) throws IOException {
- BufferedWriter bw = null;
- try {
- bw = new BufferedWriter(new FileWriter(file, true));
- bw.write(record.toString());
- bw.newLine();
- bw.flush();
- } finally {
- if (bw != null) {
- try {
- bw.close();
- } catch (IOException ioe2) {
- // do nothing;
- }
- }
- }
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/HistoricalRecord.java b/opends/src/quicksetup/org/opends/quicksetup/HistoricalRecord.java
deleted file mode 100644
index b769896..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/HistoricalRecord.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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.
- */
-
-package org.opends.quicksetup;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import java.util.StringTokenizer;
-import java.util.EnumSet;
-import java.util.Set;
-import java.util.Date;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.text.SimpleDateFormat;
-
-/**
- * A record in the historical log stored in [install root]/history/log.
- */
-public class HistoricalRecord {
-
- static private final Logger LOG =
- Logger.getLogger(HistoricalRecord.class.getName());
-
- //--------------------------------------------------//
- // Since these are internationalized, logs that are //
- // moved from one locale to another may not be //
- // readable programmatically. //
- //--------------------------------------------------//
-
- static private Message OPERATION = INFO_UPGRADE_LOG_FIELD_OP.get();
-
- static private Message TIME = INFO_UPGRADE_LOG_FIELD_TIME.get();
-
- static private Message FROM = INFO_UPGRADE_LOG_FIELD_FROM.get();
-
- static private Message TO = INFO_UPGRADE_LOG_FIELD_TO.get();
-
- static private Message STATUS = INFO_UPGRADE_LOG_FIELD_STATUS.get();
-
- static private Message NOTE = INFO_UPGRADE_LOG_FIELD_NOTE.get();
-
- static private String SEPARATOR = " ";
-
- static private String DATE_FORMAT = "yyyyMMddHHmmss";
-
- /**
- * State of an upgrade.
- */
- public enum Status {
-
- /** Operation has started. */
- STARTED(INFO_UPGRADE_LOG_STATUS_STARTED.get()),
-
- /** Operation completed successfully. */
- SUCCESS(INFO_UPGRADE_LOG_STATUS_SUCCESS.get()),
-
- /** Operation failed. */
- FAILURE(INFO_UPGRADE_LOG_STATUS_FAILURE.get()),
-
- /** Operation was canceled. */
- CANCEL(INFO_UPGRADE_LOG_STATUS_CANCEL.get());
-
- private Message representation;
-
- /**
- * Creates a State from a String.
- * @param s string representation of a state
- * @return Status created from <code>s</code>
- */
- static public Status fromString(String s) {
- Status retOc = null;
- Set<Status> all = EnumSet.allOf(Status.class);
- for (Status oc : all) {
- if (oc.toString().equals(s)) {
- retOc = oc;
- }
- }
- return retOc;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return String.valueOf(representation);
- }
-
- private Status(Message representation) {
- this.representation = representation;
- }
-
- }
-
- /**
- * Creates a historical log record from its string representation.
- * @param s string representation
- * @return HistoricalRecord created from the string
- * @throws IllegalArgumentException if the string is misformatted
- */
- static public HistoricalRecord fromString(String s)
- throws IllegalArgumentException {
- Long operationid = null;
- BuildInformation from = null;
- BuildInformation to = null;
- Status outcome = null;
- Date date = null;
- String note = null;
- Exception creationError = null;
- try {
- StringTokenizer st = new StringTokenizer(s, SEPARATOR);
-
- String token = st.nextToken();
- String operationIdString = token.substring(OPERATION.length());
- operationid = Long.parseLong(operationIdString);
-
- token = st.nextToken();
- String timeString = token.substring(TIME.length());
- date = new SimpleDateFormat(DATE_FORMAT).parse(timeString);
-
- token = st.nextToken();
- String fromString = token.substring(FROM.length());
- from = BuildInformation.fromBuildString(fromString);
-
- token = st.nextToken();
- String toString = token.substring(TO.length());
- to = BuildInformation.fromBuildString(toString);
-
- token = st.nextToken();
- String outcomeString = token.substring(STATUS.length());
- outcome = Status.fromString(outcomeString);
-
- if (st.hasMoreTokens()) {
- token = st.nextToken("");
- if (token != null) {
- note = token.substring(NOTE.length());
- }
- }
- } catch (Exception e) {
- // There was a problem creating the record. Log the error and
- // create the record with what we have already accumulated.
- LOG.log(Level.INFO, "error creating historical log record", e);
- creationError = e;
- }
- return new HistoricalRecord(operationid, date, from,
- to, outcome, note, creationError);
- }
-
- private Long operationId;
-
- private BuildInformation from;
-
- private BuildInformation to;
-
- private Status status;
-
- private Date date;
-
- private String note;
-
- /** true indicates there were not errors creating this record. */
- private Exception creationError;
-
- /**
- * Creates a new historical record using the current time and generating.
- * a new operation id
- * @param from current version
- * @param to version to upgrade to
- * @param status of the upgrade
- * @param note containing details of status; can be null
- */
- public HistoricalRecord(BuildInformation from,
- BuildInformation to,
- Status status, String note) {
- this.from = from;
- this.to = to;
- this.status = status;
- this.date = new Date();
- this.operationId = date.getTime();
- this.note = note;
- }
-
- /**
- * Creates a new historical record using the current time.
- * @param operationId obtained from a previously created HistoricalRecord
- * @param from current version
- * @param to version to upgrade to
- * @param status of the upgrade
- * @param note containing details of status; can be null
- */
- public HistoricalRecord(Long operationId,
- BuildInformation from,
- BuildInformation to,
- Status status, String note) {
- this.from = from;
- this.to = to;
- this.status = status;
- this.date = new Date();
- this.operationId = operationId;
- this.note = note;
- }
-
- /**
- * Creates a new historical record using the current time.
- * @param operationId obtained from a previously created HistoricalRecord
- * @param from current version
- * @param to version to upgrade to
- * @param status of the upgrade
- * @param note containing details of status; can be null
- * @param creationError Exception that occurred while this record was
- * being created
- * @param date of this operation
- */
- private HistoricalRecord(Long operationId, Date date, BuildInformation from,
- BuildInformation to, Status status, String note,
- Exception creationError) {
- this.operationId = operationId;
- this.from = from;
- this.to = to;
- this.status = status;
- this.date = date;
- this.note = note;
- this.creationError = creationError;
- }
-
- /**
- * Gets the operation ID associated with this record.
- * @return Long ID of this operation
- */
- public Long getOperationId() {
- return operationId;
- }
-
- /**
- * Gets the Date the record was created.
- * @return Date of the record
- */
- public Date getDate() {
- return this.date;
- }
-
- /**
- * Gets the Integer representing the SVN rev ID of the current installation.
- * @return Integer version ID
- */
- public BuildInformation getFromVersion() {
- return this.from;
- }
-
- /**
- * Gets the Integer representing the SVN rev ID of the installation being
- * upgraded to.
- * @return Integer version ID
- */
- public BuildInformation getToVersion() {
- return this.to;
- }
-
- /**
- * Returns the error that was generated during creation.
- * @return the error that was generated during creation.
- */
- public Exception getCreationError()
- {
- return creationError;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(OPERATION);
- sb.append(operationId != null ? operationId : INFO_GENERAL_UNSET.get());
- sb.append(SEPARATOR);
- sb.append(TIME);
- sb.append(new SimpleDateFormat(DATE_FORMAT).format(date));
- sb.append(SEPARATOR);
- sb.append(FROM);
- sb.append(from != null ? from.getBuildString() : INFO_GENERAL_UNSET.get());
- sb.append(SEPARATOR);
- sb.append(TO);
- sb.append(to != null ? to.getBuildString() : INFO_GENERAL_UNSET.get());
- sb.append(SEPARATOR);
- sb.append(STATUS);
- sb.append(status);
- if (note != null) {
- sb.append(SEPARATOR)
- .append(NOTE)
- .append(note);
- }
- return sb.toString();
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Installation.java b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
index e1d1862..465f509 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -23,12 +23,13 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup;
-import org.opends.admin.ads.ADSContext;
+
+
import org.opends.messages.Message;
import static org.opends.messages.QuickSetupMessages.*;
@@ -43,18 +44,21 @@
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.SetupUtils;
+
+
/**
- * This class represents the physical state of an OpenDJ installation.
- * All the operations are dependent upon the root directory that is
- * specified in the constructor.
+ * This class represents the physical state of an OpenDJ installation. All the
+ * operations are dependent upon the root directory that is specified in the
+ * constructor.
*/
-public final class Installation {
+public final class Installation
+{
/**
* Relative path to OpenDJ jar files.
*/
- public static final String[] OPEN_DS_JAR_RELATIVE_PATHS =
- {"lib/quicksetup.jar", "lib/OpenDJ.jar", "lib/je.jar"};
+ public static final String[] OPEN_DS_JAR_RELATIVE_PATHS = {
+ "lib/quicksetup.jar", "lib/OpenDJ.jar", "lib/je.jar" };
/**
* The relative path where all the Windows binaries (batch files) are.
@@ -75,7 +79,7 @@
* The relative path where all the libraries (jar files) are.
*/
public static final String LIBRARIES_PATH_RELATIVE =
- SetupUtils.LIBRARIES_PATH_RELATIVE;
+ SetupUtils.LIBRARIES_PATH_RELATIVE;
/**
* The relative path where the resources directory (to customize the product)
@@ -114,12 +118,6 @@
public static final String CONFIG_PATH_RELATIVE = "config";
/**
- * The relative path where the archived config files are.
- */
- public static final String ARCHIVED_CONFIG_PATH_RELATIVE =
- CONFIG_PATH_RELATIVE + File.separator + "archived-configs";
-
- /**
* The relative path where the config files are.
*/
public static final String HISTORY_PATH_RELATIVE = "history";
@@ -130,11 +128,6 @@
public static final String UPGRADE_PATH = "upgrade";
/**
- * Relative path to the change log database directory.
- */
- public static final String CHANGELOG_PATH_RELATIVE = "changelogDb";
-
- /**
* Relative path to the locks directory.
*/
public static final String LOCKS_PATH_RELATIVE = "locks";
@@ -152,35 +145,28 @@
/**
* The relative path to the current Configuration LDIF file.
*/
- public static final String BASE_CONFIG_FILE_PREFIX ="config.ldif.";
-
- /**
- * The relative path to the tools.properties file.
- */
- public static final String TOOLS_PROPERTIES =
- CONFIG_PATH_RELATIVE+File.separator+"tools.properties";
+ public static final String BASE_CONFIG_FILE_PREFIX = "config.ldif.";
/**
* The path to the default instance.
- */
public static final String DEFAULT_INSTANCE_PATH = "/var/opendj";
+ */
/**
* The relative path to the instance.loc file.
*/
- public static final String INSTANCE_LOCATION_PATH_RELATIVE =
- "instance.loc";
+ public static final String INSTANCE_LOCATION_PATH_RELATIVE = "instance.loc";
/**
* The path to the instance.loc file.
*/
- public static final String INSTANCE_LOCATION_PATH = "/etc/opendj/" +
- INSTANCE_LOCATION_PATH_RELATIVE;
+ public static final String INSTANCE_LOCATION_PATH = "/etc/opendj/"
+ + INSTANCE_LOCATION_PATH_RELATIVE;
/**
* The relative path to tmpl_instance.
*/
- public static final String TMPL_INSTANCE_RELATIVE_PATH = "tmpl_instance";
+ public static final String TEMPLATE_RELATIVE_PATH = "template";
/**
* The relative path to buildinfo file.
@@ -213,26 +199,11 @@
public static final String UNIX_UPGRADE_FILE_NAME = "upgrade";
/**
- * The Windows upgrade batch file name.
- */
- public static final String WINDOWS_UPGRADE_FILE_NAME = "upgrade.bat";
-
- /**
* The UNIX configure script file name.
*/
public static final String UNIX_CONFIGURE_FILE_NAME = "configure";
/**
- * Newly upgraded Windows upgrade batch file name. When the upgrade
- * batch file requires upgrade it is not done during execution of the
- * upgrade utility itself since replacing a running script on Windows
- * with a different version leads to unpredictable results. Instead
- * this new name is used for the upgraded version and the user is
- * expected to manually rename the file following the upgrade.
- */
- public static final String WINDOWS_UPGRADE_FILE_NAME_NEW = "upgrade.bat.NEW";
-
- /**
* The UNIX start script file name.
*/
public static final String UNIX_START_FILE_NAME = "start-ds";
@@ -261,19 +232,7 @@
* The Windows control panel batch file name.
*/
public static final String WINDOWS_CONTROLPANEL_FILE_NAME =
- "control-panel.bat";
-
- /**
- * The UNIX dsjavaproperties script file name.
- */
- public static final String UNIX_DSJAVAPROPERTIES_FILE_NAME =
- "dsjavaproperties";
-
- /**
- * The Windows dsjavaproperties batch file name.
- */
- public static final String WINDOWS_DSJAVAPROPERTIES_FILE_NAME =
- "dsjavaproperties.bat";
+ "control-panel.bat";
/**
* The MacOS X Java application stub name.
@@ -306,43 +265,12 @@
public static final String WINDOWS_IMPORT_LDIF = "import-ldif.bat";
/**
- * Name of the file kept in the history directory containing logs
- * of upgrade and reversions.
+ * Name of the file kept in the history directory containing logs of upgrade
+ * and reversions.
*/
public static final String HISTORY_LOG_FILE_NAME = "log";
/**
- * The name of the directory in an upgrade backup directory (child
- * of the 'history' directory) that contains the install files from a
- * previous version.
- */
- public static final String HISTORY_BACKUP_FILES_DIR_INSTALL = "install";
-
- /**
- * The name of the directory in an upgrade backup directory (child
- * of the 'history' directory) that contains the instance files from a
- * previous version.
- */
-
- public static final String HISTORY_BACKUP_FILES_DIR_INSTANCE = "instance";
- /**
- * The name of the directory in an upgrade backup directory (child
- * of the 'history' directory) that contains the files from a
- * previous version.
- */
- public static final String HISTORY_BACKUP_FILES_DIR_NAME = "files";
-
- /**
- * Generic name for the backup tool.
- */
- public static final String BACKUP = "backup";
-
- /**
- * Generic name for the ldif-diff tool.
- */
- public static final String LDIF_DIFF = "ldif-diff";
-
- /**
* The default java properties file.
*/
public static final String DEFAULT_JAVA_PROPERTIES_FILE = "java.properties";
@@ -351,13 +279,13 @@
* The default java properties file relative path.
*/
public static final String RELATIVE_JAVA_PROPERTIES_FILE =
- CONFIG_PATH_RELATIVE+File.separator+"java.properties";
+ CONFIG_PATH_RELATIVE + File.separator + "java.properties";
/**
* The set java home and arguments properties file for Windows.
*/
public static final String SET_JAVA_PROPERTIES_FILE_WINDOWS =
- "set-java-home.bat";
+ "set-java-home.bat";
/**
* script utils file for UNIX systems.
@@ -372,70 +300,90 @@
/**
* The set java home and arguments properties file for UNIX systems.
*/
- public static final String SET_JAVA_PROPERTIES_FILE_UNIX =
- "set-java-home";
+ public static final String SET_JAVA_PROPERTIES_FILE_UNIX = "set-java-home";
/**
- * Directories required to be present for this installation
- * to be considered valid.
+ * Directories required to be present for this installation to be considered
+ * valid.
*/
- public static final String[] REQUIRED_DIRECTORIES =
- new String[] {
- CONFIG_PATH_RELATIVE,
- DATABASES_PATH_RELATIVE,
- LIBRARIES_PATH_RELATIVE
- };
+ public static final String[] REQUIRED_DIRECTORIES = new String[] {
+ CONFIG_PATH_RELATIVE, DATABASES_PATH_RELATIVE, LIBRARIES_PATH_RELATIVE };
+
+
/**
- * Performs validation on the specified file to make sure that it is
- * an actual OpenDJ installation.
- * @param rootDirectory File directory candidate
- * @throws IllegalArgumentException if root directory does not appear to
- * be an OpenDJ installation root. The thrown exception contains
- * a localized message indicating the reason why
- * <code>rootDirectory</code> is not a valid OpenDJ install root.
+ * Performs validation on the specified file to make sure that it is an actual
+ * OpenDJ installation.
+ *
+ * @param rootDirectory
+ * File directory candidate
+ * @throws IllegalArgumentException
+ * if root directory does not appear to be an OpenDJ installation
+ * root. The thrown exception contains a localized message
+ * indicating the reason why <code>rootDirectory</code> is not a
+ * valid OpenDJ install root.
*/
static public void validateRootDirectory(File rootDirectory)
- throws IllegalArgumentException {
+ throws IllegalArgumentException
+ {
Message failureReason = null;
- if (rootDirectory == null) {
+ if (rootDirectory == null)
+ {
failureReason = INFO_ERROR_INSTALL_ROOT_DIR_NULL.get();
- } else if (!rootDirectory.exists()) {
- failureReason = INFO_ERROR_INSTALL_ROOT_DIR_NO_EXIST.get(
- Utils.getPath(rootDirectory));
- } else if (!rootDirectory.isDirectory()) {
- failureReason = INFO_ERROR_INSTALL_ROOT_DIR_NOT_DIR.get(
- Utils.getPath(rootDirectory));
- } else {
+ }
+ else if (!rootDirectory.exists())
+ {
+ failureReason = INFO_ERROR_INSTALL_ROOT_DIR_NO_EXIST.get(Utils
+ .getPath(rootDirectory));
+ }
+ else if (!rootDirectory.isDirectory())
+ {
+ failureReason = INFO_ERROR_INSTALL_ROOT_DIR_NOT_DIR.get(Utils
+ .getPath(rootDirectory));
+ }
+ else
+ {
String[] children = rootDirectory.list();
- if (children != null) {
+ if (children != null)
+ {
Set<String> childrenSet = new HashSet<String>(Arrays.asList(children));
- for (String dir : REQUIRED_DIRECTORIES) {
- if (!childrenSet.contains(dir)) {
+ for (String dir : REQUIRED_DIRECTORIES)
+ {
+ if (!childrenSet.contains(dir))
+ {
failureReason = INFO_ERROR_INSTALL_ROOT_DIR_NO_DIR.get(
- Utils.getPath(rootDirectory), dir);
+ Utils.getPath(rootDirectory), dir);
}
}
- } else {
- failureReason = INFO_ERROR_INSTALL_ROOT_DIR_EMPTY.get(
- Utils.getPath(rootDirectory));
+ }
+ else
+ {
+ failureReason = INFO_ERROR_INSTALL_ROOT_DIR_EMPTY.get(Utils
+ .getPath(rootDirectory));
}
}
- if (failureReason != null) {
+ if (failureReason != null)
+ {
throw new IllegalArgumentException(failureReason.toString());
}
}
+
+
static private Installation local;
+
+
/**
- * Obtains the installation by reading the classpath of the running
- * JVM to determine the location of the jars and determine the
- * installation root.
+ * Obtains the installation by reading the classpath of the running JVM to
+ * determine the location of the jars and determine the installation root.
+ *
* @return Installation obtained by reading the classpath
*/
- static public Installation getLocal() {
- if (local == null) {
+ static public Installation getLocal()
+ {
+ if (local == null)
+ {
// This allows testing of configuration components when the OpenDJ.jar
// in the classpath does not necessarily point to the server's
@@ -443,10 +391,12 @@
String instanceRoot = System
.getProperty("org.opends.quicksetup.instance");
- if (installRoot == null) {
+ if (installRoot == null)
+ {
installRoot = Utils.getInstallPathFromClasspath();
}
- if (instanceRoot == null) {
+ if (instanceRoot == null)
+ {
instanceRoot = Utils.getInstancePathFromInstallPath(installRoot);
}
local = new Installation(installRoot, instanceRoot);
@@ -454,8 +404,10 @@
return local;
}
- static private final Logger LOG =
- Logger.getLogger(Installation.class.getName());
+
+
+ static private final Logger LOG = Logger.getLogger(Installation.class
+ .getName());
private File rootDirectory;
@@ -471,107 +423,72 @@
private BuildInformation instanceInformation;
- /**
- * Indicates if the install and instance are in the same directory.
- */
- private boolean instanceAndInstallInSameDir;
/**
* Creates a new instance from a root directory specified as a string.
*
- * @param rootDirectory of this installation
- * @param instanceRootDirectory The instance root directory
+ * @param rootDirectory
+ * of this installation
+ * @param instanceRootDirectory
+ * The instance root directory
*/
- public Installation(String rootDirectory, String instanceRootDirectory) {
- this(new File(rootDirectory),new File(instanceRootDirectory));
+ public Installation(String rootDirectory, String instanceRootDirectory)
+ {
+ this(new File(rootDirectory), new File(instanceRootDirectory));
}
+
+
/**
* Creates a new instance from a root directory specified as a File.
*
- * @param rootDirectory of this installation
- *
- * @param instanceDirectory of the instance
+ * @param rootDirectory
+ * of this installation
+ * @param instanceDirectory
+ * of the instance
*/
- public Installation(File rootDirectory, File instanceDirectory) {
+ public Installation(File rootDirectory, File instanceDirectory)
+ {
setRootDirectory(rootDirectory);
setInstanceDirectory(instanceDirectory);
- try
- {
- if (rootDirectory.getCanonicalFile().
- equals(instanceDirectory.getCanonicalFile()))
- {
- instanceAndInstallInSameDir = true ;
- }
- else
- {
- instanceAndInstallInSameDir = false;
- }
- }
- catch (Throwable t)
- {
- if (rootDirectory.getAbsolutePath().
- equals(instanceDirectory.getAbsolutePath()))
- {
- instanceAndInstallInSameDir = true ;
- }
- else
- {
- instanceAndInstallInSameDir = false;
- }
- }
}
- /**
- * Indicates if the install and instance are in the same directory.
- * @return true if the install and instance are in the same directory.
- */
- public boolean instanceAndInstallInSameDir()
- {
- return instanceAndInstallInSameDir;
- }
+
/**
* Gets the top level directory of an OpenDJ installation.
*
- * @return File object representing the top level directory of
- * and OpenDJ installation
+ * @return File object representing the top level directory of and OpenDJ
+ * installation
*/
- public File getRootDirectory() {
+ public File getRootDirectory()
+ {
return this.rootDirectory;
}
+
+
/**
* Gets the top level directory of an OpenDJ instance.
*
- * @return File object representing the top level directory of
- * and OpenDK installation
+ * @return File object representing the top level directory of and OpenDK
+ * installation
*/
- public File getInstanceDirectory() {
+ public File getInstanceDirectory()
+ {
return this.instanceDirectory;
}
- /**
- * Gets the directory of the OpenDJ template instance.
- *
- * @return File object representing the top level directory of
- * and OpenDJ installation
- */
- public File getTmplInstanceDirectory() {
- File f = new File(getRootDirectory().getAbsolutePath() +
- File.separator + TMPL_INSTANCE_RELATIVE_PATH );
- if (f.exists())
- return f;
- else
- return getInstanceDirectory();
- }
+
/**
* Sets the root directory of this installation.
*
- * @param rootDirectory File of this installation
+ * @param rootDirectory
+ * File of this installation
*/
- public void setRootDirectory(File rootDirectory) {
+ public void setRootDirectory(File rootDirectory)
+ {
// Hold off on doing validation of rootDirectory since
// some applications (like the Installer) create an Installation
@@ -580,23 +497,31 @@
// Obtaining build information is a fairly time consuming operation.
// Try to get a head start if possible.
- if (isValid(rootDirectory)) {
- try {
+ if (isValid(rootDirectory))
+ {
+ try
+ {
BuildInformation bi = getBuildInformation();
- LOG.log(Level.INFO, "build info for " + rootDirectory.getName() +
- ": " + bi);
- } catch (ApplicationException e) {
+ LOG.log(Level.INFO, "build info for " + rootDirectory.getName() + ": "
+ + bi);
+ }
+ catch (ApplicationException e)
+ {
LOG.log(Level.INFO, "error determining build information", e);
}
}
}
+
+
/**
* Sets the root directory of this instance.
*
- * @param instanceDirectory File of this instance
+ * @param instanceDirectory
+ * File of this instance
*/
- public void setInstanceDirectory(File instanceDirectory) {
+ public void setInstanceDirectory(File instanceDirectory)
+ {
// Hold off on doing validation of rootDirectory since
// some applications (like the Installer) create an Installation
@@ -605,633 +530,708 @@
// Obtaining build information is a fairly time consuming operation.
// Try to get a head start if possible.
- if (isValid(instanceDirectory)) {
- try {
+ if (isValid(instanceDirectory))
+ {
+ try
+ {
BuildInformation bi = getBuildInformation();
- LOG.log(Level.INFO, "build info for " + instanceDirectory.getName() +
- ": " + bi);
- } catch (ApplicationException e) {
+ LOG.log(Level.INFO, "build info for " + instanceDirectory.getName()
+ + ": " + bi);
+ }
+ catch (ApplicationException e)
+ {
LOG.log(Level.INFO, "error determining build information", e);
}
}
}
+
+
/**
- * Indicates whether or not this installation appears to be an actual
- * OpenDJ installation.
- * @param file The root directory
- * @return boolean where true indicates that this does indeed appear to be
- * a valid OpenDJ installation; false otherwise
+ * Indicates whether or not this installation appears to be an actual OpenDJ
+ * installation.
+ *
+ * @param file
+ * The root directory
+ * @return boolean where true indicates that this does indeed appear to be a
+ * valid OpenDJ installation; false otherwise
*/
- public boolean isValid(File file) {
+ public boolean isValid(File file)
+ {
boolean valid = true;
- try {
+ try
+ {
validateRootDirectory(file);
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
valid = false;
}
return valid;
}
+
+
/**
* Creates a string explaining why this is not a legitimate OpenDJ
- * installation. Null if this is in fact a vaild installation.
- * @return localized message indicating the reason this is not an
- * OpenDJ installation
+ * installation. Null if this is in fact a vaild installation.
+ *
+ * @return localized message indicating the reason this is not an OpenDJ
+ * installation
*/
- public String getInvalidityReason() {
+ public String getInvalidityReason()
+ {
String reason = null;
- try {
+ try
+ {
validateRootDirectory(rootDirectory);
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
reason = e.getLocalizedMessage();
}
return reason;
}
+
+
/**
- * Gets the Configuration object representing this file. The
- * current configuration is stored in config/config.ldif.
+ * Gets the Configuration object representing this file. The current
+ * configuration is stored in config/config.ldif.
*
* @return Configuration representing the current configuration.
*/
- public Configuration getCurrentConfiguration() {
- if (configuration == null) {
+ public Configuration getCurrentConfiguration()
+ {
+ if (configuration == null)
+ {
configuration = new Configuration(this, getCurrentConfigurationFile());
}
return configuration;
}
+
+
/**
- * Gets the Configuration object representing this file. The base
+ * Gets the Configuration object representing this file. The base
* configuration is stored in config/upgrade/config.ldif.[svn rev].
*
* @return Configuration object representing the base configuration.
- * @throws ApplicationException if there was a problem determining the
- * svn rev number.
+ * @throws ApplicationException
+ * if there was a problem determining the svn rev number.
*/
- public Configuration getBaseConfiguration() throws ApplicationException {
- if (baseConfiguration == null) {
+ public Configuration getBaseConfiguration() throws ApplicationException
+ {
+ if (baseConfiguration == null)
+ {
baseConfiguration = new Configuration(this, getBaseConfigurationFile());
}
return baseConfiguration;
}
+
+
/**
* Gets the current status of this installation.
+ *
* @return Status object representing the state of this installation.
*/
- public Status getStatus() {
- if (status == null) {
+ public Status getStatus()
+ {
+ if (status == null)
+ {
status = new Status(this);
}
return status;
}
+
+
/**
* Returns the path to the libraries.
*
* @return the path to the libraries.
*/
- public File getLibrariesDirectory() {
+ public File getLibrariesDirectory()
+ {
return new File(getRootDirectory(), LIBRARIES_PATH_RELATIVE);
}
+
+
/**
* Returns the path to the resources directory.
*
* @return the path to the resources directory.
*/
- public File getResourcesDirectory() {
+ public File getResourcesDirectory()
+ {
return new File(getRootDirectory(), RESOURCES_PATH_RELATIVE);
}
+
+
/**
* Returns the path to the classes directory.
*
* @return the path to the classes directory.
*/
- public File getClassesDirectory() {
+ public File getClassesDirectory()
+ {
return new File(getRootDirectory(), CLASSES_PATH_RELATIVE);
}
- /**
- * Returns the path to the tools properties file.
- *
- * @return the path to the tools properties file.
- */
- public File getToolsPropertiesFile() {
- return new File(getTmplInstanceDirectory(), TOOLS_PROPERTIES);
- }
+
/**
- * Returns the path to the set-java-home file.
- *
- * @return the path to the set-java-home file.
- */
- public File getSetJavaHomeFile() {
- return new File(getInstanceDirectory().getAbsolutePath() + File.separator +
- LIBRARIES_PATH_RELATIVE,
- Utils.isWindows()?SET_JAVA_PROPERTIES_FILE_WINDOWS :
- SET_JAVA_PROPERTIES_FILE_UNIX);
- }
-
- /**
- * Creates a File object representing config/upgrade/schema.ldif.current
- * which the server creates the first time it starts if there are schema
+ * Creates a File object representing config/upgrade/schema.ldif.current which
+ * the server creates the first time it starts if there are schema
* customizations.
*
* @return File object with no
*/
- public File getSchemaConcatFile() {
- return new File(getConfigurationUpgradeDirectory(),
- "schema.ldif.current");
+ public File getSchemaConcatFile()
+ {
+ return new File(getConfigurationUpgradeDirectory(), "schema.ldif.current");
}
+
+
/**
- * Creates a File object representing config/upgrade/schema.ldif.current
- * which the server creates the first time it starts if there are schema
+ * Creates a File object representing config/upgrade/schema.ldif.current which
+ * the server creates the first time it starts if there are schema
* customizations.
*
* @return File object with no
- * @throws ApplicationException if there was a problem determining the
- * svn revision number
+ * @throws ApplicationException
+ * if there was a problem determining the svn revision number
*/
- public File getBaseSchemaFile() throws ApplicationException {
- return new File(getConfigurationUpgradeDirectory(),
- "schema.ldif." + getInstanceSvnRev().toString());
+ public File getBaseSchemaFile() throws ApplicationException
+ {
+ return new File(getConfigurationUpgradeDirectory(), "schema.ldif."
+ + getInstanceSvnRev().toString());
}
- /**
- * Creates a File object representing
- * tmpl_instance/config/upgrade/schema.ldif.current.
- *
- * @return File object representing
- * tmpl_instance/config/upgrade/schema.ldif.current
- * @throws ApplicationException if there was a problem determining the
- * svn revision number
- */
- public File getTemplSchemaFile() throws ApplicationException {
- return new File(getTmplInstanceDirectory().getAbsolutePath() +
- File.separator + CONFIG_PATH_RELATIVE +
- File.separator + UPGRADE_PATH,
- "schema.ldif." + getSvnRev().toString());
- }
+
/**
- * Creates a File object representing
- * tmpl_instance/config/upgrade/config.ldif.current.
- *
- * @return File object representing
- * tmpl_instance/config/upgrade/config.ldif.current
- * @throws ApplicationException if there was a problem determining the
- * svn revision number
- */
- public File getTemplConfigFile() throws ApplicationException {
- return new File(getTmplInstanceDirectory().getAbsolutePath() +
- File.separator + CONFIG_PATH_RELATIVE +
- File.separator + UPGRADE_PATH,
- BASE_CONFIG_FILE_PREFIX + getSvnRev().toString());
- }
-
- /**
- * Creates a File object representing config/upgrade/schema.ldif.current
- * which the server creates the first time it starts if there are schema
+ * Creates a File object representing config/upgrade/schema.ldif.current which
+ * the server creates the first time it starts if there are schema
* customizations.
*
* @return File object with no
- * @throws ApplicationException if there was a problem determining the
- * svn revision number
+ * @throws ApplicationException
+ * if there was a problem determining the svn revision number
*/
- public File getBaseConfigurationFile() throws ApplicationException {
- return new File(getConfigurationUpgradeDirectory(),
- BASE_CONFIG_FILE_PREFIX + getInstanceSvnRev().toString());
+ public File getBaseConfigurationFile() throws ApplicationException
+ {
+ return new File(getConfigurationUpgradeDirectory(), BASE_CONFIG_FILE_PREFIX
+ + getInstanceSvnRev().toString());
}
+
+
/**
* Gets the SVN revision number of the build.
*
* @return Integer representing the svn number
- * @throws ApplicationException if for some reason the number could not
- * be determined
+ * @throws ApplicationException
+ * if for some reason the number could not be determined
*/
- public Integer getSvnRev() throws ApplicationException {
+ public Integer getSvnRev() throws ApplicationException
+ {
BuildInformation bi = getBuildInformation();
return bi.getRevisionNumber();
}
+
+
/**
* Gets the SVN revision number of the instance.
*
* @return Integer representing the svn number
- * @throws ApplicationException if for some reason the number could not
- * be determined
+ * @throws ApplicationException
+ * if for some reason the number could not be determined
*/
- public Integer getInstanceSvnRev() throws ApplicationException {
+ public Integer getInstanceSvnRev() throws ApplicationException
+ {
BuildInformation bi = getInstanceBuildInformation();
return bi.getRevisionNumber();
}
+
+
/**
- * Returns the path to the configuration file of the directory server. Note
+ * Returns the path to the configuration file of the directory server. Note
* that this method assumes that this code is being run locally.
*
* @return the path of the configuration file of the directory server.
*/
- public File getCurrentConfigurationFile() {
+ public File getCurrentConfigurationFile()
+ {
return new File(getConfigurationDirectory(), CURRENT_CONFIG_FILE_NAME);
}
- /**
- * Returns the path to the ADS file of the directory server. Note
- * that this method assumes that this code is being run locally.
- *
- * @return the path of the ADS file of the directory server.
- */
- public File getADSBackendFile() {
- return new File(getTmplInstanceDirectory(), ADSContext.getAdminLDIFFile());
- }
+
/**
* Returns the relative path of the directory containing the binaries/scripts
- * of the Open DS installation. The path is relative to the installation
- * path.
+ * of the Open DS installation. The path is relative to the installation path.
*
* @return the relative path of the directory containing the binaries/scripts
* of the Open DS installation.
*/
- public File getBinariesDirectory() {
+ public File getBinariesDirectory()
+ {
File binPath;
- if (Utils.isWindows()) {
+ if (Utils.isWindows())
+ {
binPath = new File(getRootDirectory(), WINDOWS_BINARIES_PATH_RELATIVE);
- } else {
+ }
+ else
+ {
binPath = new File(getRootDirectory(), UNIX_BINARIES_PATH_RELATIVE);
}
return binPath;
}
+
+
/**
* Returns the path to the database files under the install path.
*
* @return the path to the database files under the install path.
*/
- public File getDatabasesDirectory() {
+ public File getDatabasesDirectory()
+ {
return new File(getInstanceDirectory(), DATABASES_PATH_RELATIVE);
}
+
+
/**
* Returns the path to the backup files under the install path.
*
* @return the path to the backup files under the install path.
*/
- public File getBackupDirectory() {
+ public File getBackupDirectory()
+ {
return new File(getInstanceDirectory(), BACKUPS_PATH_RELATIVE);
}
- /**
- * Returns the path to the archived config files under the install path.
- *
- * @return the path to the archived config files under the install path.
- */
- public File getArchivedConfigsDirectory() {
- return new File(getInstanceDirectory(), ARCHIVED_CONFIG_PATH_RELATIVE);
- }
+
/**
* Returns the path to the config files under the install path.
*
* @return the path to the config files under the install path.
*/
- public File getConfigurationDirectory() {
+ public File getConfigurationDirectory()
+ {
return new File(getInstanceDirectory(), CONFIG_PATH_RELATIVE);
}
- /**
- * Returns the path to the config files under the instance path.
- *
- * @return the path to the config files under the instance path.
- */
- public File getInstallConfigurationDirectory() {
- return new File(getRootDirectory(), CONFIG_PATH_RELATIVE);
- }
+
/**
* Returns the path to the log files under the install path.
*
* @return the path to the log files under the install path.
*/
- public File getLogsDirectory() {
+ public File getLogsDirectory()
+ {
return new File(getInstanceDirectory(), LOGS_PATH_RELATIVE);
}
+
+
/**
* Returns the directory where the lock files are stored.
*
* @return the path to the lock files.
*/
- public File getLocksDirectory() {
+ public File getLocksDirectory()
+ {
return new File(getInstanceDirectory(), LOCKS_PATH_RELATIVE);
}
+
+
+ /**
+ * Gets the directory used to store the template configuration.
+ *
+ * @return The directory used to store the template configuration.
+ */
+ public File getTemplateDirectory()
+ {
+ return new File(getRootDirectory(), TEMPLATE_RELATIVE_PATH);
+ }
+
+
+
/**
* Gets the directory used to store files temporarily.
+ *
* @return File temporary directory
*/
- public File getTemporaryDirectory() {
+ public File getTemporaryDirectory()
+ {
return new File(getInstanceDirectory(), TMP_PATH_RELATIVE);
}
+
+
/**
* Returns the directory where the lock files are stored.
*
* @return the path to the lock files.
*/
- public File getHistoryDirectory() {
+ public File getHistoryDirectory()
+ {
return new File(getInstanceDirectory(), HISTORY_PATH_RELATIVE);
}
+
+
/**
- * Creates a new directory in the history directory appropriate
- * for backing up an installation during an upgrade.
- * @return File representing a new backup directory. The directory
- * can be assumed to exist if this method returns cleanly.
- * @throws IOException if an error occurred creating the directory.
+ * Creates a new directory in the history directory appropriate for backing up
+ * an installation during an upgrade.
+ *
+ * @return File representing a new backup directory. The directory can be
+ * assumed to exist if this method returns cleanly.
+ * @throws IOException
+ * if an error occurred creating the directory.
*/
- public File createHistoryBackupDirectory() throws IOException {
- File backupDirectory =
- new File(getHistoryDirectory(),
- Long.toString(System.currentTimeMillis()));
- if (backupDirectory.exists()) {
+ public File createHistoryBackupDirectory() throws IOException
+ {
+ File backupDirectory = new File(getHistoryDirectory(), Long.toString(System
+ .currentTimeMillis()));
+ if (backupDirectory.exists())
+ {
backupDirectory.delete();
}
- if (!backupDirectory.mkdirs()) {
+ if (!backupDirectory.mkdirs())
+ {
throw new IOException("failed to create history backup directory");
}
return backupDirectory;
}
+
+
/**
* Gets the log file where the history of upgrades and reversions is kept.
+ *
* @return File containing upgrade/reversion history.
*/
- public File getHistoryLogFile() {
+ public File getHistoryLogFile()
+ {
return new File(getHistoryDirectory(), HISTORY_LOG_FILE_NAME);
}
+
+
/**
* Gets the directory config/upgrade.
+ *
* @return File representing the config/upgrade directory
*/
- public File getConfigurationUpgradeDirectory() {
+ public File getConfigurationUpgradeDirectory()
+ {
return new File(getConfigurationDirectory(), UPGRADE_PATH);
}
+
+
/**
* Gets the directory where the upgrader stores files temporarily.
+ *
* @return File representing the upgrader's temporary directory
*/
- public File getTemporaryUpgradeDirectory() {
+ public File getTemporaryUpgradeDirectory()
+ {
return new File(getTemporaryDirectory(), UPGRADE_PATH);
}
+
+
/**
- * Gets the file for invoking a particular command appropriate for
- * the current operating system.
- * @param command namd of the command
+ * Gets the file for invoking a particular command appropriate for the current
+ * operating system.
+ *
+ * @param command
+ * namd of the command
* @return File representing the command
*/
- public File getCommandFile(String command) {
+ public File getCommandFile(String command)
+ {
File commandFile;
- if (Utils.isWindows()) {
- commandFile = new File(getBinariesDirectory(),
- command + ".bat");
- } else {
- commandFile = new File(getBinariesDirectory(),
- command);
+ if (Utils.isWindows())
+ {
+ commandFile = new File(getBinariesDirectory(), command + ".bat");
+ }
+ else
+ {
+ commandFile = new File(getBinariesDirectory(), command);
}
return commandFile;
}
+
+
/**
- * Gets the file responsible for stopping the server appropriate
- * for the current operating system.
+ * Gets the file responsible for stopping the server appropriate for the
+ * current operating system.
+ *
* @return File representing the stop command
*/
- public File getServerStartCommandFile() {
+ public File getServerStartCommandFile()
+ {
File startCommandFile;
- if (Utils.isWindows()) {
+ if (Utils.isWindows())
+ {
startCommandFile = new File(getBinariesDirectory(),
- WINDOWS_START_FILE_NAME);
- } else {
- startCommandFile = new File(getBinariesDirectory(),
- UNIX_START_FILE_NAME);
+ WINDOWS_START_FILE_NAME);
+ }
+ else
+ {
+ startCommandFile = new File(getBinariesDirectory(), UNIX_START_FILE_NAME);
}
return startCommandFile;
}
+
+
/**
- * Gets the file responsible for stopping the server appropriate
- * for the current operating system.
+ * Gets the file responsible for stopping the server appropriate for the
+ * current operating system.
+ *
* @return File representing the stop command
*/
- public File getServerStopCommandFile() {
+ public File getServerStopCommandFile()
+ {
File stopCommandFile;
- if (Utils.isWindows()) {
+ if (Utils.isWindows())
+ {
stopCommandFile = new File(getBinariesDirectory(),
- WINDOWS_STOP_FILE_NAME);
- } else {
+ WINDOWS_STOP_FILE_NAME);
+ }
+ else
+ {
stopCommandFile = new File(getBinariesDirectory(),
- UNIX_STOP_FILE_NAME);
+ UNIX_STOP_FILE_NAME);
}
return stopCommandFile;
}
+
+
/**
* Returns the 'ldif' directory.
*
* @return the 'ldif' directory.
*/
- public File getLdifDirectory() {
+ public File getLdifDirectory()
+ {
return new File(getRootDirectory(), LDIFS_PATH_RELATIVE);
}
+
+
/**
* Returns the path to the quicksetup jar file.
*
* @return the path to the quicksetup jar file.
*/
- public File getQuicksetupJarFile() {
+ public File getQuicksetupJarFile()
+ {
return new File(getLibrariesDirectory(), "quicksetup.jar");
}
+
+
/**
* Returns the path to the opends jar file.
*
* @return the path to the opends jar file.
*/
- public File getOpenDSJarFile() {
+ public File getOpenDSJarFile()
+ {
return new File(getLibrariesDirectory(), "OpenDJ.jar");
}
+
+
/**
* Returns the path to the uninstall.bat file.
*
* @return the path to the uninstall.bat file.
*/
- public File getUninstallBatFile() {
+ public File getUninstallBatFile()
+ {
return new File(getRootDirectory(), "uninstall.bat");
}
+
+
/**
* Gets the control panel command file appropriate for the current operating
* system.
+ *
* @return File object representing the control panel command
*/
- public File getControlPanelCommandFile() {
+ public File getControlPanelCommandFile()
+ {
File controlPanelCommandFile;
- if (Utils.isWindows()) {
+ if (Utils.isWindows())
+ {
controlPanelCommandFile = new File(getBinariesDirectory(),
- WINDOWS_CONTROLPANEL_FILE_NAME);
- } else if (Utils.isMacOS()) {
- controlPanelCommandFile = new File(getRootDirectory() +
- File.separator + MAC_APPLICATIONS_PATH_RELATIVE,
- MAC_CONTROLPANEL_FILE_NAME);
- } else {
+ WINDOWS_CONTROLPANEL_FILE_NAME);
+ }
+ else if (Utils.isMacOS())
+ {
+ controlPanelCommandFile = new File(getRootDirectory() + File.separator
+ + MAC_APPLICATIONS_PATH_RELATIVE, MAC_CONTROLPANEL_FILE_NAME);
+ }
+ else
+ {
controlPanelCommandFile = new File(getBinariesDirectory(),
- UNIX_CONTROLPANEL_FILE_NAME);
+ UNIX_CONTROLPANEL_FILE_NAME);
}
return controlPanelCommandFile;
}
- /**
- * Gets the status command file appropriate for the current operating
- * system.
- * @return File object representing the status command
- */
- public File getStatusCommandFile() {
- File statusPanelCommandFile;
- if (Utils.isWindows()) {
- statusPanelCommandFile = new File(getBinariesDirectory(),
- WINDOWS_STATUSCLI_FILE_NAME);
- } else {
- statusPanelCommandFile = new File(getBinariesDirectory(),
- UNIX_STATUSCLI_FILE_NAME);
- }
- return statusPanelCommandFile;
- }
- /**
- * Gets the dsjavaproperties file appropriate for the current operating
- * system.
- * @return File object representing the dsjavaproperties command
- */
- public File getJavaPropertiesCommandFile() {
- File javaPropertiesCommandFile;
- if (Utils.isWindows()) {
- javaPropertiesCommandFile = new File(getBinariesDirectory(),
- WINDOWS_DSJAVAPROPERTIES_FILE_NAME);
- } else {
- javaPropertiesCommandFile = new File(getBinariesDirectory(),
- UNIX_DSJAVAPROPERTIES_FILE_NAME);
- }
- return javaPropertiesCommandFile;
- }
- /**
- * Gets information about the build that was used to produce the bits
- * for this installation.
+ /**
+ * Gets information about the build that was used to produce the bits for this
+ * installation.
+ *
* @return BuildInformation object describing this installation
- * @throws ApplicationException if there is a problem obtaining the
- * build information
+ * @throws ApplicationException
+ * if there is a problem obtaining the build information
*/
- public BuildInformation getBuildInformation() throws ApplicationException {
+ public BuildInformation getBuildInformation() throws ApplicationException
+ {
return getBuildInformation(true);
}
+
+
/**
- * Gets information about the build that was used to produce the bits
- * for this installation.
- * @param useCachedVersion where true indicates that a potentially cached
- * version of the build information is acceptable for use; false indicates
- * the the build information will be created from scratch which is potentially
- * time consuming
+ * Gets information about the build that was used to produce the bits for this
+ * installation.
+ *
+ * @param useCachedVersion
+ * where true indicates that a potentially cached version of the
+ * build information is acceptable for use; false indicates the the
+ * build information will be created from scratch which is
+ * potentially time consuming
* @return BuildInformation object describing this installation
- * @throws ApplicationException if there is a problem obtaining the
- * build information
+ * @throws ApplicationException
+ * if there is a problem obtaining the build information
*/
public BuildInformation getBuildInformation(boolean useCachedVersion)
- throws ApplicationException
+ throws ApplicationException
{
- if (buildInformation == null || !useCachedVersion) {
+ if (buildInformation == null || !useCachedVersion)
+ {
FutureTask<BuildInformation> ft = new FutureTask<BuildInformation>(
- new Callable<BuildInformation>() {
+ new Callable<BuildInformation>()
+ {
- @Override
- public BuildInformation call() throws ApplicationException {
- return BuildInformation.create(Installation.this);
- }
- });
+ @Override
+ public BuildInformation call() throws ApplicationException
+ {
+ return BuildInformation.create(Installation.this);
+ }
+ });
new Thread(ft).start();
- try {
+ try
+ {
buildInformation = ft.get();
- } catch (InterruptedException e) {
+ }
+ catch (InterruptedException e)
+ {
LOG.log(Level.INFO, "interrupted trying to get build information", e);
- } catch (ExecutionException e) {
- throw (ApplicationException)e.getCause();
+ }
+ catch (ExecutionException e)
+ {
+ throw (ApplicationException) e.getCause();
}
}
return buildInformation;
}
+
+
/**
- * Gets information about the build that was used to produce the
- * instance.
+ * Gets information about the build that was used to produce the instance.
+ *
* @return BuildInformation object describing this instance
*/
- public BuildInformation getInstanceBuildInformation() {
+ public BuildInformation getInstanceBuildInformation()
+ {
return getInstanceBuildInformation(true);
}
+
+
/**
- * Gets information about the build that was used to produce the
- * instance.
- * @param useCachedVersion where true indicates that a potentially cached
- * version of the build information is acceptable for use; false indicates
- * the build information will be created from scratch which is potentially
- * time consuming
+ * Gets information about the build that was used to produce the instance.
+ *
+ * @param useCachedVersion
+ * where true indicates that a potentially cached version of the
+ * build information is acceptable for use; false indicates the build
+ * information will be created from scratch which is potentially time
+ * consuming
* @return BuildInformation object describing this instance
*/
- public BuildInformation
- getInstanceBuildInformation(boolean useCachedVersion) {
- if (instanceInformation == null || !useCachedVersion) {
- try {
+ public BuildInformation getInstanceBuildInformation(boolean useCachedVersion)
+ {
+ if (instanceInformation == null || !useCachedVersion)
+ {
+ try
+ {
File bif = new File(getConfigurationDirectory(),
- BUILDINFO_RELATIVE_PATH);
+ BUILDINFO_RELATIVE_PATH);
- if (bif.exists()) {
+ if (bif.exists())
+ {
BufferedReader reader = new BufferedReader(new FileReader(bif));
// Read the first line and close the file.
String line;
- try {
+ try
+ {
line = reader.readLine();
instanceInformation = BuildInformation.fromBuildString(line);
- } finally {
- try {
+ }
+ finally
+ {
+ try
+ {
reader.close();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
+ // do nothing
}
}
- } else {
+ }
+ else
+ {
return getBuildInformation();
}
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "error getting build information for " +
- "current instance", e);
+ }
+ catch (Exception e)
+ {
+ LOG.log(Level.SEVERE, "error getting build information for "
+ + "current instance", e);
}
}
return instanceInformation;
}
- }
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/JavaArguments.java b/opends/src/quicksetup/org/opends/quicksetup/JavaArguments.java
index 8b2eafe..8484e07 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/JavaArguments.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/JavaArguments.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -168,11 +169,12 @@
public String toString()
{
StringBuilder sb = new StringBuilder();
- sb.append("Initial Memory: "+initialMemory+" Max Memory: "+maxMemory);
+ sb.append("Initial Memory: ").append(initialMemory)
+ .append(" Max Memory: ").append(maxMemory);
int i=1;
for (String arg : additionalArguments)
{
- sb.append(" arg "+i+": "+arg);
+ sb.append(" arg ").append(i).append(": ").append(arg);
i++;
}
return sb.toString();
@@ -191,7 +193,7 @@
{
Message msg = getMessage(javaArguments, defaultJavaArguments);
String s = msg.toString();
- if (s.indexOf("<br>") != -1)
+ if (s.contains("<br>"))
{
msg = Message.raw("<html>"+UIFactory.applyFontToHtml(s, font));
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Launcher.java b/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
index d0000f1..8cfbf55 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -120,26 +121,6 @@
}
/**
- * Indicates whether or not the launcher should print a usage
- * statement based on the content of the arguments passed into
- * the constructor.
- * @return boolean where true indicates usage should be printed
- */
- protected boolean isNoPrompt() {
- boolean printUsage = false;
- if ((args != null) && (args.length > 0)) {
- for (String arg : args) {
- if (arg.equals("-?") ||
- arg.equalsIgnoreCase("-n") ||
- arg.equalsIgnoreCase("--no-prompt")) {
- printUsage = true;
- }
- }
- }
- return printUsage;
- }
-
- /**
* Indicates whether or not the launcher should print a version
* statement based on the content of the arguments passed into
* the constructor.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java b/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
index 817812c..6243829 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -140,14 +141,8 @@
*/
static public boolean exists()
{
- if (Utils.isWebStart())
- {
- return false;
- }
- else
- {
- return getFile().exists();
- }
+ // TODO: Try to support License with webstart
+ return !Utils.isWebStart() && getFile().exists();
}
@@ -213,6 +208,7 @@
}
catch (IOException e)
{
+ // do nothing
}
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java
index 035ea23..e1a21a7 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup;
@@ -42,9 +42,6 @@
*/
public class QuickSetupLog {
- /** Suffix for log files. */
- static public final String LOG_FILE_SUFFIX = ".log";
-
static private File logFile = null;
static private FileHandler fileHandler = null;
@@ -116,12 +113,9 @@
static private String getInitialLogRecord() {
// Note; currently the logs are not internationalized.
- StringBuilder sb = new StringBuilder()
- .append("QuickSetup application launched " +
- DateFormat.getDateTimeInstance(DateFormat.LONG,
- DateFormat.LONG).
- format(new Date()));
- return sb.toString();
+ return "QuickSetup application launched " +
+ DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.LONG).format(new Date());
}
private static boolean disableLoggingToConsole()
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ReturnCode.java b/opends/src/quicksetup/org/opends/quicksetup/ReturnCode.java
index 4000a61..87f5123 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ReturnCode.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ReturnCode.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -116,11 +117,6 @@
public static final ReturnCode PRINT_VERSION = new ReturnCode(50);
/**
- * Return code: Print Usage.
- */
- public static final ReturnCode PRINT_USAGE = new ReturnCode(51);
-
- /**
* Return code for errors that are non-specified.
*/
public static final ReturnCode UNKNOWN = new ReturnCode(100);
@@ -129,7 +125,7 @@
private int code;
/**
- * Creates a new parameterized instance.
+ * Creates a new parametrized instance.
*
* @param code to return
*/
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Status.java b/opends/src/quicksetup/org/opends/quicksetup/Status.java
index daa03a0..d1549bb 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Status.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Status.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -52,28 +52,6 @@
}
/**
- * Indicates whether there is something installed or not.
- *
- * @return <CODE>true</CODE> if there is something installed under the
- * binaries that we are running, or <CODE>false</CODE> if not.
- */
- public boolean isInstalled() {
- File rootDirectory = installation.getRootDirectory();
- return rootDirectory == null || !rootDirectory.exists() ||
- !rootDirectory.isDirectory();
- }
-
- /**
- * Determines whether or not the schema has been modified for this
- * installation.
- * @return boolean where true means the schema has been modified
- */
- public boolean schemaHasBeenModified() {
- File f = installation.getSchemaConcatFile();
- return f.exists();
- }
-
- /**
* Returns if the server is running on the given path.
* NOTE: this method is to be called only when the OpenDS.jar class has
* already been loaded as it uses classes in that jar.
@@ -117,21 +95,4 @@
}
return isServerRunning;
}
-
- /**
- * Indicates whether there are database files under this installation.
- *
- * @return <CODE>true</CODE> if there are database files, or
- * <CODE>false</CODE> if not.
- */
- public boolean dbFilesExist() {
- boolean dbFilesExist = false;
- File dbDir = installation.getDatabasesDirectory();
- File[] children = dbDir.listFiles();
- if ((children != null) && (children.length > 0)) {
- dbFilesExist = true;
- }
- return dbFilesExist;
- }
-
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/UserData.java b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
index 305be5f..13641c4 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/UserData.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.quicksetup;
@@ -45,9 +45,6 @@
/**
* This class is used to provide a data model for the different parameters
* that the user can provide in the installation wizard.
- *
- * @see org.opends.quicksetup.DataOptions
- *
*/
public class UserData
{
@@ -95,10 +92,6 @@
private boolean forceOnError;
- private String configurationFile;
-
- private String configurationClass;
-
private Map<String, JavaArguments> hmJavaArguments;
private Map<String, JavaArguments> hmDefaultJavaArguments;
@@ -563,16 +556,6 @@
}
/**
- * Sets whether or not this session should solicite feedback from the user
- * for missing information.
- * @param interactive boolean where true indicates this application
- * should NOT solicite feedback from the user
- */
- public void setInteractive(boolean interactive) {
- this.interactive = interactive;
- }
-
- /**
* Indicates whether or not the user has requested interactive mode.
* <p>
* Interactive mode in the CLI means that the CLI will prompt the user
@@ -851,42 +834,6 @@
}
/**
- * Returns the configuration file to be used.
- * @return the configuration file to be used.
- */
- public String getConfigurationFile()
- {
- return configurationFile;
- }
-
- /**
- * Sets the configuration file to be used.
- * @param configurationFile the configuration file to be used.
- */
- public void setConfigurationFile(String configurationFile)
- {
- this.configurationFile = configurationFile;
- }
-
- /**
- * Returns the configuration class to be used.
- * @return the configuration class to be used.
- */
- public String getConfigurationClassName()
- {
- return configurationClass;
- }
-
- /**
- * Sets the configuration class to be used.
- * @param configurationClass the configuration class to be used.
- */
- public void setConfigurationClassName(String configurationClass)
- {
- this.configurationClass = configurationClass;
- }
-
- /**
* Returns the different script names for which there are java arguments.
* @return the different script names for which there are java arguments.
*/
diff --git a/opends/src/quicksetup/org/opends/quicksetup/event/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/event/package-info.java
index 56f281a..44fb4bd 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/event/package-info.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/event/package-info.java
@@ -23,12 +23,13 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
/**
* Defines the different classes that are used to define the specific events
- * and listeners in both the upgrader and installer applications.
+ * and listeners in the installer application.
*/
package org.opends.quicksetup.event;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/images/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/images/package-info.java
index 82c376e..cdb5c42 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/images/package-info.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/images/package-info.java
@@ -23,12 +23,13 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
/**
* Contains the different images (in gif and png format) that are used by the
- * installer and the upgrader.
+ * installer.
*/
package org.opends.quicksetup.images;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgradeUserData.java b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgradeUserData.java
deleted file mode 100644
index ca194cb..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgradeUserData.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.installandupgrader;
-
-import org.opends.quicksetup.upgrader.UpgradeUserData;
-
-/**
- * User data specific to the upgrade and install merged application.
- */
-public class InstallAndUpgradeUserData extends UpgradeUserData
-{
- private boolean isUpgrade;
-
- /**
- * Returns <CODE>true</CODE> if we are doing an upgrade and <CODE>false</CODE>
- * if not.
- * @return <CODE>true</CODE> if we are doing an upgrade and <CODE>false</CODE>
- * if not.
- */
- public boolean isUpgrade() {
- return isUpgrade;
- }
-
- /**
- * Sets whether we want to make an upgrade.
- * @param isUpgrade the boolean telling whether we want to do an upgrade or
- * not.
- */
- public void setUpgrade(boolean isUpgrade) {
- this.isUpgrade = isUpgrade;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
deleted file mode 100644
index 904a5ad..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2010 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.installandupgrader;
-
-import org.opends.admin.ads.util.ApplicationTrustManager;
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.opends.quicksetup.ButtonName;
-import org.opends.quicksetup.Constants;
-import org.opends.quicksetup.CurrentInstallStatus;
-import org.opends.quicksetup.ProgressStep;
-import org.opends.quicksetup.QuickSetupLog;
-import org.opends.quicksetup.Step;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.UserDataException;
-import org.opends.quicksetup.WizardStep;
-import org.opends.quicksetup.event.ProgressUpdateListener;
-import org.opends.quicksetup.installandupgrader.ui.WelcomePanel;
-import org.opends.quicksetup.installer.offline.OfflineInstaller;
-import org.opends.quicksetup.installer.webstart.WebStartInstaller;
-import org.opends.quicksetup.ui.FieldName;
-import org.opends.quicksetup.ui.GuiApplication;
-import org.opends.quicksetup.ui.QuickSetup;
-import org.opends.quicksetup.ui.QuickSetupDialog;
-import org.opends.quicksetup.ui.QuickSetupStepPanel;
-import org.opends.quicksetup.upgrader.UpgradeWizardStep;
-import org.opends.quicksetup.upgrader.Upgrader;
-import org.opends.quicksetup.util.ProgressMessageFormatter;
-import org.opends.quicksetup.util.Utils;
-import org.opends.server.util.DynamicConstants;
-
-/**
- * Application that allows to upgrade or install OpenDS.
- */
-public class InstallAndUpgrader extends GuiApplication
-{
- private GuiApplication installer;
- private GuiApplication upgrader;
- private InstallAndUpgradeUserData userData;
-
- /**
- * Creates a default instance.
- */
- public InstallAndUpgrader() {
-
- // Initialize the logs if necessary
- try {
- if (!QuickSetupLog.isInitialized())
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(
- Constants.LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (IOException e) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- e.printStackTrace();
- }
- if (Utils.isWebStart())
- {
- installer = new WebStartInstaller();
- }
- else
- {
- installer = new OfflineInstaller();
- }
- upgrader = new Upgrader();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public void setProgressMessageFormatter(ProgressMessageFormatter formatter) {
- super.setProgressMessageFormatter(formatter);
- installer.setProgressMessageFormatter(formatter);
- upgrader.setProgressMessageFormatter(formatter);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setCurrentInstallStatus(CurrentInstallStatus installStatus) {
- super.setCurrentInstallStatus(installStatus);
- installer.setCurrentInstallStatus(installStatus);
- upgrader.setCurrentInstallStatus(installStatus);
- }
-
- /**
- * {@inheritDoc}
- */
- public UserData getUserData()
- {
- return getDelegateApplication().getUserData();
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getFrameTitle() {
- return Utils.getCustomizedObject("INFO_FRAME_INSTALL_TITLE",
- INFO_FRAME_INSTALL_TITLE.get(DynamicConstants.PRODUCT_NAME),
- Message.class);
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getFirstWizardStep() {
- return Step.WELCOME;
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getFinishedStep() {
- return getDelegateApplication().getFinishedStep();
- }
-
- /**
- * {@inheritDoc}
- */
- public void run()
- {
- getDelegateApplication().run();
- }
-
- /**
- * {@inheritDoc}
- */
- public void addProgressUpdateListener(ProgressUpdateListener l)
- {
- installer.addProgressUpdateListener(l);
- upgrader.addProgressUpdateListener(l);
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeProgressUpdateListener(ProgressUpdateListener l)
- {
- installer.removeProgressUpdateListener(l);
- upgrader.removeProgressUpdateListener(l);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isCancellable()
- {
- return getDelegateApplication().isCancellable();
- }
-
- /**
- * {@inheritDoc}
- */
- public void setWizardDialogState(QuickSetupDialog dlg,
- UserData userData,
- WizardStep step) {
- if ((getDelegateApplication() == upgrader) &&
- (step == Step.WELCOME))
- {
- step = UpgradeWizardStep.WELCOME;
- }
- getDelegateApplication().setWizardDialogState(dlg, userData, step);
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getNextWizardStep(WizardStep step) {
- if ((getDelegateApplication() == upgrader) &&
- (step == Step.WELCOME))
- {
- step = UpgradeWizardStep.WELCOME;
- }
- return getDelegateApplication().getNextWizardStep(step);
- }
-
- /**
- * {@inheritDoc}
- */
- public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
- QuickSetupStepPanel p = null;
- if (step == Step.WELCOME) {
- p = new WelcomePanel(this);
- }
- if (p == null)
- {
- p = upgrader.createWizardStepPanel(step);
- }
- if (p == null)
- {
- p = installer.createWizardStepPanel(step);
- }
- return p;
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getPreviousWizardStep(WizardStep step) {
- WizardStep s = getDelegateApplication().getPreviousWizardStep(step);
- if (s == UpgradeWizardStep.WELCOME)
- {
- s = Step.WELCOME;
- }
- return s;
- }
-
- /**
- * {@inheritDoc}
- */
- public LinkedHashSet<WizardStep> getOrderedSteps()
- {
- LinkedHashSet<WizardStep> set = new LinkedHashSet<WizardStep>();
- set.addAll(installer.getOrderedSteps());
- set.addAll(upgrader.getOrderedSteps());
- set.remove(UpgradeWizardStep.WELCOME);
- return set;
- }
-
- /**
- * {@inheritDoc}
- */
- public ProgressStep getCurrentProgressStep() {
- return getDelegateApplication().getCurrentProgressStep();
- }
-
- /**
- * {@inheritDoc}
- */
- public Integer getRatio(ProgressStep step) {
- return getDelegateApplication().getRatio(step);
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getSummary(ProgressStep step) {
- return getDelegateApplication().getSummary(step);
- }
-
- /**
- * {@inheritDoc}
- */
- public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
- getDelegateApplication().windowClosing(dlg, evt);
- }
-
- /**
- * {@inheritDoc}
- */
- public ButtonName getInitialFocusButtonName() {
- return getDelegateApplication().getInitialFocusButtonName();
- }
-
- /**
- * {@inheritDoc}
- */
- public Set<? extends WizardStep> getWizardSteps() {
- Set<WizardStep> set = new HashSet<WizardStep>();
- set.addAll(installer.getWizardSteps());
- set.addAll(upgrader.getWizardSteps());
- set.remove(UpgradeWizardStep.WELCOME);
- return set;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isVisible(WizardStep step, UserData userData)
- {
- boolean isVisible;
- if (step == Step.WELCOME)
- {
- isVisible = true;
- }
- else
- {
- isVisible = getDelegateApplication().isVisible(step,
- getDelegateApplication().getUserData()) &&
- getDelegateApplication().getWizardSteps().contains(step);
- }
- return isVisible;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isVisible(WizardStep step, QuickSetup qs)
- {
- boolean isVisible;
- if (step == Step.WELCOME)
- {
- isVisible = true;
- }
- else
- {
- GuiApplication appl;
- Boolean isUpgrade = (Boolean)qs.getFieldValue(FieldName.IS_UPGRADE);
- if (Boolean.TRUE.equals(isUpgrade))
- {
- appl = upgrader;
- }
- else
- {
- appl = installer;
- }
- isVisible = appl.isVisible(step, qs) &&
- appl.getWizardSteps().contains(step);
- }
- return isVisible;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isSubStep(WizardStep step)
- {
- boolean isSubStep;
- if (step == Step.WELCOME)
- {
- isSubStep = false;
- }
- else
- {
- isSubStep = getDelegateApplication().isSubStep(step);
- }
- return isSubStep;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canGoBack(WizardStep step) {
- boolean canGoBack;
- if (step == Step.WELCOME)
- {
- canGoBack = false;
- }
- else
- {
- canGoBack = getDelegateApplication().canGoBack(step);
- }
- return canGoBack;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canGoForward(WizardStep step) {
- boolean canGoForward;
- if (step == Step.WELCOME)
- {
- canGoForward = true;
- }
- else
- {
- canGoForward = getDelegateApplication().canGoForward(step);
- }
- return canGoForward;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canFinish(WizardStep step) {
- return getDelegateApplication().canFinish(step);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canQuit(WizardStep step) {
- return getDelegateApplication().canQuit(step);
- }
-
- /**
- * {@inheritDoc}
- */
- public void previousClicked(WizardStep cStep, QuickSetup qs)
- {
- getDelegateApplication().previousClicked(cStep, qs);
- }
-
- /**
- * {@inheritDoc}
- */
- public void nextClicked(WizardStep cStep, QuickSetup qs)
- {
- getDelegateApplication().nextClicked(cStep, qs);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean finishClicked(WizardStep cStep, QuickSetup qs)
- {
- return getDelegateApplication().finishClicked(cStep, qs);
- }
-
- /**
- * {@inheritDoc}
- */
- public void closeClicked(WizardStep cStep, QuickSetup qs)
- {
- getDelegateApplication().closeClicked(cStep, qs);
- }
-
- /**
- * {@inheritDoc}
- */
- public void quitClicked(WizardStep cStep, QuickSetup qs)
- {
- getDelegateApplication().quitClicked(cStep, qs);
- }
-
- /**
- * {@inheritDoc}
- */
- public void updateUserData(WizardStep cStep, QuickSetup qs)
- throws UserDataException
- {
- if (cStep == Step.WELCOME)
- {
- Boolean isUpgrade = (Boolean)qs.getFieldValue(FieldName.IS_UPGRADE);
- getInstallAndUpgradeUserData().setUpgrade(isUpgrade);
- if (isUpgrade)
- {
- upgrader.updateUserData(UpgradeWizardStep.WELCOME, qs);
- getUserData().setServerLocation(
- upgrader.getUserData().getServerLocation());
- }
- else
- {
- installer.updateUserData(cStep, qs);
- }
- }
- else
- {
- getDelegateApplication().updateUserData(cStep, qs);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void cancel()
- {
- getDelegateApplication().cancel();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isFinished()
- {
- return getDelegateApplication().isFinished();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstallationPath()
- {
- return getDelegateApplication().getInstallationPath();
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getInstancePath()
- {
- return getDelegateApplication().getInstancePath();
- }
-
- /**
- * {@inheritDoc}
- */
- public void setQuickSetupDialog(QuickSetupDialog dialog) {
- installer.setQuickSetupDialog(dialog);
- upgrader.setQuickSetupDialog(dialog);
- }
-
- private GuiApplication getDelegateApplication()
- {
- GuiApplication application;
- if (getInstallAndUpgradeUserData().isUpgrade())
- {
- application = upgrader;
- }
- else
- {
- application = installer;
- }
- return application;
- }
-
- /**
- * Returns the install and upgrader specific user data.
- * @return the install and upgrader specific user data.
- */
- public InstallAndUpgradeUserData getInstallAndUpgradeUserData()
- {
- if (userData == null) {
- userData = new InstallAndUpgradeUserData();
- }
- return userData;
- }
-
- /**
- * Returns the trust manager that can be used to establish secure connections.
- * @return the trust manager that can be used to establish secure connections.
- */
- public ApplicationTrustManager getTrustManager()
- {
- return getDelegateApplication().getTrustManager();
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/package-info.java
deleted file mode 100644
index 1b0142a..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/package-info.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-/**
- * Defines the specific classes that are used in the merged version of the
- * upgrader and the installer. This is the webstart application where we
- * propose the user to upgrade an existing installation or to install a new
- * server.
- */
-package org.opends.quicksetup.installandupgrader;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
deleted file mode 100644
index b6e677f..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2010 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.installandupgrader.ui;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.ui.*;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.ButtonName;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.event.BrowseActionListener;
-import org.opends.quicksetup.event.ButtonEvent;
-import org.opends.quicksetup.installandupgrader.InstallAndUpgrader;
-import org.opends.server.util.DynamicConstants;
-
-import javax.swing.*;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-/**
- * This panel is used to show a welcome message asking the user whether to
- * install a new instance or upgrade an existing instance.
- */
-public class WelcomePanel extends QuickSetupStepPanel {
-
- private static final long serialVersionUID = 8696606861642491768L;
-
- private JLabel lblServerLocation;
-
- private JTextComponent tcServerLocation;
-
- private JRadioButton rbInstall;
-
- private JRadioButton rbUpgrade;
-
- private JButton butBrowse;
-
- private InstallAndUpgrader appl;
-
- private boolean initialized = false;
-
- /**
- * Default constructor.
- * @param application Upgrader application
- */
- public WelcomePanel(InstallAndUpgrader application) {
- super(application);
- appl = application;
- }
-
- /**
- * {@inheritDoc}
- */
- public void beginDisplay(UserData data) {
- super.beginDisplay(data);
- if (!initialized)
- {
- String userDir = System.getProperty("user.home");
- String firstLocation =
- userDir + File.separator
- + org.opends.server.util.DynamicConstants.SHORT_NAME;
- String serverLocation = firstLocation;
- if (!Utils.directoryExistsAndIsNotEmpty(serverLocation))
- {
- serverLocation = data.getServerLocation();
- }
- tcServerLocation.setText(serverLocation);
- boolean isUpgrade = appl.getInstallAndUpgradeUserData().isUpgrade();
- rbInstall.setSelected(!isUpgrade);
- rbUpgrade.setSelected(isUpgrade);
- initialized = true;
- }
- checkEnablingState();
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getFieldValue(FieldName fieldName) {
- Object v = null;
- if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
- v = tcServerLocation.getText();
- }
- else if (FieldName.IS_UPGRADE.equals(fieldName))
- {
- v = rbUpgrade.isSelected() ? Boolean.TRUE : Boolean.FALSE;
- }
- return v;
- }
-
- /**
- * {@inheritDoc}
- */
- public void displayFieldInvalid(FieldName fieldName, boolean invalid) {
- UIFactory.TextStyle style;
- if (invalid) {
- style = UIFactory.TextStyle.PRIMARY_FIELD_INVALID;
- } else {
- style = UIFactory.TextStyle.PRIMARY_FIELD_VALID;
- }
- if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
- UIFactory.setTextStyle(lblServerLocation, style);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getTitle() {
- return INFO_INSTALLANDUPGRADE_WELCOME_PANEL_TITLE.get();
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getInstructions() {
- /*
- * We can use org.opends.server.util.DynamicConstants without problems as it
- * has been added to quicksetup.jar during build time.
- */
- return Utils.getCustomizedObject(
- "INFO_INSTALLANDUPGRADE_WELCOME_PANEL_INSTRUCTIONS",
- INFO_INSTALLANDUPGRADE_WELCOME_PANEL_INSTRUCTIONS.get(
- DynamicConstants.SHORT_NAME,
- DynamicConstants.SHORT_NAME,
- DynamicConstants.DOC_REFERENCE_WIKI,
- DynamicConstants.SHORT_NAME),
- Message.class);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Component createInputPanel()
- {
- JPanel p = UIFactory.makeJPanel();
- p.setLayout(new GridBagLayout());
-
- rbInstall = UIFactory.makeJRadioButton(
- INFO_INSTALLANDUPGRADER_RBINSTALL_LABEL.get(),
- INFO_INSTALLANDUPGRADER_RBINSTALL_TOOLTIP.get(),
- UIFactory.TextStyle.PRIMARY_FIELD_VALID);
- rbUpgrade = UIFactory.makeJRadioButton(
- INFO_INSTALLANDUPGRADER_RBUPGRADE_LABEL.get(),
- INFO_INSTALLANDUPGRADER_RBUPGRADE_TOOLTIP.get(),
- UIFactory.TextStyle.PRIMARY_FIELD_VALID);
- ButtonGroup group = new ButtonGroup();
- group.add(rbInstall);
- group.add(rbUpgrade);
-
- ActionListener l = new ActionListener()
- {
- public void actionPerformed(ActionEvent ev)
- {
- checkEnablingState();
- ButtonEvent be = new ButtonEvent(ev.getSource(),
- ButtonName.INPUT_PANEL_BUTTON);
- notifyButtonListeners(be);
- }
- };
- rbInstall.addActionListener(l);
- rbUpgrade.addActionListener(l);
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets = UIFactory.getEmptyInsets();
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.weightx = 1.0;
- gbc.weighty = 0.0;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
-
- p.add(rbInstall, gbc);
- gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
- p.add(rbUpgrade, gbc);
- gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
-
- p.add(createUpgraderPanel(), gbc);
-
- gbc.insets.top = 0;
- gbc.weighty = 1.0;
- gbc.fill = GridBagConstraints.VERTICAL;
- p.add(Box.createVerticalGlue(), gbc);
- return p;
- }
-
- /**
- * Updates the state of the widgets in the panel depending on the radio button
- * that has been chosen.
- *
- */
- private void checkEnablingState()
- {
- boolean enable = rbUpgrade.isSelected();
- lblServerLocation.setEnabled(enable);
- tcServerLocation.setEnabled(enable);
- butBrowse.setEnabled(enable);
- }
-
- /**
- * Creates the panel containing the fields specific to the upgrader.
- * @return the panel containing the fields specific to the upgrader.
- */
- private Component createUpgraderPanel() {
- Component c;
-
- LabelFieldDescriptor serverLocationDescriptor =
- new LabelFieldDescriptor(INFO_UPGRADE_LOCATION_LABEL.get(),
- INFO_UPGRADE_LOCATION_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.TEXTFIELD,
- LabelFieldDescriptor.LabelType.PRIMARY,
- UIFactory.PATH_FIELD_SIZE);
-
- JPanel pnlBuildInfo = UIFactory.makeJPanel();
- pnlBuildInfo.setLayout(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- UserData userData = getApplication().getUserData();
-
- lblServerLocation = UIFactory.makeJLabel(serverLocationDescriptor);
-
- tcServerLocation =
- UIFactory.makeJTextComponent(serverLocationDescriptor,
- userData.getServerLocation());
-
- butBrowse =
- UIFactory.makeJButton(INFO_BROWSE_BUTTON_LABEL.get(),
- INFO_BROWSE_BUTTON_TOOLTIP.get());
-
- BrowseActionListener l =
- new BrowseActionListener(tcServerLocation,
- BrowseActionListener.BrowseType.LOCATION_DIRECTORY,
- getMainWindow());
- butBrowse.addActionListener(l);
-
- JPanel pnlBrowser = Utilities.createBrowseButtonPanel(
- lblServerLocation,
- tcServerLocation,
- butBrowse);
- pnlBrowser.setOpaque(false);
-
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
- pnlBuildInfo.add(pnlBrowser, gbc);
-
- gbc.gridy = 1;
- gbc.weighty = 1.0;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
- gbc.anchor = GridBagConstraints.LINE_START;
- JPanel fill = UIFactory.makeJPanel();
- // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
- pnlBuildInfo.add(fill, gbc);
-
- c = pnlBuildInfo;
-
- return c;
- }
-}
-
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/package-info.java
deleted file mode 100644
index dc264d7..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/package-info.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-/**
- * Defines the specific graphical classes that are used in the merged version of
- * the upgrader and the installer.
- */
-package org.opends.quicksetup.installandupgrader.ui;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/DataReplicationOptions.java b/opends/src/quicksetup/org/opends/quicksetup/installer/DataReplicationOptions.java
index c836796..9b88b66 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/DataReplicationOptions.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/DataReplicationOptions.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
@@ -54,7 +55,7 @@
*/
FIRST_IN_TOPOLOGY,
/**
- * Replicate Contents of the new Suffix with existings server.
+ * Replicate Contents of the new Suffix with existing server.
*/
IN_EXISTING_TOPOLOGY
}
@@ -66,7 +67,7 @@
{
authenticationData.setDn(Constants.DIRECTORY_MANAGER_DN);
authenticationData.setPort(4444);
- };
+ }
/**
* Private constructor for the DataReplicationOptions object.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/GlobalAdministratorOptions.java b/opends/src/quicksetup/org/opends/quicksetup/installer/GlobalAdministratorOptions.java
deleted file mode 100644
index 6f6f4f6..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/GlobalAdministratorOptions.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.installer;
-
-/**
- * This class is used to provide a data model for the global administrator
- * options.
- *
- */
-public class GlobalAdministratorOptions
-{
- private String uid;
-
- private String pwd;
-
- /**
- * Returns the UID of the global administrator.
- * @return the UID of the global administrator.
- */
- public String getUid()
- {
- return uid;
- }
-
- /**
- * Sets the UID of the global administrator.
- * @param uid the UID of the global administrator.
- */
- public void setUid(String uid)
- {
- this.uid = uid;
- }
-
- /**
- * Returns the password of the global administrator.
- * @return the password of the global administrator.
- */
- public String getPwd()
- {
- return pwd;
- }
-
- /**
- * Sets the password of the global administrator.
- * @param pwd the password of the global administrator.
- */
- public void setPwd(String pwd)
- {
- this.pwd = pwd;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 7fcee3b..7090ae8 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup.installer;
@@ -78,6 +78,7 @@
import org.opends.quicksetup.UserDataException;
import org.opends.quicksetup.WizardStep;
import org.opends.quicksetup.ui.*;
+import org.opends.quicksetup.util.FileManager;
import org.opends.quicksetup.util.IncompatibleVersionException;
import org.opends.quicksetup.util.Utils;
@@ -314,16 +315,6 @@
/**
* {@inheritDoc}
*/
- @Override
- public boolean canQuit(WizardStep step) {
- return step != PROGRESS &&
- step != FINISHED;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public boolean isSubStep(WizardStep step)
{
return SUBSTEPS.contains(step);
@@ -896,16 +887,18 @@
protected void configureServer() throws ApplicationException {
notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CONFIGURING.get()));
- writeOpenDSJavaHome();
-
- writeHostName();
-
if (Utils.isWebStart())
{
String installDir = getUserData().getServerLocation();
setInstallation(new Installation(installDir, installDir));
}
+ copyTemplateInstance();
+
+ writeOpenDSJavaHome();
+
+ writeHostName();
+
checkAbort();
ArrayList<String> argList = new ArrayList<String>();
@@ -1069,11 +1062,9 @@
@Override
public void run()
{
- int result = -1;
try
{
- result = helper.invokeConfigureServer(args);
- if (result != 0)
+ if (helper.invokeConfigureServer(args) != 0)
{
ae = new ApplicationException(
ReturnCode.CONFIGURATION_ERROR,
@@ -1662,12 +1653,9 @@
{
throw ace;
}
- else
- {
- // Nothing to do: this may occur if the new server has been
- // unregistered on another server and the modification has
- // been already propagated by replication.
- }
+ // Else, nothing to do: this may occur if the new server has been
+ // unregistered on another server and the modification has been
+ // already propagated by replication.
}
}
if (createdAdministrator)
@@ -1694,7 +1682,7 @@
ctx.close();
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
}
@@ -1724,7 +1712,7 @@
ctx.close();
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
notifyListeners(getFormattedDoneWithLineBreak());
@@ -1876,7 +1864,7 @@
}
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
@@ -2025,7 +2013,7 @@
}
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
notifyListeners(getFormattedDoneWithLineBreak());
@@ -2148,7 +2136,7 @@
ctx.close();
}
catch (Throwable t)
- {
+ { /* do nothing */
}
notifyListeners(getFormattedDoneWithLineBreak());
checkAbort();
@@ -2334,7 +2322,7 @@
}
}
catch (Exception ex)
- {
+ { /* do nothing */
}
}
}
@@ -2345,10 +2333,9 @@
*/
private String getHostNameFile()
{
- String file = Utils.getPath(
+ return Utils.getPath(
getInstallation().getRootDirectory().getAbsolutePath(),
SetupUtils.HOST_NAME_FILE);
- return file;
}
/**
@@ -2505,7 +2492,7 @@
}
}
catch (Throwable t1)
- {
+ { /* do nothing */
}
throw new ApplicationException(
ReturnCode.CONFIGURATION_ERROR, failedMsg, t);
@@ -2560,7 +2547,7 @@
finally
{
try{ rCtx.close(); }
- catch (Throwable t){}
+ catch (Throwable t){ /* do nothing */ }
}
}
@@ -2645,7 +2632,7 @@
rCtx.close();
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
}
@@ -2659,7 +2646,7 @@
{
Thread.sleep(3000);
}
- catch (Throwable t) {}
+ catch (Throwable t) { /* do nothing */ }
int nTries = 5;
boolean initDone = false;
while (!initDone)
@@ -2688,7 +2675,7 @@
Thread.sleep((5 - nTries) * 3000);
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
nTries--;
@@ -2704,7 +2691,7 @@
}
}
catch (Throwable t1)
- {
+ { /* do nothing */
}
throw ae;
}
@@ -2739,7 +2726,7 @@
InitialLdapContext localCtx = null; // Bound to local server.
ADSContext adsContext = null; // Bound to ADS host (via one of above).
- /* Outer try-catch-finally to convert occurences of NamingException and
+ /* Outer try-catch-finally to convert occurrences of NamingException and
ADSContextException to ApplicationException and clean up JNDI contexts.*/
try
{
@@ -2899,9 +2886,11 @@
finally
{
if (null != remoteCtx)
- try { remoteCtx.close(); } catch (NamingException x){ }
+ try { remoteCtx.close(); }
+ catch (NamingException x){ /* do nothing */ }
if (null != localCtx)
- try { localCtx.close(); } catch (NamingException x){ }
+ try { localCtx.close(); }
+ catch (NamingException x){ /* do nothing */ }
}
}
@@ -3255,7 +3244,7 @@
serverLocation, String.valueOf(requiredInMb)));
qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
- } else if (isWindows() && (serverLocation.indexOf("%") != -1))
+ } else if (isWindows() && (serverLocation.contains("%")))
{
errorMsgs.add(INFO_INVALID_CHAR_IN_PATH.get("%"));
qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
@@ -3768,14 +3757,7 @@
{
/* Check if there are already global administrators */
Set<?> administrators = adsContext.readAdministratorRegistry();
- if (administrators.size() > 0)
- {
- hasGlobalAdministrators[0] = true;
- }
- else
- {
- hasGlobalAdministrators[0] = false;
- }
+ hasGlobalAdministrators[0] = administrators.size() > 0;
Set<TopologyCacheException> exceptions =
updateUserDataWithSuffixesInADS(adsContext, trustManager);
Set<Message> exceptionMsgs = new LinkedHashSet<Message>();
@@ -3929,7 +3911,7 @@
ctx.close();
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
}
@@ -4239,7 +4221,7 @@
nEntriesValid = n >= MIN_NUMBER_ENTRIES && n <= MAX_NUMBER_ENTRIES;
} catch (NumberFormatException nfe)
- {
+ { /* do nothing */
}
if (!nEntriesValid)
@@ -4558,7 +4540,7 @@
* @param server the object describing the server.
* @param trustManager the trust manager to be used to establish the
* connection.
- * @param preferredURLs the list of preferred LDAP URLs to be used to connect
+ * @param cnx the list of preferred LDAP URLs to be used to connect
* to the server.
* @return the InitialLdapContext to the remote server.
* @throws ApplicationException if something goes wrong.
@@ -4695,7 +4677,7 @@
Thread.sleep(500);
}
catch (Throwable t)
- {
+ { /* do nothing */
}
if (canceled)
{
@@ -4909,12 +4891,7 @@
*/
private String getConfigurationFile()
{
- String file = getUserData().getConfigurationFile();
- if (file == null)
- {
- file = getPath(getInstallation().getCurrentConfigurationFile());
- }
- return file;
+ return getPath(getInstallation().getCurrentConfigurationFile());
}
/**
@@ -4925,12 +4902,7 @@
*/
private String getConfigurationClassName()
{
- String className = getUserData().getConfigurationClassName();
- if (className == null)
- {
- className = DEFAULT_CONFIG_CLASS_NAME;
- }
- return className;
+ return DEFAULT_CONFIG_CLASS_NAME;
}
private String getLocalReplicationServer()
@@ -4975,7 +4947,7 @@
dirCtx.close();
}
catch (NameAlreadyBoundException x)
- {
+ { /* do nothing */
}
catch (NamingException ne)
{
@@ -5006,7 +4978,7 @@
Thread.sleep(500);
}
catch (Throwable t)
- {
+ { /* do nothing */
}
try
{
@@ -5061,10 +5033,9 @@
helper.isStoppedByError(state))
{
LOG.log(Level.WARNING, "Error: "+errorMsg);
- ApplicationException ae = new ApplicationException(
+ throw new ApplicationException(
ReturnCode.APPLICATION_ERROR, errorMsg,
null);
- throw ae;
}
}
}
@@ -5121,7 +5092,7 @@
Thread.sleep(100);
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
}
@@ -5203,6 +5174,20 @@
{
return getUserData().getConnectTimeout();
}
+
+
+ /**
+ * Copies the template instance files into the instance directory.
+ *
+ * @throws ApplicationException
+ * If an IO error occurred.
+ */
+ private void copyTemplateInstance() throws ApplicationException
+ {
+ FileManager fileManager = new FileManager();
+ fileManager.synchronize(getInstallation().getTemplateDirectory(),
+ getInstallation().getInstanceDirectory());
+ }
}
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index 7795711..5e7eefa 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -834,9 +834,8 @@
*/
public boolean isPeersNotFoundError(String logMsg)
{
- return logMsg.indexOf(
- "="+ReplicationMessages.
- ERR_NO_REACHABLE_PEER_IN_THE_DOMAIN.getId()) != -1;
+ return logMsg.contains("=" + ReplicationMessages.
+ ERR_NO_REACHABLE_PEER_IN_THE_DOMAIN.getId());
}
/**
@@ -1092,7 +1091,7 @@
fileProperties.load(fs);
}
catch (Throwable t)
- {
+ { /* do nothing */
}
finally
{
@@ -1103,7 +1102,7 @@
fs.close();
}
catch (Throwable t)
- {
+ { /* do nothing */
}
}
}
@@ -1115,9 +1114,8 @@
String configDir = Utils.getPath(Utils
.getInstancePathFromInstallPath(installPath),
Installation.CONFIG_PATH_RELATIVE);
- String propertiesFile = Utils.getPath(
+ return Utils.getPath(
configDir, Installation.DEFAULT_JAVA_PROPERTIES_FILE);
- return propertiesFile;
}
/**
@@ -1224,10 +1222,10 @@
String parsedMsg = null;
if (msg != null)
{
- if ((msg.indexOf(
- "msgID="+JebMessages.NOTE_JEB_IMPORT_FINAL_STATUS.getId()) != -1) ||
- (msg.indexOf(
- "msgID="+JebMessages.NOTE_JEB_IMPORT_PROGRESS_REPORT.getId()) != -1))
+ if ((msg.contains("msgID=" + JebMessages
+ .NOTE_JEB_IMPORT_FINAL_STATUS.getId())) ||
+ (msg.contains("msgID=" + JebMessages
+ .NOTE_JEB_IMPORT_PROGRESS_REPORT.getId())))
{
int index = msg.indexOf("msg=");
if (index != -1)
@@ -1240,61 +1238,3 @@
}
}
-/**
- * A class describing a replication domain.
- *
- */
-class DomainEntry
-{
- private String name;
- private int replicationId;
- private String baseDn;
- private Set<String> replicationServers;
- /**
- * The constructor of the domain entry.
- * @param name the name of the domain.
- * @param replicationId the replicationId of the domain.
- * @param baseDn the base dn of the domain.
- * @param replicationServers the list of replication servers for the domain.
- */
- public DomainEntry(String name, int replicationId, String baseDn,
- Set<String> replicationServers)
- {
- this.name = name;
- this.replicationId = replicationId;
- this.baseDn = baseDn;
- this.replicationServers = replicationServers;
- }
- /**
- * Returns the base dn of the domain.
- * @return the base dn of the domain.
- */
- public String getBaseDn()
- {
- return baseDn;
- }
- /**
- * Returns the name of the domain.
- * @return the name of the domain.
- */
- public String getName()
- {
- return name;
- }
- /**
- * Returns the replication Id of the domain.
- * @return the replication Id of the domain.
- */
- public int getReplicationId()
- {
- return replicationId;
- }
- /**
- * Returns the list of replication servers of the domain.
- * @return the list of replication servers of the domain.
- */
- public Set<String> getReplicationServers()
- {
- return replicationServers;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/NewSuffixOptions.java b/opends/src/quicksetup/org/opends/quicksetup/installer/NewSuffixOptions.java
index fb017fa..9737982 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/NewSuffixOptions.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/NewSuffixOptions.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
@@ -161,8 +162,7 @@
*/
public LinkedList<String> getLDIFPaths()
{
- LinkedList<String> copy = new LinkedList<String>(ldifPaths);
- return copy;
+ return new LinkedList<String>(ldifPaths);
}
/**
@@ -206,7 +206,6 @@
*/
public LinkedList<String> getBaseDns()
{
- LinkedList<String> copy = new LinkedList<String>(baseDns);
- return copy;
+ return new LinkedList<String>(baseDns);
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
index 6028c8e..ec632e1 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -328,7 +329,7 @@
*/
private Object getDefaultValue(FieldName fieldName)
{
- Object value = null;
+ Object value;
AuthenticationData auth =
defaultUserData.getReplicationOptions().getAuthenticationData();
switch (fieldName)
@@ -494,30 +495,23 @@
FieldName.REMOTE_SERVER_HOST,
FieldName.REMOTE_SERVER_PORT
};
- for (int i=0; i<fields.length; i++)
- {
- JTextComponent tf = getField(fields[i]);
- tf.getDocument().addDocumentListener(new DocumentListener()
- {
- public void changedUpdate(DocumentEvent ev)
- {
- if (!rbReplicated.isSelected())
- {
+ for (FieldName field : fields) {
+ JTextComponent tf = getField(field);
+ tf.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent ev) {
+ if (!rbReplicated.isSelected()) {
rbReplicated.setSelected(true);
}
- if (!cbTopologyExists.isSelected())
- {
+ if (!cbTopologyExists.isSelected()) {
cbTopologyExists.setSelected(true);
}
}
- public void insertUpdate(DocumentEvent ev)
- {
+ public void insertUpdate(DocumentEvent ev) {
changedUpdate(ev);
}
- public void removeUpdate(DocumentEvent ev)
- {
+ public void removeUpdate(DocumentEvent ev) {
changedUpdate(ev);
}
});
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/GlobalAdministratorPanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/GlobalAdministratorPanel.java
index d1eeb07..38ea5a1 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/GlobalAdministratorPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/GlobalAdministratorPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -215,7 +216,7 @@
*/
private String getDefaultValue(FieldName fieldName)
{
- String value = null;
+ String value;
switch (fieldName)
{
case GLOBAL_ADMINISTRATOR_UID:
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallLicensePanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallLicensePanel.java
index 191b1e7..751bed2 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallLicensePanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallLicensePanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -76,7 +77,6 @@
return null;
}
- private JTextArea detailsTextArea;
private JCheckBox acceptCheck;
/**
@@ -105,7 +105,7 @@
gbc.insets.bottom = 3;
panel.add(l, gbc);
- detailsTextArea = new JTextArea(10, 50);
+ JTextArea detailsTextArea = new JTextArea(10, 50);
detailsTextArea.setBackground(
UIFactory.CURRENT_STEP_PANEL_BACKGROUND);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
index 8801518..7d827ef 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -32,6 +33,7 @@
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.admin.ads.ServerDescriptor;
+import org.opends.quicksetup.Constants;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.JavaArguments;
import org.opends.quicksetup.UserData;
@@ -532,9 +534,9 @@
cardLayoutPanel.setOpaque(false);
JComponent p = createReadOnlyPanel();
- p.setBorder(new EmptyBorder(UIFactory.LEFT_INSET_SECONDARY_FIELD,
+ p.setBorder(new EmptyBorder(UIFactory.TOP_INSET_SECONDARY_FIELD,
UIFactory.LEFT_INSET_SECONDARY_FIELD,
- UIFactory.LEFT_INSET_SECONDARY_FIELD,
+ UIFactory.BOTTOM_INSET_SECONDARY_FIELD,
UIFactory.LEFT_INSET_SECONDARY_FIELD));
JScrollPane scroll = new JScrollPane(p);
@@ -765,9 +767,10 @@
sb.append(formatter.getFormattedProgress(
INFO_INSTALL_SETUP_EQUIVALENT_COMMAND_LINE.get()));
sb.append(formatter.getLineBreak());
- sb.append("<b>"+Utils.getFormattedEquivalentCommandLine(
- Utils.getSetupEquivalentCommandLine(userData), formatter)+
- "</b>");
+ sb.append(Constants.HTML_BOLD_OPEN)
+ .append(Utils.getFormattedEquivalentCommandLine(
+ Utils.getSetupEquivalentCommandLine(userData), formatter))
+ .append(Constants.HTML_BOLD_CLOSE);
if (userData.getReplicationOptions().getType() ==
DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY)
{
@@ -787,9 +790,10 @@
for (ArrayList<String> cmdLine : cmdLines)
{
sb.append(formatter.getLineBreak());
- sb.append("<b>"+
- Utils.getFormattedEquivalentCommandLine(cmdLine, formatter)+
- "</b>");
+ sb.append(Constants.HTML_BOLD_OPEN)
+ .append(Utils.getFormattedEquivalentCommandLine(cmdLine,
+ formatter))
+ .append(Constants.HTML_BOLD_CLOSE);
}
sb.append(formatter.getLineBreak());
@@ -810,9 +814,10 @@
for (ArrayList<String> cmdLine : cmdLines)
{
sb.append(formatter.getLineBreak());
- sb.append("<b>"+
- Utils.getFormattedEquivalentCommandLine(cmdLine, formatter)+
- "</b>");
+ sb.append(Constants.HTML_BOLD_OPEN)
+ .append(Utils.getFormattedEquivalentCommandLine(cmdLine,
+ formatter))
+ .append(Constants.HTML_BOLD_CLOSE);
}
}
else if (userData.getReplicationOptions().getType() ==
@@ -826,9 +831,10 @@
for (ArrayList<String> cmdLine : cmdLines)
{
sb.append(formatter.getLineBreak());
- sb.append("<b>"+
- Utils.getFormattedEquivalentCommandLine(cmdLine, formatter)+
- "</b>");
+ sb.append(Constants.HTML_BOLD_OPEN)
+ .append(Utils.getFormattedEquivalentCommandLine(cmdLine,
+ formatter))
+ .append(Constants.HTML_BOLD_CLOSE);
}
}
@@ -842,7 +848,9 @@
sb.append(formatter.getFormattedProgress(
INFO_INSTALL_STOP_SERVER_EQUIVALENT_COMMAND_LINE.get()));
sb.append(formatter.getLineBreak());
- sb.append("<b>"+formatter.getFormattedProgress(Message.raw(cmd))+"</b>");
+ sb.append(Constants.HTML_BOLD_OPEN)
+ .append(formatter.getFormattedProgress(Message.raw(cmd)))
+ .append(Constants.HTML_BOLD_CLOSE);
}
equivalentCommandPane.setText(sb.toString());
}
@@ -918,9 +926,8 @@
path = Utils.getInstallPathFromClasspath();
path = Utils.getInstancePathFromInstallPath(path);
}
- String configDir = Utils.getPath(path, Installation.CONFIG_PATH_RELATIVE);
- String propertiesFile = Utils.getPath(
- configDir, Installation.DEFAULT_JAVA_PROPERTIES_FILE);
- return propertiesFile;
+ return Utils.getPath(
+ Utils.getPath(path, Installation.CONFIG_PATH_RELATIVE),
+ Installation.DEFAULT_JAVA_PROPERTIES_FILE);
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java
index 62371c0..e984f06 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup.installer.ui;
@@ -94,8 +94,6 @@
private boolean isCheckingVisible;
- private final int MAX_VALUE_32_BIT = 2048;
-
private static boolean userAgreedWithWebStart;
/**
@@ -779,7 +777,8 @@
private Message getMemoryErrorMessage(Message msg, int memValue)
{
- if (memValue < MAX_VALUE_32_BIT)
+ // 2048 MB is acceptable max heap size on 32Bit OS
+ if (memValue < 2048)
{
return msg;
}
@@ -884,7 +883,8 @@
}
if (sb.length() > 0)
{
- checkOptions(sb.toString(), errorMsgs, ls.toArray(new JLabel[]{}),
+ checkOptions(sb.toString(), errorMsgs,
+ ls.toArray(new JLabel[ls.size()]),
ERR_GENERIC_JAVA_ARGUMENT.get(sb.toString()));
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RuntimeOptionsPanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RuntimeOptionsPanel.java
index 2c6e557..9197640 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RuntimeOptionsPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RuntimeOptionsPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -83,11 +84,10 @@
// The size of the LDIF file to be imported used as threshold to display
// a warning message, telling the user to update the import runtime
// settings.
- private long WARNING_THRESOLD_FOR_IMPORT = 200 * 1024 * 1024;
-
- private int WARNING_THRESOLD_AUTOMATICALLY_GENERATED_IMPORT = 100000;
-
- private int WARNING_THRESOLD_REPLICATED_ENTRIES = 100000;
+ private static final long WARNING_THRESOLD_FOR_IMPORT = 200 * 1024 * 1024;
+ private static final int WARNING_THRESOLD_AUTOMATICALLY_GENERATED_IMPORT
+ = 100000;
+ private static final int WARNING_THRESOLD_REPLICATED_ENTRIES = 100000;
/**
* Constructor of the panel.
@@ -128,11 +128,10 @@
JLabel l = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON,
INFO_SERVER_RUNTIME_ARGS_LABEL.get(),
UIFactory.TextStyle.PRIMARY_FIELD_VALID);
- int serverInsetsTop = Math.abs(
+
+ gbc.insets.top = Math.abs(
bServer.getPreferredSize().height -
l.getPreferredSize().height) / 2;
-
- gbc.insets.top = serverInsetsTop;
panel.add(l, gbc);
gbc.gridx ++;
gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
@@ -381,13 +380,9 @@
{
Message msg = null;
- boolean createSuffix = false;
-
DataReplicationOptions repl = uData.getReplicationOptions();
-
SuffixesToReplicateOptions suf = uData.getSuffixesToReplicateOptions();
-
- createSuffix =
+ boolean createSuffix =
repl.getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY ||
repl.getType() == DataReplicationOptions.Type.STANDALONE ||
suf.getType() == SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY;
@@ -408,7 +403,7 @@
case IMPORT_AUTOMATICALLY_GENERATED_DATA:
if (options.getNumberEntries() >
- WARNING_THRESOLD_AUTOMATICALLY_GENERATED_IMPORT)
+ WARNING_THRESOLD_AUTOMATICALLY_GENERATED_IMPORT)
{
msg =
INFO_AUTOMATICALLY_GENERATED_DATA_WARNING_UPDATE_RUNTIME_ARGS.
@@ -450,9 +445,11 @@
UIFactory.TITLE_FONT);
String details = UIFactory.applyFontToHtml(msg.toString(),
UIFactory.SECONDARY_FIELD_VALID_FONT);
- buf.append(UIFactory.getIconHtml(UIFactory.IconType.WARNING_LARGE) +
- space + space + title + lBreak + lBreak)
- .append(details);
+ buf.append(UIFactory.getIconHtml(UIFactory.IconType.WARNING_LARGE))
+ .append(space).append(space)
+ .append(title)
+ .append(lBreak).append(lBreak)
+ .append(details);
String s = "<form>"+UIFactory.applyErrorBackgroundToHtml(buf.toString())+
"</form>";
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java
index ee0b585..10a24b0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -34,6 +35,7 @@
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.util.Collections;
import java.util.TreeSet;
import javax.swing.Box;
@@ -105,10 +107,7 @@
}
isCanceled = true;
TreeSet<String> s = new TreeSet<String>();
- for (int i=0; i<aliases.length; i++)
- {
- s.add(aliases[i]);
- }
+ Collections.addAll(s, aliases);
String[] orderedAliases = new String[s.size()];
s.toArray(orderedAliases);
comboAliases.setModel(new DefaultComboBoxModel(orderedAliases));
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
index 42d41e5..777b6d0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.installer.ui;
@@ -71,7 +72,6 @@
implements Comparator<SuffixDescriptor>
{
private static final long serialVersionUID = -8051367953737385327L;
- private Component lastFocusComponent;
private TreeSet<SuffixDescriptor> orderedSuffixes =
new TreeSet<SuffixDescriptor>(this);
private HashMap<String, JCheckBox> hmCheckBoxes =
@@ -126,17 +126,9 @@
/**
* {@inheritDoc}
*/
- public void displayFieldInvalid(FieldName fieldName, boolean invalid)
- {
- }
-
- /**
- * {@inheritDoc}
- */
public int compare(SuffixDescriptor desc1, SuffixDescriptor desc2)
{
- int result = 0;
- result = compareSuffixDN(desc1, desc2);
+ int result = compareSuffixDN(desc1, desc2);
if (result == 0)
{
result = compareSuffixStrings(desc1, desc2);
@@ -277,17 +269,6 @@
}
/**
- * {@inheritDoc}
- */
- public void endDisplay()
- {
- if (lastFocusComponent != null)
- {
- lastFocusComponent.requestFocusInWindow();
- }
- }
-
- /**
* Creates the components of this panel.
*/
private void createComponents()
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index 8ec0f59..49ebad1 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup.installer.webstart;
@@ -541,43 +541,6 @@
}
/**
- * {@inheritDoc}
- */
- protected String getOpenDSClassPath()
- {
- StringBuilder buf = new StringBuilder();
- String[] jars = getOpenDSJarPaths();
- for (int i = 0; i < jars.length; i++)
- {
- if (i != 0)
- {
- buf.append(System.getProperty("path.separator"));
- }
- buf.append(jars[i]);
- }
- return buf.toString();
- }
-
- /**
- * Returns the jar file paths in the installation. This is used to launch
- * command lines that require a classpath.
- * @return the jar file paths in the installation.
- */
- private String[] getOpenDSJarPaths()
- {
- String[] jarPaths =
- new String[Installation.OPEN_DS_JAR_RELATIVE_PATHS.length];
- File parentDir = new File(getUserData().getServerLocation());
- for (int i = 0; i < jarPaths.length; i++)
- {
- File f = new File(parentDir, Installation.OPEN_DS_JAR_RELATIVE_PATHS[i]);
- jarPaths[i] = f.getAbsolutePath();
- }
- return jarPaths;
-
- }
-
- /**
* Returns the name of the zip file name that contains all the installation.
* @return the name of the zip file name that contains all the installation.
*/
diff --git a/opends/src/quicksetup/org/opends/quicksetup/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/package-info.java
index 38d0d28..e2bdc73 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/package-info.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/package-info.java
@@ -23,13 +23,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
/**
* Defines the main classes that are you used by both the QuickSetup utilities:
- * the installer and the upgrader. This includes some shared classes used to
+ * the installer. This includes some shared classes used to
* represent user provided (like UserData), or the class that represents an
* application (Application class).
*
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java b/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
index 8e0c0cd..5509061 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -94,13 +95,11 @@
* The user accepted the certificate permanently.
*/
ACCEPTED_PERMANENTLY
- };
+ }
private static final long serialVersionUID = -8989965057591475064L;
private ReturnType returnValue = ReturnType.NOT_ACCEPTED;
private UserDataCertificateException ce;
private JButton doNotAcceptButton;
- private JButton acceptSessionButton;
- private JButton acceptPermanentlyButton;
private JComponent certificateDetails;
private JEditorPane explanationPane;
private boolean detailsAlreadyClicked;
@@ -113,7 +112,7 @@
/**
* Constructor of the certificate dialog.
* @param parent the parent frame for this dialog.
- * @param ce the UserDataCertificateException we use to get the informations
+ * @param ce the UserDataCertificateException we use to get the information
* about the certificate that was presented and the reason why it was
* rejected.
*/
@@ -360,30 +359,24 @@
gbc.gridwidth = 3;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
- acceptSessionButton =
- UIFactory.makeJButton(
- INFO_CERTIFICATE_DIALOG_ACCEPT_FOR_SESSION_BUTTON_LABEL.get(),
- INFO_CERTIFICATE_DIALOG_ACCEPT_FOR_SESSION_BUTTON_TOOLTIP.get());
+ JButton acceptSessionButton = UIFactory.makeJButton(
+ INFO_CERTIFICATE_DIALOG_ACCEPT_FOR_SESSION_BUTTON_LABEL.get(),
+ INFO_CERTIFICATE_DIALOG_ACCEPT_FOR_SESSION_BUTTON_TOOLTIP.get());
buttonsPanel.add(acceptSessionButton, gbc);
- acceptSessionButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent ev)
- {
+ acceptSessionButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ev) {
acceptForSession();
}
});
gbc.gridwidth = GridBagConstraints.RELATIVE;
gbc.insets.left = UIFactory.HORIZONTAL_INSET_BETWEEN_BUTTONS;
- acceptPermanentlyButton =
- UIFactory.makeJButton(
- INFO_CERTIFICATE_DIALOG_ACCEPT_PERMANENTLY_BUTTON_LABEL.get(),
- INFO_CERTIFICATE_DIALOG_ACCEPT_PERMANENTLY_BUTTON_TOOLTIP.get());
+ JButton acceptPermanentlyButton = UIFactory.makeJButton(
+ INFO_CERTIFICATE_DIALOG_ACCEPT_PERMANENTLY_BUTTON_LABEL.get(),
+ INFO_CERTIFICATE_DIALOG_ACCEPT_PERMANENTLY_BUTTON_TOOLTIP.get());
buttonsPanel.add(acceptPermanentlyButton, gbc);
- acceptPermanentlyButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent ev)
- {
+ acceptPermanentlyButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ev) {
acceptPermanently();
}
});
@@ -555,12 +548,11 @@
Date date = cert.getNotBefore();
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,
- DateFormat.SHORT);
+ DateFormat.SHORT);
Message value = Message.raw(df.format(date));
- boolean isNotValidYet = false;
long t1 = System.currentTimeMillis();
long t2 = date.getTime();
- isNotValidYet = t1 < t2;
+ boolean isNotValidYet = t1 < t2;
if (isNotValidYet)
{
@@ -575,35 +567,6 @@
return c;
}
- /**
- * Returns the string representation for the date from which the certificate
- * is valid.
- * @param cert the certificate object.
- * @return the string representation for the date from which the certificate
- * is valid.
- */
- public static String getValidFrom(X509Certificate cert)
- {
- String s;
- Date date = cert.getNotBefore();
- DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,
- DateFormat.SHORT);
- String value = df.format(date);
- boolean isNotValidYet = false;
- long t1 = System.currentTimeMillis();
- long t2 = date.getTime();
- isNotValidYet = t1 < t2;
-
- if (isNotValidYet)
- {
- s = INFO_CERTIFICATE_NOT_VALID_YET.get(value).toString();
- }
- else
- {
- s = value;
- }
- return s;
- }
private JComponent createExpiresOnComponent(X509Certificate cert)
{
@@ -613,10 +576,9 @@
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.SHORT);
Message value = Message.raw(df.format(date));
- boolean isExpired = false;
long t1 = System.currentTimeMillis();
long t2 = date.getTime();
- isExpired = t1 > t2;
+ boolean isExpired = t1 > t2;
if (isExpired)
{
@@ -631,35 +593,6 @@
return c;
}
- /**
- * Returns the string representation for the date from which the certificate
- * is expired.
- * @param cert the certificate object.
- * @return the string representation for the date from which the certificate
- * is expired.
- */
- public static String getExpiresOn(X509Certificate cert)
- {
- String s;
- Date date = cert.getNotAfter();
- DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT,
- DateFormat.SHORT);
- String value = df.format(date);
- boolean isExpired = false;
- long t1 = System.currentTimeMillis();
- long t2 = date.getTime();
- isExpired = t1 > t2;
-
- if (isExpired)
- {
- s = INFO_CERTIFICATE_EXPIRED.get(value).toString();
- }
- else
- {
- s = value;
- }
- return s;
- }
private JComponent createTypeComponent(X509Certificate cert)
{
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java b/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
index 37e3b4a..185b7b8 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -40,18 +41,6 @@
public enum FieldName
{
/**
- * The value associated with this is a Boolean.
- * It is used by the merged installer and upgrader to know whether an upgrade
- * or an install must be performed.
- */
- IS_UPGRADE,
- /**
- * The value associated with this is a String.
- * The upgrader uses this field to indicate the
- * location of the server to upgrade.
- */
- SERVER_TO_UPGRADE_LOCATION,
- /**
* The value associated with this is a String.
* The web start installer uses this field to indicate the
* location to install the server.
@@ -90,7 +79,7 @@
*/
SECURITY_OPTIONS,
/**
- * The value associated with this is a DataOptions.Type.
+ * The value associated with this is a data options.Type.
*/
DATA_OPTIONS,
/**
@@ -174,10 +163,6 @@
/**
* The value associated with this is a Boolean.
*/
- SERVER_START_UPGRADER,
- /**
- * The value associated with this is a Boolean.
- */
ENABLE_WINDOWS_SERVICE,
/**
* The value associated with this is a Boolean.
@@ -210,29 +195,5 @@
/**
* The value associated with this is a Set of String.
*/
- EXTERNAL_LOG_FILES,
-
- /**
- * Indicates whether the upgrade will need to first download
- * an OpenDS install package (.zip) to download or the
- * upgrader will use a file that has already been
- * downloaded. The value of this field is boolean and if
- * true must be accompanied by a value for UPGRADE_BUILD_TO_DOWNLOAD.
- * If false UPGRADE_FILE must be specified.
- */
- UPGRADE_DOWNLOAD,
-
- /**
- * Display name of the build to which the upgrader
- * will upgrade the build indicated by SERVER_LOCATION.
- */
- UPGRADE_BUILD_TO_DOWNLOAD,
-
- /**
- * Local OpenDS install package (.zip) file containing
- * a build to which the build indicated by SERVER_LOCATION
- * will be upgraded.
- */
- UPGRADE_FILE
-
+ EXTERNAL_LOG_FILES
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
index 63f414d..cf53640 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -23,23 +23,18 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
-import org.opends.quicksetup.util.ServerController;
-import org.opends.quicksetup.util.InProcessServerController;
import org.opends.quicksetup.util.UIKeyStore;
-import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.Application;
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.ButtonName;
-import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.UserDataCertificateException;
import org.opends.quicksetup.UserDataException;
-import org.opends.quicksetup.UserInteraction;
import org.opends.quicksetup.WizardStep;
import org.opends.quicksetup.webstart.WebStartDownloader;
import org.opends.messages.Message;
@@ -47,7 +42,6 @@
import javax.swing.*;
import java.awt.event.WindowEvent;
-import java.lang.reflect.Constructor;
import java.security.cert.X509Certificate;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -57,7 +51,7 @@
/**
* This class represents an application with a wizard GUI that can be run in the
* context of QuickSetup. Examples of applications might be 'installer',
- * 'uninstaller' and 'upgrader'.
+ * and 'uninstaller'.
*/
public abstract class GuiApplication extends Application {
@@ -229,15 +223,6 @@
}
/**
- * Returns the QuickSetupDialog in control.
- * @return the QuickSetupDialog in control.
- */
- protected QuickSetupDialog getQuickSetupDialog()
- {
- return qs;
- }
-
- /**
* Indicates whether the provided <code>step</code> is a sub step or not.
* @param step WizardStep for which the return value indicates whether
* or not is a sub step.
@@ -333,17 +318,6 @@
public abstract boolean canFinish(WizardStep step);
/**
- * Indicates whether or not the user is allowed to quit the wizard from
- * <code>step</code>.
- * @param step WizardStep for which the the return value indicates whether
- * or not the user can quit the wizard
- * @return boolean where true indicates the user can quit the wizard
- */
- public boolean canQuit(WizardStep step) {
- return false;
- }
-
- /**
* Called when the user has clicked the 'previous' button.
* @param cStep WizardStep at which the user clicked the previous button
* @param qs QuickSetup controller
@@ -580,57 +554,6 @@
}
/**
- * Starts the server to be able to update its configuration but not allowing
- * it to listen to external connections.
- * @throws ApplicationException if the server could not be started.
- */
- protected void startServerWithoutConnectionHandlers()
- throws ApplicationException {
- try {
- ServerController control = new ServerController(getInstallation());
- if (getInstallation().getStatus().isServerRunning()) {
- control.stopServer(true);
- }
- InProcessServerController ipsc =
- new InProcessServerController(getInstallation());
- InProcessServerController.disableConnectionHandlers(true);
- ipsc.startServer();
- } catch (Throwable t) {
- Message msg = INFO_ERROR_STARTING_SERVER_WITH_NO_CONNECTION_HANDLERS.get(
- (t.getMessage() == null) ? t.toString() : t.getMessage());
- LOG.log(Level.INFO, msg.toString(), t);
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR, msg, t);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public UserInteraction userInteraction()
- {
- if (Utils.isCli())
- {
- // Use reflection to avoid breaking the java web start in some
- // platforms.
- try
- {
- Class<?> cl = Class.forName("org.opends.quicksetup.CliUserInteraction");
- Constructor<?> c = cl.getConstructor(UserData.class);
- return (UserInteraction) c.newInstance(getUserData());
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Unexpected error: " + t, t);
- }
- }
- else
- {
- return new GuiUserInteraction(qs.getFrame());
- }
- }
-
- /**
* Sets the QuickSetupDialog driving this application.
* @param dialog QuickSetupDialog driving this application
*/
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiUserInteraction.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiUserInteraction.java
deleted file mode 100644
index f1bb1dc..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiUserInteraction.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.ui;
-
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.UserInteraction;
-import org.opends.quicksetup.Constants;
-import org.opends.quicksetup.util.Utils;
-
-import javax.swing.*;
-import javax.swing.plaf.basic.BasicOptionPaneUI;
-import javax.swing.border.Border;
-import java.awt.*;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-/**
- * This class supports user interactions for a graphical application.
- */
-public class GuiUserInteraction implements UserInteraction {
-
- private Component parent = null;
-
- /**
- * Creates an instance.
- * @param parent Component acting as parent to dialogs supporting interaction.
- */
- public GuiUserInteraction(Component parent) {
- this.parent = parent;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object confirm(Message summary, Message details,
- Message title, MessageType type, Message[] options,
- Message def) {
- return confirm(summary, details, null, title, type, options, def, null);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object confirm(Message summary, Message details, Message fineDetails,
- Message title, MessageType type, Message[] options,
- Message def, Message viewDetailsOption) {
- int optionType;
- if (options != null) {
- if (options.length == 2) {
- optionType = JOptionPane.YES_NO_OPTION;
- } else if (options.length == 3) {
- optionType = JOptionPane.YES_NO_CANCEL_OPTION;
- } else {
- throw new IllegalArgumentException(
- "unsupported number of options: " + options.length);
- }
- } else {
- throw new NullPointerException("options cannot be null");
- }
- int msgType;
- switch(type) {
- case PLAIN: msgType = JOptionPane.PLAIN_MESSAGE; break;
- case ERROR: msgType = JOptionPane.ERROR_MESSAGE; break;
- case INFORMATION: msgType = JOptionPane.INFORMATION_MESSAGE; break;
- case WARNING: msgType = JOptionPane.WARNING_MESSAGE; break;
- case QUESTION: msgType = JOptionPane.QUESTION_MESSAGE; break;
- default: throw new IllegalArgumentException("unsupported MessageType");
- }
- JOptionPane op;
- if (fineDetails != null) {
- op = new DetailsOptionPane(Constants.MAX_CHARS_PER_LINE_IN_DIALOG,
- fineDetails);
- } else {
- op = new MaxCharactersPerLineOptionPane(
- Constants.MAX_CHARS_PER_LINE_IN_DIALOG);
- }
-
- // Create the main message using HTML formatting. The max
- // characters per line functionality of the extends options
- // pane does not affect message that are components so we
- // have to format this ourselves.
- MessageBuilder sb = new MessageBuilder();
- sb.append(Constants.HTML_BOLD_OPEN);
- sb.append(Utils.breakHtmlString(summary,
- Constants.MAX_CHARS_PER_LINE_IN_DIALOG));
- sb.append(Constants.HTML_BOLD_CLOSE);
- sb.append(Constants.HTML_LINE_BREAK);
- sb.append(Constants.HTML_LINE_BREAK);
-
- sb.append(Utils.breakHtmlString(details,
- Constants.MAX_CHARS_PER_LINE_IN_DIALOG));
- JEditorPane ep = UIFactory.makeHtmlPane(
- sb.toMessage(),
- UIFactory.INSTRUCTIONS_FONT);
- ep.setBorder(BorderFactory.createEmptyBorder(0, 0, 20, 0));
- op.setMessage(ep);
- op.setOptionType(optionType);
- op.setMessageType(msgType);
- op.setOptions(options);
- op.setInitialValue(def);
- JDialog dlg = op.createDialog(parent, String.valueOf(title));
- dlg.setVisible(true);
- return op.getValue();
- }
-
- /**
- * {@inheritDoc}
- */
- public String createUnorderedList(List<?> list) {
- StringBuilder sb = new StringBuilder();
- if (list != null) {
- sb.append(Constants.HTML_UNORDERED_LIST_OPEN);
- for (Object o : list) {
- sb.append(Constants.HTML_LIST_ITEM_OPEN);
- sb.append(o.toString());
- sb.append(Constants.HTML_LIST_ITEM_CLOSE);
- }
- sb.append(Constants.HTML_UNORDERED_LIST_CLOSE);
- }
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isCLI()
- {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isForceOnError()
- {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isInteractive()
- {
- return true;
- }
-
- /**
- * JOptionPane that controls the number of characters that are allowed
- * to appear on a single line in the input area of the dialog.
- */
- private class MaxCharactersPerLineOptionPane extends JOptionPane {
-
- /** Implements serializable. */
- static final long serialVersionUID = 8984664928623358120L;
-
- private int maxCharactersPerLineCount;
-
- /**
- * Creates an instance.
- * @param maxCharactersPerLine the maximum number of characters that
- * are allowed on a single line in the dialog.
- */
- public MaxCharactersPerLineOptionPane(int maxCharactersPerLine) {
- this.maxCharactersPerLineCount = maxCharactersPerLine;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getMaxCharactersPerLineCount() {
- return maxCharactersPerLineCount;
- }
-
- }
-
- /**
- * JOptionPane that controls the number of characters that are allowed
- * to appear on a single line in the input area of the dialog.
- */
- private class DetailsOptionPane extends MaxCharactersPerLineOptionPane {
-
- static final long serialVersionUID = -7813059467702205272L;
-
- private static final int MAX_DETAILS_COMPONENT_HEIGHT = 200;
-
- private boolean detailsShowing = false;
-
- private Component detailsComponent;
-
- private JDialog dialog;
-
- /**
- * Creates an instance.
- * @param maxCharactersPerLine the maximum number of characters that
- * are allowed on a single line in the dialog.
- * @param details String of HTML representing the details section of the
- * dialog.
- */
- public DetailsOptionPane(int maxCharactersPerLine,
- Message details) {
- super(maxCharactersPerLine);
- detailsComponent = createDetailsComponent(details);
- }
-
- /**
- * {@inheritDoc}
- */
- public Component add(Component comp) {
- if ("OptionPane.buttonArea".equals(comp.getName())) {
- JPanel detailsButtonsPanel = new JPanel();
- detailsButtonsPanel.setLayout(
- new BoxLayout(detailsButtonsPanel,
- BoxLayout.LINE_AXIS));
- final Message showDetailsLabel = INFO_SHOW_DETAILS_BUTTON_LABEL.get();
- final Message hideDetailsLabel = INFO_HIDE_DETAILS_BUTTON_LABEL.get();
- final JButton btnDetails = new JButton(showDetailsLabel.toString());
- btnDetails.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Dimension current = dialog.getSize();
- if (!detailsShowing) {
- // detailsComponent.setVisible(true);
- dialog.setSize(current.width,
- current.height + getExpansionHeight());
- btnDetails.setText(hideDetailsLabel.toString());
- } else {
- // detailsComponent.setVisible(false);
- dialog.setSize(current.width,
- current.height - getExpansionHeight());
- btnDetails.setText(showDetailsLabel.toString());
- }
- detailsShowing = !detailsShowing;
- }
- });
-
- JPanel detailsBottom = new JPanel();
- Border border = UIManager.getBorder("OptionPane.buttonAreaBorder");
- if (border != null) {
- detailsBottom.setBorder(border);
- }
- detailsBottom.setLayout(
- new BasicOptionPaneUI.ButtonAreaLayout(
- UIManager.getBoolean("OptionPane.sameSizeButtons"),
- UIManager.getInt("OptionPane.buttonPadding")));
- detailsBottom.add(btnDetails);
- detailsButtonsPanel.add(detailsBottom);
- detailsButtonsPanel.add(Box.createHorizontalGlue());
- detailsButtonsPanel.add(comp);
- super.add(detailsButtonsPanel);
- } else {
- super.add(comp);
- }
- return comp;
- }
-
- /**
- * {@inheritDoc}
- */
- public JDialog createDialog(Component parentComponent, String title)
- throws HeadlessException
- {
- this.dialog = super.createDialog(parentComponent, title);
- Dimension d = dialog.getSize();
- add(detailsComponent);
- this.dialog.pack();
- dialog.setSize(d);
- return dialog;
- }
-
- private Component createDetailsComponent(Message details) {
- JPanel detailsPanel = new JPanel();
- detailsPanel.setLayout(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.insets = new Insets(15, 0, 0, 0);
- gbc.fill = GridBagConstraints.HORIZONTAL;
- detailsPanel.add(UIFactory.makeJLabel(null,
- INFO_DETAILS_LABEL.get(),
- UIFactory.TextStyle.PRIMARY_FIELD_VALID), gbc);
-
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- gbc.gridx++;
- gbc.weightx = 1.0;
- gbc.weighty = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
-
- JEditorPane ep;
- if (Utils.containsHtml(String.valueOf(details))) {
- ep = UIFactory.makeHtmlPane(details, UIFactory.INSTRUCTIONS_FONT);
- } else {
- ep = UIFactory.makeTextPane(details, UIFactory.TextStyle.INSTRUCTIONS);
- }
- ep.setOpaque(false);
-
- detailsPanel.add(new JScrollPane(ep), gbc);
- return detailsPanel;
- }
-
- private int getExpansionHeight() {
- return (int) Math.min(detailsComponent.getPreferredSize().getHeight(),
- MAX_DETAILS_COMPONENT_HEIGHT);
- }
-
- }
-
-// public static void main(String[] args) {
-// new GuiUserInteraction(null).confirm(
-// "Summary",
-// "Details",
-// "Title",
-// MessageType.ERROR,
-// new String[]{"Yes","No"},"No");
-// }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressDialog.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressDialog.java
index 07593fe..4d9a95e 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressDialog.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -66,8 +67,6 @@
private JEditorPane detailsTextArea;
- private JScrollPane scroll;
-
private Message lastText;
private JFrame parent;
@@ -117,15 +116,6 @@
}
/**
- * Sets the title of the panel.
- * @param title the title of the panel.
- */
- public void setPanelTitle(Message title)
- {
- this.panelTitle = title;
- }
-
- /**
* Returns the title of the panel.
* @return the title of the panel
*/
@@ -242,7 +232,7 @@
gbc.insets = UIFactory.getEmptyInsets();
mainPanel.add(l, gbc);
- scroll = new JScrollPane();
+ JScrollPane scroll = new JScrollPane();
detailsTextArea = UIFactory.makeProgressPane(scroll);
detailsTextArea.setBackground(
UIFactory.CURRENT_STEP_PANEL_BACKGROUND);
@@ -253,9 +243,8 @@
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
String url = e.getURL().toString();
- Message newText = getFormatter().getFormattedAfterUrlClick(url,
+ lastText = getFormatter().getFormattedAfterUrlClick(url,
lastText);
- lastText = newText;
setDetails(lastText);
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
index c7121c9..a16250e 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -313,37 +314,10 @@
btnCancel,
detailsTextArea
};
- for (int i = 0; i < comps.length; i++)
- {
- comps[i].addFocusListener(l);
+ for (JComponent comp : comps) {
+ comp.addFocusListener(l);
}
lastFocusComponent = detailsTextArea;
}
-
-// public static void main(String[] args) {
-// final UserData ud = new UpgradeUserData();
-// ud.setServerLocation("XXX/XXXXX/XX/XXXXXXXXXXXX/XXXX");
-// Upgrader app = new Upgrader();
-// app.setUserData(ud);
-// final ProgressPanel p = new ProgressPanel(app);
-// p.initialize();
-// JFrame frame = new JFrame();
-// frame.getContentPane().add(p);
-// frame.addComponentListener(new ComponentAdapter() {
-// public void componentHidden(ComponentEvent componentEvent) {
-// System.exit(0);
-// }
-// });
-// frame.pack();
-// frame.setVisible(true);
-// new Thread(new Runnable() {
-// public void run() {
-// p.beginDisplay(ud);
-// }
-// }).start();
-//
-// }
-
-
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
index 0479b31..944853f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -44,7 +45,6 @@
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.event.MinimumSizeComponentListener;
import org.opends.quicksetup.ProgressDescriptor;
-import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.messages.Message;
/**
* This class represents the dialog used by quicksetup applications.
@@ -226,17 +226,6 @@
}
/**
- * Return the progress message formatter that will be used in the dialog
- * to display the messages.
- * @return the progress message formatter that will be used in the dialog
- * to display the messages.
- */
- public ProgressMessageFormatter getFormatter()
- {
- return getCurrentStepPanel().getProgressPanel().getFormatter();
- }
-
- /**
* Marks as invalid (or valid depending on the value of the invalid parameter)
* a field corresponding to FieldName. This basically implies udpating the
* style of the JLabel associated with fieldName (the association is done
@@ -313,15 +302,6 @@
}
/**
- * Notification from the worker with a message.
- * @param msg the message sent by the worker.
- */
- public void workerMessage(String msg)
- {
- // TODO For the moment not used.
- }
-
- /**
* Notification telling that the installation/uninstallation is finished.
* @param successful a boolean telling whether the setup was successful or
* not.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
index 41546c7..72bafaa 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -170,15 +171,6 @@
}
/**
- * Sets the specified value in the field associated with the field name.
- * @param fieldName the field name associated with the field.
- * @param value the value that must be set.
- */
- public void setFieldValue(FieldName fieldName, Object value)
- {
- }
-
- /**
* Marks as invalid (or valid depending on the value of the invalid parameter)
* a field corresponding to FieldName. This basically implies udpating the
* style of the JLabel associated with fieldName (the association is done
@@ -261,16 +253,6 @@
}
/**
- * Tells whether a working progress icon is being displayed in the panel.
- * @return <CODE>true</CODE> if a working progress icon is being displayed in
- * the panel and <CODE>false</CODE> otherwise.
- */
- public boolean isCheckingVisible()
- {
- return isCheckingVisible;
- }
-
- /**
* Returns the text to be displayed in the progress label for a give icon
* type.
* @param iconType the icon type.
@@ -387,7 +369,6 @@
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets.left = 0;
add(inputContainer, gbc);
- somethingAdded = true;
}
else
{
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
index ae3a88a..555de33 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -23,39 +23,26 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Font;
-import java.awt.Image;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.html.HTMLEditorKit;
+import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.swing.*;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.BevelBorder;
-import javax.swing.table.DefaultTableCellRenderer;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
+import static org.opends.messages.QuickSetupMessages.*;
/**
@@ -80,11 +67,6 @@
public static final int HORIZONTAL_INSET_BETWEEN_BUTTONS = 5;
/**
- * Specifies the horizontal inset for the control panel sub section.
- */
- public static final int HORIZONTAL_INSET_CONTROL_PANEL_SUBSECTION = 20;
-
- /**
* Specifies the top inset for the steps.
*/
public static final int TOP_INSET_STEP = 15;
@@ -154,11 +136,6 @@
public static final int TOP_INSET_BROWSE = 5;
/**
- * Specifies the top inset for the control panel sub section.
- */
- public static final int TOP_INSET_CONTROL_PANEL_SUBSECTION = 30;
-
- /**
* Specifies the right inset for background image.
*/
public static final int RIGHT_INSET_BACKGROUND = 20;
@@ -209,6 +186,11 @@
public static final int BOTTOM_INSET_BACKGROUND = 30;
/**
+ * Specifies the top inset for a secondary field.
+ */
+ public static final int BOTTOM_INSET_SECONDARY_FIELD = 5;
+
+ /**
* Specifies the number of columns of a text field for a path.
*/
public static final int PATH_FIELD_SIZE = 20;
@@ -797,16 +779,6 @@
}
/**
- * Creates a JComboBox.
- * @return JComboBox a new combo box
- */
- static public JComboBox makeJComboBox() {
- JComboBox cbo = new JComboBox();
- cbo.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
- return cbo;
- }
-
- /**
* Creates a JButton with the given label and tooltip.
* @param label the text of the button.
* @param tooltip the tooltip of the button.
@@ -1331,58 +1303,6 @@
return buf.toString();
}
-
- /**
- * Returns a table created with the provided model and renderers.
- * @param tableModel the table model.
- * @param renderer the cell renderer.
- * @param headerRenderer the header renderer.
- * @return a table created with the provided model and renderers.
- */
- public static JTable makeSortableTable(final SortableTableModel tableModel,
- TableCellRenderer renderer,
- TableCellRenderer headerRenderer)
- {
- final JTable table = new JTable(tableModel);
- table.setShowGrid(true);
- table.setGridColor(UIFactory.PANEL_BORDER_COLOR);
- table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- table.setBackground(UIFactory.CURRENT_STEP_PANEL_BACKGROUND);
- table.getTableHeader().setBackground(UIFactory.DEFAULT_BACKGROUND);
- table.setRowMargin(0);
-
- for (int i=0; i<tableModel.getColumnCount(); i++)
- {
- TableColumn col = table.getColumn(table.getColumnName(i));
- col.setCellRenderer(renderer);
- col.setHeaderRenderer(headerRenderer);
- }
- MouseAdapter listMouseListener = new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- TableColumnModel columnModel = table.getColumnModel();
- int viewColumn = columnModel.getColumnIndexAtX(e.getX());
- int sortedBy = table.convertColumnIndexToModel(viewColumn);
- if (e.getClickCount() == 1 && sortedBy != -1) {
- tableModel.setSortAscending(!tableModel.isSortAscending());
- tableModel.setSortColumn(sortedBy);
- tableModel.forceResort();
- }
- }
- };
- table.getTableHeader().addMouseListener(listMouseListener);
- return table;
- }
-
- /**
- * Creates a header renderer for a JTable with our own look and feel.
- * @return a header renderer for a JTable with our own look and feel.
- */
- public static TableCellRenderer makeHeaderRenderer()
- {
- return new HeaderRenderer();
- }
-
/**
* Returns a String that contains the html passed as parameter with a div
* applied. The div style corresponds to the Font specified as parameter.
@@ -1412,8 +1332,11 @@
{
StringBuilder buf = new StringBuilder();
- buf.append("font-family:" + font.getName()).append(
- ";font-size:" + font.getSize() + "pt");
+ buf.append("font-family:")
+ .append(font.getName())
+ .append(";font-size:")
+ .append(font.getSize())
+ .append("pt");
if (font.isItalic())
{
@@ -1478,10 +1401,8 @@
public static String applyMargin(String html, int top, int right, int bottom,
int left)
{
- String result =
- "<div style=\"margin:" + top + "px " + right + "px " + bottom + "px "
- + left + "px;\">" + html + DIV_CLOSE;
- return result;
+ return "<div style=\"margin:" + top + "px " + right + "px " + bottom + "px "
+ + left + "px;\">" + html + DIV_CLOSE;
}
/**
@@ -1545,7 +1466,7 @@
*/
private static String getIconPath(IconType iconType)
{
- Message key = null;
+ Message key;
switch (iconType)
{
case CURRENT_STEP:
@@ -1625,7 +1546,7 @@
*/
private static Message getIconDescription(IconType iconType)
{
- Message description = null;
+ Message description;
switch (iconType)
{
case CURRENT_STEP:
@@ -1793,7 +1714,7 @@
private static ListCellRenderer makeCellRenderer(final TextStyle textStyle)
{
- ListCellRenderer renderer = new ListCellRenderer()
+ return new ListCellRenderer()
{
public Component getListCellRendererComponent(JList list,
Object value,
@@ -1807,50 +1728,6 @@
return l;
}
};
- return renderer;
- }
-}
-
-/**
- * Class used to render the table headers.
- */
-class HeaderRenderer extends DefaultTableCellRenderer
-{
- private static final long serialVersionUID = -8604332267021523835L;
-
- /**
- * Default constructor.
- */
- public HeaderRenderer()
- {
- super();
- UIFactory.setTextStyle(this, UIFactory.TextStyle.PRIMARY_FIELD_VALID);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Component getTableCellRendererComponent(JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int column) {
- setText((String)value);
- JComponent comp = (JComponent)super.getTableCellRendererComponent(table,
- value, isSelected, hasFocus, row, column);
- if (column == 0)
- {
- comp.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createMatteBorder(1, 1, 1, 1,
- UIFactory.PANEL_BORDER_COLOR),
- BorderFactory.createEmptyBorder(4, 4, 4, 4)));
- }
- else
- {
- comp.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createMatteBorder(1, 0, 1, 1,
- UIFactory.PANEL_BORDER_COLOR),
- BorderFactory.createEmptyBorder(4, 4, 4, 4)));
- }
- return comp;
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java b/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
deleted file mode 100644
index 6c2311b..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.ui;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
-import java.util.Properties;
-import java.net.SocketAddress;
-import java.net.InetSocketAddress;
-
-/**
- * Dialog allowing the user to specify a host, port, user name and passoword
- * for accessing a web proxy.
- */
-public class WebProxyDialog extends JDialog
- implements PropertyChangeListener, ActionListener {
-
- private static final long serialVersionUID = 4402474441754399992L;
-
- private JTextField tfHost;
- private JTextField tfPort;
- private JCheckBox chkRequiresAuth;
- private JTextField tfUserName;
- private JPasswordField tfPassword;
-
- private JOptionPane optionPane;
-
- /**
- * Creates an instance loading values from system properties.
- * @param parent of this dialog
- */
- public WebProxyDialog(Frame parent) {
- this(parent, null, null, null, null);
- loadSystemProperties();
- }
-
- /**
- * Creates an instance loading values from system properties.
- * @param parent of this dialog
- */
- public WebProxyDialog(Dialog parent) {
- this(parent, null, null, null, null);
- loadSystemProperties();
- }
-
- /**
- * Creates an instance.
- * @param parent of this dialog
- * @param host default value for host field
- * @param port default value for port field
- * @param user default value for user field
- * @param pw default value for password field
- */
- public WebProxyDialog(Frame parent, String host, Integer port,
- String user, char[] pw) {
- super(parent, /*modal=*/true);
- init(host, port, user, pw);
- }
-
- /**
- * Creates an instance.
- * @param parent of this dialog
- * @param host default value for host field
- * @param port default value for port field
- * @param user default value for user field
- * @param pw default value for password field
- */
- public WebProxyDialog(Dialog parent, String host, Integer port,
- String user, char[] pw) {
- super(parent, /*modal=*/true);
- init(host, port, user, pw);
- }
-
- private void init(String host, Integer port, String user, char[] pw) {
- setTitle(INFO_WEB_PROXY_DLG_TITLE.get().toString());
- optionPane = createContentPane(host, port, user, pw);
- optionPane.addPropertyChangeListener(this);
- setContentPane(optionPane);
- setDefaultCloseOperation(DISPOSE_ON_CLOSE);
-
- //Ensure the text field always gets the first focus.
- addComponentListener(new ComponentAdapter() {
- public void componentShown(ComponentEvent ce) {
- tfHost.requestFocusInWindow();
- }
- });
- Utilities.centerOnComponent(this, getParent());
- pack();
- }
-
- /**
- * Creates a SocketAddress from current data.
- * @return newly created SocketAddress from the current value of the
- * host and port fields
- */
- public SocketAddress getSocketAddress() {
- SocketAddress addr = null;
- String host = getHost();
- Integer port = getPort();
- if (host != null && port != null) {
- addr = new InetSocketAddress(host, port);
- }
- return addr;
- }
-
- private JOptionPane createContentPane(String host, Integer port,
- String user, char[] pw) {
- JOptionPane pane = new JOptionPane(createPanel(host, port, user, pw),
- JOptionPane.INFORMATION_MESSAGE,
- JOptionPane.OK_CANCEL_OPTION);
- return pane;
- }
-
- /**
- * {@inheritDoc}
- */
- public void propertyChange(PropertyChangeEvent e) {
- String prop = e.getPropertyName();
-
- if (isVisible()
- && (e.getSource() == optionPane)
- && (JOptionPane.VALUE_PROPERTY.equals(prop) ||
- JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
- Object value = optionPane.getValue();
-
- if (value == JOptionPane.UNINITIALIZED_VALUE) {
- //ignore reset
- return;
- }
-
- //Reset the JOptionPane's value.
- //If you don't do this, then if the user
- //presses the same button next time, no
- //property change event will be fired.
- optionPane.setValue(
- JOptionPane.UNINITIALIZED_VALUE);
-
- if (value.equals(JOptionPane.OK_OPTION)) {
- if (validateUserData()) {
- setVisible(false);
- }
- } else if (value.equals(JOptionPane.CANCEL_OPTION)) {
- setVisible(false);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void actionPerformed(ActionEvent actionEvent) {
- optionPane.setValue(JOptionPane.OK_OPTION);
- }
-
- /**
- * Gets the current value of the host field.
- * @return String representing the host value
- */
- public String getHost() {
- String v = tfHost.getText();
- if (v != null && v.trim().length() == 0) v = null;
- return v;
- }
-
- /**
- * Gets the current value of the port field.
- * @return String representing the port value
- */
- public Integer getPort() {
- Integer i = null;
- String v = tfPort.getText();
- if (v != null && v.trim().length() == 0) v = null;
- try {
- i = Integer.parseInt(v);
- } catch (NumberFormatException e) {
- // do nothing;
- }
- return i;
- }
-
- /**
- * Gets the current value of the user field.
- * @return String representing the user value
- */
- public String getUserName() {
- String v = tfUserName.getText();
- if ((v != null && v.trim().length() == 0) ||
- !chkRequiresAuth.isSelected()) v = null;
- return v;
- }
-
- /**
- * Gets the current value of the password field.
- * @return char[] representing the password value
- */
- public char[] getPassword() {
- char[] v = tfPassword.getPassword();
- if ((v != null && v.length == 0) ||
- !chkRequiresAuth.isSelected()) v = null;
- return v;
- }
-
- /**
- * Writes the current values to system properties.
- */
- public void applySystemProperties() {
- Properties systemSettings = System.getProperties();
-
- String v = tfHost.getText();
- if (v != null && v.trim().length() == 0) v = null;
- systemSettings.put("http.proxyHost", v);
- systemSettings.put("https.proxyHost", v);
-
- v = tfPort.getText();
- if (v != null && v.trim().length() == 0) v = null;
- systemSettings.put("http.proxyPort", v);
- systemSettings.put("https.proxyPort", v);
-
- System.setProperties(systemSettings);
- }
-
- private void loadSystemProperties() {
- Properties systemSettings = System.getProperties();
-
- Object v = systemSettings.get("http.proxyHost");
- tfHost.setText(v != null ? v.toString() : "");
-
- v = systemSettings.get("http.proxyPort");
- tfPort.setText(v != null ? v.toString() : "");
- }
-
- private JPanel createPanel(String host, Integer port,
- String user, char[] pw) {
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- final JLabel lblUser = UIFactory.makeJLabel(null,
- INFO_WEB_PROXY_DLG_USER_LABEL.get(),
- UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
- final JLabel lblPassword = UIFactory.makeJLabel(null,
- INFO_WEB_PROXY_DLG_PASSWORD_LABEL.get(),
- UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- gbc.fill = GridBagConstraints.NONE;
- p.add(new JLabel(INFO_WEB_PROXY_DLG_HOST_LABEL.get().toString()), gbc);
-
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.weightx = 1.0;
- p.add(tfHost = new JTextField(host), gbc);
-
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weightx = 0;
- gbc.fill = GridBagConstraints.NONE;
- p.add(new JLabel(INFO_WEB_PROXY_DLG_PORT_LABEL.get().toString()), gbc);
-
- gbc.gridx = 1;
- gbc.gridy = 1;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- p.add(tfPort = new JTextField(port != null?port.toString():""), gbc);
-
- gbc.gridx = 0;
- gbc.gridy = 2;
- gbc.weightx = 0;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets.top = 7; // I don't understand why this is necesary
- p.add(new JLabel(INFO_WEB_PROXY_DLG_AUTH_LABEL.get().toString()), gbc);
-
- gbc.gridx = 1;
- gbc.gridy = 2;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets.top = 0;
- p.add(chkRequiresAuth =
- UIFactory.makeJCheckBox(
- INFO_WEB_PROXY_DLG_AUTH_REQ_LABEL.get(),
- Message.EMPTY,
- UIFactory.TextStyle.SECONDARY_FIELD_VALID
- ), gbc);
- chkRequiresAuth.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent actionEvent) {
- tfUserName.setEnabled(chkRequiresAuth.isSelected());
- tfPassword.setEnabled(chkRequiresAuth.isSelected());
- lblUser.setEnabled(chkRequiresAuth.isSelected());
- lblPassword.setEnabled(chkRequiresAuth.isSelected());
- }
- });
-
- gbc.gridx = 0;
- gbc.gridy = 3;
- gbc.gridwidth = 1;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
- p.add(lblUser, gbc);
-
- gbc.gridx = 1;
- gbc.gridy = 3;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets.left = 0;
- p.add(tfUserName = new JTextField(user), gbc);
-
- gbc.gridx = 0;
- gbc.gridy = 4;
- gbc.fill = GridBagConstraints.NONE;
- gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
- p.add(lblPassword, gbc);
-
- gbc.gridx = 1;
- gbc.gridy = 4;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets.left = 0;
- gbc.weighty = 1.0;
- p.add(tfPassword = new JPasswordField(pw != null ? new String(pw) : ""),
- gbc);
-
- // By default, proxy does not require auth
- chkRequiresAuth.setSelected(false);
- tfUserName.setEnabled(false);
- tfPassword.setEnabled(false);
- lblPassword.setEnabled(false);
- lblUser.setEnabled(false);
-
- // For automatic closure
- tfHost.addActionListener(this);
- tfPort.addActionListener(this);
- tfUserName.addActionListener(this);
- tfPassword.addActionListener(this);
-
- return p;
- }
-
- private boolean validateUserData() {
- Message errorMsg = null;
- String portString = tfPort.getText();
-
- try {
- Integer port = Integer.parseInt(portString);
- if (!(port >= 1 && port <= 65535)) {
- errorMsg = INFO_INVALID_PORT_VALUE_RANGE.get(
- String.valueOf(1),
- String.valueOf(65535));
- }
- } catch (NumberFormatException e) {
- errorMsg = INFO_INVALID_PORT_VALUE_RANGE.get(
- String.valueOf(1),
- String.valueOf(65535));
- }
-
- if (errorMsg != null) {
- JOptionPane.showMessageDialog(this, errorMsg);
- }
- return (errorMsg == null);
- }
-
-// /**
-// * For testing.
-// * @param args cl args
-// */
-// public static void main(String[] args) {
-// JDialog dlg = new WebProxyDialog(new JFrame());
-// dlg.addComponentListener(new ComponentAdapter() {
-// public void componentHidden(ComponentEvent componentEvent) {
-// System.exit(0);
-// }
-// });
-// dlg.setVisible(true);
-// }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Build.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Build.java
deleted file mode 100644
index 2a6e45c..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Build.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import java.net.URL;
-import java.util.EnumSet;
-
-/**
- * Representation of an OpenDS build package.
- */
-public class Build implements Comparable<Build> {
-
- /**
- * Describes build types.
- */
- enum Category {
-
- /**
- * Daily build descriptor.
- */
- DAILY("Daily Build"), // DO NOT i18n
-
- /**
- * Weekly build descriptor.
- */
- WEEKLY("Weekly Build"), // DO NOT i18n
-
- /**
- * Release build descriptor.
- */
- RELEASE("Release Build"); // DO NOT i18n
-
- /**
- * Creates a Category from its 'key' String value.
- * @param s String representing a key
- * @return the Category corresponding to the input <code>key</code>; null
- * if the input string is not a category key
- */
- public static Category fromString(String s) {
- Category category = null;
- for (Category c : EnumSet.allOf(Category.class)) {
- if (c.key.equals(s)) {
- category = c;
- break;
- }
- }
- return category;
- }
-
- String key;
-
- private Category(String key) {
- this.key = key;
- }
-
- /**
- * Gets the string that represents this category in
- * the build information page.
- * @return String key
- */
- public String getKey() {
- return key;
- }
-
- }
-
- private URL downloadUrl;
- private String displayName;
- private Category category;
-
- /**
- * Creates an instance.
- * @param displayName where the build package can be accessed
- * @param downloadUrl of the new build
- * @param category build category
- */
- Build(String displayName, URL downloadUrl, Category category) {
- this.displayName = displayName;
- this.downloadUrl = downloadUrl;
- this.category = category;
- }
-
- /**
- * Gets the URL where the build can be accessed.
- * @return URL representing access to the build package
- */
- public URL getUrl() {
- return this.downloadUrl;
- }
-
- /**
- * Gets a string appropriate for presentation to a user.
- * @return String representing this build
- */
- public String getDisplayName() {
- return this.displayName;
- }
-
- /**
- * Gets the category of this build.
- * @return Category indicating the type of this build.
- */
- public Category getCategory() {
- return this.category;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return getDisplayName();
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(Build o) {
- if (o == null) throw new NullPointerException();
- int c = getCategory().compareTo(o.getCategory());
- if (c == 0) {
- c = getDisplayName().compareTo(o.getDisplayName());
- }
- return c;
- }
-
- /**
- * {@inheritDoc}
- */
- public int hashCode() {
- int hc = 11;
- Category cat = getCategory();
- if (cat != null) {
- hc = 31 * hc + cat.hashCode();
- }
- String disp = getDisplayName();
- if (disp != null) {
- hc = 31 * hc + disp.hashCode();
- }
- return hc;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(Object obj) {
- if (this == obj) return true;
- boolean eq = false;
- if (obj != null && obj instanceof Build) {
- Category thisCat = getCategory();
- Category thatCat = ((Build)obj).getCategory();
- if ((thisCat != null && thisCat.equals(thatCat)) ||
- (thisCat == null && thatCat == null)) {
- String thisDisp = getDisplayName();
- String thatDisp = ((Build)obj).getDisplayName();
- eq = ((thisDisp != null && thisDisp.equals(thatDisp)) ||
- (thisDisp == null && thatDisp == null));
- }
- }
- return eq;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
deleted file mode 100644
index bb1ed5f..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2010 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.*;
-import org.opends.quicksetup.event.ProgressUpdateListener;
-
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.ZipExtractor;
-import org.opends.quicksetup.util.FileManager;
-import org.opends.quicksetup.util.ProgressMessageFormatter;
-
-import java.io.File;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * BuildExtractor runs prior to an upgrade or reversion operation. Its main
- * purpose is to unzip an OpenDS installation package (.zip file) from a user
- * specified location into the current builds staging directory. However,
- * this program is also responsible for determining whether or not this
- * invocation is intended to be an upgrade or reversion operation. If this
- * is a reversion, this program just exists with the appropriate exit code
- * indicating reversion. If this is an upgrade this program unzips the
- * installation package.
- *
- * This Java program handles unzipping files so that we don't need to rely on
- * the operating system's tools for managing zip files.
- *
- * This tool is a stand-alone program since it is run in preparation for a
- * off line upgrade and runs using the current program's jars rather than
- * the new build's jars as is manditory for the Upgrader itself. Since this
- * tool itself is run using the old bits prior to upgrade and the upgrade
- * itself is dependent upon this tool, it should be kept simple and stable
- * to insure that the upgrade will work.
- */
-public class BuildExtractor extends UpgradeLauncher implements CliApplication {
-
- static private final Logger LOG =
- Logger.getLogger(BuildExtractor.class.getName());
-
- /** Return code indicating that this invocation is an upgrade. */
- private static final int RC_CONTINUE_WITH_UPGRADE = 99;
-
- /** Return code indicating that this invocation is a reversion. */
- private static final int RC_CONTINUE_WITH_REVERSION = 98;
-
- /**
- * Creates and run a BuildExtractor using command line arguments.
- * @param args String[] command line arguments
- */
- public static void main(String[] args) {
- try {
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(
- UpgradeLauncher.LOG_FILE_PREFIX + "ext-",
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (Throwable t) {
- System.err.println(
- INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
- new BuildExtractor(args).launch();
- }
-
- private UpgradeUserData userData;
-
- private boolean finished;
-
- private ApplicationException error;
-
- private ReturnCode rc;
-
- private BuildExtractor(String[] args) {
- super(args);
- }
-
- /**
- * Executes this build extractor. First and attempt is made to extract the
- * build file name from the command line arguments. If no such file has been
- * specified this program simply exits with a return code of 0. If such a
- * file has been specified this program performs a certain amount of
- * verification on the file. If the verification fails this program prints
- * a message and exits with with a return code of 1 meaning that the upgrade
- * process should end. If verification succeeeds this program unzips its
- * contents into the current build's staging are and exits with return code 0.
- */
- public void run() {
- UpgradeUserData uud = (UpgradeUserData)getUserData();
- if (UpgradeUserData.Operation.REVERSION.equals(uud.getOperation())) {
- rc = new ReturnCode(RC_CONTINUE_WITH_REVERSION);
- } else {
- try {
- File buildFile = uud.getInstallPackage();
- if (buildFile != null) {
- LOG.log(Level.INFO, "Expanding zip file " + buildFile.getPath());
- File stageDirectory = initStageDirectory();
- ZipExtractor extractor = new ZipExtractor(buildFile);
- extractor.extract(stageDirectory);
- LOG.log(Level.INFO, "Extraction finished");
- Installation installation = new Installation(stageDirectory,
- stageDirectory);
- if (!installation.isValid(stageDirectory)) {
- LOG.log(Level.INFO, "Extraction produed an invalid OpenDS" +
- "installation: " + installation.getInvalidityReason());
- Message invalidMsg = INFO_BUILD_EXTRACTOR_FILE_INVALID.get(
- Utils.getPath(buildFile),
- installation.getInvalidityReason());
- error = new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- invalidMsg, null);
- System.err.println(invalidMsg);
- }
- rc = new ReturnCode(RC_CONTINUE_WITH_UPGRADE);
- } else {
- // This should never happen assuming createUserData did the
- // right thing
- LOG.log(Level.INFO, "Build extractor failed to " +
- "specify valid installation zip file");
- throw new IllegalStateException("Build extractor failed to " +
- "specify valid installation zip file");
- }
- } catch (Throwable t) {
- LOG.log(Level.INFO, "Unexpected error extracting build", t);
- String reason = t.getLocalizedMessage();
- error = new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_BUILD_EXTRACTOR_ERROR.get(reason), t);
- System.err.println(reason);
- } finally {
- finished = true;
- }
- }
- }
-
- private File initStageDirectory() throws ApplicationException {
- File stageDir;
- Installation installation = new Installation(getInstallationPath(),
- getInstancePath());
- stageDir = installation.getTemporaryUpgradeDirectory();
- if (stageDir.exists()) {
- FileManager fm = new FileManager();
- fm.deleteRecursively(stageDir);
- }
- if (!stageDir.mkdirs()) {
- Message msg = INFO_ERROR_FAILED_TO_CREATE_STAGE_DIRECTORY.get(
- Utils.getPath(stageDir));
- throw ApplicationException.createFileSystemException(msg, null);
- }
- LOG.log(Level.INFO, "stage directory " + stageDir.getPath());
- return stageDir;
- }
-
- /**
- * {@inheritDoc}
- */
- protected CliApplication createCliApplication() {
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstallationPath() {
- return Utils.getInstallPathFromClasspath();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstancePath() {
- return Utils.getInstancePathFromInstallPath(getInstallationPath());
- }
-
-
- /**
- * {@inheritDoc}
- * @param launcher
- */
- public UserData createUserData(Launcher launcher)
- throws UserDataException
- {
- BuildExtractorCliHelper helper =
- new BuildExtractorCliHelper((UpgradeLauncher)launcher);
- UpgradeUserData uud = helper.createUserData(args);
-
- if (uud != null)
- {
- // Build Extractor is always quiet
- uud.setQuiet(true);
-
- // The user may have indicated the operation via interactivity
- if (UpgradeUserData.Operation.UPGRADE.equals(uud.getOperation())) {
- isUpgrade = true;
- } else if (UpgradeUserData.Operation.REVERSION.equals(
- uud.getOperation())) {
- isReversion = true;
- }
- }
-
- return uud;
- }
-
- /**
- * {@inheritDoc}
- */
- public UserData getUserData() {
- return userData;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setUserData(UserData userData) {
- if (userData instanceof UpgradeUserData) {
- this.userData = (UpgradeUserData)userData;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void setProgressMessageFormatter(ProgressMessageFormatter formatter) {
- // ignore
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isFinished() {
- return finished;
- }
-
- /**
- * {@inheritDoc}
- */
- public ApplicationException getRunError() {
- return error;
- }
-
- /**
- * {@inheritDoc}
- */
- public ReturnCode getReturnCode() {
- return rc;
- }
-
- /**
- * {@inheritDoc}
- */
- public void addProgressUpdateListener(ProgressUpdateListener l) {
- // ignored; no progress messages
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeProgressUpdateListener(ProgressUpdateListener l) {
- // ignored; no progress messages
- }
-
- /**
- * {@inheritDoc}
- */
- public void notifyListeners(Integer ratio, Message currentPhaseSummary,
- Message newLogDetail) {
- // ignored; no progress messages
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractorCliHelper.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractorCliHelper.java
deleted file mode 100644
index 634de07..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractorCliHelper.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import static org.opends.messages.QuickSetupMessages.*;
-import static org.opends.messages.UtilityMessages.*;
-
-import org.opends.messages.Message;
-
-import org.opends.quicksetup.CliUserInteraction;
-import org.opends.quicksetup.UserDataException;
-import org.opends.quicksetup.UserInteraction;
-import org.opends.server.util.cli.CLIException;
-import org.opends.server.util.cli.Menu;
-import org.opends.server.util.cli.MenuBuilder;
-import org.opends.server.util.cli.MenuResult;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.io.File;
-
-/**
- * Assists Upgrader utility in CLI drudgery.
- */
-public class BuildExtractorCliHelper extends UpgraderCliHelper {
-
- static private final Logger LOG =
- Logger.getLogger(BuildExtractorCliHelper.class.getName());
-
- /**
- * Create a parameterized instance.
- * @param launcher for this CLI
- */
- public BuildExtractorCliHelper(UpgradeLauncher launcher) {
- super(launcher);
- }
-
- /**
- * Creates a set of user data from command line arguments and installation
- * status.
- * @param args String[] of arguments passed in from the command line
- * @return UserData object populated to reflect the input args and status
- * @throws org.opends.quicksetup.UserDataException if something is wrong
- */
- public UpgradeUserData createUserData(String[] args)
- throws UserDataException {
- UpgradeUserData uud = super.createUserData(args);
- if (launcher.isInteractive()) {
- if (!launcher.isNoPrompt()) {
- LOG.log(Level.INFO, "obtaining file information interactively");
- final int UPGRADE = 1;
- final int REVERT = 2;
- int[] indexes = {UPGRADE, REVERT};
- Message[] options = new Message[] {
- INFO_UPGRADE_OPERATION_UPGRADE.get(),
- INFO_UPGRADE_OPERATION_REVERSION.get()
- };
-
- MenuBuilder<Integer> builder = new MenuBuilder<Integer>(this);
-
- builder.setPrompt(INFO_UPGRADE_OPERATION_PROMPT.get());
-
- for (int i=0; i<indexes.length; i++)
- {
- builder.addNumberedOption(options[i], MenuResult.success(indexes[i]));
- }
-
- builder.setDefault(Message.raw(String.valueOf(UPGRADE)),
- MenuResult.success(UPGRADE));
-
- Menu<Integer> menu = builder.toMenu();
- int choice;
- try
- {
- MenuResult<Integer> m = menu.run();
- if (m.isSuccess())
- {
- choice = m.getValue();
- }
- else
- {
- // Should never happen.
- throw new RuntimeException();
- }
- }
- catch (CLIException ce)
- {
- choice = UPGRADE;
- LOG.log(Level.WARNING, "Error reading input: "+ce, ce);
- }
-
- if (choice == UPGRADE) {
- uud.setOperation(UpgradeUserData.Operation.UPGRADE);
- int nTries = 0;
- while(true) {
- String fileName = readInput(
- INFO_UPGRADE_FILE_PROMPT.get(), null, LOG);
- if (fileName != null)
- {
- try {
- uud.setInstallPackage(validateInstallPackFile(fileName));
- LOG.log(Level.INFO, "file specified interactively: " +
- fileName);
- break;
- } catch (UserDataException ude) {
- System.out.println(ude.getMessage());
- }
- }
- else
- {
- // There was an error reading the input: add a line return
- System.out.println();
- }
- nTries++;
- if (nTries >= CONFIRMATION_MAX_TRIES)
- {
- throw new UserDataException(null,
- ERR_CONFIRMATION_TRIES_LIMIT_REACHED.get(
- CONFIRMATION_MAX_TRIES));
- }
- }
- System.out.println();
- Message cont = INFO_CONTINUE_BUTTON_LABEL.get();
- Message cancel = INFO_CANCEL_BUTTON_LABEL.get();
- UserInteraction ui = new CliUserInteraction();
- if (cancel.equals(ui.confirm(
- INFO_UPGRADE_CONFIRM_TITLE.get(),
- INFO_UPGRADE_CONFIRM_PROMPT.get(
- uud.getInstallPackage().getAbsolutePath()),
- INFO_REVERT_CONFIRM_TITLE.get(),
- UserInteraction.MessageType.WARNING,
- new Message[] { cont, cancel },
- cont))) {
- LOG.log(Level.INFO, "User canceled upgrade.");
- return null;
- }
- } else {
- uud.setOperation(UpgradeUserData.Operation.REVERSION);
- }
- } else {
- throw new UserDataException(null,
- INFO_ERROR_OPTIONS_REQUIRED_OR_INTERACTIVE.get());
- }
- } else {
- String upgradeFile = launcher.getUpgradeFileName();
- if (upgradeFile != null) {
- uud.setInstallPackage(
- validateInstallPackFile(upgradeFile));
- }
- if (launcher.isRevertMostRecent() || launcher.isRevertToArchive())
- {
- uud.setOperation(UpgradeUserData.Operation.REVERSION);
- }
- }
- return uud;
- }
-
- private File validateInstallPackFile(String fileName)
- throws UserDataException
- {
- File f = new File(fileName);
- if (!f.exists()) {
- throw new UserDataException(null,
- INFO_BUILD_EXTRACTOR_ERROR_FILE_NO_EXIST.get(fileName));
- } else if (f.isDirectory() || !f.getName().toLowerCase().endsWith(".zip")) {
- throw new UserDataException(null,
- INFO_BUILD_EXTRACTOR_ERROR_FILE_NOT_ZIP.get(fileName));
- }
- return f;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java
deleted file mode 100644
index 604660d..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.ReturnCode;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.UserInteraction;
-import org.opends.quicksetup.Constants;
-
-import org.opends.quicksetup.util.ExternalTools;
-import org.opends.quicksetup.util.FileManager;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.OperationOutput;
-import org.opends.quicksetup.util.InProcessServerController;
-import org.opends.server.util.LDIFReader;
-import org.opends.server.util.ChangeRecordEntry;
-import org.opends.server.types.LDIFImportConfig;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This class handles migration of both schema and configuration
- * for an installation that is in the process of being upgraded.
- *
- * This class is intented to be used in two differnt stages of the
- * upgrade process: first, before installation's filesystem bits
- * have been upgraded, a call to both {@link #calculateConfigCustomizations()}
- * and {@link #calculateSchemaCustomizations()} should be made in
- * order to capture what changes will need to be made to the server
- * later on. Then once the filesystem bit have been upgraded calls to
- * {@link #migrateConfiguration()} and {@link #migrateSchema()} are
- * made to actually perform the migration.
- */
-public class MigrationManager {
-
- static private final Logger LOG =
- Logger.getLogger(MigrationManager.class.getName());
-
- /** Describes a particular component to be migrated. */
- private enum Component { SCHEMA, CONFIGURATION }
-
- private Installation installation;
- private File backupDir;
- private UserInteraction ui;
- private boolean isSchemaCustomized;
- private boolean mustRunDSJavaProperties;
-
- /**
- * Creates a new parameterized instance.
- * @param installation describing the file layout of the installation
- * to be migrated
- * @param backupDir directory where diffs between the base configuration
- * and schema are to be stored
- * @param ui user interaction allowing this class to prompt the user
- * for feedback if necessary. This object can be null in which
- * case this class will throw an exception rather than prompt
- * the user for more information if necessary.
- */
- public MigrationManager(Installation installation, File backupDir,
- UserInteraction ui)
- {
- if (installation == null) {
- throw new NullPointerException("installation cannot be null");
- }
- if (backupDir == null) {
- throw new NullPointerException("backup directory cannot be null");
- }
- this.installation = installation;
- this.backupDir = backupDir;
- this.ui = ui;
- }
-
- /**
- * Diffs the current and base schema for the
- * <code>Installation</code> associated with this class and
- * generates a diff file that can later be used to migrate
- * an upgraded server.
- *
- * @throws ApplicationException if there is a problem performing
- * the diff operation
- */
- public void calculateSchemaCustomizations() throws ApplicationException {
- isSchemaCustomized = false;
- if (installation.getStatus().schemaHasBeenModified()) {
- LOG.log(Level.INFO, "Schema contains customizations that will " +
- "be migrated");
- try {
- ldifDiff(installation.getBaseSchemaFile(),
- installation.getSchemaConcatFile(),
- getCustomSchemaDiffFile(), true);
- isSchemaCustomized = true;
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DETERMINING_CUSTOM_SCHEMA.get(), e);
- }
- } else {
- LOG.log(Level.INFO, "No schema customizations to migrate");
- }
- }
-
- /**
- * Diffs the current and base configuration for the
- * <code>Installation</code> associated with this class and
- * generates a diff file that can later be used to migrate
- * an upgraded server.
- *
- * @throws ApplicationException if there is a problem performing
- * the diff operation
- */
- public void calculateConfigCustomizations() throws ApplicationException {
- try {
- if (installation.getCurrentConfiguration().hasBeenModified()) {
- LOG.log(Level.INFO, "Configuration contains customizations that will " +
- "be migrated");
- try {
- ldifDiff(installation.getBaseConfigurationFile(),
- installation.getCurrentConfigurationFile(),
- getCustomConfigDiffFile(), false);
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DETERMINING_CUSTOM_CONFIG.get(), e);
- }
- } else {
- LOG.log(Level.INFO, "No configuration customizations to migrate");
- }
- } catch (IOException e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DETERMINING_CUSTOM_CONFIG.get(), e);
- }
- mustRunDSJavaProperties = installation.getSetJavaHomeFile().exists();
- }
-
- /**
- * Migrates a configuration using the diff file generated by a call
- * to {@link MigrationManager#calculateConfigCustomizations()}.
- * @throws ApplicationException if there is an error migrating the
- * configuration
- */
- public void migrateConfiguration() throws ApplicationException {
- try {
- File configDiff = getCustomConfigDiffFile();
- if (configDiff.exists()) {
- modify(configDiff, Component.CONFIGURATION);
- }
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- Message msg = INFO_ERROR_APPLYING_CUSTOM_CONFIG.get();
- LOG.log(Level.INFO, msg.toString(), e);
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR, msg, e);
- }
- }
-
- /**
- * Tells whether the ADS backend file must be migrated or not.
- * This method assumes that the ADS backend file in the original install
- * has not been overwritten.
- * @return <CODE>true</CODE> if the tools properties file must be migrated
- * and <CODE>false</CODE> otherwise.
- * @throws IOException if there is an error accessing the installation
- * information.
- */
- public boolean mustMigrateADS() throws IOException {
- return !installation.getADSBackendFile().exists();
- }
-
- /**
- * Migrates the ADS backend file.
- * @param newADSFile the new ADS backend file.
- * @throws ApplicationException if there is an error copying the new
- * ADS backend file.
- */
- public void migrateADS(File newADSFile) throws ApplicationException
- {
- FileManager fileManager = new FileManager();
- fileManager.copy(newADSFile, installation.getConfigurationDirectory(),
- true);
- }
-
-
- /**
- * Tells whether the tools properties file must be migrated or not.
- * This method assumes that the tools properties file in the original install
- * has not been overwritten.
- * @return <CODE>true</CODE> if the tools properties file must be migrated
- * and <CODE>false</CODE> otherwise.
- */
- public boolean mustMigrateToolProperties()
- {
- return !installation.getToolsPropertiesFile().exists();
- }
-
- /**
- * Tells whether a set-java-home file exists and so if we have to run
- * dsjavaproperties to regenerate it.
- * @return <CODE>true</CODE> if the set-java-home file exists and
- * <CODE>false</CODE> otherwise.
- */
- public boolean mustRunDSJavaProperties()
- {
- return mustRunDSJavaProperties;
- }
-
- /**
- * Migrates the tools properties file.
- * @param newPropertiesFile the new properties file.
- * @throws ApplicationException if there is an error copying the new
- * properties file.
- */
- public void migrateToolPropertiesFile(File newPropertiesFile)
- throws ApplicationException
- {
- FileManager fileManager = new FileManager();
- fileManager.copy(newPropertiesFile,
- installation.getConfigurationDirectory(), true);
- }
-
- /**
- * Migrates a schema using the diff file generated by a call
- * to {@link MigrationManager#calculateSchemaCustomizations()}.
- * @throws ApplicationException if there is an error migrating the
- * schema
- */
- public void migrateSchema() throws ApplicationException {
- try {
- File schemaDiff = getCustomSchemaDiffFile();
- if (schemaDiff.exists()) {
- modify(schemaDiff, Component.SCHEMA);
- }
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- Message msg = INFO_ERROR_APPLYING_CUSTOM_SCHEMA.get();
- LOG.log(Level.INFO, msg.toString(), e);
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR, msg, e);
- }
- }
-
- /**
- * Returns a value to indicate whether the installation associated
- * with this class contains schema customizations. A call to
- * {@link #calculateSchemaCustomizations()} must first be made in
- * order for this value to be valid.
- *
- * @return boolean where true indicates schema customization
- */
- public boolean isSchemaCustomized() {
- return isSchemaCustomized;
- }
-
- /**
- * Returns a value to indicate whether the installation associated
- * with this class contains configuration customizations. A call to
- * {@link #calculateConfigCustomizations()} must first be made in
- * order for this value to be valid.
- *
- * @return boolean where true indicates configuration customization
- * @throws java.io.IOException if there was a problem reading the
- * current configuration file.
- */
- public boolean isConfigurationCustomized() throws IOException {
- return installation.getCurrentConfiguration().hasBeenModified();
- }
-
-
- /**
- * Applies modifications contained in an LDIF file to the server.
- *
- * @param ldifFile LDIF file to apply
- * @param component being modified
- * @throws Exception if something goes wrong. This may be an
- * ApplicationException if the user cancels the application
- * altogether or an LDIFException or IOException should other
- * problems occur.
- */
- private void modify(File ldifFile, Component component)
- throws Exception {
- InProcessServerController ipsc =
- new InProcessServerController(installation);
- LDIFImportConfig importCfg =
- new LDIFImportConfig(
- Utils.getPath(ldifFile));
- LDIFReader ldifReader =
- new LDIFReader(importCfg);
- ArrayList<ChangeRecordEntry> remainingChanges =
- new ArrayList<ChangeRecordEntry>();
- ChangeRecordEntry o = ldifReader.readChangeRecord(false);
- while (o != null)
- {
- remainingChanges.add(o);
- o = ldifReader.readChangeRecord(false);
- }
- ArrayList<ChangeRecordEntry> appliedChanges =
- new ArrayList<ChangeRecordEntry>();
- // In the particular case of the schema, the order on which the
- // the modifications are applied is important. That is why we retry
- // until no modification works.
- while (remainingChanges.size() > 0)
- {
- Exception firstException = null;
- appliedChanges.clear();
- for (ChangeRecordEntry cre : remainingChanges)
- {
- try {
- ipsc.modify(cre);
- appliedChanges.add(cre);
- } catch (Exception e) {
- if (firstException == null)
- {
- firstException = e;
- }
- }
- }
- remainingChanges.removeAll(appliedChanges);
- if ((firstException != null) && (appliedChanges.size() == 0))
- {
- if (ui.isInteractive()) {
- Message cancel = INFO_CANCEL_BUTTON_LABEL.get();
- Message cont = INFO_CONTINUE_BUTTON_LABEL.get();
- Message retry = INFO_RETRY_BUTTON_LABEL.get();
- // Now changeList contains the changes that could not be applied:
- // just ask to confirm about the first element.
- Object r = ui.confirm(
- getModificationErrorSummary(component),
- getModificationErrorMessage(remainingChanges.get(0)),
- Message.raw(firstException.getLocalizedMessage()),
- INFO_ERROR_UPGRADE_MIGRATION.get(),
- UserInteraction.MessageType.ERROR,
- new Message[]{cancel, cont, retry},
- cancel, null);
- if (cont.equals(r)) {
- remainingChanges.remove(0);
- } else if (retry.equals(r)) {
- // do nothing; will retry;
- } else {
- throw new ApplicationException(
- ReturnCode.CANCELED,
- INFO_UPGRADE_CANCELED.get(), firstException);
- }
- } else if (ui.isForceOnError()) {
- // Continue.
- remainingChanges.remove(0);
- } else {
- throw firstException;
- }
- }
- }
- }
-
- private Message getModificationErrorSummary(Component c) {
- Message summary;
- switch(c) {
- case SCHEMA:
- summary = INFO_ERROR_UPGRADE_MIGRATION_SCHEMA.get();
- break;
- case CONFIGURATION:
- summary = INFO_ERROR_UPGRADE_MIGRATION_CONFIG.get();
- break;
- default:
- summary = Message.EMPTY;
- }
- return summary;
- }
-
- private Message getModificationErrorMessage(ChangeRecordEntry cre) {
- MessageBuilder msg = new MessageBuilder();
- if (Utils.isCli())
- {
- msg.append(Constants.LINE_SEPARATOR);
- }
- else
- {
- msg.append(Constants.HTML_LINE_BREAK);
- }
- if (cre != null) {
- switch (cre.getChangeOperationType()) {
- case MODIFY:
- if (Utils.isCli())
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_MODIFY_CLI.get(
- cre.getDN().toNormalizedString()));
- }
- else
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_MODIFY.get(
- cre.getDN().toNormalizedString()));
- }
- break;
- case ADD:
- if (Utils.isCli())
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_ADD_CLI.get(
- cre.getDN().toNormalizedString()));
- }
- else
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_ADD.get(
- cre.getDN().toNormalizedString()));
- }
- break;
- case DELETE:
- if (Utils.isCli())
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_DELETE_CLI.get(
- cre.getDN().toNormalizedString()));
- }
- else
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_DELETE.get(
- cre.getDN().toNormalizedString()));
- }
- break;
- default:
- LOG.log(Level.INFO, "Unexpected change operation type " +
- cre.getChangeOperationType());
- if (Utils.isCli())
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_UNEXPECTED_CLI.get(
- cre.getDN().toNormalizedString()));
- }
- else
- {
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_UNEXPECTED.get(
- cre.getDN().toNormalizedString()));
- }
- break;
- }
- }
- if (Utils.isCli())
- {
- msg.append(Constants.LINE_SEPARATOR);
- msg.append(Constants.LINE_SEPARATOR);
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_NOTE_CLI.get(
- Utils.getPath(backupDir)));
- }
- else
- {
- msg.append(Constants.HTML_LINE_BREAK);
- msg.append(Constants.HTML_LINE_BREAK);
- msg.append(INFO_ERROR_UPGRADE_MIGRATION_NOTE.get(
- Utils.getPath(backupDir)));
- }
- return msg.toMessage();
- }
-
- private void ldifDiff(File source, File target, File output,
- boolean splitMods)
- throws ApplicationException, IOException, InterruptedException {
- ExternalTools et = new ExternalTools(installation);
- String[] args;
- if (splitMods)
- {
- args = new String[]{
- "-o", Utils.getPath(output),
- "-O",
- "-S"
- };
- }
- else
- {
- args = new String[]{
- "-o", Utils.getPath(output),
- "-O"
- };
- }
- OperationOutput oo = et.ldifDiff(source, target, args);
- int ret = oo.getReturnCode();
- if (ret != 0) {
- throw new ApplicationException(
- ReturnCode.TOOL_ERROR,
- INFO_ERROR_LDIF_DIFF_TOOL_RETURN_CODE.get(Integer.toString(ret)),
- null);
- }
- }
-
- private File getCustomConfigDiffFile() throws IOException {
- return new File(backupDir, "config.custom.diff");
- }
-
- private File getCustomSchemaDiffFile() throws IOException {
- return new File(backupDir, "schema.custom.diff");
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
deleted file mode 100644
index b2dbbf4..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
- */
-
-package org.opends.quicksetup.upgrader;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.Application;
-
-import org.opends.quicksetup.util.Utils;
-
-import javax.swing.*;
-import java.net.URL;
-import java.net.Proxy;
-import java.net.URLConnection;
-import java.net.MalformedURLException;
-import java.util.*;
-import java.util.List;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.io.*;
-import java.awt.*;
-
-/**
- * Manages listing and retrieval of build packages on a remote host.
- */
-public class RemoteBuildManager {
-
- static private final Logger LOG =
- Logger.getLogger(RemoteBuildManager.class.getName());
-
- private Application app;
-
- /**
- * This URL is expected to point at a list of the builds parsable by
- * the <code>RemoteBuildsPageParser</code>.
- */
- private URL buildListUrl;
-
- private Proxy proxy;
-
- private String proxyUserName;
-
- private char[] proxyPw;
-
- /**
- * Creates an instance.
- * @param app using this tool
- * @param url base context for an OpenDJ build list
- * @param proxy Proxy to use for connections; can be null if not proxy is
- * to be used
- */
- public RemoteBuildManager(Application app, URL url, Proxy proxy) {
- this.app = app;
- this.buildListUrl = url;
- this.proxy = proxy;
- }
-
- /**
- * Gets the base context where the build information is stored.
- * @return URL representing base context of the build repo
- */
- public URL getBaseContext() {
- return this.buildListUrl;
- }
-
- /**
- * Gets the list of builds from the build repository using a
- * progress monitor to keep the user informed about the status
- * of downloading the build page.
- * @param in InputStream of build information
- * @return list of Build objects
- * @throws IOException if something goes wrong loading the list
- * from the build repository
- */
- public List<Build> listBuilds(InputStream in) throws IOException {
- String dailyBuildsPage = downloadDailyBuildsPage(in);
- return Collections.unmodifiableList(
- RemoteBuildsPageParser.parseBuildList(dailyBuildsPage));
- }
-
- /**
- * Gets an input stream to download.
- * @param c Component parent
- * @param o Object message to display in the ProgressMonitor
- * @return InputStream for the build list
- * @throws IOException if something goes wrong
- */
- public InputStream getDailyBuildsInputStream(final Component c,
- final Object o)
- throws IOException
- {
- URLConnection conn;
- if (proxy == null) {
- conn = buildListUrl.openConnection();
- } else {
- conn = buildListUrl.openConnection(proxy);
- }
- String proxyAuthString = createProxyAuthString();
- if (proxyAuthString != null) {
- conn.setRequestProperty("Proxy-Authorization", "Basic " + // DO NOT i18n
- proxyAuthString);
- }
- InputStream in;
- if (c != null) {
- ProgressMonitorInputStream pmis =
- new ProgressMonitorInputStream(c, o, conn.getInputStream());
- ProgressMonitor pm = pmis.getProgressMonitor();
- pm.setMaximum(conn.getContentLength());
- // pm.setMillisToDecideToPopup(0);
- // pm.setMillisToPopup(0);
- in = pmis;
- } else {
- in = conn.getInputStream();
- }
- return in;
- }
-
- private String downloadDailyBuildsPage(InputStream in)
- throws IOException
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- StringBuilder builder = new StringBuilder();
- String line;
- while (null != (line = reader.readLine())) {
- builder.append(line).append('\n');
- }
- return builder.toString();
- }
-
- /**
- * Downloads a particular build from the build repository to a specific
- * location on the local file system.
- * @param build to download
- * @param destination directory for the newly downloaded file
- * @throws IOException if the build could not be downloaded
- */
- public void download(Build build, File destination) throws IOException {
- download(build.getUrl(), destination);
- }
-
- private void download(URL url, File destination) throws IOException {
- URLConnection conn = null;
- if (proxy == null) {
- conn = url.openConnection();
- } else {
- conn = url.openConnection(proxy);
- }
- String proxyAuthString = createProxyAuthString();
- if (proxyAuthString != null) {
- conn.setRequestProperty("Proxy-Authorization", "Basic " + // DO NOT i18n
- proxyAuthString);
- }
- InputStream is = null;
- FileOutputStream fos = null;
-
- // If the destination already exists blow it away, then
- // create the new file.
- if (destination.exists()) {
- if (!destination.delete()) {
- throw new IOException("Could not overwrite existing file " +
- Utils.getPath(destination));
- }
- }
- Utils.createFile(destination);
-
- try {
- is = conn.getInputStream();
- int length = conn.getContentLength();
- fos = new FileOutputStream(destination);
- int i = 0;
- int bytesRead = 0;
- byte[] buf = new byte[1024];
- app.notifyListeners(0,
- INFO_BUILD_MANAGER_DOWNLOADING_BUILD.get(),
- null);
- while ((i = is.read(buf)) != -1) {
- fos.write(buf, 0, i);
- if (app != null) {
- bytesRead += i;
- if (length > 0) {
- int progress = (bytesRead * 100) / length;
- app.notifyListeners(0,
- INFO_BUILD_MANAGER_DOWNLOADING_BUILD_PROGRESS.get(
- String.valueOf(progress)),
- null);
- }
- }
- }
- app.notifyListeners(0,
- INFO_BUILD_MANAGER_DOWNLOADING_BUILD_DONE.get(),
- null);
- } finally {
- if (is != null) {
- is.close();
- }
- if (fos != null) {
- fos.close();
- }
- }
- }
-
- /**
- * Sets the proxy object this class will use when establishing network
- * connections.
- * @param proxy to use when establishing connections
- */
- public void setProxy(Proxy proxy) {
- this.proxy = proxy;
- }
-
- /**
- * Gets the proxy object this class uses when establishing network
- * connections.
- * @return Proxy to use when establishing connections
- */
- public Proxy getProxy() {
- return this.proxy;
- }
-
- /**
- * Sets the user name this class will use to authenticate to its
- * proxy when establishing network connections.
- * @param user this class is acting on behalf of
- */
- public void setProxyUserName(String user) {
- this.proxyUserName = user;
- }
-
- /**
- * Sets the user name this class will use to authenticate to its
- * proxy when establishing network connections.
- * @return String representing the name of the user of which this class is
- * acting on behalf
- */
- public String getProxyUserName() {
- return this.proxyUserName;
- }
-
- /**
- * Sets the password this class will use to authenticate to its
- * proxy when establishing network connections.
- * @param pw char[] representing the password of the user of which this class
- * is acting on behalf
- */
- public void setProxyPassword(char[] pw) {
- this.proxyPw = pw;
- }
-
- /**
- * Sets the password this class will use to authenticate to its
- * proxy when establishing network connections.
- * @return char[] representing the password of the user of which this class is
- * acting on behalf
- */
- public char[] getProxyPassword() {
- return this.proxyPw;
- }
-
- private String createProxyAuthString() {
- return createAuthenticationString(getProxyUserName(), getProxyPassword());
- }
-
- static private String createAuthenticationString(String user, char[] pw) {
- String s = null;
- if (user != null && pw != null) {
- StringBuilder sb = new StringBuilder()
- .append(user)
- .append(":")
- .append(pw);
- s = org.opends.server.util.Base64.encode(sb.toString().getBytes());
- }
- return s;
- }
-
- /**
- * Parser for the web page that lists available builds. This pag is expected
- * to be a tab-delimited text document where each line represents a build with
- * the following fields:
- * 1. A build display name (e.g. OpenDS 0.1 Build 036)
- * 2. A URL where the build's .zip file can be downloaded
- * 3. A category string for the build (e.g. Weekly Build, Daily Build)
- */
- static private class RemoteBuildsPageParser {
-
- /**
- * Parses a string representing the build information list into a list
- * of builds sorted by usefulness meaning that release builds are first,
- * followed by weekly builds and finally daily builds.
- * @param page String representing the build info page
- * @return List of Builds
- */
- static public List<Build> parseBuildList(String page) {
- List<Build> builds = new ArrayList<Build>();
- if (page != null) {
- BufferedReader reader = new BufferedReader(new StringReader(page));
- String line;
- try {
- while (null != (line = reader.readLine())) {
- if (!isComment(line)) {
- try {
- Build build = parseBuildLine(line);
- builds.add(build);
- } catch (IllegalArgumentException iae) {
- StringBuilder msg = new StringBuilder()
- .append("Error parsing line '")
- .append(line)
- .append("': ")
- .append(iae.getMessage());
- LOG.log(Level.INFO, msg.toString());
- }
- }
- }
- } catch (IOException e) {
- LOG.log(Level.INFO, "error", e);
- }
- } else {
- LOG.log(Level.WARNING, "build list page is null");
- }
- return builds;
- }
-
- static private boolean isComment(String line) {
- return line != null && line.startsWith("#");
- }
-
- static private Build parseBuildLine(String line)
- throws IllegalArgumentException {
- String displayName = null;
- String downloadUrlString = null;
- String categoryString = null;
- URL downloadUrl;
- Build.Category category;
- StringTokenizer st = new StringTokenizer(line, "\t");
- if (st.hasMoreTokens()) {
- displayName = st.nextToken();
- }
- if (st.hasMoreTokens()) {
- downloadUrlString = st.nextToken();
- }
- if (st.hasMoreTokens()) {
- categoryString = st.nextToken();
- }
- if (displayName == null ||
- downloadUrlString == null ||
- categoryString == null) {
- StringBuilder msg = new StringBuilder()
- .append("Line '")
- .append(line)
- .append("' is incomplete or is not correctly delimited")
- .append("with tab characters");
- throw new IllegalArgumentException(msg.toString());
- } else {
-
- try {
- downloadUrl = new URL(downloadUrlString);
- } catch (MalformedURLException e) {
- StringBuilder msg = new StringBuilder()
- .append("URL '")
- .append(downloadUrlString)
- .append("' is invalid");
- throw new IllegalArgumentException(msg.toString());
- }
- category = Build.Category.fromString(categoryString);
- if (category == null) {
- StringBuilder msg = new StringBuilder()
- .append("Category '")
- .append(categoryString)
- .append("' is invalid; must be one of ");
- for (Build.Category c : EnumSet.allOf(Build.Category.class)) {
- msg.append("'").append(c.getKey()).append("' ");
- }
- throw new IllegalArgumentException(msg.toString());
- }
- }
- return new Build(displayName, downloadUrl, category);
- }
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionIssueNotifier.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionIssueNotifier.java
deleted file mode 100644
index dcd17ac..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionIssueNotifier.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2009 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.quicksetup.UserInteraction;
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.ReturnCode;
-import org.opends.quicksetup.Constants;
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-import static org.opends.messages.QuickSetupMessages.*;
-import org.opends.server.util.VersionCompatibilityIssue;
-import static org.opends.server.util.VersionCompatibilityIssue.*;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.util.List;
-import java.util.Set;
-
-/**
- * {@link VersionIssueNotifier} specific
- * to upgrade tools.
- */
-public class ReversionIssueNotifier extends VersionIssueNotifier {
-
- static private final Logger LOG =
- Logger.getLogger(ReversionIssueNotifier.class.getName());
-
- /**
- * Creates a new instance that can analyze a hypothetical upgrade/reversion
- * operation from one version to another.
- * @param ui UserInteraction for relaying information to the user
- * @param current BuildInformation representing the current version
- * @param neu BuildInformation representing the proposed next version
- */
- public ReversionIssueNotifier(UserInteraction ui,
- BuildInformation current,
- BuildInformation neu) {
- super(ui, current, neu);
- }
-
- /**
- * {@inheritDoc}
- */
- public void notifyUser() throws ApplicationException {
- Message cont = INFO_ORACLE_ACTION_PROMPT_CONTINUE.get();
- Message cancel = INFO_ORACLE_ACTION_PROMPT_CANCEL.get();
- if (hasIssues()) {
- List<Directive> issues = getIssues();
- if (!isSupported()) {
- MessageBuilder reason = new MessageBuilder();
- if (issues != null) {
- for (Directive directive : issues) {
- LOG.log(Level.INFO, "Unsupported reversion details: " +
- directive.getMessage());
- reason.append(directive.getMessage());
- reason.append(EOL);
- }
- }
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_REVERSION_ORACLE_UNSUPPORTED.get(
- currentBuildInfo.toString(),
- newBuildInfo.toString(),
- reason.toMessage()),
- null);
- } else {
- if (ui.isInteractive()) {
- for (Directive directive : issues) {
- Message title;
- Message summary;
- Message details;
- Message defaultAction;
- UserInteraction.MessageType msgType;
- String lineBreak = ui.isCLI() ?
- Constants.LINE_SEPARATOR : Constants.HTML_LINE_BREAK;
- switch (directive.getType()) {
- case ACTION:
- title = INFO_GENERAL_ACTION_REQUIRED.get();
- summary = INFO_REVERSION_ORACLE_ACTION.get();
- details = new MessageBuilder(directive.getMessage())
- .append(lineBreak)
- .append(lineBreak)
- .append(INFO_ORACLE_ACTION_PROMPT.get())
- .toMessage();
- msgType = UserInteraction.MessageType.WARNING;
- defaultAction = cancel;
- break;
- case INFO:
- title = INFO_GENERAL_INFO.get();
- summary = INFO_REVERSION_ORACLE_INFO.get();
- details = new MessageBuilder(directive.getMessage())
- .append(lineBreak)
- .append(lineBreak)
- .append(INFO_ORACLE_INFO_PROMPT.get())
- .toMessage();
- msgType = UserInteraction.MessageType.INFORMATION;
- defaultAction = cont;
- break;
- case WARNING:
- title = INFO_GENERAL_WARNING.get();
- summary = INFO_REVERSION_ORACLE_WARNING.get();
- details = new MessageBuilder(directive.getMessage())
- .append(lineBreak)
- .append(lineBreak)
- .append(INFO_ORACLE_INFO_PROMPT.get())
- .toMessage();
- msgType = UserInteraction.MessageType.WARNING;
- defaultAction = cont;
- break;
- default:
- LOG.log(Level.INFO, "Unexpected issue type " +
- directive.getType());
- title = Message.EMPTY;
- summary = Message.EMPTY;
- details = directive.getMessage();
- msgType = UserInteraction.MessageType.WARNING;
- defaultAction = cont;
- }
- if (cancel.equals(ui.confirm(
- summary,
- details,
- title,
- msgType,
- new Message[]{cont, cancel},
- defaultAction))) {
- throw new ApplicationException(
- ReturnCode.CANCELED,
- INFO_REVERSION_CANCELED.get(), null);
- }
- }
- } else if (!ui.isForceOnError()) {
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_ORACLE_NO_SILENT.get(), null);
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getLocalizedDetailMessage(
- VersionCompatibilityIssue.Cause cause)
- {
- Message msg = cause.getLocalizedReversionMessage();
-
- // See if we need to supply a generic message
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
-
- // If the import/export effect is present, append the detailed
- // instructions.
- if (effects.contains(Effect.REVERSION_DATA_EXPORT_AND_REIMPORT_REQUIRED)) {
- if (ui.isInteractive())
- {
- String lineBreak = ui.isCLI() ? Constants.LINE_SEPARATOR
- : Constants.HTML_LINE_BREAK;
- msg = new MessageBuilder(msg).append(lineBreak).append(
- ui.createUnorderedList(getExportImportInstructions())).toMessage();
- }
- else
- {
- String lineBreak = Constants.LINE_SEPARATOR;
- msg = new MessageBuilder(msg).append(lineBreak).append(
- createUnorderedList(getExportImportInstructions())).toMessage();
- }
- }
- return msg;
- }
-
- /**
- * {@inheritDoc}
- */
- protected boolean isActionRequired(VersionCompatibilityIssue.Cause cause) {
- boolean isAction = false;
- if (cause != null) {
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
- isAction =
- effects.contains(
- Effect.REVERSION_DATA_EXPORT_AND_REIMPORT_REQUIRED) ||
- (effects.contains(
- Effect.REVERSION_MANUAL_ACTION_REQUIRED) &&
- cause.getLocalizedUpgradeMessage() != null);
- }
- return isAction;
- }
-
- /**
- * {@inheritDoc}
- */
- protected boolean isWarning(VersionCompatibilityIssue.Cause cause) {
- boolean isWarning = false;
- if (cause != null && !isActionRequired(cause)) {
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
- isWarning = effects.contains(Effect.REVERSION_SHOW_WARNING_MESSAGE) &&
- cause.getLocalizedUpgradeMessage() != null;
- }
- return isWarning;
- }
-
- /**
- * {@inheritDoc}
- */
- protected boolean isUnsupported(VersionCompatibilityIssue.Cause cause) {
- boolean isUnsupported = false;
- if (cause != null) {
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
- for (VersionCompatibilityIssue.Effect effect : effects) {
- switch (effect) {
- case REVERSION_NOT_POSSIBLE:
- isUnsupported = true; break;
- default:
- // assume not an tion;
- }
- }
- }
- return isUnsupported;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionLauncher.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionLauncher.java
deleted file mode 100644
index 43d1ce3..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionLauncher.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.QuickSetupLog;
-
-import java.io.File;
-
-/**
- * Launches a reversion operation. This class just extends UpgradeLauncher
- * which really contains all the smarts for launching reversion/upgrade
- * operations.
- */
-public class ReversionLauncher extends UpgradeLauncher {
-
- /**
- * Creates and launches a reversion operation.
- * @param args from the command line
- */
- static public void main(String[] args) {
- try {
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (Throwable t) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
- new ReversionLauncher(args).launch();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isReversion() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- protected CliApplication createCliApplication() {
- return new Reverter();
- }
-
- /**
- * Creates a new launcher.
- * @param args from the command line
- */
- protected ReversionLauncher(String[] args) {
- super(args);
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java
deleted file mode 100644
index 1643bda..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.ProgressStep;
-
-/**
- * Steps during the reversion process.
- */
-enum ReversionProgressStep implements ProgressStep {
-
- NOT_STARTED(INFO_SUMMARY_REVERT_NOT_STARTED.get(), null, null, 0, false),
-
- INITIALIZING(INFO_SUMMARY_REVERT_INITIALIZING.get(),
- INFO_PROGRESS_REVERT_INITIALIZING.get(),
- INFO_PROGRESS_REVERT_INITIALIZING.get(),
- 20, true),
-
- STOPPING_SERVER(INFO_SUMMARY_STOPPING.get(), null, null, 40, false),
-
- REVERTING_FILESYSTEM(INFO_SUMMARY_REVERT_REVERTING_COMPONENTS.get(),
- INFO_PROGRESS_REVERT_REVERTING_COMPONENTS.get(),
- INFO_PROGRESS_REVERT_REVERTING_COMPONENTS.get(), 60, true),
-
- VERIFYING(INFO_SUMMARY_REVERT_VERIFYING.get(),
- INFO_PROGRESS_REVERT_VERIFYING.get(),
- INFO_PROGRESS_REVERT_VERIFYING.get(), 70, true),
-
- STARTING_SERVER(INFO_SUMMARY_STARTING.get(), null, null, 80, false),
-
- RECORDING_HISTORY(INFO_SUMMARY_REVERT_HISTORY.get(),
- INFO_PROGRESS_REVERT_HISTORY.get(),
- INFO_PROGRESS_REVERT_HISTORY.get(), 90, true),
-
- CLEANUP(INFO_SUMMARY_REVERT_CLEANUP.get(),
- INFO_PROGRESS_REVERT_CLEANUP.get(),
- INFO_PROGRESS_REVERT_CLEANUP.get(), 95, true),
-
- ABORT(INFO_SUMMARY_REVERT_ABORT.get(),
- INFO_PROGRESS_REVERT_ABORT.get(),
- INFO_PROGRESS_REVERT_ABORT.get(), 99, true),
-
- FINISHED_WITH_ERRORS(INFO_SUMMARY_REVERT_FINISHED_WITH_ERRORS_CLI.get(),
- null, null, 100, false),
-
- FINISHED_WITH_WARNINGS(
- INFO_SUMMARY_REVERT_FINISHED_WITH_WARNINGS_CLI.get(), null, null,
- 100, false),
-
- FINISHED_CANCELED(INFO_SUMMARY_REVERT_FINISHED_CANCELED_CLI.get(), null,
- null, 100, false),
-
- FINISHED(INFO_SUMMARY_REVERT_FINISHED_SUCCESSFULLY_CLI.get("",""), null, null,
- 100, false);
-
- private Message summaryMsg;
- private Message logMsg;
- private Message logMsgVerbose;
- private int progress;
- private boolean logWithPoints;
-
- private ReversionProgressStep(Message summaryMsg, Message logMsg,
- Message logMsgVerbose, int progress, boolean logWithPoints) {
- this.summaryMsg = summaryMsg;
- this.logMsg = logMsg;
- this.logMsgVerbose = logMsgVerbose;
- this.progress = progress;
- this.logWithPoints = logWithPoints;
- }
-
- /**
- * Return the summary message for the step.
- *
- * @return the summary message for the step.
- */
- public Message getSummaryMessage() {
- return summaryMsg;
- }
-
- /**
- * Return the log message for the step.
- * @param isVerbose whether we are running in verbose mode or not.
- *
- * @return the log message for the step.
- */
- public Message getLogMsg(boolean isVerbose) {
- Message msg;
- if (isVerbose)
- {
- msg = logMsgVerbose;
- }
- else
- {
- msg = logMsg;
- }
- return msg;
- }
-
- /**
- * Return whether we must add points to the log message or not.
- * @param isVerbose whether we are running in verbose mode or not.
- *
- * @return <CODE>true</CODE> if we must add points to the log message and
- * <CODE>false</CODE> otherwise.
- */
- public boolean logRequiresPoints(boolean isVerbose) {
- boolean returnValue;
- if (logWithPoints)
- {
- if (isVerbose)
- {
- returnValue = logMsgVerbose == logMsg;
- }
- else
- {
- returnValue = true;
- }
- }
- else
- {
- returnValue = false;
- }
- return returnValue;
- }
-
- /**
- * Gets the amount of progress to show in the progress meter for this step.
- * @return int representing progress
- */
- public int getProgress() {
- return this.progress;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isLast() {
- return this == FINISHED ||
- this == FINISHED_WITH_ERRORS ||
- this == FINISHED_WITH_WARNINGS ||
- this == FINISHED_CANCELED;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isError() {
- return this == FINISHED_WITH_ERRORS;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java
deleted file mode 100644
index f419c94..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import java.io.File;
-import java.util.HashSet;
-
-/**
- * Filter defining files we want to manage in the upgrade
- * process.
- */
-class RevertFileFilter extends UpgradeFileFilter {
-
- /**
- * Creates a filter for ignoring in an OpenDS installation at
- * <code>root</code>certain OpenDS files below root.
- * @param root the root of the installation
- */
- public RevertFileFilter(File root) {
- super(root);
- this.filesToIgnore = new HashSet<File>();
- for (String rootFileNamesToIgnore :
- Upgrader.ROOT_FILES_TO_IGNORE_DURING_BACKUP) {
- filesToIgnore.add(new File(root, rootFileNamesToIgnore));
- }
- }
-
- /**
- * Creates a filter for ignoring in an OpenDS installation at
- * <code>root</code>certain OpenDS files below root.
- * @param root the root of the installation
- * @param forInstallDir true if the filter is for the install directory.
- */
- public RevertFileFilter(File root,boolean forInstallDir ) {
- super(root, forInstallDir);
- this.filesToIgnore = new HashSet<File>();
- for (String rootFileNamesToIgnore :
- Upgrader.ROOT_FILES_TO_IGNORE_DURING_BACKUP) {
- filesToIgnore.add(new File(root, rootFileNamesToIgnore));
- }
- }
-}
-
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
deleted file mode 100644
index 1573bf6..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
+++ /dev/null
@@ -1,1171 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.ReturnCode;
-import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.UserDataException;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.ProgressUpdateListenerDelegate;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.Launcher;
-import org.opends.quicksetup.Status;
-import org.opends.quicksetup.ProgressStep;
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.Application;
-import org.opends.quicksetup.HistoricalRecord;
-import org.opends.quicksetup.UserInteraction;
-import org.opends.quicksetup.CliUserInteraction;
-import static org.opends.quicksetup.Installation.*;
-import org.opends.quicksetup.event.ProgressUpdateListener;
-import org.opends.quicksetup.util.ProgressMessageFormatter;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.ServerController;
-import org.opends.quicksetup.util.FileManager;
-import org.opends.server.util.cli.CLIException;
-import org.opends.server.util.cli.Menu;
-import org.opends.server.util.cli.MenuBuilder;
-import org.opends.server.util.cli.MenuResult;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.FilenameFilter;
-import java.io.FileFilter;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Date;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.text.DateFormat;
-
-/**
- * Reverts an installation from its current version to a prior version.
- */
-public class Reverter extends Application implements CliApplication {
-
- static private final Logger LOG =
- Logger.getLogger(Reverter.class.getName());
-
- private ReversionProgressStep currentProgressStep =
- ReversionProgressStep.NOT_STARTED;
-
- private ReverterUserData userData;
- private ProgressUpdateListenerDelegate listenerDelegate;
- private ApplicationException runError;
- private ApplicationException runWarning;
- private Installation installation;
- private Installation archiveInstallation;
- private File tempBackupDir;
- private long historicalOperationId;
- private BuildInformation fromBuildInfo;
- private BuildInformation archiveBuildInfo;
- private boolean abort = false;
- private boolean restartServer = false;
- private Stage stage = null;
-
- /**
- * {@inheritDoc}
- */
- public UserData createUserData(Launcher launcher)
- throws UserDataException, ApplicationException {
- ReverterUserData ud = null;
-
- if (launcher instanceof UpgradeLauncher) {
- ud = new ReverterUserData();
- UpgradeLauncher rl = (UpgradeLauncher)launcher;
- File filesDir;
- if (rl.isInteractive()) {
- if (rl.isNoPrompt()) {
- StringBuilder sb = new StringBuilder()
- .append("-")
- .append(UpgradeLauncher.REVERT_ARCHIVE_OPTION_SHORT)
- .append("/--")
- .append(ReversionLauncher.REVERT_ARCHIVE_OPTION_LONG)
- .append(", -")
- .append(ReversionLauncher.REVERT_MOST_RECENT_OPTION_SHORT)
- .append("/--")
- .append(ReversionLauncher.REVERT_MOST_RECENT_OPTION_LONG);
- throw new UserDataException(null,
- INFO_REVERT_ERROR_NO_DIR.get(sb.toString()));
- } else {
- CliUserInteraction ui = new CliUserInteraction();
- Message[] options = new Message[] {
- INFO_REVERSION_TYPE_PROMPT_RECENT.get(),
- INFO_REVERSION_TYPE_PROMPT_FILE.get()};
- if (options[0].equals(ui.confirm(
- INFO_REVERT_CONFIRM_TITLE.get(),
- INFO_REVERSION_TYPE_PROMPT.get(),
- INFO_REVERT_CONFIRM_TITLE.get(),
- UserInteraction.MessageType.QUESTION,
- options, options[0])))
- {
- ud.setRevertMostRecent(true);
- } else {
- ud.setRevertMostRecent(false);
-
- // Present a list of reversion archive choices to the user.
- // In the future perhaps we might also allow them to type
- // freehand.
- File historyDir = getInstallation().getHistoryDirectory();
- if (historyDir != null && historyDir.exists()) {
-
- // Print a wait message, this could take a while
- System.out.println(formatter.getFormattedWithPoints(
- INFO_REVERSION_DIR_WAIT.get()));
-
- String[] historyChildren = historyDir.list();
- Arrays.sort(historyChildren);
- List<File> raDirList = new ArrayList<File>();
- for (int i = historyChildren.length - 1; i >=0; i--) {
- File raDirCandidate = new File(historyDir, historyChildren[i]);
- if (isReversionFilesDirectory(raDirCandidate)) {
- raDirList.add(raDirCandidate);
- }
- }
- File[] raDirs = raDirList.toArray(new File[raDirList.size()]);
- List<Message> raDirChoiceList = new ArrayList<Message>();
- for (File raDir : raDirs) {
- String name = raDir.getName();
- Message buildInfo = INFO_UPGRADE_BUILD_ID_UNKNOWN.get();
- Message date = INFO_GENERAL_UNKNOWN.get();
- try {
- File f = appendFilesDirIfNeccessary(raDir);
- Installation i =
- new Installation(f,f);
- BuildInformation bi = i.getBuildInformation();
- buildInfo = Message.raw(bi.toString());
- } catch (Exception e) {
- LOG.log(Level.INFO,
- "Error determining archive version for " + name);
- }
-
- try {
- Date d = new Date(Long.valueOf(name));
- DateFormat df = DateFormat.getInstance();
- date = Message.raw(df.format(d));
- } catch (Exception e) {
- LOG.log(Level.INFO, "Error converting reversion archive " +
- "name " + name + " to date helper");
- }
- MessageBuilder mb = new MessageBuilder(name);
- mb.append(" (");
- mb.append(INFO_REVERSION_DIR_FROM_UPGRADE.get(buildInfo, date));
- mb.append(")");
- raDirChoiceList.add(mb.toMessage());
- }
- Message[] raDirChoices =
- raDirChoiceList.toArray(new Message[0]);
- if (raDirChoices.length > 0) {
- MenuBuilder<Integer> builder = new MenuBuilder<Integer>(ui);
-
- builder.setPrompt(INFO_REVERSION_DIR_PROMPT.get());
-
- for (int i=0; i<raDirChoices.length; i++)
- {
- builder.addNumberedOption(raDirChoices[i],
- MenuResult.success(i+1));
- }
-
- builder.setDefault(Message.raw(String.valueOf("1")),
- MenuResult.success(1));
-
- Menu<Integer> menu = builder.toMenu();
- int resp;
- try
- {
- MenuResult<Integer> m = menu.run();
- if (m.isSuccess())
- {
- resp = m.getValue();
- }
- else
- {
- // Should never happen.
- throw new RuntimeException();
- }
- }
- catch (CLIException ce)
- {
- resp = 1;
- LOG.log(Level.WARNING, "Error reading input: "+ce, ce);
- }
-
- File raDir = raDirs[resp - 1];
- raDir = appendFilesDirIfNeccessary(raDir);
- try {
- ud.setReversionArchiveDirectory(
- validateReversionArchiveDirectory(raDir));
- } catch (UserDataException ude) {
- System.err.println(ude.getMessageObject());
- }
- } else {
- LOG.log(Level.INFO, "No archives in history dir");
- throw new UserDataException(null,
- INFO_REVERT_ERROR_NO_HISTORY_DIR.get());
- }
- } else {
- LOG.log(Level.INFO, "History dir does not exist");
- throw new UserDataException(null,
- INFO_REVERT_ERROR_NO_HISTORY_DIR.get());
- }
- }
- }
- } else if (rl.isRevertMostRecent()) {
- ud.setRevertMostRecent(true);
- } else {
- filesDir = rl.getReversionArchiveDirectory();
- filesDir = appendFilesDirIfNeccessary(filesDir);
- ud.setReversionArchiveDirectory(
- validateReversionArchiveDirectory(filesDir));
- }
- if (ud.isRevertMostRecent()) {
- Installation install = getInstallation();
- File historyDir = install.getHistoryDirectory();
- if (historyDir.exists()) {
- FilenameFilter filter = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return !HISTORY_LOG_FILE_NAME.equals(name);
- }
- };
- String[] childNames = historyDir.list(filter);
- boolean found = false;
- if (childNames != null && childNames.length > 0) {
-
- // The directories beneath 'history' are named according
- // to the system time at which they were generated.
- // Go through the directory names in order of most
- // recent to oldest looking for the first one that
- // looks like a backup directory
- Arrays.sort(childNames);
- for (String childName : childNames) {
- File b = new File(historyDir, childName);
- File d = new File(b, HISTORY_BACKUP_FILES_DIR_NAME);
- if (isReversionFilesDirectory(d)) {
- found = true;
- ud.setReversionArchiveDirectory(d);
- break;
- }
- }
- if (!found)
- {
- throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
- INFO_REVERT_ERROR_INVALID_HISTORY_DIR.get(), null);
- }
- } else {
- throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
- INFO_REVERT_ERROR_EMPTY_HISTORY_DIR.get(), null);
- }
- } else {
- throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
- INFO_REVERT_ERROR_NO_HISTORY_DIR.get(), null);
- }
- }
- ud.setQuiet(rl.isQuiet());
- ud.setInteractive(!rl.isNoPrompt());
- ud.setVerbose(rl.isVerbose());
- }
- return ud;
- }
-
- /**
- * {@inheritDoc}
- */
- public UserData getUserData() {
- return this.userData;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setUserData(UserData userData) {
- if (userData instanceof ReverterUserData) {
- this.userData = (ReverterUserData)userData;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void setProgressMessageFormatter(ProgressMessageFormatter formatter) {
- this.formatter = formatter;
- this.listenerDelegate = new ProgressUpdateListenerDelegate();
- }
-
- /**
- * {@inheritDoc}
- */
- public ApplicationException getRunError() {
- return this.runError;
- }
-
- /**
- * {@inheritDoc}
- */
- public ReturnCode getReturnCode() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public void addProgressUpdateListener(ProgressUpdateListener l) {
- listenerDelegate.addProgressUpdateListener(l);
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeProgressUpdateListener(ProgressUpdateListener l) {
- listenerDelegate.removeProgressUpdateListener(l);
- }
-
- /**
- * {@inheritDoc}
- */
- public void notifyListeners(Integer ratio,
- Message currentPhaseSummary,
- Message newLogDetail) {
- listenerDelegate.notifyListeners(null,
- ratio,
- currentPhaseSummary,
- newLogDetail);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstallationPath() {
- String installationPath = null;
- String path = System.getProperty("INSTALL_ROOT");
- if (path != null) {
- File f = new File(path);
- if (f.getParentFile() != null &&
- f.getParentFile().getParentFile() != null &&
- new File(f.getParentFile().getParentFile(),
- LOCKS_PATH_RELATIVE).exists()) {
- installationPath = Utils.getPath(f.getParentFile().getParentFile());
- } else {
- installationPath = path;
- }
- }
- return installationPath;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstancePath() {
- String installPath = getInstallationPath() ;
- return Utils.getInstancePathFromInstallPath(installPath);
- }
-
- /**
- * {@inheritDoc}
- */
- public ProgressStep getCurrentProgressStep() {
- return this.currentProgressStep;
- }
-
- /**
- * {@inheritDoc}
- */
- public Integer getRatio(ProgressStep step) {
- Integer ratio = null;
- if (step instanceof ReversionProgressStep) {
- ratio = ((ReversionProgressStep)step).getProgress();
- }
- return ratio;
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getSummary(ProgressStep step) {
- Message txt;
- if (step == ReversionProgressStep.FINISHED) {
- txt = getFinalSuccessMessage();
-// } else if (step == ReversionProgressStep.FINISHED_CANCELED) {
-// txt = getFinalCanceledMessage();
-// } else if (step == ReversionProgressStep.FINISHED_WITH_ERRORS) {
-// txt = getFinalErrorMessage();
-// } else if (step == ReversionProgressStep.FINISHED_WITH_WARNINGS) {
-// txt = getFinalWarningMessage();
- }
- else {
- txt = (((ReversionProgressStep) step).getSummaryMessage());
- }
- return txt;
- }
-
- /**
- * Returns the progress message for a given progress step.
- * @param step the progress step.
- * @return the progress message for the provided step.
- */
- private Message getLogMsg(ReversionProgressStep step) {
- Message txt;
- if (step == ReversionProgressStep.FINISHED) {
- txt = getFinalSuccessMessage();
- } else if (step == ReversionProgressStep.FINISHED_CANCELED) {
- txt = step.getSummaryMessage();
- } else if (step == ReversionProgressStep.FINISHED_WITH_ERRORS) {
- txt = step.getSummaryMessage();
- } else if (step == ReversionProgressStep.FINISHED_WITH_WARNINGS) {
- txt = step.getSummaryMessage();
- }
- else
- {
- txt = step.getLogMsg(isVerbose());
- }
- return txt;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isFinished() {
- return getCurrentProgressStep() ==
- ReversionProgressStep.FINISHED
- || getCurrentProgressStep() ==
- ReversionProgressStep.FINISHED_WITH_ERRORS
- || getCurrentProgressStep() ==
- ReversionProgressStep.FINISHED_WITH_WARNINGS
- || getCurrentProgressStep() ==
- ReversionProgressStep.FINISHED_CANCELED;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isCancellable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public void cancel() {
- // not supported
- }
-
- /**
- * Gets the OpenDS installation associated with the execution of this
- * command.
- * @return Installation object representing the current OpenDS installation
- */
- public Installation getInstallation() {
- if (installation == null) {
- String installPath = getInstallationPath();
- String instancePath = getInstancePath();
- if (installPath != null) {
- if (instancePath != null)
- {
- installation = new Installation(installPath, instancePath);
- }
- else
- {
- installation = new Installation(installPath, installPath);
- }
- }
- }
- return installation;
- }
-
- /**
- * {@inheritDoc}
- */
- public void run() {
-
- try {
-
- // Get the user to confirm if possible
- UserInteraction ui = userInteraction();
- if (ui.isInteractive()) {
- Message cont = INFO_CONTINUE_BUTTON_LABEL.get();
- Message cancel = INFO_CANCEL_BUTTON_LABEL.get();
-
- String toBuildString;
- BuildInformation toBi = getArchiveBuildInformation();
- if (toBi != null) {
- toBuildString = toBi.toString();
- } else {
- if (getReversionFilesDirectory() == null)
- {
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_REVERT_ERROR_INVALID_HISTORY_DIR.get(), null);
- }
- toBuildString = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- if (cancel.equals(ui.confirm(
- INFO_REVERT_CONFIRM_TITLE.get(),
- INFO_REVERT_CONFIRM_PROMPT.get(
- toBuildString,
- Utils.getPath(getReversionFilesDirectory())),
- INFO_REVERT_CONFIRM_TITLE.get(),
- UserInteraction.MessageType.WARNING,
- new Message[] { cont, cancel },
- cont))) {
- throw new ApplicationException(
- ReturnCode.CANCELED,
- INFO_REVERSION_CANCELED.get(), null);
- }
- }
-
- // Stop the server if necessary. Task note as to whether the server
- // is running since we will leave it in that state when we are done.
- Installation installation = getInstallation();
- Status status = installation.getStatus();
- ServerController sc = new ServerController(installation);
- if (status.isServerRunning()) {
- restartServer = true;
- sc = new ServerController(installation);
- try {
- setCurrentProgressStep(ReversionProgressStep.STOPPING_SERVER);
- LOG.log(Level.INFO, "Stopping server");
-
- if (isVerbose())
- {
- notifyListeners(getTaskSeparator());
- }
- else
- {
- notifyListeners(getFormattedWithPoints(
- INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
- }
-
- sc.stopServer(!isVerbose());
-
- if (!isVerbose())
- {
- notifyListeners(getFormattedDoneWithLineBreak());
- }
- else
- {
- notifyListeners(getLineBreak());
- }
- } catch (ApplicationException ae) {
- runError = ae;
- notifyListeners(getFormattedErrorWithLineBreak());
- }
- }
-
- try {
- setCurrentProgressStep(ReversionProgressStep.INITIALIZING);
- initialize();
- notifyListeners(getFormattedDoneWithLineBreak());
- } catch (ApplicationException ae) {
- LOG.log(Level.INFO, "Error initializing reversion", ae);
- notifyListeners(getFormattedErrorWithLineBreak());
- throw ae;
- }
-
- try {
- LOG.log(Level.INFO, "Reverting components");
- setCurrentProgressStep(ReversionProgressStep.REVERTING_FILESYSTEM);
- revertComponents();
- LOG.log(Level.INFO, "Finished reverting components");
- notifyListeners(getFormattedDoneWithLineBreak());
- } catch (ApplicationException ae) {
- LOG.log(Level.INFO, "Error reverting components", ae);
- notifyListeners(getFormattedErrorWithLineBreak());
- throw ae;
- }
-
- if (restartServer) {
- try {
- LOG.log(Level.INFO, "Restarting server");
- setCurrentProgressStep(ReversionProgressStep.STARTING_SERVER);
- if (isVerbose())
- {
- notifyListeners(getTaskSeparator());
- }
- else
- {
- notifyListeners(getFormattedWithPoints(
- INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
- }
- sc.startServer(!isVerbose());
- if (!isVerbose())
- {
- notifyListeners(getFormattedDoneWithLineBreak());
- }
- else
- {
- notifyListeners(getLineBreak());
- }
- } catch (ApplicationException ae) {
- runError = ae;
- notifyListeners(getFormattedErrorWithLineBreak());
- }
- }
-
- } catch (Throwable e) {
- if (!(e instanceof ApplicationException)) {
- runError = new ApplicationException(
- ReturnCode.BUG,
- Message.raw(e.getLocalizedMessage()), e);
- } else {
- runError = (ApplicationException)e;
- abort = ReturnCode.CANCELED.equals(
- ((ApplicationException)e).getType());
- }
- } finally {
- end();
- }
- }
-
- private void setCurrentProgressStep(ReversionProgressStep step) {
- this.currentProgressStep = step;
- int progress = step.getProgress();
- Message summary = getSummary(step);
- Message log = getLogMsg(step);
- if (step.logRequiresPoints(isVerbose()) && (log != null))
- {
- log = getFormattedWithPoints(log);
- }
- notifyListeners(progress, summary, log);
- }
-
- private void initialize() throws ApplicationException {
- this.historicalOperationId =
- writeInitialHistoricalRecord(
- getFromBuildInformation(),
- getArchiveBuildInformation());
- insureRevertability();
- backupCurrentInstallation();
- }
-
- private void backupCurrentInstallation() throws ApplicationException {
- LOG.log(Level.INFO, "Backing up filesystem");
- try {
- File filesBackupDirectory = getTempBackupDirectory();
- FileManager fm = new FileManager();
- File root = getInstallation().getRootDirectory();
- FileFilter filter = new RevertFileFilter(root);
- for (String fileName : root.list()) {
- File f = new File(root, fileName);
-
- // Replacing a Windows bat file while it is running with a different
- // version leads to unpredictable behavior so we make a special case
- // here and during the upgrade components step.
- if (Utils.isWindows() &&
- fileName.equals(WINDOWS_UPGRADE_FILE_NAME)) {
- continue;
- }
-
- fm.move(f, filesBackupDirectory, filter);
- }
- LOG.log(Level.INFO, "Finished backing up filesystem");
- } catch (ApplicationException ae) {
- LOG.log(Level.INFO, "Error backing up filesystem", ae);
- throw ae;
- } catch (Exception e) {
- LOG.log(Level.INFO, "Error backing up filesystem", e);
- throw new ApplicationException(
- ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
- INFO_ERROR_BACKUP_FILESYSTEM.get(),
- e);
- }
- }
-
- private void revertComponents() throws ApplicationException {
- try {
- Stage stage = getStage();
- Installation installation = getInstallation();
- if (installation.instanceAndInstallInSameDir())
- {
- File root = installation.getRootDirectory();
- stage.move(root, new RevertFileFilter(getReversionFilesDirectory()));
- }
- else
- {
- File root = installation.getRootDirectory();
- File revFileRoot = new File(getReversionFilesDirectory(),
- Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
- stage.move(root, new RevertFileFilter(revFileRoot,true),true);
-
- root = installation.getInstanceDirectory();
- revFileRoot = new File(getReversionFilesDirectory(),
- Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
- stage.move(root, new RevertFileFilter(revFileRoot,false),false);
- }
-
- // The bits should now be of the new version. Have
- // the installation update the build information so
- // that it is correct.
- LOG.log(Level.INFO, "Reverted bits to " +
- installation.getBuildInformation(false));
-
- } catch (IOException e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_UPGRADING_COMPONENTS.get(), e);
- }
- }
-
- private File getReversionFilesDirectory()
- throws ApplicationException, IOException {
- return userData.getReversionArchiveDirectory();
- }
-
- private File validateReversionArchiveDirectory(File filesDir)
- throws UserDataException
- {
- if (filesDir == null) {
- throw new UserDataException(null,
- INFO_REVERT_ERROR_NULL_FILES_DIR.get());
- } else if (!filesDir.isDirectory()) {
- throw new UserDataException(null,
- INFO_REVERT_ERROR_NOT_DIR_FILES_DIR.get());
- } else if (!isReversionFilesDirectory(filesDir)) {
- throw new UserDataException(null,
- INFO_REVERT_ERROR_INVALID_FILES_DIR.get());
- }
- return filesDir;
- }
-
- private boolean isReversionFilesDirectory(File filesDir) {
- filesDir = appendFilesDirIfNeccessary(filesDir);
- boolean isFilesDir = false;
- if (filesDir != null && filesDir.exists() && filesDir.isDirectory()) {
- String[] children = filesDir.list();
- Set<String> cs = new HashSet<String>(Arrays.asList(children));
-
- // TODO: more testing of file dir
- if (installation.instanceAndInstallInSameDir())
- {
- isFilesDir = cs.contains(CONFIG_PATH_RELATIVE) &&
- cs.contains(LIBRARIES_PATH_RELATIVE);
- }
- else
- {
- isFilesDir = cs.contains(Installation.HISTORY_BACKUP_FILES_DIR_INSTALL)
- && cs.contains( Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
- }
- }
- return isFilesDir;
- }
-
- private void end() {
- try {
- HistoricalRecord.Status status;
- String note = null;
- if (runError == null && !abort) {
- status = HistoricalRecord.Status.SUCCESS;
-
- // Since everything went OK, delete the archive
- LOG.log(Level.INFO, "Cleaning up after reversion");
- setCurrentProgressStep(ReversionProgressStep.CLEANUP);
- deleteArchive();
- deleteBackup();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "Clean up complete");
-
- } else {
- if (abort) {
- status = HistoricalRecord.Status.CANCEL;
- } else {
- status = HistoricalRecord.Status.FAILURE;
- note = runError.getLocalizedMessage();
- }
-
- // Abort the reversion and put things back like we found it
- LOG.log(Level.INFO, "Canceling reversion");
- ProgressStep lastProgressStep = currentProgressStep;
- setCurrentProgressStep(ReversionProgressStep.ABORT);
- abort(lastProgressStep);
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "Cancelation complete");
- }
-
- // Remove the lib directory temporarily created by the
- // launch script with which the program is running
- deleteReversionLib();
-
- // Write a record in the log file indicating success/failure
- LOG.log(Level.INFO, "Recording history");
- setCurrentProgressStep(ReversionProgressStep.RECORDING_HISTORY);
- writeHistoricalRecord(historicalOperationId,
- getFromBuildInformation(),
- getArchiveBuildInformation(),
- status,
- note);
-
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "History recorded");
- notifyListeners(getFormattedProgress(INFO_GENERAL_SEE_FOR_HISTORY.get(
- Utils.getPath(getInstallation().getHistoryLogFile()))));
- notifyListeners(formatter.getLineBreak());
-
- try {
- Stage stage = getStage();
- List<Message> stageMessages = stage.getMessages();
- for (Message m : stageMessages) {
- notifyListeners(m);
- }
- } catch (IOException e) {
- LOG.log(Level.INFO, "failed to access stage", e);
- }
-
- } catch (ApplicationException e) {
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "Error cleaning up after reversion.", e);
- }
-
- // Decide final status based on presense of error
-
- // WARNING: change this code at your own risk! The ordering
- // of these statements is important. There are differences
- // in how the CLI and GUI application's processes exit.
- // Changing the ordering here may result in messages being
- // skipped because the process has already exited by the time
- // processing messages has finished. Need to resolve these
- // issues.
- if (abort) {
- LOG.log(Level.INFO, "reversion canceled by user");
- setCurrentProgressStep(ReversionProgressStep.FINISHED_CANCELED);
- } else if (runError != null) {
- LOG.log(Level.INFO, "reversion completed with errors", runError);
- notifyListeners(getFormattedErrorWithLineBreak(runError,true));
- notifyListeners(getLineBreak());
- setCurrentProgressStep(ReversionProgressStep.FINISHED_WITH_ERRORS);
- notifyListeners(getLineBreak());
- } else if (runWarning != null) {
- LOG.log(Level.INFO, "reversion completed with warnings");
- Message warningText = runWarning.getMessageObject();
-
- // By design, the warnings are written as errors to the details section
- // as errors. Warning markup is used surrounding the main message
- // at the end of progress.
- notifyListeners(getFormattedErrorWithLineBreak(warningText, true));
- notifyListeners(getLineBreak());
- setCurrentProgressStep(ReversionProgressStep.FINISHED_WITH_WARNINGS);
- notifyListeners(formatter.getLineBreak());
-
- } else {
- LOG.log(Level.INFO, "reversion completed successfully");
- setCurrentProgressStep(ReversionProgressStep.FINISHED);
- }
- }
-
- /**
- * Abort this reversion and repair the installation.
- *
- * @param lastStep ProgressStep indicating how much work we will have to
- * do to get the installation back like we left it
- * @throws ApplicationException of something goes wrong
- */
- private void abort(ProgressStep lastStep) throws ApplicationException {
-
- // This can be used to bypass the aborted reversion cleanup
- // process so that an autopsy can be performed on the
- // crippled server.
- if ("true".equals(System.getProperty(Upgrader.SYS_PROP_NO_ABORT))) {
- return;
- }
-
- ReversionProgressStep lastReversionStep = (ReversionProgressStep) lastStep;
- EnumSet<ReversionProgressStep> stepsStarted =
- EnumSet.range(ReversionProgressStep.NOT_STARTED, lastReversionStep);
-
- if (stepsStarted.contains(ReversionProgressStep.REVERTING_FILESYSTEM)) {
-
- // Files were copied from the reversion directory to the current
- // directory. Repair things by overwriting file in the
- // root with those that were copied to the backup directory
- // during revertFiles()
-
- File root = getInstallation().getRootDirectory();
- File backupDirectory;
- try {
- backupDirectory = getTempBackupDirectory();
- FileManager fm = new FileManager();
- boolean restoreError = false;
- for (String fileName : backupDirectory.list()) {
- File f = new File(backupDirectory, fileName);
-
- // Do our best to restore the filesystem like
- // we found it. Just report potential problems
- // to the user.
- try {
- fm.move(f, root, null);
- } catch (Throwable t) {
- restoreError = true;
- notifyListeners(INFO_ERROR_RESTORING_FILE.get(Utils.getPath(f),
- Utils.getPath(root)));
- }
- }
- if (!restoreError) {
- fm.deleteRecursively(backupDirectory);
- }
-
- } catch (IOException e) {
- LOG.log(Level.INFO, "Error getting backup directory", e);
- }
- }
-
- }
-
- /**
- * Deletes the archived backup to which we reverted.
- */
- private void deleteArchive() {
- FileManager fm = new FileManager();
- try {
- fm.deleteRecursively(getReversionFilesDirectory());
- File parent = getReversionFilesDirectory().getParentFile();
- if (Utils.directoryExistsAndIsEmpty(parent.getAbsolutePath()))
- {
- fm.deleteRecursively(parent);
- }
- } catch (Exception e) {
- // ignore; this is best effort
- LOG.log(Level.WARNING, "Error: "+e, e);
- }
- }
-
- /**
- * Deletes the backup of the current installation.
- */
- private void deleteBackup() {
- FileManager fm = new FileManager();
- try {
- fm.deleteRecursively(getTempBackupDirectory());
- } catch (Exception e) {
- // ignore; this is best effort
- LOG.log(Level.WARNING, "Error: "+e, e);
- }
- }
-
- /**
- * Delete the library with which this reversion is currently
- * running.
- */
- private void deleteReversionLib() {
- FileManager fm = new FileManager();
- try {
- File tmpDir = getInstallation().getTemporaryDirectory();
- File revertLibDir = new File(tmpDir, "revert");
- fm.deleteRecursively(
- revertLibDir, null,
- FileManager.DeletionPolicy.DELETE_ON_EXIT);
- } catch (Exception e) {
- // ignore; this is best effort
- }
- }
-
- /**
- * Gets the directory that will be used to store the bits that this
- * reversion operation will replace. The bits are stored in case there
- * is a problem with this reversion in which case they can be restored.
- *
- * @return File directory where the unreverted bits will be stored.
- * @throws java.io.IOException if something goes wrong
- * @throws org.opends.quicksetup.ApplicationException if something goes wrong
- */
- private File getTempBackupDirectory()
- throws IOException, ApplicationException
- {
- if (tempBackupDir == null) {
- tempBackupDir = new File(getInstallation().getTemporaryDirectory(),
- HISTORY_BACKUP_FILES_DIR_NAME);
- if (tempBackupDir.exists()) {
- FileManager fm = new FileManager();
- fm.deleteRecursively(tempBackupDir);
- }
- if (!tempBackupDir.mkdirs()) {
- throw new IOException("error creating files backup directory");
- }
- }
- return tempBackupDir;
- }
-
- private BuildInformation getFromBuildInformation() {
- if (fromBuildInfo == null) {
- if (currentProgressStep.ordinal() <
- ReversionProgressStep.REVERTING_FILESYSTEM.ordinal()) {
- try {
- fromBuildInfo = installation.getBuildInformation(false);
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Failed to obtain 'from' build information", e);
- }
- }
- }
- return fromBuildInfo;
- }
-
- private BuildInformation getArchiveBuildInformation() {
- if (archiveBuildInfo == null) {
- if (currentProgressStep.ordinal() >
- ReversionProgressStep.REVERTING_FILESYSTEM.ordinal()) {
- try {
- archiveBuildInfo = installation.getBuildInformation(false);
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Failed to obtain archived build information " +
- "from reverted files", e);
- }
- } else {
-
- Installation archiveInstall;
- try {
- archiveInstall = getArchiveInstallation();
- archiveBuildInfo = archiveInstall.getBuildInformation();
- } catch (Exception e) {
- LOG.log(Level.INFO, "Failed to obtain archived build information " +
- "from archived files", e);
- }
- }
- }
- return archiveBuildInfo;
- }
-
- private Message getFinalSuccessMessage() {
- Message txt;
- String installPath = Utils.getPath(getInstallation().getRootDirectory());
- String newVersion;
- try {
- BuildInformation bi = getInstallation().getBuildInformation();
- if (bi != null) {
- newVersion = bi.toString();
- } else {
- newVersion = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- } catch (ApplicationException e) {
- newVersion = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- txt = INFO_SUMMARY_REVERT_FINISHED_SUCCESSFULLY_CLI.get(
- formatter.getFormattedText(Message.raw(installPath)),
- newVersion);
- return txt;
- }
-
- /**
- * Given the current information, determines whether or not
- * a reversion from the current version to the archived version
- * is possible. Reversion may not be possible due to 'flag
- * day' types of changes to the codebase.
- * @throws org.opends.quicksetup.ApplicationException if revertability
- * cannot be insured.
- */
- private void insureRevertability() throws ApplicationException {
- BuildInformation currentVersion;
- BuildInformation newVersion;
- try {
- currentVersion = getInstallation().getBuildInformation();
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Error getting build information for " +
- "current installation", e);
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DETERMINING_CURRENT_BUILD.get(), e);
- }
-
- try {
- Installation revInstallation = getArchiveInstallation();
- newVersion = revInstallation.getBuildInformation();
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- LOG.log(Level.INFO, "Error getting build information for " +
- "staged installation", e);
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DETERMINING_REVERSION_BUILD.get(), e);
- }
-
- if (currentVersion != null && newVersion != null) {
- UserInteraction ui = userInteraction();
- ReversionIssueNotifier uo = new ReversionIssueNotifier(
- ui,currentVersion,newVersion);
- uo.notifyUser();
- if (uo.noServerStartFollowingOperation()) {
- // Some issue dictates that we don't try and restart the server
- // after this operation. It may be that the databases are no
- // longer readable after the reversion or something equally earth
- // shattering.
- getUserData().setStartServer(false);
- }
- } else {
- LOG.log(Level.INFO, "Did not run reversion issue notifier due to " +
- "incomplete build information");
- }
- }
-
- private Installation getArchiveInstallation()
- throws ApplicationException, IOException
- {
- if (archiveInstallation == null) {
- File revFiles = getReversionFilesDirectory();
- String[] children = revFiles.list();
- Set<String> cs = new HashSet<String>(Arrays.asList(children));
- if ((cs.contains(Installation.HISTORY_BACKUP_FILES_DIR_INSTALL)) &&
- (cs.contains(Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE)))
- {
- File installRevFiles =
- new File (revFiles,Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
- File instanceRevFiles =
- new File (revFiles,Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
- archiveInstallation =
- new Installation(installRevFiles,instanceRevFiles);
- }
- else
- {
- archiveInstallation = new Installation(revFiles,revFiles);
- }
- }
- return archiveInstallation;
- }
-
- private File appendFilesDirIfNeccessary(File archiveDir) {
- if (archiveDir != null) {
- // Automatically append the 'filesDir' subdirectory if necessary
- if (!archiveDir.getName().
- endsWith(HISTORY_BACKUP_FILES_DIR_NAME)) {
- archiveDir = new File(archiveDir,
- HISTORY_BACKUP_FILES_DIR_NAME);
- }
- }
- return archiveDir;
- }
-
- private Stage getStage() throws IOException, ApplicationException {
- if (this.stage == null) {
- this.stage = new Stage(getReversionFilesDirectory());
- }
- return stage;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReverterUserData.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReverterUserData.java
deleted file mode 100644
index 4f52fa9..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReverterUserData.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.quicksetup.UserData;
-
-import java.io.File;
-
-/**
- * Holds state data specific to a reversion operation.
- */
-class ReverterUserData extends UserData {
-
- /** Directory where the reversion archive lives. */
- private File reversionArchiveDir = null;
-
- /** Indicates that we are reverting to the most recent version. */
- private boolean mostRecent;
-
- /**
- * Gets the directory where the files are stored for the reversion.
- * @return File where the reversion files are kept
- */
- public File getReversionArchiveDirectory() {
- return reversionArchiveDir;
- }
-
- /**
- * Sets the directory where the files are stored for the reversion.
- * @param files where the reversion files are kept
- */
- public void setReversionArchiveDirectory(File files) {
- this.reversionArchiveDir = files;
- }
-
- /**
- * Sets whether or not we will be reverting to the most recent version.
- * @param mostRecent version or not
- */
- public void setRevertMostRecent(boolean mostRecent) {
- this.mostRecent = mostRecent;
- }
-
- /**
- * Indicates whether or not we will be reverting to the most recent version.
- * @return boolean where true means revert to the most recent version
- */
- public boolean isRevertMostRecent() {
- return this.mostRecent;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java
deleted file mode 100644
index 0be6085..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import static org.opends.quicksetup.Installation.*;
-import static org.opends.messages.QuickSetupMessages.*;
-import org.opends.messages.Message;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.FileManager;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Collections;
-
-/**
- * Represents a directory used to stage files for upgrade or reversion and
- * is intended to handle special case operations.
- */
-public class Stage {
-
- private static final Logger LOG =
- Logger.getLogger(Stage.class.getName());
-
- private File root;
-
- private FileManager fm;
-
- private List<Message> messages = new LinkedList<Message>();
-
- /**
- * Creates a parameterized instance.
- *
- * @param root of the stage directory
- */
- public Stage(File root) {
- this.root = root;
- this.fm = new FileManager();
- }
-
- /**
- * Moves the files in the staging area to a destination directory.
- *
- * @param destination for the staged files
- * @param fileFilter the file filter to be used
- * @throws ApplicationException if something goes wrong
- */
- public void move(File destination, FileFilter fileFilter)
- throws ApplicationException {
- for (String fileName : root.list()) {
- File dest = new File(destination, fileName);
- File srctmp = new File(root, fileName);
- File src = getSourceForCopy(srctmp, fileName, dest);
- //fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
- fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
- }
- }
-
- /**
- * Moves the files in the staging area to a destination directory.
- *
- * @param destination for the staged files
- * @param fileFilter the file filter to be used
- * @param forInstallDir true if the filter is for the install directory.
- * @throws ApplicationException if something goes wrong
- */
- public void move(File destination, FileFilter fileFilter,
- boolean forInstallDir)
- throws ApplicationException {
- File actualRoot = root ;
- if (forInstallDir)
- {
- actualRoot =
- new File(root, Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
- }
- else
- {
- actualRoot =
- new File(root, Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
- }
- for (String fileName : actualRoot.list()) {
- File dest = new File(destination, fileName);
- File srctmp = new File(actualRoot, fileName);
- File src = getSourceForCopy(srctmp, fileName, dest);
- //fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
- fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
- }
- }
-
- /**
- * Returns a list of messages to be displayed to the user following
- * this operation.
- *
- * @return list of messages
- */
- public List<Message> getMessages() {
- return Collections.unmodifiableList(messages);
- }
-
- private File getSourceForCopy(File src, String fileName, File dest) {
-
- // If this is the running script on Windows, see if it is actually
- // different than the new version. If not don't do anything but if
- // so copy it over under a different name so that the running script
- // is not disturbed
- if (WINDOWS_UPGRADE_FILE_NAME.equals(fileName) &&
- Utils.isWindows()) {
- try {
- if (fm.filesDiffer(src, dest)) {
- File renamedUpgradeBatFile = new File(root,
- WINDOWS_UPGRADE_FILE_NAME_NEW);
- if (src.renameTo(renamedUpgradeBatFile)) {
- src = renamedUpgradeBatFile;
- messages.add(INFO_NEW_UPGRADE_SCRIPT_AVAILABLE.get(
- WINDOWS_UPGRADE_FILE_NAME,
- WINDOWS_UPGRADE_FILE_NAME_NEW));
- } else {
- LOG.log(Level.INFO, "Failed to rename new version of " +
- "'" + WINDOWS_UPGRADE_FILE_NAME + "' to '" +
- WINDOWS_UPGRADE_FILE_NAME_NEW + "'");
- }
- }
- } catch (IOException e) {
- LOG.log(Level.INFO, "Exception comparing files " + e.getMessage());
- }
- }
- return src;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java
deleted file mode 100644
index d12678f..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.Utils.Dir;
-
-import java.io.FileFilter;
-import java.io.File;
-import java.util.Set;
-import java.util.HashSet;
-
-
-/**
- * Filter defining files we want to manage in the upgrade
- * process.
- */
-class UpgradeFileFilter implements FileFilter {
-
- /**
- * Private variable that store the filter scope.
- */
- private Dir dir ;
-
-
- private Set<File> installDirFileList;
-
- Set<File> filesToIgnore;
-
- /**
- * Creates a filter for ignoring in an OpenDS installation at
- * <code>root</code>certain OpenDS files below root.
- * @param root the root of the installation
- */
- public UpgradeFileFilter(File root) { //throws IOException {
- this.filesToIgnore = new HashSet<File>();
- for (String rootFileNamesToIgnore :
- Upgrader.ROOT_FILES_TO_IGNORE_DURING_BACKUP) {
- filesToIgnore.add(new File(root, rootFileNamesToIgnore));
- }
- for (String rootFileNamesToIgnore :
- Upgrader.FILES_TO_IGNORE_DURING_BACKUP) {
- filesToIgnore.add(new File(root, rootFileNamesToIgnore));
- }
-
- dir = Dir.ALL ;
- installDirFileList = null ;
- }
-
- /**
- * Creates a filter for ignoring in an OpenDS installation at
- * <code>root</code>certain OpenDS files below root.
- * @param root the root of the installation
- * @param forInstallDir true if the filter is for the install directory.
- */
- public UpgradeFileFilter(File root, boolean forInstallDir) {
- this(root);
- if (forInstallDir)
- {
- dir = Dir.INSTALL;
- }
- else
- {
- dir = Dir.INSTANCE;
- }
-
- installDirFileList = new HashSet<File>();
- for (String rootInstallDirFile :
- Upgrader.ROOT_FILE_FOR_INSTALL_DIR) {
- installDirFileList.add(new File(root, rootInstallDirFile));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean accept(File file) {
- boolean accept = true;
- for (File ignoreFile : filesToIgnore) {
- if (ignoreFile.equals(file) ||
- Utils.isParentOf(ignoreFile, file)) {
- accept = false;
- break;
- }
- }
-
- if ((!accept) || (dir.compareTo(Dir.ALL) == 0))
- {
- return accept ;
- }
-
- // If we are here, accept is still set to "true".
- if(dir.compareTo(Dir.INSTALL) == 0)
- {
- accept = false ;
- for (File installDirFile : installDirFileList) {
- if (installDirFile.equals(file) ||
- Utils.isParentOf(installDirFile, file)) {
- accept = true ;
- break;
- }
- }
- }
- else
- if (dir.compareTo(Dir.INSTANCE) == 0)
- {
- for (File installDirFile : installDirFileList) {
- if (installDirFile.equals(file) ||
- Utils.isParentOf(installDirFile, file)) {
- accept = false ;
- break;
- }
- }
- }
- else
- {
- // Should never occurs
- accept = false ;
- }
-
- return accept;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java
deleted file mode 100644
index ceb5345..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-
-import org.opends.quicksetup.ReturnCode;
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.UserInteraction;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.Constants;
-import org.opends.server.util.VersionCompatibilityIssue;
-import static org.opends.messages.QuickSetupMessages.*;
-import static org.opends.server.util.VersionCompatibilityIssue.*;
-
-import java.util.Set;
-import java.util.List;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * {@link org.opends.quicksetup.upgrader.VersionIssueNotifier} specific
- * to upgrade tools.
- */
-public class UpgradeIssueNotifier extends VersionIssueNotifier {
-
- static private final Logger LOG =
- Logger.getLogger(UpgradeIssueNotifier.class.getName());
-
- /**
- * Creates a new instance that can analyze a hypothetical upgrade/reversion
- * operation from one version to another.
- * @param ui UserInteraction for relaying information to the user
- * @param current BuildInformation representing the current version
- * @param neu BuildInformation representing the proposed next version
- */
- public UpgradeIssueNotifier(UserInteraction ui,
- BuildInformation current,
- BuildInformation neu) {
- super(ui, current, neu);
- }
-
- /**
- * {@inheritDoc}
- */
- public void notifyUser() throws ApplicationException {
- Message cont = INFO_ORACLE_ACTION_PROMPT_CONTINUE.get();
- Message cancel = INFO_ORACLE_ACTION_PROMPT_CANCEL.get();
- if (hasIssues()) {
- List<Directive> issues = getIssues();
- if (!isSupported()) {
- MessageBuilder reason = new MessageBuilder();
- if (issues != null) {
- for (VersionIssueNotifier.Directive directive : issues) {
- LOG.log(Level.INFO, "Unsupported upgrade details: " +
- directive.getMessage());
- reason.append(directive.getMessage());
- reason.append(EOL);
- }
- }
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_UPGRADE_ORACLE_UNSUPPORTED.get(
- currentBuildInfo.toString(),
- newBuildInfo.toString(),
- reason.toMessage()),
- null);
- } else {
- if (ui.isInteractive()) {
- String lineBreak = ui.isCLI() ?
- Constants.LINE_SEPARATOR : Constants.HTML_LINE_BREAK;
- for (VersionIssueNotifier.Directive directive : issues) {
- Message title;
- Message summary;
- Message details;
- Message defaultAction;
- UserInteraction.MessageType msgType;
- switch (directive.getType()) {
- case ACTION:
- title = INFO_GENERAL_ACTION_REQUIRED.get();
- summary = INFO_UPGRADE_ORACLE_ACTION.get();
- details = new MessageBuilder(directive.getMessage())
- .append(lineBreak)
- .append(lineBreak)
- .append(INFO_ORACLE_ACTION_PROMPT.get())
- .toMessage();
- msgType = UserInteraction.MessageType.WARNING;
- defaultAction = cancel;
- break;
- case INFO:
- title = INFO_GENERAL_INFO.get();
- summary = INFO_UPGRADE_ORACLE_INFO.get();
- details = new MessageBuilder(directive.getMessage())
- .append(lineBreak)
- .append(lineBreak)
- .append(INFO_ORACLE_INFO_PROMPT.get())
- .toMessage();
- msgType = UserInteraction.MessageType.INFORMATION;
- defaultAction = cont;
- break;
- case WARNING:
- title = INFO_GENERAL_WARNING.get();
- summary = INFO_UPGRADE_ORACLE_WARNING.get();
- details = new MessageBuilder(directive.getMessage())
- .append(lineBreak)
- .append(lineBreak)
- .append(INFO_ORACLE_INFO_PROMPT.get())
- .toMessage();
- msgType = UserInteraction.MessageType.WARNING;
- defaultAction = cont;
- break;
- default:
- LOG.log(Level.INFO, "Unexpected issue type " +
- directive.getType());
- title = Message.EMPTY;
- summary = Message.EMPTY;
- details = directive.getMessage();
- msgType = UserInteraction.MessageType.WARNING;
- defaultAction = cont;
- }
- if (cancel.equals(ui.confirm(
- summary,
- details,
- title,
- msgType,
- new Message[]{cont, cancel},
- defaultAction))) {
- throw new ApplicationException(
- ReturnCode.CANCELED,
- INFO_UPGRADE_CANCELED.get(), null);
- }
- }
- } else if (!ui.isForceOnError()) {
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_ORACLE_NO_SILENT.get(), null);
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getLocalizedDetailMessage(
- VersionCompatibilityIssue.Cause cause)
- {
- Message msg = cause.getLocalizedUpgradeMessage();
-
- // See if we need to supply a generic message
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
-
- // If the import/export effect is present, append the detailed
- // instructions.
- if (effects.contains(Effect.UPGRADE_DATA_EXPORT_AND_REIMPORT_REQUIRED)) {
- if (ui.isInteractive())
- {
- String lineBreak = ui.isCLI() ? Constants.LINE_SEPARATOR
- : Constants.HTML_LINE_BREAK;
- msg = new MessageBuilder(msg).append(lineBreak).append(
- ui.createUnorderedList(getExportImportInstructions())).toMessage();
- }
- else
- {
- String lineBreak = Constants.LINE_SEPARATOR ;
- msg = new MessageBuilder(msg).append(lineBreak).append(
- createUnorderedList(getExportImportInstructions())).toMessage();
- }
-
- }
- return msg;
- }
-
-
- /**
- * {@inheritDoc}
- */
- protected boolean isActionRequired(VersionCompatibilityIssue.Cause cause) {
- boolean isAction = false;
- if (cause != null) {
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
- isAction =
- effects.contains(
- Effect.UPGRADE_DATA_EXPORT_AND_REIMPORT_REQUIRED) ||
- (effects.contains(
- Effect.UPGRADE_MANUAL_ACTION_REQUIRED) &&
- cause.getLocalizedUpgradeMessage() != null);
- }
- return isAction;
- }
-
- /**
- * {@inheritDoc}
- */
- protected boolean isWarning(VersionCompatibilityIssue.Cause cause) {
- boolean isWarning = false;
- if (cause != null && !isActionRequired(cause)) {
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
- isWarning = effects.contains(Effect.UPGRADE_SHOW_WARNING_MESSAGE) &&
- cause.getLocalizedUpgradeMessage() != null;
- }
- return isWarning;
- }
-
- /**
- * {@inheritDoc}
- */
- protected boolean isUnsupported(VersionCompatibilityIssue.Cause cause) {
- boolean isUnsupported = false;
- if (cause != null) {
- Set<VersionCompatibilityIssue.Effect> effects = cause.getEffects();
- for (VersionCompatibilityIssue.Effect effect : effects) {
- switch (effect) {
- case UPGRADE_NOT_POSSIBLE:
- isUnsupported = true; break;
- default:
- // assume not an tion;
- }
- }
- }
- return isUnsupported;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
deleted file mode 100644
index f43d6e7..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import static org.opends.messages.AdminToolMessages.*;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.tools.ToolConstants.*;
-
-import org.opends.quicksetup.Launcher;
-import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.QuickSetupLog;
-import org.opends.quicksetup.ReturnCode;
-
-import org.opends.quicksetup.util.Utils;
-import org.opends.server.util.ServerConstants;
-import org.opends.server.util.args.ArgumentParser;
-import org.opends.server.util.args.BooleanArgument;
-import org.opends.server.util.args.ArgumentException;
-import org.opends.server.util.args.StringArgument;
-
-import java.io.File;
-import org.opends.server.util.DynamicConstants;
-
-/**
- * This class is called by the upgrade and upgrade.bat
- * command line utilities to launch an upgrade process.
- */
-public class UpgradeLauncher extends Launcher {
-
- /** Prefix for log files. */
- static public final String LOG_FILE_PREFIX = "opendj-upgrade-";
-
- /** Short form of the option for specifying the installation package file. */
- static public final Character FILE_OPTION_SHORT = 'f';
-
- /** Long form of the option for specifying the installation package file. */
- static public final String FILE_OPTION_LONG = "file";
-
- /** Short form of the option for specifying the reversion files directory. */
- static public final Character REVERT_ARCHIVE_OPTION_SHORT = 'a';
-
- /** Long form of the option for specifying the reversion files directory. */
- static public final String REVERT_ARCHIVE_OPTION_LONG = "reversionArchive";
-
- /** Short form of the option for specifying the 'most recent' option. */
- static public final Character REVERT_MOST_RECENT_OPTION_SHORT = 'r';
-
- /** Long form of the option for specifying the 'most recent' option. */
- static public final String REVERT_MOST_RECENT_OPTION_LONG ="revertMostRecent";
-
- /** Indicates that this operation is an upgrade as opposed to reversion. */
- protected boolean isUpgrade;
-
- /** Indicates that this operation is a reversion as opposed to an upgrade. */
- protected boolean isReversion;
-
- /**
- * The main method which is called by the setup command lines.
- *
- * @param args the arguments passed by the command lines.
- */
- public static void main(String[] args) {
- try {
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (Throwable t) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
- new UpgradeLauncher(args).launch();
- }
-
- private ArgumentParser argParser;
-
- private BooleanArgument showUsage;
- private StringArgument file;
- private BooleanArgument quiet;
- private BooleanArgument noPrompt;
- private BooleanArgument forceOnError;
- private BooleanArgument verbose;
- private BooleanArgument revertMostRecent;
- private StringArgument reversionArchive;
-
-
- /**
- * {@inheritDoc}
- */
- protected Message getFrameTitle() {
- return Utils.getCustomizedObject("INFO_FRAME_UPGRADE_TITLE",
- INFO_FRAME_UPGRADE_TITLE.get(DynamicConstants.PRODUCT_NAME),
- Message.class);
- }
-
- /**
- * {@inheritDoc}
- */
- protected boolean isCli() {
- // for now only CLI is supported via command line
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void printUsage(boolean toStdErr) {
- try
- {
- ArgumentParser argParser = getArgumentParser();
- if (argParser != null) {
- String msg = argParser.getUsage();
- printUsage(msg, toStdErr);
- }
- }
- catch (Throwable t)
- {
- System.out.println("ERROR: "+t);
- t.printStackTrace();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected CliApplication createCliApplication() {
- return new Upgrader();
- }
-
- /**
- * {@inheritDoc}
- */
- protected void willLaunchGui() {
- System.out.println(INFO_UPGRADE_LAUNCHER_LAUNCHING_GUI.get());
- System.setProperty("org.opends.quicksetup.Application.class",
- "org.opends.quicksetup.upgrader.Upgrader");
- }
-
- /**
- * {@inheritDoc}
- */
- protected void guiLaunchFailed(String logFilePath) {
- if (logFilePath != null)
- {
- System.err.println(
- INFO_UPGRADE_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS.get(
- logFilePath));
- }
- else
- {
- System.err.println(INFO_UPGRADE_LAUNCHER_GUI_LAUNCHED_FAILED.get());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ArgumentParser getArgumentParser() {
- return argParser;
- }
-
- /**
- * Indicates whether or not this operation is silent.
- * @return boolean where true indicates silence
- */
- public boolean isQuiet() {
- return quiet.isPresent();
- }
-
- /**
- * Indicates whether or not this operation is verbose.
- * @return boolean where true indicates verbose
- */
- public boolean isVerbose() {
- return verbose.isPresent();
- }
-
- /**
- * Indicates whether or not this operation is interactive.
- * @return boolean where true indicates noninteractive
- */
- public boolean isNoPrompt() {
- return noPrompt.isPresent();
- }
-
- /**
- * Tells whether the user specified to force on non critical error in the non
- * interactive mode.
- * @return <CODE>true</CODE> if the user specified to force on
- * non critical error and <CODE>false</CODE> otherwise.
- */
- public boolean isForceOnError()
- {
- return forceOnError.isPresent();
- }
-
- /**
- * Indicates whether this invocation is intended to upgrade the current
- * build as opposed to revert.
- * @return boolean where true indicates upgrade
- */
- public boolean isUpgrade() {
- return isUpgrade;
- }
-
- /**
- * Indicates whether this invocation is intended to revert the current
- * build as opposed to upgrade.
- * @return boolean where true indicates revert
- */
- public boolean isReversion() {
- return isReversion;
- }
-
- /**
- * Indicates that none of the options that indicate an upgrade
- * or reversion where specified on the command line so we are going
- * to have to prompt for the information or fail.
- *
- * @return boolean where true means this application needs to ask
- * the user which operation they would like to perform; false
- * means no further input is required
- */
- public boolean isInteractive() {
- return !file.isPresent() &&
- !reversionArchive.isPresent() &&
- !revertMostRecent.isPresent();
- }
-
- /**
- * Gets the name of the file to be used for upgrade.
- * @return name of the upgrade file
- */
- public String getUpgradeFileName() {
- return file.getValue();
- }
-
- /**
- * Gets the name of the directory to be used for reversion.
- * @return name of the reversion directory
- */
- public String getReversionArchiveDirectoryName() {
- return reversionArchive.getValue();
- }
-
-
- /**
- * Gets the file's directory if specified on the command line.
- * @return File representing the directory where the reversion files are
- * stored.
- */
- public File getReversionArchiveDirectory() {
- File f = null;
- String s = reversionArchive.getValue();
- if (s != null) {
- f = new File(s);
- }
- return f;
- }
-
- /**
- * Indicates whether the user has specified the 'mostRecent' option.
- * @return boolean where true indicates use the most recent upgrade backup
- */
- public boolean isRevertMostRecent() {
- return revertMostRecent.isPresent();
- }
-
- /**
- * Indicates whether the user has specified to revert to an specific archive.
- * @return boolean where true indicates that the user specified to revert to
- * an specific archive.
- */
- public boolean isRevertToArchive() {
- return reversionArchive.isPresent();
- }
-
- /**
- * Creates an instance.
- *
- * @param args specified on command line
- */
- protected UpgradeLauncher(String[] args) {
- super(args);
-
- String scriptName;
- if (Utils.isWindows()) {
- scriptName = Installation.WINDOWS_UPGRADE_FILE_NAME;
- } else {
- scriptName = Installation.UNIX_UPGRADE_FILE_NAME;
- }
- if (System.getProperty(ServerConstants.PROPERTY_SCRIPT_NAME) == null)
- {
- System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
- }
-
- Message msg = Utils.getCustomizedObject(
- "INFO_UPGRADE_LAUNCHER_USAGE_DESCRIPTION",
- INFO_UPGRADE_LAUNCHER_USAGE_DESCRIPTION.get(), Message.class);
- argParser = new ArgumentParser(getClass().getName(), msg, false);
- try
- {
- file = new StringArgument(
- FILE_OPTION_LONG,
- FILE_OPTION_SHORT,
- FILE_OPTION_LONG,
- false, false, true,
- INFO_FILE_PLACEHOLDER.get(),
- null, null, INFO_UPGRADE_DESCRIPTION_FILE.get());
- argParser.addArgument(file);
-
- revertMostRecent = new BooleanArgument(
- REVERT_MOST_RECENT_OPTION_LONG,
- REVERT_MOST_RECENT_OPTION_SHORT,
- REVERT_MOST_RECENT_OPTION_LONG,
- INFO_REVERT_DESCRIPTION_RECENT.get());
- argParser.addArgument(revertMostRecent);
-
- reversionArchive = new StringArgument(
- REVERT_ARCHIVE_OPTION_LONG,
- REVERT_ARCHIVE_OPTION_SHORT,
- REVERT_ARCHIVE_OPTION_LONG,
- false, false, true,
- INFO_DIRECTORY_PLACEHOLDER.get(),
- null, null, INFO_REVERT_DESCRIPTION_DIRECTORY.get());
- argParser.addArgument(reversionArchive);
-
- noPrompt = new BooleanArgument(
- OPTION_LONG_NO_PROMPT,
- OPTION_SHORT_NO_PROMPT,
- OPTION_LONG_NO_PROMPT,
- INFO_UPGRADE_DESCRIPTION_NO_PROMPT.get());
- argParser.addArgument(noPrompt);
-
- forceOnError = new BooleanArgument(
- "forceOnError",
- null,
- "forceOnError",
- INFO_UPGRADE_DESCRIPTION_FORCE.get(
- "--"+noPrompt.getLongIdentifier()));
- argParser.addArgument(forceOnError);
-
- quiet = new BooleanArgument(
- OPTION_LONG_QUIET,
- OPTION_SHORT_QUIET,
- OPTION_LONG_QUIET,
- INFO_UPGRADE_DESCRIPTION_SILENT.get());
- argParser.addArgument(quiet);
-
- verbose = new BooleanArgument(OPTION_LONG_VERBOSE, OPTION_SHORT_VERBOSE,
- OPTION_LONG_VERBOSE, INFO_DESCRIPTION_VERBOSE.get());
- argParser.addArgument(verbose);
-
- showUsage = new BooleanArgument(
- "showusage",
- OPTION_SHORT_HELP,
- OPTION_LONG_HELP,
- INFO_DESCRIPTION_USAGE.get());
- argParser.addArgument(showUsage);
- argParser.setUsageArgument(showUsage);
-
- try {
- argParser.parseArguments(args);
-
- // Set fields indicating reversion or upgrade. This may change
- // later if interaction is required to make the determination.
- isUpgrade = file.isPresent();
- isReversion =
- reversionArchive.isPresent() || revertMostRecent.isPresent();
-
- if (argParser.usageOrVersionDisplayed()) {
- System.exit(ReturnCode.PRINT_USAGE.getReturnCode());
- } else if (isUpgrade) {
- if (reversionArchive.isPresent()) {
- System.err.println(ERR_UPGRADE_INCOMPATIBLE_ARGS.get(
- file.getName(), reversionArchive.getName()));
- System.exit(ReturnCode.
- APPLICATION_ERROR.getReturnCode());
- } else if (revertMostRecent.isPresent()) {
- System.err.println(ERR_UPGRADE_INCOMPATIBLE_ARGS.get(
- file.getName(), revertMostRecent.getName()));
- System.exit(ReturnCode.
- APPLICATION_ERROR.getReturnCode());
-
- }
- }
-
- if (!noPrompt.isPresent() && forceOnError.isPresent())
- {
- Message message =
- ERR_UNINSTALL_FORCE_REQUIRES_NO_PROMPT.get("--"
- + forceOnError.getLongIdentifier(), "--"
- + noPrompt.getLongIdentifier());
- System.err.println(message);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- } catch (ArgumentException ae) {
- System.err.println(ae.getMessageObject());
- printUsage(false);
- System.exit(ReturnCode.
- APPLICATION_ERROR.getReturnCode());
- }
- }
- catch (Throwable t)
- {
- System.out.println("ERROR: "+t);
- t.printStackTrace();
- }
-
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java
deleted file mode 100644
index 10f074c..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.ProgressStep;
-
-/**
- * Steps during the upgrade process.
- */
-enum UpgradeProgressStep implements ProgressStep {
-
- NOT_STARTED(INFO_SUMMARY_UPGRADE_NOT_STARTED.get(), null, null, 0, false),
-
- DOWNLOADING(INFO_SUMMARY_UPGRADE_DOWNLOADING.get(),
- INFO_PROGRESS_UPGRADE_DOWNLOADING.get(),
- INFO_PROGRESS_UPGRADE_DOWNLOADING.get(),
- 0, true),
-
- EXTRACTING(INFO_SUMMARY_UPGRADE_EXTRACTING.get(),
- INFO_PROGRESS_UPGRADE_EXTRACTING.get(),
- INFO_PROGRESS_UPGRADE_EXTRACTING_VERBOSE.get(),
- 15, true),
-
- INITIALIZING(INFO_SUMMARY_UPGRADE_INITIALIZING.get(),
- INFO_PROGRESS_UPGRADE_INITIALIZING.get(),
- INFO_PROGRESS_UPGRADE_INITIALIZING.get(), 20, true),
-
-
- CALCULATING_SCHEMA_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(),
- 25, true),
-
- CALCULATING_CONFIGURATION_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(),
- 30, true),
-
- BACKING_UP_DATABASES(INFO_SUMMARY_UPGRADE_BACKING_UP_DB.get(),
- INFO_PROGRESS_UPGRADE_BACKING_UP_DB.get(),
- INFO_PROGRESS_UPGRADE_BACKING_UP_DB.get(), 35, true),
-
- BACKING_UP_FILESYSTEM(INFO_SUMMARY_UPGRADE_BACKING_UP_FILES.get(),
- INFO_PROGRESS_UPGRADE_BACKING_UP_FILES.get(),
- INFO_PROGRESS_UPGRADE_BACKING_UP_FILES.get(), 40, true),
-
- UPGRADING_COMPONENTS(INFO_SUMMARY_UPGRADE_UPGRADING_COMPONENTS.get(),
- INFO_PROGRESS_UPGRADE_UPGRADING_COMPONENTS.get(),
- INFO_PROGRESS_UPGRADE_UPGRADING_COMPONENTS.get(), 45, true),
-
- PREPARING_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_PREPARING_CUSTOMIZATIONS.get(),
- INFO_PROGRESS_UPGRADE_PREPARING_CUSTOMIZATIONS.get(),
- INFO_PROGRESS_UPGRADE_PREPARING_CUSTOMIZATIONS.get(),
- 50, true),
-
- APPLYING_SCHEMA_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(),
- 55, true),
-
- APPLYING_CONFIGURATION_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(),
- INFO_SUMMARY_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(),
- 60, true),
-
- APPLYING_ADS_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(),
- INFO_PROGRESS_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(), 65, true),
-
- VERIFYING(INFO_SUMMARY_UPGRADE_VERIFYING.get(),
- INFO_PROGRESS_UPGRADE_VERIFYING.get(),
- INFO_PROGRESS_UPGRADE_VERIFYING.get(), 70, true),
-
- STARTING_SERVER(INFO_SUMMARY_STARTING.get(), null, null, 75, false),
-
- STOPPING_SERVER(INFO_SUMMARY_STOPPING.get(), null, null, 75, false),
-
- RECORDING_HISTORY(INFO_SUMMARY_UPGRADE_HISTORY.get(),
- INFO_PROGRESS_UPGRADE_HISTORY.get(),
- INFO_PROGRESS_UPGRADE_HISTORY.get(), 90, true),
-
- CLEANUP(INFO_SUMMARY_UPGRADE_CLEANUP.get(),
- INFO_PROGRESS_UPGRADE_CLEANUP.get(),
- INFO_PROGRESS_UPGRADE_CLEANUP.get(), 90, true),
-
- ABORT(INFO_SUMMARY_UPGRADE_ABORT.get(),
- INFO_PROGRESS_UPGRADE_ABORT.get(),
- INFO_PROGRESS_UPGRADE_ABORT.get(), 90, true),
-
- FINISHED_WITH_ERRORS(INFO_SUMMARY_UPGRADE_FINISHED_WITH_ERRORS.get(),
- null, null, 100, false),
-
- FINISHED_WITH_WARNINGS(
- INFO_SUMMARY_UPGRADE_FINISHED_WITH_WARNINGS.get(), null, null, 100,
- false),
-
- FINISHED_CANCELED(INFO_SUMMARY_UPGRADE_FINISHED_CANCELED.get(),
- null, null, 100, false),
-
- FINISHED(INFO_SUMMARY_UPGRADE_FINISHED_SUCCESSFULLY.get("",""),
- null, null, 100, false);
-
- private Message summaryMsg;
- private Message logMsg;
- private Message logMsgVerbose;
- private int progress;
- private boolean logWithPoints;
-
- private UpgradeProgressStep(Message summaryMsg, Message logMsg,
- Message logMsgVerbose, int progress, boolean logWithPoints) {
- this.summaryMsg = summaryMsg;
- this.logMsg = logMsg;
- this.logMsgVerbose = logMsgVerbose;
- this.progress = progress;
- this.logWithPoints = logWithPoints;
- }
-
- /**
- * Return the summary message for the step.
- *
- * @return the summary message for the step.
- */
- public Message getSummaryMessage() {
- return summaryMsg;
- }
-
- /**
- * Return the log message for the step.
- * @param isVerbose whether we are running in verbose mode or not.
- *
- * @return the log message for the step.
- */
- public Message getLogMsg(boolean isVerbose) {
- Message msg;
- if (isVerbose)
- {
- msg = logMsgVerbose;
- }
- else
- {
- msg = logMsg;
- }
- return msg;
- }
-
- /**
- * Return whether we must add points to the log message or not.
- * @param isVerbose whether we are running in verbose mode or not.
- *
- * @return <CODE>true</CODE> if we must add points to the log message and
- * <CODE>false</CODE> otherwise.
- */
- public boolean logRequiresPoints(boolean isVerbose) {
- boolean returnValue;
- if (logWithPoints)
- {
- if (isVerbose)
- {
- returnValue = logMsgVerbose == logMsg;
- }
- else
- {
- returnValue = true;
- }
- }
- else
- {
- returnValue = false;
- }
- return returnValue;
- }
-
- /**
- * Gets the amount of progress to show in the progress meter for this step.
- * @return int representing progress
- */
- public int getProgress() {
- return this.progress;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isLast() {
- return this == FINISHED ||
- this == FINISHED_WITH_ERRORS ||
- this == FINISHED_WITH_WARNINGS ||
- this == FINISHED_CANCELED;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isError() {
- return this == FINISHED_WITH_ERRORS;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeSvr4Launcher.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeSvr4Launcher.java
deleted file mode 100644
index e4df3c6..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeSvr4Launcher.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2010 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import static org.opends.messages.QuickSetupMessages.*;
-
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.tools.ToolConstants.*;
-
-import org.opends.messages.Message;
-import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.QuickSetupLog;
-import org.opends.quicksetup.ReturnCode;
-
-import org.opends.quicksetup.util.Utils;
-import org.opends.server.util.ServerConstants;
-import org.opends.server.util.args.ArgumentParser;
-import org.opends.server.util.args.BooleanArgument;
-import org.opends.server.util.args.ArgumentException;
-import org.opends.server.util.args.StringArgument;
-
-import java.io.File;
-
-/**
- * This class is called by the upgrade and upgrade.bat
- * command line utilities to launch an upgrade process.
- */
-public class UpgradeSvr4Launcher extends UpgradeLauncher {
-
- /**
- * The main method which is called by the setup command lines.
- *
- * @param args the arguments passed by the command lines.
- */
- public static void main(String[] args) {
- try {
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (Throwable t) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
- new UpgradeSvr4Launcher(args).launch();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected CliApplication createCliApplication() {
- return new UpgraderSvr4();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void willLaunchGui() {
- System.out.println(INFO_UPGRADE_LAUNCHER_LAUNCHING_GUI.get());
- System.setProperty("org.opends.quicksetup.Application.class",
- "org.opends.quicksetup.upgrader.UpgraderSvr4");
- }
-
- private ArgumentParser argParser;
-
- private BooleanArgument showUsage;
- private BooleanArgument quiet;
- private BooleanArgument noPrompt;
- private BooleanArgument verbose;
- private BooleanArgument revertMostRecent;
- private StringArgument reversionArchive;
-
-
- /**
- * Creates an instance.
- *
- * @param args specified on command line
- */
- protected UpgradeSvr4Launcher(String[] args) {
- super(args);
-
- String scriptName;
- if (Utils.isWindows()) {
- scriptName = Installation.WINDOWS_UPGRADE_FILE_NAME;
- } else {
- scriptName = Installation.UNIX_UPGRADE_FILE_NAME;
- }
- if (System.getProperty(ServerConstants.PROPERTY_SCRIPT_NAME) == null)
- {
- System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
- }
-
- Message msg = Utils.getCustomizedObject(
- "INFO_UPGRADE_LAUNCHER_USAGE_DESCRIPTION",
- INFO_UPGRADE_LAUNCHER_USAGE_DESCRIPTION.get(), Message.class);
-
- argParser = new ArgumentParser(getClass().getName(), msg, false);
- try
- {
- revertMostRecent = new BooleanArgument(
- REVERT_MOST_RECENT_OPTION_LONG,
- REVERT_MOST_RECENT_OPTION_SHORT,
- REVERT_MOST_RECENT_OPTION_LONG,
- INFO_REVERT_DESCRIPTION_RECENT.get());
- argParser.addArgument(revertMostRecent);
-
- reversionArchive = new StringArgument(
- REVERT_ARCHIVE_OPTION_LONG,
- REVERT_ARCHIVE_OPTION_SHORT,
- REVERT_ARCHIVE_OPTION_LONG,
- false, false, true,
- INFO_DIRECTORY_PLACEHOLDER.get(),
- null, null, INFO_REVERT_DESCRIPTION_DIRECTORY.get());
- argParser.addArgument(reversionArchive);
-
- noPrompt = new BooleanArgument(
- OPTION_LONG_NO_PROMPT,
- OPTION_SHORT_NO_PROMPT,
- OPTION_LONG_NO_PROMPT,
- INFO_UPGRADE_DESCRIPTION_NO_PROMPT.get());
- argParser.addArgument(noPrompt);
-
- quiet = new BooleanArgument(
- OPTION_LONG_QUIET,
- OPTION_SHORT_QUIET,
- OPTION_LONG_QUIET,
- INFO_UPGRADE_DESCRIPTION_SILENT.get());
- argParser.addArgument(quiet);
-
- verbose = new BooleanArgument(OPTION_LONG_VERBOSE, OPTION_SHORT_VERBOSE,
- OPTION_LONG_VERBOSE, INFO_DESCRIPTION_VERBOSE.get());
- argParser.addArgument(verbose);
-
- showUsage = new BooleanArgument(
- "showusage",
- OPTION_SHORT_HELP,
- OPTION_LONG_HELP,
- INFO_DESCRIPTION_USAGE.get());
- argParser.addArgument(showUsage);
- argParser.setUsageArgument(showUsage);
-
- try {
- argParser.parseArguments(args);
-
- // Set fields indicating reversion or upgrade. This may change
- // later if interaction is required to make the determination.
- isReversion =
- reversionArchive.isPresent() || revertMostRecent.isPresent();
- isUpgrade = !isReversion;
-
- if (argParser.usageOrVersionDisplayed()) {
- System.exit(ReturnCode.PRINT_USAGE.getReturnCode());
- }
- } catch (ArgumentException ae) {
- System.err.println(ae.getMessageObject());
- printUsage(false);
- System.exit(ReturnCode.
- APPLICATION_ERROR.getReturnCode());
- }
- }
- catch (Throwable t)
- {
- System.out.println("ERROR: "+t);
- t.printStackTrace();
- }
-
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeUserData.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeUserData.java
deleted file mode 100644
index 6e13ffa..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeUserData.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.quicksetup.UserData;
-
-import java.io.File;
-
-/**
- * User data specific to the upgrade process.
- */
-public class UpgradeUserData extends UserData {
-
- /** Describes upgrade operation type. */
- public enum Operation { UPGRADE, REVERSION };
-
- private File installPackage;
-
- private Build buildToDownload;
-
- private Operation operation;
-
- /**
- * Gets the OpenDS package (.zip) file whose contents will
- * be used in the upgrade/reversion.
- * @return File object representing the OpenDS package
- */
- public File getInstallPackage() {
- return installPackage;
- }
-
- /**
- * Sets the OpenDS package (.zip) file whose contents will
- * be used in the upgrade/reversion.
- * @param installPackage File object representing the OpenDS package
- */
- public void setInstallPackage(File installPackage) {
- this.installPackage = installPackage;
- }
-
- /**
- * Gets the Build that will need to be downloaded before
- * the upgrade can begin.
- * @return Build representing the build to download
- */
- public Build getInstallPackageToDownload() {
- return buildToDownload;
- }
-
- /**
- * Sets the Build that will need to be downloaded before
- * the upgrade can begin.
- * @param build Build to download
- */
- public void setBuildToDownload(Build build) {
- this.buildToDownload = build;
- }
-
- /**
- * Indicates whether or not the upgrader should perform a
- * backup of the databases as part of the upgrade.
- * @return boolean where true indicates that the databases
- * should be backed up
- */
- public boolean getPerformDatabaseBackup() {
- // It would be nice to make this an option (see issue 1740)
- return false;
- }
-
- /**
- * Sets the operation the user would like to perform.
- * @param operation upgrade or reversion
- */
- public void setOperation(Operation operation) {
- this.operation = operation;
- }
-
- /**
- * Gets the operation the user would like to perform.
- * @return operation upgrade or reversion
- */
- public Operation getOperation() {
- return this.operation;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeWizardStep.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeWizardStep.java
deleted file mode 100644
index a8d9874..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeWizardStep.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.WizardStep;
-
-/**
- * Steps in the Upgrade wizard.
- */
-public enum UpgradeWizardStep implements WizardStep {
-
- /**
- * The welcome step.
- */
- WELCOME(INFO_WELCOME_STEP.get()),
- /**
- * The welcome step.
- */
- REVIEW(INFO_REVIEW_STEP.get()),
- /**
- * The progress step.
- */
- PROGRESS(INFO_PROGRESS_STEP.get()),
- /**
- * The finished step.
- */
- FINISHED(INFO_FINISHED_STEP.get());
-
- private Message msg;
-
- private UpgradeWizardStep(Message msg) {
- this.msg = msg;
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getDisplayMessage() {
- return msg;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isProgressStep() {
- return this == PROGRESS;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isFinishedStep() {
- return this == FINISHED;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isLicenseStep() {
- // Irrelevant here
- return false;
- }
-
- /**
- * Returns an String representation of this object.
- * @return an String representation of this object. This method is
- * overwritten in order to be able to use this objects as keys in Maps and
- * make them different to the Steps defined in the Step class.
- */
- public String toString() {
- return "UpgradWizardStep"+super.toString();
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
deleted file mode 100644
index 9997b9e..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ /dev/null
@@ -1,2222 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.quicksetup.CliApplication;
-
-import org.opends.quicksetup.LicenseFile;
-import static org.opends.quicksetup.Installation.*;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.admin.ads.ADSContext;
-import org.opends.messages.Message;
-
-import org.opends.quicksetup.ReturnCode;
-import org.opends.quicksetup.WizardStep;
-import org.opends.quicksetup.ProgressStep;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.QuickSetupLog;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.ButtonName;
-import org.opends.quicksetup.UserDataException;
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.UserInteraction;
-import org.opends.quicksetup.Constants;
-import org.opends.quicksetup.Launcher;
-import org.opends.quicksetup.HistoricalRecord;
-
-import org.opends.quicksetup.webstart.WebStartDownloader;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.ZipExtractor;
-import org.opends.quicksetup.util.ServerController;
-import org.opends.quicksetup.util.InProcessServerController;
-import org.opends.quicksetup.util.ServerHealthChecker;
-import org.opends.quicksetup.util.FileManager;
-
-import org.opends.quicksetup.util.ExternalTools;
-import org.opends.quicksetup.util.OperationOutput;
-import org.opends.quicksetup.ui.FinishedPanel;
-import org.opends.quicksetup.ui.GuiApplication;
-import org.opends.quicksetup.ui.QuickSetupDialog;
-import org.opends.quicksetup.ui.ProgressPanel;
-import org.opends.quicksetup.ui.QuickSetupStepPanel;
-import org.opends.quicksetup.ui.QuickSetup;
-import org.opends.quicksetup.ui.FieldName;
-import org.opends.quicksetup.upgrader.ui.UpgraderReviewPanel;
-import org.opends.quicksetup.upgrader.ui.WelcomePanel;
-import org.opends.server.tools.JavaPropertiesTool;
-
-import java.awt.event.WindowEvent;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Proxy;
-import java.net.SocketAddress;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.opends.server.util.DynamicConstants;
-
-/**
- * QuickSetup application of upgrading the bits of an installation of
- * OpenDJ.
- */
-public class Upgrader extends GuiApplication implements CliApplication {
-
- static private final Logger LOG = Logger.getLogger(Upgrader.class.getName());
-
- /**
- * Passed in from the shell script if the root is known at the time
- * of invocation.
- */
- static private final String SYS_PROP_INSTALL_ROOT =
- "org.opends.quicksetup.upgrader.Root";
-
- /**
- * Passed in from the shell script if the root is known at the time
- * of invocation.
- */
- static private final String SYS_PROP_INSTANCE_ROOT =
- "org.opends.quicksetup.upgrader.Instance";
-
- /**
- * If set to true, an error is introduced during the
- * upgrade process for testing.
- */
- static private final String SYS_PROP_CREATE_ERROR =
- "org.opends.quicksetup.upgrader.CreateError";
-
- /**
- * If set to true, an error is introduced during the
- * upgrade verification process.
- */
- static private final String SYS_PROP_CREATE_VERIFY_ERROR =
- "org.opends.quicksetup.upgrader.VerifyError";
-
- /**
- * If set to true, if the upgrader encounters an error
- * during upgrade, the abort method that backs out
- * changes is made a no-op leaving the server in the
- * erroneous state.
- */
- static final String SYS_PROP_NO_ABORT =
- "org.opends.quicksetup.upgrader.NoAbort";
-
- // Root files that will be ignored during backup
- static final String[] ROOT_FILES_TO_IGNORE_DURING_BACKUP = {
- CHANGELOG_PATH_RELATIVE, // changelogDb
- DATABASES_PATH_RELATIVE, // db
- LOGS_PATH_RELATIVE, // logs
- LOCKS_PATH_RELATIVE, // locks
- HISTORY_PATH_RELATIVE, // history
- TMP_PATH_RELATIVE, // tmp
- INSTANCE_LOCATION_PATH_RELATIVE //instance.loc
- };
-
- // Files that should be located into the install directory
- static final String[] ROOT_FILE_FOR_INSTALL_DIR= {
- "bin",
- "lib",
- "bat",
- "config" + File.separator + "schema",
- "setup",
- "setup.bat",
- "uninstall",
- "uninstall.bat",
- "install.html",
- "install.txt",
- "legal-notices",
- "opends_logo.png",
- "README",
- "upgrade",
- "upgrade.bat",
- "QuickSetup.app",
- "Uninstall.app",
- "tmpl_instance"
- };
-
- // Files that will be ignored during backup
- static final String[] FILES_TO_IGNORE_DURING_BACKUP = {
- TOOLS_PROPERTIES, // tools.properties
- RELATIVE_JAVA_PROPERTIES_FILE, // java.properties
- ADSContext.getAdminLDIFFile() // admin-backend.ldif
- };
-
- private ProgressStep currentProgressStep = UpgradeProgressStep.NOT_STARTED;
-
- /**
- * Assigned if an exception occurs during run().
- */
- private ApplicationException runError = null;
-
- /**
- * Assigned if a non-fatal error happened during the upgrade that the
- * user needs to be warned about during run().
- */
- private ApplicationException runWarning = null;
-
- /**
- * Directory where backup is kept in case the upgrade needs reversion.
- */
- private File backupDirectory = null;
-
- /**
- * ID that uniquely identifies this invocation of the Upgrader in the
- * historical logs.
- */
- private Long historicalOperationId;
-
- /**
- * Information on the current build.
- */
- protected BuildInformation currentVersion = null;
-
- /**
- * Information on the current instance.
- */
- protected BuildInformation currentInstanceVersion = null;
-
- /**
- * Information on the staged build.
- */
- private BuildInformation stagedVersion = null;
-
- /**
- * New OpenDJ bits.
- */
- private Installation stagedInstallation = null;
-
- // TODO: remove dead code
- private RemoteBuildManager remoteBuildManager = null;
-
-
- /**
- * Represents staged files for upgrade.
- */
- private Stage stage = null;
-
-
- /** Set to true if the user decides to close the window while running. */
- private boolean abort = false;
-
- /**
- * Creates a default instance.
- */
- public Upgrader() {
-
- // Initialize the logs if necessary
- try {
- if (!QuickSetupLog.isInitialized())
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(
- UpgradeLauncher.LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (IOException e) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- e.printStackTrace();
- }
-
- // Get started on downloading the web start jars
- if (Utils.isWebStart()) {
- initLoader();
- }
-
- final String installRootFromSystem =
- System.getProperty(SYS_PROP_INSTALL_ROOT);
- final String instanceRootFromSystem =
- System.getProperty(SYS_PROP_INSTANCE_ROOT);
- if (installRootFromSystem != null)
- {
- if (instanceRootFromSystem != null)
- {
- setInstallation(new Installation(installRootFromSystem,
- instanceRootFromSystem));
- } else
- {
- setInstallation(new Installation(installRootFromSystem,
- installRootFromSystem));
- }
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getFrameTitle() {
- return Utils.getCustomizedObject("INFO_FRAME_UPGRADE_TITLE",
- INFO_FRAME_UPGRADE_TITLE.get(DynamicConstants.PRODUCT_NAME),
- Message.class);
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getFirstWizardStep() {
- return UpgradeWizardStep.WELCOME;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setWizardDialogState(QuickSetupDialog dlg,
- UserData userData,
- WizardStep step) {
- // Set the default button for the frame
- if (step == UpgradeWizardStep.REVIEW) {
- dlg.setFocusOnButton(ButtonName.FINISH);
- dlg.setDefaultButton(ButtonName.FINISH);
- } else if (step == UpgradeWizardStep.WELCOME) {
- dlg.setDefaultButton(ButtonName.NEXT);
- dlg.setFocusOnButton(ButtonName.NEXT);
- } else if ((step == UpgradeWizardStep.PROGRESS) ||
- (step == UpgradeWizardStep.FINISHED)) {
- dlg.setDefaultButton(ButtonName.CLOSE);
- dlg.setFocusOnButton(ButtonName.CLOSE);
- }
- }
-
- /**
- * Gets a remote build manager that this class can use to find
- * out about and download builds for upgrading.
- *
- * @return RemoteBuildManager to use for builds
- */
- public RemoteBuildManager getRemoteBuildManager() {
- if (remoteBuildManager == null) {
- try {
- String listUrlString =
- System.getProperty("org.opends.quicksetup.upgrader.BuildList");
- if (listUrlString == null) {
- listUrlString =
- "http://www.forgerock.org/downloads/opendj/upgrade-builds";
- }
- URL buildRepo = new URL(listUrlString);
-
- // See if system properties dictate use of a proxy
- Proxy proxy = null;
- String proxyHost = System.getProperty("http.proxyHost");
- String proxyPort = System.getProperty("http.proxyPort");
- if (proxyHost != null && proxyPort != null) {
- try {
- SocketAddress addr =
- new InetSocketAddress(proxyHost, new Integer(proxyPort));
- proxy = new Proxy(Proxy.Type.HTTP, addr);
- } catch (NumberFormatException nfe) {
- LOG.log(Level.INFO, "Illegal proxy port number " + proxyPort);
- }
- }
-
- remoteBuildManager = new RemoteBuildManager(this, buildRepo, proxy);
- } catch (MalformedURLException e) {
- LOG.log(Level.INFO, "", e);
- }
- }
- return remoteBuildManager;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getExtraDialogHeight() {
- // Makes dialog height same as QuickSetup
- return 177;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstallationPath() {
- // The upgrader runs from the bits extracted by BuildExtractor
- // in the staging directory. However
- // we still want the Installation to point at the build being
- // upgraded so the install path reported in [installroot].
- String installationPath = System.getProperty("INSTALL_ROOT");
- if (installationPath == null)
- {
- String path = Utils.getInstallPathFromClasspath();
- if (path != null)
- {
- File f = new File(path);
- if (f.getParentFile() != null
- && f.getParentFile().getParentFile() != null
- && new File(f.getParentFile().getParentFile(),
- Installation.LOCKS_PATH_RELATIVE).exists())
- {
- installationPath = Utils.getPath(f.getParentFile().getParentFile());
- } else
- {
- installationPath = path;
- }
- }
- }
- return installationPath;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInstancePath()
- {
- String installPath = getInstallationPath();
- if (installPath == null)
- {
- return null;
- }
-
- return Utils.getInstancePathFromInstallPath(installPath);
- }
-
- /**
- * {@inheritDoc}
- */
- public ProgressStep getCurrentProgressStep() {
- return currentProgressStep;
- }
-
- /**
- * {@inheritDoc}
- */
- public Integer getRatio(ProgressStep step) {
- return ((UpgradeProgressStep) step).getProgress();
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getSummary(ProgressStep step) {
- Message txt;
- if (step == UpgradeProgressStep.FINISHED) {
- txt = getFinalSuccessMessage();
- } else if (step == UpgradeProgressStep.FINISHED_CANCELED) {
- txt = getFinalCanceledMessage();
- } else if (step == UpgradeProgressStep.FINISHED_WITH_ERRORS) {
- txt = getFinalErrorMessage();
- } else if (step == UpgradeProgressStep.FINISHED_WITH_WARNINGS) {
- txt = getFinalWarningMessage();
- }
- else {
- txt = (((UpgradeProgressStep) step).getSummaryMessage());
- }
- return txt;
- }
-
- /**
- * {@inheritDoc}
- */
- public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
- if ((dlg.getDisplayedStep() == UpgradeWizardStep.PROGRESS) ||
- (dlg.getDisplayedStep() == UpgradeWizardStep.FINISHED)) {
- // Simulate a close button event
- dlg.notifyButtonEvent(ButtonName.CLOSE);
- } else {
- // Simulate a quit button event
- dlg.notifyButtonEvent(ButtonName.QUIT);
- }
- }
-
- /**
- * Returns the progress message for a given progress step.
- * @param step the progress step.
- * @return the progress message for the provided step.
- */
- private Message getLogMsg(UpgradeProgressStep step) {
- Message txt;
- if (step == UpgradeProgressStep.FINISHED) {
- txt = getFormattedProgress(getFinalSuccessMessage());
- } else if (step == UpgradeProgressStep.FINISHED_CANCELED) {
- txt = getFinalCanceledMessage();
- } else if (step == UpgradeProgressStep.FINISHED_WITH_ERRORS) {
- txt = getFinalErrorMessage();
- } else if (step == UpgradeProgressStep.FINISHED_WITH_WARNINGS) {
- txt = getFinalWarningMessage();
- }
- else
- {
- txt = step.getLogMsg(isVerbose());
- }
- return txt;
- }
-
- /**
- * {@inheritDoc}
- */
- public ButtonName getInitialFocusButtonName() {
- // TODO
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public Set<? extends WizardStep> getWizardSteps() {
- return Collections.unmodifiableSet(EnumSet.allOf(UpgradeWizardStep.class));
- }
-
- /**
- * {@inheritDoc}
- */
- public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
- QuickSetupStepPanel pnl = null;
- if (UpgradeWizardStep.WELCOME.equals(step)) {
- pnl = new WelcomePanel(this);
- } else if (UpgradeWizardStep.REVIEW.equals(step)) {
- pnl = new UpgraderReviewPanel(this);
- } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
- pnl = new ProgressPanel(this);
- } else if (UpgradeWizardStep.FINISHED.equals(step)) {
- pnl = new FinishedPanel(this);
- }
- return pnl;
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getNextWizardStep(WizardStep step) {
- WizardStep next = null;
- if (UpgradeWizardStep.WELCOME.equals(step)) {
- next = UpgradeWizardStep.REVIEW;
- } else if (UpgradeWizardStep.REVIEW.equals(step)) {
- next = UpgradeWizardStep.PROGRESS;
- } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
- next = UpgradeWizardStep.FINISHED;
- }
- return next;
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getPreviousWizardStep(WizardStep step) {
- WizardStep prev = null;
- if (UpgradeWizardStep.FINISHED.equals(step)) {
- prev = UpgradeWizardStep.PROGRESS;
- } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
- prev = UpgradeWizardStep.REVIEW;
- } else if (UpgradeWizardStep.REVIEW.equals(step)) {
- prev = UpgradeWizardStep.WELCOME;
- }
- return prev;
- }
-
- /**
- * {@inheritDoc}
- */
- public WizardStep getFinishedStep() {
- return UpgradeWizardStep.FINISHED;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canQuit(WizardStep step) {
- return UpgradeWizardStep.WELCOME == step ||
- UpgradeWizardStep.REVIEW == step;
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getFinishButtonToolTip() {
- return INFO_FINISH_BUTTON_UPGRADE_TOOLTIP.get();
- }
-
- /**
- * {@inheritDoc}
- */
- public Message getQuitButtonToolTip() {
- return INFO_QUIT_BUTTON_UPGRADE_TOOLTIP.get();
- }
-
- /**
- * {@inheritDoc}
- */
- public void cancel() {
-
- // The run() method checks that status of this variable
- // occasionally and aborts the operation if it discovers
- // a 'true' value.
- abort = true;
-
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean confirmCancel(QuickSetup qs) {
- return qs.displayConfirmation(
- INFO_CONFIRM_CANCEL_UPGRADE_MSG.get(),
- INFO_CONFIRM_CANCEL_UPGRADE_TITLE.get());
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isFinished() {
- return getCurrentProgressStep() ==
- UpgradeProgressStep.FINISHED
- || getCurrentProgressStep() ==
- UpgradeProgressStep.FINISHED_WITH_ERRORS
- || getCurrentProgressStep() ==
- UpgradeProgressStep.FINISHED_WITH_WARNINGS
- || getCurrentProgressStep() ==
- UpgradeProgressStep.FINISHED_CANCELED;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isCancellable() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void quitClicked(WizardStep cStep, final QuickSetup qs) {
- if (cStep == UpgradeWizardStep.PROGRESS) {
- throw new IllegalStateException(
- "Cannot click on quit from progress step");
- } else if (isFinished()) {
- qs.quit();
- } else if (qs.displayConfirmation(
- INFO_CONFIRM_QUIT_UPGRADE_MSG.get(),
- INFO_CONFIRM_QUIT_UPGRADE_TITLE.get())) {
- qs.quit();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void updateUserData(WizardStep cStep, QuickSetup qs)
- throws UserDataException {
- List<Message> errorMsgs = new ArrayList<Message>();
- UpgradeUserData uud = getUpgradeUserData();
- if (cStep == UpgradeWizardStep.WELCOME) {
-
- // User can only select the installation to upgrade
- // in the webstart version of this tool. Otherwise
- // the fields are readonly.
- if (Utils.isWebStart()) {
- String serverLocationString =
- qs.getFieldStringValue(FieldName.SERVER_TO_UPGRADE_LOCATION);
- if ((serverLocationString == null) ||
- ("".equals(serverLocationString.trim()))) {
- errorMsgs.add(INFO_EMPTY_SERVER_LOCATION.get());
- qs.displayFieldInvalid(FieldName.SERVER_TO_UPGRADE_LOCATION, true);
- } else {
- try {
- File serverLocation = new File(serverLocationString);
- Installation.validateRootDirectory(serverLocation);
-
- // If we get here the value is acceptable and not null
-
- Installation currentInstallation = getInstallation();
- if (currentInstallation == null ||
- !serverLocation.equals(getInstallation().getRootDirectory())) {
- LOG.log(Level.INFO,
- "user changed server root from " +
- (currentInstallation == null ?
- "'null'" :
- currentInstallation.getRootDirectory()) +
- " to " + serverLocation);
- Installation installation = new Installation(serverLocation,
- serverLocation);
- setInstallation(installation);
- try
- {
- // Try to see if there is a problem with the build information,
- // we might be trying to do the upgrade with a JVM that is not
- // compatible with the java arguments used by the server
- // scripts (see issue ).
- installation.getBuildInformation(true);
- }
- catch (ApplicationException ae)
- {
- if (ae.getMessageObject().getDescriptor().equals(
- INFO_ERROR_CREATING_BUILD_INFO_MSG))
- {
- // This is the message thrown when there was a problem with
- // the binary. The details content is on the scripts and not
- // localized, we can assume that if there is a mention to
- // OPENDJ_JAVA_HOME in the message there is an error with the
- // script.
- if (ae.getMessageObject().toString().indexOf(
- "OPENDJ_JAVA_HOME") != -1)
- {
- String javaBin = System.getProperty("java.home")+
- File.separator+
- "bin"+File.separator+"java";
- String setJavaHome =
- installation.getSetJavaHomeFile().getAbsolutePath();
- String dsJavaProperties =
- installation.getJavaPropertiesCommandFile().
- getAbsolutePath();
- errorMsgs.add(ERR_INVALID_JAVA_ARGS.get(
- serverLocationString,
- javaBin,
- setJavaHome,
- dsJavaProperties));
- }
- }
- }
- }
-
- uud.setServerLocation(serverLocationString);
- qs.displayFieldInvalid(FieldName.SERVER_TO_UPGRADE_LOCATION, false);
- } catch (IllegalArgumentException iae) {
- LOG.log(Level.INFO,
- "illegal OpenDJ installation directory selected", iae);
- errorMsgs.add(INFO_ERROR_INVALID_SERVER_LOCATION.get(
- serverLocationString));
- qs.displayFieldInvalid(FieldName.SERVER_TO_UPGRADE_LOCATION, true);
- }
- }
- } else {
- // do nothing; all fields are read-only
- }
-
- } else if (cStep == UpgradeWizardStep.REVIEW) {
- Boolean startServer =
- (Boolean) qs.getFieldValue(FieldName.SERVER_START_UPGRADER);
- uud.setStartServer(startServer);
- }
-
- if (errorMsgs.size() > 0) {
- throw new UserDataException(UpgradeWizardStep.WELCOME,
- Utils.getMessageFromCollection(errorMsgs, "\n"));
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void previousClicked(WizardStep cStep, QuickSetup qs) {
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean finishClicked(final WizardStep cStep, final QuickSetup qs) {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void nextClicked(WizardStep cStep, QuickSetup qs) {
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canFinish(WizardStep step) {
- return UpgradeWizardStep.REVIEW.equals(step);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean canGoBack(WizardStep step) {
- return super.canGoBack(step) && !step.equals(UpgradeWizardStep.PROGRESS)
- && !step.equals(UpgradeWizardStep.FINISHED);
- }
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- // Reset exception just in case this application is rerun
- // for some reason
- runError = null;
-
- notifyListenersOfLog();
- notifyListeners(getLineBreak());
-
- try {
-
- if (Utils.isWebStart()) {
- ZipExtractor extractor;
- setCurrentProgressStep(UpgradeProgressStep.DOWNLOADING);
-
- try {
- LOG.log(Level.INFO, "Waiting for Java Web Start jar download");
- waitForLoader(UpgradeProgressStep.EXTRACTING.getProgress());
- LOG.log(Level.INFO, "Downloaded build file");
- String zipName = WebStartDownloader.getZipFileName();
- InputStream in =
- Upgrader.class.getClassLoader().getResourceAsStream(zipName);
- extractor = new ZipExtractor(in,
- UpgradeProgressStep.EXTRACTING.getProgress(),
- UpgradeProgressStep.INITIALIZING.getProgress(),
- Utils.getNumberZipEntries(), zipName, this);
-
- } catch (ApplicationException e) {
- LOG.log(Level.SEVERE, "Error downloading Web Start jars", e);
- throw e;
- }
- notifyListeners(getFormattedDoneWithLineBreak());
-
- checkAbort();
-
- try {
- setCurrentProgressStep(UpgradeProgressStep.EXTRACTING);
- if (isVerbose())
- {
- notifyListeners(getLineBreak());
- }
- extractor.extract(getStageDirectory());
- if (!isVerbose())
- {
- notifyListeners(getFormattedDoneWithLineBreak());
- }
- else
- {
- notifyListeners(getLineBreak());
- }
- LOG.log(Level.INFO, "extraction finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Error extracting build file", e);
- throw e;
- }
- }
-
- checkAbort();
-
- // Check license
- if (!LicenseFile.isAlreadyApproved())
- {
- String currentInstallRoot = System.getProperty("INSTALL_ROOT");
- System.setProperty("INSTALL_ROOT",
- getStageDirectory().getAbsolutePath());
- if (LicenseFile.exists())
- {
- String licenseString = LicenseFile.getText();
- System.out.println(licenseString);
- if (getUserData().isInteractive())
- {
- // If the user asks for no-prompt. We just display the license text.
- // User doesn't asks for no-prompt. We just display the license text
- // and force to accept it.
- String yes = INFO_LICENSE_CLI_ACCEPT_YES.get().toString();
- String no = INFO_LICENSE_CLI_ACCEPT_NO.get().toString();
- System.out.println(INFO_LICENSE_DETAILS_CLI_LABEL.get().toString());
-
- BufferedReader in = new BufferedReader(new InputStreamReader(
- System.in));
- while (true)
- {
- System.out.print(INFO_LICENSE_CLI_ACCEPT_QUESTION
- .get(yes, no, no).toString());
- try
- {
- String response = in.readLine();
- if ((response == null)
- || (response.toLowerCase().equals(no.toLowerCase()))
- || (response.length() == 0))
- {
- System.exit(ReturnCode.CANCELED.getReturnCode());
- }
- else if (response.toLowerCase().equals(yes.toLowerCase()))
- {
- // create the file
- LicenseFile.setApproval(true);
- LicenseFile.createFileLicenseApproved();
- break;
- }
- else
- {
- System.out.println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE
- .get().toString());
- }
- }
- catch (IOException e)
- {
- System.out.println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE
- .get().toString());
- }
- }
- }
- }
- if (currentInstallRoot != null) {
- System.setProperty("INSTALL_ROOT", currentInstallRoot);
- } else {
- System.clearProperty("INSTALL_ROOT");
- }
- }
-
- if (!Utils.isWebStart())
- {
- // The command-line upgrade has not the option of leaving the server
- // started or stopped, so we must leave it as it was at the beginning of
- // the upgrade.
- getUserData().setStartServer(
- getInstallation().getStatus().isServerRunning());
- }
-
- try {
- LOG.log(Level.INFO, "initializing upgrade");
- setCurrentProgressStep(UpgradeProgressStep.INITIALIZING);
- initialize();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "initialization finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Error initializing upgrader", e);
- throw e;
- }
-
- checkAbort();
-
- MigrationManager migration =
- new MigrationManager(getInstallation(),
- getUpgradeBackupDirectory(),
- userInteraction());
- try {
- LOG.log(Level.INFO, "checking for schema customizations");
- setCurrentProgressStep(
- UpgradeProgressStep.CALCULATING_SCHEMA_CUSTOMIZATIONS);
- migration.calculateSchemaCustomizations();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "check for schema customizations finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Error calculating schema customizations", e);
- throw e;
- }
-
- checkAbort();
-
- try {
- LOG.log(Level.INFO, "checking for config customizations");
- setCurrentProgressStep(
- UpgradeProgressStep.CALCULATING_CONFIGURATION_CUSTOMIZATIONS);
- migration.calculateConfigCustomizations();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "check for config customizations finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error calculating config customizations", e);
- throw e;
- }
-
- checkAbort();
-
- if (getUpgradeUserData().getPerformDatabaseBackup()) {
- try {
- LOG.log(Level.INFO, "backing up databases");
- setCurrentProgressStep(UpgradeProgressStep.BACKING_UP_DATABASES);
- backupDatabases();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "database backup finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Error backing up databases", e);
- throw e;
- }
- }
-
- checkAbort();
-
- try {
- LOG.log(Level.INFO, "backing up filesystem");
- setCurrentProgressStep(UpgradeProgressStep.BACKING_UP_FILESYSTEM);
- backupFilesystem();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "filesystem backup finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "Error backing up files", e);
- throw e;
- }
-
- checkAbort();
-
- try {
- LOG.log(Level.INFO, "upgrading components");
- setCurrentProgressStep(
- UpgradeProgressStep.UPGRADING_COMPONENTS);
- upgradeComponents();
- updateConfigDirectory();
- updateExtensionsDirectory();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "component upgrade finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error upgrading components", e);
- throw e;
- }
-
- checkAbort();
-
- //********************************************
- //* The two steps following this step require
- //* the server to be started 'in process'.
- // *******************************************
- LOG.log(Level.INFO, "schema customization " +
- (migration.isSchemaCustomized() ? "":"not ") + "present");
- LOG.log(Level.INFO, "config customization " +
- (migration.isConfigurationCustomized() ? "":"not ") + "present");
- if (migration.isSchemaCustomized() ||
- migration.isConfigurationCustomized()) {
- try {
- LOG.log(Level.INFO, "starting server");
- setCurrentProgressStep(
- UpgradeProgressStep.PREPARING_CUSTOMIZATIONS);
- InProcessServerController ipsc =
- new InProcessServerController(getInstallation());
- InProcessServerController.disableConnectionHandlers(true);
- InProcessServerController.disableAdminDataSynchronization(true);
- InProcessServerController.disableSynchronization(true);
- ipsc.startServer();
- LOG.log(Level.INFO, "start server finished");
- notifyListeners(getFormattedDoneWithLineBreak());
- } catch (Exception e) {
- LOG.log(Level.INFO,
- "Error starting server in order to apply custom" +
- "schema and/or configuration", e);
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_ERROR_STARTING_SERVER.get(), e);
- }
-
- checkAbort();
-
- if (migration.isSchemaCustomized()) {
- try {
- LOG.log(Level.INFO, "Applying schema customizations");
- setCurrentProgressStep(
- UpgradeProgressStep.APPLYING_SCHEMA_CUSTOMIZATIONS);
- migration.migrateSchema();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "custom schema application finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error applying schema customizations", e);
- throw e;
- }
- }
-
- checkAbort();
-
- if (migration.isConfigurationCustomized()) {
- try {
- LOG.log(Level.INFO, "Applying config customizations");
- setCurrentProgressStep(
- UpgradeProgressStep.APPLYING_CONFIGURATION_CUSTOMIZATIONS);
- migration.migrateConfiguration();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "custom config application finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error applying configuration customizations", e);
- throw e;
- }
- }
-
- checkAbort();
-
- if (migration.mustMigrateADS())
- {
- try {
- LOG.log(Level.INFO, "Applying registration changes");
- if (isVerbose())
- {
- setCurrentProgressStep(
- UpgradeProgressStep.APPLYING_ADS_CUSTOMIZATIONS);
- }
- migration.migrateADS(
- getStagedInstallation().getADSBackendFile());
- if (isVerbose())
- {
- notifyListeners(getFormattedDone());
- }
- LOG.log(Level.INFO, "custom registration application finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error applying registration customizations", e);
- throw e;
- }
- }
-
- checkAbort();
-
- if (migration.mustMigrateToolProperties())
- {
- try {
- LOG.log(Level.INFO, "Applying tools properties");
- migration.migrateToolPropertiesFile(
- getStagedInstallation().getToolsPropertiesFile());
- LOG.log(Level.INFO, "tools properties application finished");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error applying tools properties changes", e);
- throw e;
- }
- }
-
- if (migration.mustRunDSJavaProperties())
- {
- try {
- LOG.log(Level.INFO, "Upgrading script with java properties");
-// Launch the script
- String propertiesFile = new File(
- getInstallation().getConfigurationDirectory(),
- Installation.DEFAULT_JAVA_PROPERTIES_FILE).getAbsolutePath();
- String setJavaFile =
- getInstallation().getSetJavaHomeFile().getAbsolutePath();
- String[] args =
- {
- "--propertiesFile", propertiesFile,
- "--destinationFile", setJavaFile,
- "--quiet"
- };
-
- int returnValue = JavaPropertiesTool.mainCLI(args);
-
- if ((returnValue !=
- JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL.getReturnCode()) &&
- returnValue !=
- JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode())
- {
- throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
- ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS.get(returnValue), null);
- }
- LOG.log(Level.INFO, "scripts successfully upgraded");
- } catch (ApplicationException e) {
- LOG.log(Level.INFO,
- "Error upgrading scripts", e);
- throw e;
- }
- }
-
- checkAbort();
-
- try {
- LOG.log(Level.INFO, "stopping server");
- // This class imports classes from the server
- if (isVerbose())
- {
- notifyListeners(INFO_PROGRESS_UPGRADE_INTERNAL_STOP.get());
- }
- new InProcessServerController(
- getInstallation()).stopServer();
- InProcessServerController.disableConnectionHandlers(false);
- if (isVerbose())
- {
- notifyListeners(getFormattedDone());
- }
- LOG.log(Level.INFO, "server stopped");
- } catch (Throwable t) {
- LOG.log(Level.INFO, "Error stopping server", t);
- throw new ApplicationException(ReturnCode.BUG,
- INFO_ERROR_STOPPING_SERVER.get(), t);
- }
- }
-
- checkAbort();
-
- // This allows you to test whether or not he upgrader can successfully
- // abort an upgrade once changes have been made to the installation
- // path's filesystem.
- if ("true".equals(
- System.getProperty(SYS_PROP_CREATE_ERROR))) {
- LOG.log(Level.WARNING, "creating artificial error");
- throw new ApplicationException(
- null, INFO_ERROR_ARTIFICIAL.get(), null);
- }
-
- List<Message> errors;
- try {
- LOG.log(Level.INFO, "verifying upgrade");
- setCurrentProgressStep(UpgradeProgressStep.VERIFYING);
- Installation installation = getInstallation();
- ServerHealthChecker healthChecker =
- new ServerHealthChecker(installation);
- healthChecker.checkServer();
- errors = healthChecker.getProblemMessages();
- } catch (Exception e) {
- LOG.log(Level.INFO, "error performing server health check", e);
- throw e;
- }
-
- // For testing
- if ("true".equals(
- System.getProperty(SYS_PROP_CREATE_VERIFY_ERROR))) {
- LOG.log(Level.WARNING, "creating artificial verification error");
- if (errors == null || errors.size() == 0) {
- errors = new ArrayList<Message>();
- errors.add(Message.raw("Artificial verification error for testing"));
- }
- }
-
- if (errors != null && errors.size() > 0) {
- notifyListeners(getFormattedErrorWithLineBreak());
- Message formattedDetails =
- Utils.listToMessage(errors,
- Constants.LINE_SEPARATOR, /*bullet=*/"\u2022 ", "");
- ApplicationException ae = new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_ERROR_UPGRADED_SERVER_STARTS_WITH_ERRORS.get(
- Constants.LINE_SEPARATOR + formattedDetails), null);
- UserInteraction ui = userInteraction();
- if (ui.isInteractive()) {
-
- // We are about to present the problems with the upgrade to the
- // user and ask if they would like to continue. Regardless of
- // whether or not they continue at this point, since they will
- // have seen the errors we consider the errors as warnings.
- runWarning = ae;
-
- // Ask the user if they would like to continue.
- Message cancel = INFO_UPGRADE_VERIFICATION_FAILURE_CANCEL.get();
- if (cancel.equals(ui.confirm(
- INFO_UPGRADE_VERIFICATION_FAILURE_TITLE.get(),
- INFO_UPGRADE_VERIFICATION_FAILURE_PROMPT.get(),
- formattedDetails,
- INFO_UPGRADE_VERIFICATION_FAILURE_TITLE.get(),
- UserInteraction.MessageType.ERROR,
- new Message[]{INFO_CONTINUE_BUTTON_LABEL.get(), cancel},
- cancel,
- INFO_UPGRADE_VERIFICATION_FAILURE_VIEW_DETAILS.get()))) {
- // User indicated cancel
- cancel();
- checkAbort();
- } else {
- // User wants to continue; nothing to do
- }
- } else if (!ui.isForceOnError()) {
- // We can't ask the user if they want to continue so we
- // just bail on the upgrade by throwing an exception which
- // will cause upgrader to exit unsuccessfully
- throw ae;
- }
- } else {
- notifyListeners(getFormattedDoneWithLineBreak());
- }
- LOG.log(Level.INFO, "upgrade verification complete");
-
- // Leave the server in the state requested by the user via the
- // checkbox on the review panel. The upgrade has already been
- // verified at this point to in the unlikely event of an error,
- // we call this a warning instead of an error.
- try {
- ServerController control = new ServerController(getInstallation());
- boolean serverRunning = getInstallation().getStatus().isServerRunning();
- boolean userRequestsStart = getUserData().getStartServer();
- if (userRequestsStart && !serverRunning) {
- try {
- LOG.log(Level.INFO, "starting server");
- setCurrentProgressStep(UpgradeProgressStep.STARTING_SERVER);
- if (isVerbose())
- {
- notifyListeners(getTaskSeparator());
- }
- else
- {
- notifyListeners(getFormattedWithPoints(
- INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
- }
- int port = getInstallation().getCurrentConfiguration().getPort();
- if (port != -1 && !Utils.canUseAsPort(port)) {
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_ERROR_PORT_IN_USE.get(Integer.toString(port)),
- null);
- }
- control.startServer(!isVerbose());
- if (!isVerbose())
- {
- notifyListeners(getFormattedDoneWithLineBreak());
- }
- else
- {
- notifyListeners(getLineBreak());
- }
- } catch (ApplicationException e) {
- if (isVerbose())
- {
- notifyListeners(getLineBreak());
- }
- notifyListeners(getFormattedErrorWithLineBreak());
- LOG.log(Level.INFO, "error starting server");
- this.runWarning = e;
- }
- } else if (!userRequestsStart && serverRunning) {
- try {
- LOG.log(Level.INFO, "stopping server");
- if (isVerbose())
- {
- notifyListeners(getTaskSeparator());
- }
- else
- {
- notifyListeners(getFormattedWithPoints(
- INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
- }
- setCurrentProgressStep(UpgradeProgressStep.STOPPING_SERVER);
- control.stopServer(!isVerbose());
- if (!isVerbose())
- {
- notifyListeners(getFormattedDoneWithLineBreak());
- }
- else
- {
- notifyListeners(getLineBreak());
- }
- } catch (ApplicationException e) {
- if (isVerbose())
- {
- notifyListeners(getLineBreak());
- }
- notifyListeners(getFormattedErrorWithLineBreak());
- LOG.log(Level.INFO, "error stopping server");
- this.runWarning = e;
- }
- }
- } catch (IOException ioe) {
- LOG.log(Level.INFO, "error determining if server running");
- this.runWarning = new ApplicationException(
- ReturnCode.TOOL_ERROR,
- INFO_ERROR_SERVER_STATUS.get(), ioe);
- }
-
- } catch (ApplicationException ae) {
-
- // We don't consider a user cancelation exception
- // to be an error.
- if (ae.getType() != ReturnCode.CANCELED) {
- this.runError = ae;
- } else {
- this.abort = true;
- }
-
- } catch (Throwable t) {
- this.runError =
- new ApplicationException(ReturnCode.BUG,
- INFO_BUG_MSG.get(), t);
- } finally {
- try {
- HistoricalRecord.Status status;
- String note = null;
- if (runError == null && !abort) {
- status = HistoricalRecord.Status.SUCCESS;
- backupWindowsUpgradeFile();
- } else {
- if (abort) {
- status = HistoricalRecord.Status.CANCEL;
- } else {
- status = HistoricalRecord.Status.FAILURE;
- note = runError.getLocalizedMessage();
- }
-
- if (runError != null)
- {
- notifyListeners(getFormattedErrorWithLineBreak());
- Message msg;
-
- if (runError.getCause() != null)
- {
- msg = getFormattedError(
- Utils.getThrowableMsg(runError.getMessageObject(),
- runError.getCause()), true);
- }
- else
- {
- msg = getFormattedError(runError, true);
- }
- notifyListeners(msg);
- if (Utils.isCli())
- {
- notifyListeners(getLineBreak());
- notifyListeners(getLineBreak());
- }
- }
- // Abort the upgrade and put things back like we found it
- LOG.log(Level.INFO, "canceling upgrade");
- ProgressStep lastProgressStep = getCurrentProgressStep();
- setCurrentProgressStep(UpgradeProgressStep.ABORT);
- abort(lastProgressStep);
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "cancelation complete");
- }
-
- LOG.log(Level.INFO, "cleaning up after upgrade");
- setCurrentProgressStep(UpgradeProgressStep.CLEANUP);
- cleanup();
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "clean up complete");
-
-
- // Write a record in the log file indicating success/failure
- LOG.log(Level.INFO, "recording upgrade history");
- setCurrentProgressStep(UpgradeProgressStep.RECORDING_HISTORY);
- writeHistoricalRecord(historicalOperationId,
- getCurrentBuildInformation(),
- getStagedBuildInformation(),
- status,
- note);
- notifyListeners(getFormattedDoneWithLineBreak());
- LOG.log(Level.INFO, "history recorded");
- notifyListeners(getFormattedProgress(INFO_GENERAL_SEE_FOR_HISTORY.get(
- Utils.getPath(getInstallation().getHistoryLogFile()))));
- notifyListeners(formatter.getLineBreak());
-
- try {
- Stage stage = getStage();
- List<Message> stageMessages = stage.getMessages();
- for (Message m : stageMessages) {
- notifyListeners(m);
- }
- } catch (IOException e) {
- LOG.log(Level.INFO, "failed to access stage", e);
- }
-
- } catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
- Message msg;
- if (e.getCause() != null)
- {
- msg = getFormattedError(
- Utils.getThrowableMsg(e.getMessageObject(), e.getCause()), true);
- }
- else
- {
- msg = getFormattedError(e, true);
- }
- notifyListeners(msg);
- if (Utils.isCli())
- {
- notifyListeners(getLineBreak());
- }
- LOG.log(Level.INFO, "Error cleaning up after upgrade.", e);
- }
-
- // Decide final status based on presence of error
-
- // WARNING: change this code at your own risk! The ordering
- // of these statements is important. There are differences
- // in how the CLI and GUI application's processes exit.
- // Changing the ordering here may result in messages being
- // skipped because the process has already exited by the time
- // processing messages has finished. Need to resolve these
- // issues.
- if (abort) {
- LOG.log(Level.INFO, "upgrade canceled by user");
- if (!Utils.isCli()) {
- this.currentProgressStep = UpgradeProgressStep.FINISHED_CANCELED;
- notifyListeners(null);
- } else {
- setCurrentProgressStep(UpgradeProgressStep.FINISHED_CANCELED);
- notifyListeners(getLineBreak());
- }
- } else if (runError != null) {
- LOG.log(Level.INFO, "upgrade completed with errors", runError);
- if (!Utils.isCli()) {
- notifyListenersOfLogAfterError();
- this.currentProgressStep = UpgradeProgressStep.FINISHED_WITH_ERRORS;
- } else {
- setCurrentProgressStep(UpgradeProgressStep.FINISHED_WITH_ERRORS);
- notifyListeners(getLineBreak());
- }
- } else if (runWarning != null) {
- LOG.log(Level.INFO, "upgrade completed with warnings");
- Message warningText = runWarning.getMessageObject();
-
- // By design, the warnings are written as errors to the details section
- // as errors. Warning markup is used surrounding the main message
- // at the end of progress.
- if (!Utils.isCli()) {
- notifyListenersOfLogAfterError();
- this.currentProgressStep = UpgradeProgressStep.FINISHED_WITH_WARNINGS;
- notifyListeners(getFormattedError(warningText, true));
- } else {
- notifyListeners(getFormattedErrorWithLineBreak(warningText, true));
- notifyListeners(getLineBreak());
- setCurrentProgressStep(UpgradeProgressStep.FINISHED_WITH_WARNINGS);
- notifyListeners(getLineBreak());
- }
-
- } else {
- LOG.log(Level.INFO, "upgrade completed successfully");
- if (!Utils.isCli()) {
- this.currentProgressStep = UpgradeProgressStep.FINISHED;
- notifyListeners(null);
- } else {
- setCurrentProgressStep(UpgradeProgressStep.FINISHED);
- notifyListeners(getLineBreak());
- }
- }
- }
- }
-
- /**
- * Checks the value of <code>aborted</code> field and throws an
- * ApplicationException if true. This indicates that the user has
- * aborted this operation and the process of aborting should begin
- * as soon as possible.
- *
- * @throws ApplicationException thrown if <code>aborted</code>
- */
- public void checkAbort() throws ApplicationException {
- if (abort) throw new ApplicationException(
- ReturnCode.CANCELED,
- INFO_UPGRADE_CANCELED.get(), null);
- }
-
- /**
- * Abort this upgrade and repair the installation.
- *
- * @param lastStep ProgressStep indicating how much work we will have to
- * do to get the installation back like we left it
- * @throws ApplicationException of something goes wrong
- */
- private void abort(ProgressStep lastStep) throws ApplicationException {
-
- // This can be used to bypass the aborted upgrade cleanup
- // process so that an autopsy can be performed on the
- // crippled server.
- if ("true".equals(System.getProperty(SYS_PROP_NO_ABORT))) {
- return;
- }
-
- UpgradeProgressStep lastUpgradeStep = (UpgradeProgressStep) lastStep;
- EnumSet<UpgradeProgressStep> stepsStarted =
- EnumSet.range(UpgradeProgressStep.NOT_STARTED, lastUpgradeStep);
-
- if (stepsStarted.contains(UpgradeProgressStep.BACKING_UP_FILESYSTEM)) {
-
- // Files were copied from the stage directory to the current
- // directory. Repair things by overwriting file in the
- // root with those that were copied to the backup directory
- // during backupFiles()
-
- File root = getInstallation().getRootDirectory();
- File backupDirectory;
- try {
- backupDirectory = getFilesInstallBackupDirectory();
- FileManager fm = new FileManager();
- boolean restoreError = false;
- for (String fileName : backupDirectory.list()) {
- File f = new File(backupDirectory, fileName);
-
- // Do our best to restore the filesystem like
- // we found it. Just report potential problems
- // to the user.
- try {
- fm.move(f, root, null);
- } catch (Throwable t) {
- restoreError = true;
- notifyListeners(INFO_ERROR_RESTORING_FILE.get(Utils.getPath(f),
- Utils.getPath(root)));
- }
- }
- if (!restoreError) {
- fm.deleteRecursively(backupDirectory);
- }
-
- if (! instanceAndInstallInSameDir())
- {
- root = getInstallation().getInstanceDirectory();
- backupDirectory = getFilesInstanceBackupDirectory();
- fm = new FileManager();
- for (String fileName : backupDirectory.list()) {
- File f = new File(backupDirectory, fileName);
-
- // Do our best to restore the filesystem like
- // we found it. Just report potential problems
- // to the user.
- try {
- fm.move(f, root, null);
- } catch (Throwable t) {
- restoreError = true;
- notifyListeners(INFO_ERROR_RESTORING_FILE.get(Utils.getPath(f),
- Utils.getPath(root)));
- }
- }
- if (!restoreError) {
- fm.deleteRecursively(backupDirectory);
- }
- }
-
- // Restart the server after putting the files
- // back like we found them.
- ServerController sc = new ServerController(getInstallation());
- sc.stopServer(true);
- sc.startServer(true);
-
- } catch (IOException e) {
- LOG.log(Level.INFO, "Error getting backup directory", e);
- }
- }
-
-
- }
-
- /**
- * Returns the directory used to stage files for upgrade or reversion.
- * @return the directory used to stage files for upgrade or reversion
- * @throws IOException if errors occurs while accessing stage files
- * @throws org.opends.quicksetup.ApplicationException
- * if retrieval of stage files path fails
- */
- protected Stage getStage() throws IOException, ApplicationException {
- if (this.stage == null) {
- this.stage = new Stage(getStageDirectory());
- }
- return this.stage;
- }
-
- /**
- * Upgrade components.
- * @throws ApplicationException if upgrade fails
- */
- protected void upgradeComponents() throws ApplicationException {
- try {
- Stage stage = getStage();
- Installation installation = getInstallation();
- File root = installation.getRootDirectory();
-
- if (instanceAndInstallInSameDir())
- {
- stage.move(root, new UpgradeFileFilter(getStageDirectory()));
- }
- else
- {
- stage.move(root, new UpgradeFileFilter(getStageDirectory(),true));
- root = installation.getInstanceDirectory();
- stage.move(root, new UpgradeFileFilter(getStageDirectory(),false));
- }
-
- // Check if instance.loc exits
- File instanceFile = new File
- (installation.getRootDirectory(),
- Installation.INSTANCE_LOCATION_PATH_RELATIVE);
- if (! instanceFile.exists())
- {
- BufferedWriter instanceLoc =
- new BufferedWriter(new FileWriter(instanceFile));
- instanceLoc.append(
- installation.getInstanceDirectory().getAbsolutePath());
- instanceLoc.close();
- }
-
- // The bits should now be of the new version. Have
- // the installation update the build information so
- // that it is correct.
- LOG.log(Level.INFO, "upgraded bits to " +
- installation.getBuildInformation(false));
-
- } catch (IOException e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_UPGRADING_COMPONENTS.get(), e);
- }
- }
-
- private void updateConfigDirectory()
- throws IOException,ApplicationException
- {
- // The config directory may contain files that are needed
- // by the new installation (e.g. SSL config files and tasks)
- File oldInstallConfigDir =
- new File(getFilesInstallBackupDirectory(),
- Installation.CONFIG_PATH_RELATIVE);
- File oldInstanceConfigDir =
- new File(getFilesInstanceBackupDirectory(),
- Installation.CONFIG_PATH_RELATIVE);
- File newInstallConfigDir =
- getInstallation().getInstallConfigurationDirectory();
- File newInstanceConfigDir =
- getInstallation().getConfigurationDirectory();
- FileManager fm = new FileManager();
-
- // Define a filter for files that we don't want to copy over
- // from the old config directory.
- {
- final File oldConfigUpgradeDir = new File(oldInstallConfigDir, "upgrade");
- final File oldConfigSchemaDir = new File(oldInstallConfigDir, "schema");
- FileFilter filter = new FileFilter()
- {
- public boolean accept(File f)
- {
- return !Utils.isDescendant(f, oldConfigUpgradeDir)
- && !Utils.isDescendant(f, oldConfigSchemaDir);
- }
- };
-
- fm.synchronize(oldInstallConfigDir, newInstallConfigDir, filter);
- }
-
- {
- final File oldConfigUpgradeDir =
- new File(oldInstanceConfigDir, "upgrade");
- FileFilter filter = new FileFilter()
- {
- public boolean accept(File f)
- {
- return !Utils.isDescendant(f, oldConfigUpgradeDir);
- }
- };
-
- fm.synchronize(oldInstanceConfigDir, newInstanceConfigDir, filter);
- }
- }
-
- private void updateExtensionsDirectory()
- throws IOException,ApplicationException
- {
- // Get extensions back
- File savedDir =
- new File(getFilesInstanceBackupDirectory(),
- Installation.LIBRARIES_PATH_RELATIVE);
- File destDir = getInstallation().getInstanceDirectory();
-
- FileManager fm = new FileManager();
- fm.copyRecursively(savedDir, destDir);
-
- // Get classes back
- savedDir =
- new File(getFilesInstanceBackupDirectory(),
- Installation.CLASSES_PATH_RELATIVE);
- destDir = getInstallation().getInstanceDirectory();
-
- fm.copyRecursively(savedDir, destDir);
-
- }
-
- /**
- * Backup files to be able to revert if upgrdae fails.
- * @throws ApplicationException if backup fails
- */
- protected void backupFilesystem() throws ApplicationException {
- try {
- // Backup first install (potentially everything if install and instance
- // are in the same dir
- File filesBackupDirectory = getFilesInstallBackupDirectory();
- FileManager fm = new FileManager();
- File root = getInstallation().getRootDirectory();
- FileFilter filter = new UpgradeFileFilter(root);
- for (String fileName : root.list()) {
- File f = new File(root, fileName);
-
- // Replacing a Windows bat file while it is running with a different
- // version leads to unpredictable behavior so we make a special case
- // here and during the upgrade components step. This file will only
- // be backed up at the end of the process if everything went fine.
- if (Utils.isWindows() &&
- fileName.equals(Installation.WINDOWS_UPGRADE_FILE_NAME)) {
- continue;
- }
-
- fm.move(f, filesBackupDirectory, filter);
- }
- if (!instanceAndInstallInSameDir())
- {
- filesBackupDirectory = getFilesInstanceBackupDirectory();
- root = getInstallation().getInstanceDirectory();
- filter = new UpgradeFileFilter(root);
- for (String fileName : root.list())
- {
- File f = new File(root, fileName);
-
- // Replacing a Windows bat file while it is running with a different
- // version leads to unpredictable behavior so we make a special case
- // here and during the upgrade components step. This file will only
- // be backed up at the end of the process if everything went fine.
- if (Utils.isWindows()
- && fileName.equals(Installation.WINDOWS_UPGRADE_FILE_NAME))
- {
- continue;
- }
- fm.move(f, filesBackupDirectory, filter);
- }
- }
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw new ApplicationException(
- ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
- INFO_ERROR_BACKUP_FILESYSTEM.get(),
- e);
- }
- }
-
- /**
- * This method is called at the end of the upgrade process if everything went
- * fine since the reverter requires to have the upgrade file to properly
- * complete (see issue 2784).
- * @throws ApplicationException if there was an error backing up the upgrade
- * file.
- */
- private void backupWindowsUpgradeFile() throws ApplicationException {
- try
- {
- if (Utils.isWindows())
- {
- File filesBackupDirectory = getFilesInstallBackupDirectory();
- FileManager fm = new FileManager();
- File root = getInstallation().getRootDirectory();
- File f = new File(root, Installation.WINDOWS_UPGRADE_FILE_NAME);
- fm.copy(f, filesBackupDirectory);
- }
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw new ApplicationException(
- ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
- INFO_ERROR_BACKUP_FILESYSTEM.get(),
- e);
- }
- }
-
- private void backupDatabases() throws ApplicationException {
- try {
- ExternalTools et = new ExternalTools(getInstallation());
- OperationOutput output = et.backup(getUpgradeBackupDirectory());
- int ret = output.getReturnCode();
- if (ret != 0) {
- throw new ApplicationException(
- ReturnCode.TOOL_ERROR,
- INFO_ERROR_BACKUP_DB_TOOL_RETURN_CODE.get(
- Integer.toString(ret)),
- null);
-
- }
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw new ApplicationException(
- ReturnCode.TOOL_ERROR,
- INFO_ERROR_BACKUP_DB.get(), e);
- }
- }
-
- /**
- * Cleanup to done executed once upgrade is done.
- * @throws org.opends.quicksetup.ApplicationException
- * if cleanup fails
- */
- protected void cleanup() throws ApplicationException {
- deleteStagingDirectory();
- }
-
- private void deleteStagingDirectory() throws ApplicationException {
- File stagingDir = null;
- try {
- stagingDir = getStageDirectory();
- FileManager fm = new FileManager();
-
- // On Linux at least the deleteOnExit seems not to work very well
- // for directories that contain files, even if they have been marked
- // for deletion upon exit as well. Note that on Windows there are
- // file locking issues so we mark files for deletion after this JVM exits.
- if (stagingDir.exists()) {
- fm.deleteRecursively(stagingDir, null,
- FileManager.DeletionPolicy.DELETE_ON_EXIT_IF_UNSUCCESSFUL);
- }
-
- } catch (IOException e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DELETING_STAGE_DIRECTORY.get(
- Utils.getPath(stagingDir)), e);
- }
- }
-
- /**
- * Implements the initialization phase of the upgrade.
- * @throws ApplicationException if upgrade is not possible
- */
- protected void initialize() throws ApplicationException {
- try {
- BuildInformation fromVersion = getCurrentInstanceBuildInformation();
- BuildInformation toVersion = getStagedBuildInformation();
- if (fromVersion.equals(toVersion)) {
- // Only possible if product differs
- String fromProductName = getCurrentBuildInformation().getName();
- String toProductName = toVersion.getName();
- LOG.log(Level.FINEST, "fromProductName=" + fromProductName);
- LOG.log(Level.FINEST, "toProductName=" + toProductName);
- if ((fromProductName != null) &&
- (toProductName != null) &&
- fromProductName.equals(toProductName)) {
- throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
- INFO_UPGRADE_ORACLE_SAME_VERSION.get(
- toVersion.toString()), null);
- }
- }
- if (getInstallation().getStatus().isServerRunning()) {
- new ServerController(getInstallation()).stopServer(true);
- }
-
- this.historicalOperationId =
- writeInitialHistoricalRecord(fromVersion, toVersion);
-
- insureUpgradability();
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw new ApplicationException(
- ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
- INFO_ERROR_INITIALIZING_UPGRADE.get(), e);
- }
- }
-
- /**
- * Given the current information, determines whether or not
- * an upgrade from the current version to the next version
- * is possible. Upgrading may not be possible due to 'flag
- * day' types of changes to the codebase.
- * @throws org.opends.quicksetup.ApplicationException if upgradability
- * cannot be insured.
- */
- private void insureUpgradability() throws ApplicationException {
- BuildInformation newVersion;
- currentVersion = getCurrentInstanceBuildInformation();
-
- try {
- newVersion = getStagedInstallation().getBuildInformation();
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- LOG.log(Level.INFO, "error getting build information for " +
- "staged installation", e);
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_DETERMINING_UPGRADE_BUILD.get(), e);
- }
-
- UpgradeIssueNotifier uo = new UpgradeIssueNotifier(
- userInteraction(), currentVersion, newVersion);
- uo.notifyUser();
- if (uo.noServerStartFollowingOperation()) {
- // Some issue dictates that we don't try and restart the server
- // after this operation. It may be that the databases are no
- // longer readable after the upgrade or something equally earth
- // shattering.
- getUserData().setStartServer(false);
- }
- }
-
- /**
- * Returns the path of the new OpenDJ bits.
- * @return the path of the new OpenDJ bits.
- * @throws java.io.IOException if an error occurs while accessing the
- * new bits
- * @throws org.opends.quicksetup.ApplicationException if upgradability
- * cannot be insured.
- */
- protected Installation getStagedInstallation()
- throws IOException, ApplicationException {
- if (stagedInstallation == null) {
- File stageDir = getStageDirectory();
- try {
- Installation.validateRootDirectory(stageDir);
- stagedInstallation = new Installation(getStageDirectory(),
- getStageDirectory());
- } catch (IllegalArgumentException e) {
- Message msg = INFO_ERROR_BAD_STAGE_DIRECTORY.get(
- Utils.getPath(getStageDirectory()));
- throw ApplicationException.createFileSystemException(msg, e);
- }
- }
- return stagedInstallation;
- }
-
- /**
- * {@inheritDoc}
- */
- public UserData createUserData() {
- UpgradeUserData uud = new UpgradeUserData();
- String instanceRootFromSystem = System.getProperty(SYS_PROP_INSTALL_ROOT);
- if (instanceRootFromSystem != null) {
- uud.setServerLocation(instanceRootFromSystem);
- }
- return uud;
- }
-
- /**
- * {@inheritDoc}
- */
- public UserData createUserData(Launcher launcher)
- throws UserDataException {
- return new UpgraderCliHelper((UpgradeLauncher) launcher).
- createUserData(launcher.getArguments());
- }
-
- /**
- * {@inheritDoc}
- */
- public ApplicationException getRunError() {
- return runError;
- }
-
- /**
- * {@inheritDoc}
- */
- public ReturnCode getReturnCode() {
- return null;
- }
-
- private void setCurrentProgressStep(UpgradeProgressStep step) {
- this.currentProgressStep = step;
- int progress = step.getProgress();
- Message msg = getSummary(step);
- Message log = getLogMsg(step);
- if (step.logRequiresPoints(isVerbose()) && (log != null))
- {
- log = getFormattedWithPoints(log);
- }
- notifyListeners(progress, msg, log);
- }
-
- private Message getFinalSuccessMessage() {
- Message txt;
- String installPath = Utils.getPath(getInstallation().getRootDirectory());
- String newVersion;
- try {
- BuildInformation bi = getInstallation().getBuildInformation();
- if (bi != null) {
- newVersion = bi.toString();
- } else {
- newVersion = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- } catch (ApplicationException e) {
- newVersion = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- if (Utils.isCli()) {
- txt = INFO_SUMMARY_UPGRADE_FINISHED_SUCCESSFULLY_CLI.get(
- DynamicConstants.PRODUCT_NAME,
- formatter.getFormattedText(Message.raw(installPath)),
- newVersion);
- } else {
- String formattedPath = Utils.addWordBreaks(
- formatter.getFormattedText(Message.raw(installPath)).toString(),
- 60, 5);
- txt = getFormattedSuccess(
- INFO_SUMMARY_UPGRADE_FINISHED_SUCCESSFULLY.get(
- formattedPath,
- newVersion));
- }
- return txt;
- }
-
- private Message getFinalCanceledMessage() {
- Message txt;
- if (Utils.isCli()) {
- txt = INFO_SUMMARY_UPGRADE_FINISHED_CANCELED_CLI.get();
- } else {
- txt = getFormattedSuccess(
- INFO_SUMMARY_UPGRADE_FINISHED_CANCELED.get());
- }
- return txt;
- }
-
- private Message getFinalErrorMessage() {
- Message txt;
- if (Utils.isCli()) {
- txt = INFO_SUMMARY_UPGRADE_FINISHED_WITH_ERRORS_CLI.get();
- } else {
- txt = getFormattedError(
- INFO_SUMMARY_UPGRADE_FINISHED_WITH_ERRORS.get());
- }
- return txt;
- }
-
- private Message getFinalWarningMessage() {
- Message txt;
- if (Utils.isCli()) {
- txt = INFO_SUMMARY_UPGRADE_FINISHED_WITH_WARNINGS_CLI.get();
- } else {
- txt = getFormattedWarning(
- INFO_SUMMARY_UPGRADE_FINISHED_WITH_WARNINGS.get());
- }
- return txt;
- }
-
- /**
- * Returns the path of the new OpenDJ bits.
- * @return the path of the new OpenDJ bits.
- * @throws org.opends.quicksetup.ApplicationException
- * if retrieval of stage files path fails
- * @throws java.io.IOException if errors occurs while accessing stage files
- */
- protected File getStageDirectory()
- throws ApplicationException, IOException {
- return getInstallation().getTemporaryUpgradeDirectory();
- }
-
- private UpgradeUserData getUpgradeUserData() {
- return (UpgradeUserData) getUserData();
- }
-
- private boolean instanceAndInstallInSameDir()
- {
- Installation installation = getInstallation() ;
- File installDir = installation.getRootDirectory();
- try
- {
- installDir = installDir.getCanonicalFile();
- }
- catch (Exception e) {
- installDir = installation.getRootDirectory();
- }
- File instanceDir = installation.getInstanceDirectory();
- try
- {
- instanceDir = instanceDir.getCanonicalFile();
- }
- catch (Exception e) {
- instanceDir = installation.getInstanceDirectory();
- }
- return installDir.getAbsolutePath().equals(instanceDir.getAbsolutePath());
- }
-
- /**
- * Returns the path where to backup instance files.
- * @return the path where to backup instance files.
- * @throws java.io.IOException if retrieval of backup files fails
- */
- protected File getFilesInstanceBackupDirectory() throws IOException
- {
- if (instanceAndInstallInSameDir())
- {
- return getFilesBackupDirectory();
- } else
- {
- return new File(getFilesBackupDirectory(),
- Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
- }
- }
-
- private File getFilesInstallBackupDirectory() throws IOException
- {
- if (instanceAndInstallInSameDir())
- {
- return getFilesBackupDirectory();
- } else
- {
- return new File(getFilesBackupDirectory(),
- Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
- }
- }
-
- private File getFilesBackupDirectory() throws IOException {
- File files = new File(getUpgradeBackupDirectory(),
- Installation.HISTORY_BACKUP_FILES_DIR_NAME);
- if (!files.exists()) {
- if (!files.mkdirs()) {
- throw new IOException("error creating files backup directory");
- }
- }
-
- // Check if instance and instance are in the same dir
- if ( ! instanceAndInstallInSameDir())
- {
- File install = new File(files,
- Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
- if (!install.exists())
- {
- if (!install.mkdirs())
- {
- throw new IOException("error creating files backup directory");
- }
- }
- File instance = new File(files,
- Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
- if (!instance.exists())
- {
- if (!instance.mkdirs())
- {
- throw new IOException("error creating files backup directory");
- }
- }
- }
- return files;
- }
-
- private File getUpgradeBackupDirectory() throws IOException {
- if (backupDirectory == null) {
- backupDirectory = getInstallation().createHistoryBackupDirectory();
- }
- return backupDirectory;
- }
-
- /**
- * Returns the BuildInformation of the current OpenDJ bits.
- * @return the BuildInformation of the current OpenDJ bits.
- */
- private BuildInformation getCurrentBuildInformation() {
- if (this.currentVersion == null) {
- try {
- currentVersion = getInstallation().getBuildInformation();
- } catch (Exception e) {
- LOG.log(Level.INFO, "error trying to determine current version", e);
- }
- }
- return currentVersion;
- }
-
- /**
- * Returns the BuildInformation of the OpenDJ instance.
- * @return the BuildInformation of the OpenDJ instance.
- */
- private BuildInformation getCurrentInstanceBuildInformation() {
- if (this.currentInstanceVersion == null) {
- currentInstanceVersion = getInstallation().getInstanceBuildInformation();
- }
-
- return currentInstanceVersion;
- }
-
-
- private BuildInformation getStagedBuildInformation() {
- if (stagedVersion == null) {
- try {
- stagedVersion = getStagedInstallation().getBuildInformation();
- } catch (Exception e) {
- LOG.log(Level.INFO, "error getting build info for staged installation",
- e);
- }
- }
- return stagedVersion;
- }
-
- }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
deleted file mode 100644
index 8baac7c..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.upgrader;
-
-import org.opends.quicksetup.UserDataException;
-import org.opends.server.util.cli.ConsoleApplication;
-
-/**
- * Assists Upgrader utility in CLI drudgery.
- */
-public class UpgraderCliHelper extends ConsoleApplication {
-
- /** Launcher for this CLI invocation. */
- protected UpgradeLauncher launcher;
-
- /**
- * Creates a parameterized instance.
- * @param launcher for this CLI
- */
- public UpgraderCliHelper(UpgradeLauncher launcher)
- {
- super(System.in, System.out, System.err);
- this.launcher = launcher;
- }
-
- /**
- * Creates a set of user data from command line arguments and installation
- * status.
- * @param args String[] of arguments passed in from the command line
- * @return UserData object populated to reflect the input args and status
- * @throws UserDataException if something is wrong
- */
- public UpgradeUserData createUserData(String[] args)
- throws UserDataException {
- // It is assumed that if we got here that the build
- // extractor took care of extracting the file and
- // putting it in tmp/upgrade for us. So there's
- // not too much to do at this point.
- UpgradeUserData uud = new UpgradeUserData();
- uud.setQuiet(launcher.isQuiet());
- uud.setInteractive(!launcher.isNoPrompt());
- uud.setVerbose(launcher.isVerbose());
- uud.setForceOnError(launcher.isForceOnError());
- return uud;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAdvancedMode() {
- return false;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isInteractive() {
- return launcher.isInteractive();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isMenuDrivenMode() {
- return true;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isQuiet() {
- return launcher.isQuiet();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isScriptFriendly() {
- return false;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isVerbose() {
- return launcher.isVerbose();
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderSvr4.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderSvr4.java
deleted file mode 100644
index 8679632..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderSvr4.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2008 Sun Microsystems, Inc.
- */
-package org.opends.quicksetup.upgrader;
-
-import static org.opends.messages.QuickSetupMessages.*;
-
-
-import org.opends.quicksetup.ApplicationException;
-
-
-
-import java.io.File;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.Launcher;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.UserDataException;
-import org.opends.quicksetup.util.FileManager;
-import java.io.FileFilter;
-import org.opends.quicksetup.ReturnCode;
-
-/**
- * QuickSetup application of upgrading the bits of an SVR4 based installation
- * of OpenDS.
- */
-public class UpgraderSvr4 extends Upgrader {
-
- static private final Logger LOG = Logger.getLogger(
- UpgraderSvr4.class.getName());
-
- /**
- * {@inheritDoc}
- */
- @Override
- public UserData createUserData(Launcher launcher)
- throws UserDataException {
- return new UpgraderCliHelper((UpgradeSvr4Launcher) launcher).
- createUserData(launcher.getArguments());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected File getStageDirectory()
- throws ApplicationException, IOException {
- return getInstallation().getTmplInstanceDirectory();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Installation getStagedInstallation()
- throws IOException, ApplicationException {
- /* New bits have replaced old */
- return getInstallation();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void cleanup() throws ApplicationException {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void backupFilesystem() throws ApplicationException {
- try {
- FileManager fm = new FileManager();
- File filesBackupDirectory = getFilesInstanceBackupDirectory();
- File root = getInstallation().getInstanceDirectory();
- FileFilter filter = new UpgradeFileFilter(root, false);
- for (String fileName : root.list()) {
- File f = new File(root, fileName);
- fm.move(f, filesBackupDirectory, filter);
- }
- } catch (ApplicationException ae) {
- throw ae;
- } catch (Exception e) {
- throw new ApplicationException(
- ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
- INFO_ERROR_BACKUP_FILESYSTEM.get(),
- e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void upgradeComponents() throws ApplicationException {
- try {
- /* Only instance data have to be upgraded */
- Stage stage = getStage();
- Installation installation = getInstallation();
- File root = installation.getInstanceDirectory();
- stage.move(root, new UpgradeFileFilter(getStageDirectory(), false));
-
- LOG.log(Level.INFO, "upgraded bits to " +
- installation.getBuildInformation(false));
-
- } catch (IOException e) {
- throw ApplicationException.createFileSystemException(
- INFO_ERROR_UPGRADING_COMPONENTS.get(), e);
- }
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java
deleted file mode 100644
index 623aff0..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2007-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.upgrader;
-import org.opends.messages.Message;
-
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.Constants;
-import org.opends.quicksetup.UserInteraction;
-
-import org.opends.server.util.VersionCompatibilityIssue;
-import org.opends.server.util.BuildVersion;
-import static org.opends.messages.QuickSetupMessages.*;
-import static org.opends.server.util.VersionCompatibilityIssue.*;
-
-import java.util.List;
-import java.util.Set;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * This class can answer questions important upgrade/reversion questions
- * like 'can I upgrade from verion X to version Y?' and 'if not then why?'.
- * This is also responsible for obtaining and translating any applicable
- * {@link org.opends.server.util.VersionCompatibilityIssue}s and
- * interacting with the user to inform them of an actions or information
- * that they dictate.
- */
-public abstract class VersionIssueNotifier {
-
- static private final Logger LOG =
- Logger.getLogger(VersionIssueNotifier.class.getName());
-
- /**
- * End Of Line.
- */
- public static String EOL = System.getProperty("line.separator");
-
-
- /** Descriptor for a directive. */
- protected enum DirectiveType {
-
- /** Causes the tools to refuse to continue. */
- NOT_SUPPORTED,
-
- /** Causes the tools to display an action dialog. */
- ACTION,
-
- /** Causes the tools to display an informational dialog. */
- INFO,
-
- /** Causes the tools to display a warning dialog. */
- WARNING
-
- }
-
- /**
- * Holds information that directs tool behavior.
- */
- protected class Directive {
-
- DirectiveType type;
- Message msg;
-
- /**
- * Creates a parameterized instance.
- *
- * @param type of directive
- * @param localizedMsg for displaying to the user
- */
- public Directive(DirectiveType type, Message localizedMsg) {
- this.type = type;
- this.msg = localizedMsg;
- }
-
- /**
- * Gets the type of issue.
- * @return type of issue
- */
- public DirectiveType getType() {
- return this.type;
- }
-
- /**
- * Gets the issue's message.
- * @return string message
- */
-
- public Message getMessage() {
- return this.msg;
- }
-
- }
-
- /** Used for interacting with the user. */
- protected UserInteraction ui;
-
- /** Version issues applicable to this operation. */
- protected List<Directive> directives;
-
- /** Information about the current build version. */
- protected BuildInformation currentBuildInfo;
-
- /** Information about the proposed new build version. */
- protected BuildInformation newBuildInfo;
-
- private boolean isSupported = true;
- private boolean noServerStart = false;
-
- /**
- * Creates a parameterized instance.
- * @param ui for interacting with the user
- * @param current build version
- * @param neu build version
- */
- public VersionIssueNotifier(UserInteraction ui,
- BuildInformation current,
- BuildInformation neu) {
- this.ui = ui;
- this.currentBuildInfo = current;
- this.newBuildInfo = neu;
-
- // Get the list of possible version incompatibility events (aka flag days)
- List<VersionCompatibilityIssue> compatibilityIssues;
- Set<Integer> excludeIds ;
- boolean isUpgrade = neu.compareTo(current) >= 0;
- if (isUpgrade)
- {
- excludeIds = current.getIncompatibilityEventIds();
- }
- else
- {
- excludeIds = neu.getIncompatibilityEventIds();
- }
- if (excludeIds != null) {
- if (isUpgrade)
- {
- compatibilityIssues = getEvents(excludeIds, current, neu);
- }
- else
- {
- compatibilityIssues = getEvents(excludeIds, neu, current);
- }
- } else {
- // This method is only used as a fallback for pre 1.0.0 servers which
- // do not advertise incompatible version events.
- LOG.log(Level.INFO, "Legacy method for obtaining compatibility issues");
- BuildVersion bv = new BuildVersion(
- current.getMajorVersion(),
- current.getMinorVersion(),
- current.getPointVersion(),
- current.getRevisionNumber());
- compatibilityIssues = getEvents(bv);
- }
- directives = processEvents(compatibilityIssues);
- }
-
- /**
- * Interacts with the user to let them know about any
- * version issues applicable to operations between the
- * builds supplied in the constructor.
- *
- * @throws ApplicationException if something goes wrong or
- * the user cancels the operation.
- */
- public abstract void notifyUser() throws ApplicationException;
-
- /**
- * Indicates whether or not this operation would be considered an
- * upgrade (as opposed to a reversion).
- *
- * @return boolean where true indicates that this would be an upgrade;
- * false indicates that this would be a reversion.
- */
- public boolean isUpgrade() {
- return currentBuildInfo.compareTo(newBuildInfo) < 0;
- }
-
- /**
- * Indicates whether or not this operation would be considered an
- * reversion (as opposed to an upgrade).
- *
- * @return boolean where true indicates that this would be a reversion;
- * false indicates that this would be an upgrade.
- */
- public boolean isReversion() {
- return currentBuildInfo.compareTo(newBuildInfo) > 0;
- }
-
- /**
- * Returns whether or not this operation is supported.
- * @return true to indicate this operation is supported; false otherwise
- */
- public boolean isSupported() {
- return isSupported;
- }
-
- /**
- * Indicates whether the set of version issues dictates that the server
- * not be restarted afterward.
- *
- * @return true meaning the server won't be restarted; false otherwise
- */
- public boolean noServerStartFollowingOperation() {
- return noServerStart;
- }
-
- /**
- * Gets a list of issues applicable to this operation.
- * @return list of issues
- */
- protected List<Directive> getIssues() {
- return directives;
- }
-
- /**
- * Indicates whether or not there are issues with this operation.
- * @return true indicating there are issues; false otherwise
- */
- protected boolean hasIssues() {
- return (directives != null && directives.size() > 0);
- }
-
- /**
- * Given a particular cause return a detail message appropriate
- * for this operation.
- *
- * @param cause of issue
- * @return message for presenting to the user
- */
- protected abstract Message getLocalizedDetailMessage(
- VersionCompatibilityIssue.Cause cause);
-
- /**
- * Given a particular cause indicates whether or not the user
- * will be confronted with verbage explaining that they will
- * have to perform extra actions for this operation.
- *
- * @param cause of issue
- * @return message for presenting to the user
- */
- protected abstract boolean isActionRequired(
- VersionCompatibilityIssue.Cause cause);
-
- /**
- * Given a particular cause indicates whether or not this
- * operation should be allowed to continue.
- *
- * @param cause of issue
- * @return message for presenting to the user
- */
- protected abstract boolean isUnsupported(
- VersionCompatibilityIssue.Cause cause);
-
- /**
- * Given a particular cause indicates whether or not this
- * the user will be shown a warning dialog containing
- * a warning message regarding this operation.
- *
- * @param cause of issue
- * @return message for presenting to the user
- */
- protected abstract boolean isWarning(
- VersionCompatibilityIssue.Cause cause);
-
- /**
- * Given a particular cause indicates whether or not this
- * the user will be shown some verbage that may contain
- * information about this operation.
- *
- * @param cause of issue
- * @return message for presenting to the user
- */
- protected boolean isNotification(Cause cause) {
- boolean isNotification = false;
- if (cause != null) {
- Message msg = getLocalizedDetailMessage(cause);
- if (msg != null && !isWarning(cause) && !isActionRequired(cause)) {
- isNotification = true;
- }
- }
- return isNotification;
- }
-
- /**
- * Gets a list of strings representing the steps neccessary
- * to export and then reimport the data.
- *
- * @return List containing strings representing intruction steps
- */
- protected List<Message> getExportImportInstructions() {
- List<Message> instructions = new ArrayList<Message>();
- if (ui.isCLI())
- {
- instructions.add(INFO_ORACLE_EI_ACTION_STEP1_CLI.get());
- }
- else
- {
- instructions.add(INFO_ORACLE_EI_ACTION_STEP1.get());
- }
- instructions.add(INFO_ORACLE_EI_ACTION_STEP2.get());
- instructions.add(INFO_ORACLE_EI_ACTION_STEP3.get());
- instructions.add(INFO_ORACLE_EI_ACTION_STEP4.get());
- return instructions;
- }
-
- /**
- * Converts a set of compatibility issues into a set of set of
- * action oriented issues for directing tool behavior.
- *
- * @param compatibilityIssues list of issues
- * @return list of directives
- */
- private List<Directive> processEvents(
- List<VersionCompatibilityIssue> compatibilityIssues)
- {
- List<Directive> directives = new ArrayList<Directive>();
- if (compatibilityIssues != null) {
- for (VersionCompatibilityIssue evt : compatibilityIssues) {
- VersionCompatibilityIssue.Cause cause = evt.getCause();
- Set<Effect> effects = cause.getEffects();
- Message msg = getLocalizedDetailMessage(cause);
- if (isUnsupported(cause)) {
- isSupported = false;
- directives.add(new Directive(DirectiveType.NOT_SUPPORTED, msg));
- } else if (isActionRequired(cause)) {
- directives.add(new Directive(DirectiveType.ACTION, msg));
- } else if (isWarning(cause)) {
- directives.add(new Directive(DirectiveType.WARNING, msg));
- } else if (isNotification(cause)) {
- directives.add(new Directive(DirectiveType.INFO, msg));
- }
- if ((effects.contains(
- Effect.NO_SERVER_RESTART_FOLLOWING_REVERSION) ||
- effects.contains(
- Effect.REVERSION_DATA_EXPORT_AND_REIMPORT_REQUIRED) ||
- effects.contains(
- Effect.UPGRADE_DATA_EXPORT_AND_REIMPORT_REQUIRED)))
-
- {
- noServerStart = true;
- }
- }
- }
- return Collections.unmodifiableList(directives);
- }
-
- /**
- * Creates a list appropriate for the presentation implementation.
- *
- * @param list to format
- * @return String representing the list
- */
- protected String createUnorderedList(List<?> list) {
- StringBuilder sb = new StringBuilder();
- if (list != null) {
- for (Object o : list) {
- sb.append(/*bullet=*/"* ");
- sb.append(o.toString());
- sb.append(Constants.LINE_SEPARATOR);
- }
- }
- return sb.toString();
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/package-info.java
deleted file mode 100644
index 65cc7d3..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/package-info.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-/**
- * Defines the specific classes that are used by the upgrader. This includes
- * the specific objects representing the steps of the upgrader and some helper
- * classes that are used to perform the different operations that are required
- * to perform the upgrade.
- */
-package org.opends.quicksetup.upgrader;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java
deleted file mode 100644
index 0d5f7dd..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader.ui;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.upgrader.RemoteBuildManager;
-import org.opends.quicksetup.ui.CustomHTMLEditorKit;
-import org.opends.quicksetup.ui.UIFactory;
-import org.opends.quicksetup.ui.WebProxyDialog;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.net.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This panel represents the big error message the pops up when the
- * panel can't download the build information.
- */
-class BuildListDownloadErrorPanel extends JPanel {
-
- static private final Logger LOG =
- Logger.getLogger(BuildListDownloadErrorPanel.class.getName());
-
- private RemoteBuildManager rbm = null;
- private Throwable reason = null;
-
- private static final long serialVersionUID = 4614415561629811272L;
-
- /**
- * Creates an instance.
- *
- * @param rbm RemoteBuildManager that is having trouble.
- * @param reason Throwable indicating the error when downloading
- */
- public BuildListDownloadErrorPanel(RemoteBuildManager rbm,
- Throwable reason) {
- this.rbm = rbm;
- this.reason = reason;
- layoutPanel();
- }
-
- private void layoutPanel() {
- setLayout(new GridBagLayout());
-
- String proxyString = INFO_GENERAL_NONE.get().toString();
- Proxy proxy = rbm.getProxy();
- if (proxy != null) {
- SocketAddress addr = proxy.address();
- proxyString = addr.toString();
- }
-
- String baseContext = INFO_GENERAL_UNSPECIFIED.get().toString();
- URL url = rbm.getBaseContext();
- if (url != null) {
- baseContext = url.toString();
- }
-
- Message html =
- INFO_UPGRADE_CHOOSE_VERSION_BUILD_LIST_ERROR.get(baseContext,
- reason.getLocalizedMessage(),
- proxyString, baseContext);
-
- /* This helps with debugger the HTML rendering
- StringBuffer content = new StringBuffer();
- try {
- FileInputStream fis = new FileInputStream("/tmp/error-html");
- BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
- String line = null;
- while (null != (line = reader.readLine())) {
- content.append(line);
- }
- html = content.toString();
- } catch (IOException e) {
- e.printStackTrace();
- }
- */
-
- CustomHTMLEditorKit ek = new CustomHTMLEditorKit();
- ek.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ev) {
- Component dlg = SwingUtilities.getAncestorOfClass(Window.class,
- BuildListDownloadErrorPanel.this);
- specifyProxy(dlg);
-
- // Since the proxy info may change we need
- // to regenerate the text
- removeAll();
- layoutPanel();
- repaint();
- validate();
- }
- });
- add(UIFactory.makeHtmlPane(html, ek, UIFactory.INSTRUCTIONS_FONT));
- }
-
- /**
- * Displays a dialog prompting the user for proxy information
- * after which applys the new proxy information to the available
- * RemoteBuildManager.
- *
- * @param parent Component that will server as parent to the dialog
- */
- void specifyProxy(final Component parent) {
- Runnable proxySpecifier = new Runnable() {
- public void run() {
- String host = null;
- Integer port = null;
- Proxy proxy = rbm.getProxy();
- if (proxy != null) {
- SocketAddress address = proxy.address();
- if (address instanceof InetSocketAddress) {
- host = ((InetSocketAddress) address).getHostName();
- port = ((InetSocketAddress) address).getPort();
- }
- }
- String user = rbm.getProxyUserName();
- char[] pw = rbm.getProxyPassword();
- WebProxyDialog dlg;
- if (parent instanceof Dialog) {
- dlg = new WebProxyDialog((Dialog) parent, host, port, user, pw);
- } else if (parent instanceof Frame) {
- dlg = new WebProxyDialog((Frame) parent, host, port, user, pw);
- } else {
- dlg = new WebProxyDialog((Frame) null, host, port, user, pw);
- }
- dlg.setVisible(true);
- SocketAddress address = dlg.getSocketAddress();
- if (address != null) {
- proxy = new Proxy(Proxy.Type.HTTP, address);
- rbm.setProxy(proxy);
- rbm.setProxyUserName(dlg.getUserName());
- rbm.setProxyPassword(dlg.getPassword());
- }
- }
- };
- if (SwingUtilities.isEventDispatchThread()) {
- proxySpecifier.run();
- } else {
- try {
- SwingUtilities.invokeAndWait(proxySpecifier);
- } catch (Throwable t) {
- LOG.log(Level.INFO, "error waiting for event thread", t);
- }
- }
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
deleted file mode 100644
index cdc7f04..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader.ui;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.event.BrowseActionListener;
-import org.opends.quicksetup.ui.*;
-import org.opends.quicksetup.upgrader.Build;
-import org.opends.quicksetup.upgrader.RemoteBuildManager;
-import org.opends.quicksetup.upgrader.Upgrader;
-import org.opends.quicksetup.util.BackgroundTask;
-import org.opends.quicksetup.util.Utils;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This panel allows the user to select a remote or local build for upgrade.
- */
-public class ChooseVersionPanel extends QuickSetupStepPanel {
-
- static private final Logger LOG =
- Logger.getLogger(ChooseVersionPanel.class.getName());
-
- static private final long serialVersionUID = -6941309163077121917L;
-
- private JLabel lblCurrentVersion = null;
- private JRadioButton rbRemote = null;
- private JRadioButton rbLocal = null;
- private JComboBox cboBuild = null;
- private JLabel lblFile = null;
- private JTextField tfFile = null;
- private JButton butBrowse = null;
- private boolean loadBuildListAttempted = false;
- private RemoteBuildListComboBoxModelCreator bld = null;
-
- /**
- * Creates an instance.
- *
- * @param application this panel represents.
- */
- public ChooseVersionPanel(GuiApplication application) {
- super(application);
- getBuildLoader();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean blockingBeginDisplay() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void beginDisplay(UserData data) {
- super.beginDisplay(data);
-
- if (!loadBuildListAttempted) {
-
- // Begin display is called outside the UI
- // thread. loadBuildList must be called
- // inside the UI thread in order to properly
- // set up the ProgressListenerInputStream
- // displayed while downloading the build list.
- // The enclosing thread and sleep statement is
- // there to allow the card layout to switch to
- // this panel before setting up the downloading.
- int delay = 100;
- ActionListener loadPerformer = new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- rbLocal.setSelected(true);
- rbRemote.setEnabled(false);
- setComponentEnablement();
- cboBuild.setRenderer(new BuildListLoadingComboBoxRenderer());
- try {
- loadBuildList();
- } catch (IOException e) {
- LOG.log(Level.INFO, "Error loading build list", e);
- }
- }
- };
- Timer t = new Timer(delay, loadPerformer);
- t.setRepeats(false);
- t.start();
- }
-
- lblCurrentVersion.setText(
- Utils.getBuildString(getApplication().getInstallation()));
-
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getFieldValue(FieldName fieldName) {
- Object value = null;
- if (FieldName.UPGRADE_DOWNLOAD.equals(fieldName)) {
- value = rbRemote.isSelected();
- } else if (FieldName.UPGRADE_BUILD_TO_DOWNLOAD.equals(fieldName)) {
- value = cboBuild.getSelectedItem();
- } else if (FieldName.UPGRADE_FILE.equals(fieldName)) {
- String s = tfFile.getText();
- if (s != null && s.length() > 0) {
- value = new File(tfFile.getText());
- }
- }
- return value;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Component createInputPanel() {
- Component c;
-
- JPanel p = UIFactory.makeJPanel();
-
- LabelFieldDescriptor currentVersionDescriptor = new LabelFieldDescriptor(
- INFO_UPGRADE_REVIEW_PANEL_OLD_VERSION_LABEL.get(),
- INFO_UPGRADE_REVIEW_PANEL_OLD_VERSION_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY,
- 0
- );
-
- lblCurrentVersion = UIFactory.makeJLabel(
- UIFactory.IconType.NO_ICON,
- Message.EMPTY, UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
- rbRemote = UIFactory.makeJRadioButton(
- INFO_UPGRADE_CHOOSE_VERSION_REMOTE_LABEL.get(),
- INFO_UPGRADE_CHOOSE_VERSION_REMOTE_TOOLTIP.get(),
- UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
- rbLocal = UIFactory.makeJRadioButton(
- INFO_UPGRADE_CHOOSE_VERSION_LOCAL_LABEL.get(),
- INFO_UPGRADE_CHOOSE_VERSION_LOCAL_TOOLTIP.get(),
- UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
- ButtonGroup grpRemoteLocal = new ButtonGroup();
- grpRemoteLocal.add(rbRemote);
- grpRemoteLocal.add(rbLocal);
- grpRemoteLocal.setSelected(rbRemote.getModel(), true);
-
- cboBuild = UIFactory.makeJComboBox();
- cboBuild.setEditable(false);
-
- // TODO: use UIFactory
- tfFile = new JTextField();
- tfFile.setColumns(20);
-
- butBrowse =
- UIFactory.makeJButton(INFO_BROWSE_BUTTON_LABEL.get(),
- INFO_BROWSE_BUTTON_TOOLTIP.get());
-
- BrowseActionListener l =
- new BrowseActionListener(tfFile,
- BrowseActionListener.BrowseType.OPEN_ZIP_FILE,
- getMainWindow());
- butBrowse.addActionListener(l);
-
- lblFile = UIFactory.makeJLabel(null,
- INFO_UPGRADE_CHOOSE_VERSION_LOCAL_PATH.get(),
- UIFactory.TextStyle.SECONDARY_FIELD_VALID);
-
- JPanel pnlBrowse = Utilities.createBrowseButtonPanel(
- lblFile,
- tfFile,
- butBrowse);
-
- ActionListener radioListener = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- setComponentEnablement();
- }
- };
-
- rbRemote.addActionListener(radioListener);
- rbLocal.addActionListener(radioListener);
-
- p.setLayout(new GridBagLayout());
- // p.setBorder(BorderFactory.createLineBorder(Color.RED));
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- p.add(UIFactory.makeJLabel(currentVersionDescriptor), gbc);
-
- gbc.gridx = 1;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- p.add(lblCurrentVersion, gbc);
-
- gbc.gridx = 0;
- gbc.gridy++;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets.top = UIFactory.TOP_INSET_RADIOBUTTON + 15;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- p.add(rbRemote, gbc);
-
- gbc.gridy++;
- gbc.gridwidth = 2;
- gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
- gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE +
- UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.anchor = GridBagConstraints.LINE_START;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.weightx = 2;
- p.add(cboBuild, gbc);
-
- gbc.gridx = 1;
- gbc.weightx = 1.5;
- gbc.anchor = GridBagConstraints.LINE_START;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets = UIFactory.getEmptyInsets();
- JPanel fill = UIFactory.makeJPanel();
- // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
- p.add(fill, gbc);
-
- gbc.gridy++;
- gbc.gridx = 0;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- p.add(rbLocal, gbc);
-
- gbc.gridy++;
- gbc.insets = UIFactory.getEmptyInsets();
- gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
- gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE +
- UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.weightx = 2;
- gbc.fill = GridBagConstraints.BOTH;
- // pnlBrowse.setBorder(BorderFactory.createLineBorder(Color.BLUE));
- p.add(pnlBrowse, gbc);
-
- gbc.gridy++;
- gbc.weighty = 1.0;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
- gbc.anchor = GridBagConstraints.LINE_START;
- JPanel fill2 = UIFactory.makeJPanel();
- //fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
- p.add(fill2, gbc);
-
- c = p;
- return c;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getTitle() {
- return INFO_UPGRADE_CHOOSE_VERSION_PANEL_TITLE.get();
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getInstructions() {
- return INFO_UPGRADE_CHOOSE_VERSION_PANEL_INSTRUCTIONS.get();
- }
-
- private RemoteBuildListComboBoxModelCreator getBuildLoader() {
- if (bld == null) {
- RemoteBuildManager rbm =
- ((Upgrader) getApplication()).getRemoteBuildManager();
- try {
- bld = new RemoteBuildListComboBoxModelCreator(rbm);
- } catch (IOException e) {
- LOG.log(Level.INFO, "error creating remote build list combo " +
- "box model creator", e);
- }
- }
- return bld;
- }
-
- private void loadBuildList() throws IOException {
- bld.startBackgroundTask();
- }
-
- /**
- * Renders the combo box when there has been an error downloading
- * the build information.
- */
- private class BuildListErrorComboBoxRenderer extends JLabel
- implements ListCellRenderer {
-
- /**
- * The serial version identifier required to satisfy the compiler because
- * this * class extends a class that implements the
- * {@code java.io.Serializable} interface. This value was generated using
- * the {@code serialver} command-line utility included with the Java SDK.
- */
- private static final long serialVersionUID = -7075573664472711599L;
-
- /**
- * Creates a default instance.
- */
- public BuildListErrorComboBoxRenderer() {
- super(INFO_UPGRADE_CHOOSE_VERSION_UNABLE_TO_ACCESS_BUILD_INFO.get()
- .toString(),
- UIFactory.getImageIcon(UIFactory.IconType.WARNING),
- SwingConstants.LEFT);
- UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_STATUS);
- setOpaque(true);
- setBackground(Color.WHITE);
- }
-
- /**
- * {@inheritDoc}
- */
- public Component getListCellRendererComponent(JList jList,
- Object object,
- int i,
- boolean b,
- boolean b1) {
- return this;
- }
- }
-
- /**
- * Renders the combo box when there has been an error downloading
- * the build information.
- */
- private class BuildListLoadingComboBoxRenderer extends JLabel
- implements ListCellRenderer {
-
- /**
- * The serial version identifier required to satisfy the compiler because
- * this * class extends a class that implements the
- * {@code java.io.Serializable} interface. This value was generated using
- * the {@code serialver} command-line utility included with the Java SDK.
- */
- private static final long serialVersionUID = -7075573664472711599L;
-
- /**
- * Creates a default instance.
- */
- public BuildListLoadingComboBoxRenderer() {
- super(INFO_UPGRADE_CHOOSE_VERSION_LOADING_BUILD_INFO.get().toString(),
- UIFactory.getImageIcon(UIFactory.IconType.WAIT_TINY),
- SwingConstants.LEFT);
- UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_STATUS);
- setOpaque(true);
- setBackground(Color.WHITE);
- }
-
- /**
- * {@inheritDoc}
- */
- public Component getListCellRendererComponent(JList jList,
- Object object,
- int i,
- boolean b,
- boolean b1) {
- return this;
- }
- }
-
- /**
- * Uses the remote build manager is a separate thread to create
- * and populate the combo box model with build information. Contains
- * the loop and dialog prompting that happens if there is a problem
- * accessing the remote build repository.
- */
- private class RemoteBuildListComboBoxModelCreator
- extends BackgroundTask<java.util.List<Build>> {
-
- private RemoteBuildManager rbm = null;
- private InputStream in = null;
-
- public RemoteBuildListComboBoxModelCreator(RemoteBuildManager rbm)
- throws IOException
- {
- this.rbm = rbm;
-
- // This is a lengthy operation that must be
- // performed in the event thread. So try
- // to do this work now during construction
- // rather than when the panel becomes visible
- // for the first time. If we fail we'll try
- // again later.
- try {
- getInputStream();
- } catch (IOException e) {
- LOG.log(Level.INFO, "Error obtaining build list input stream", e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public java.util.List<Build> processBackgroundTask() throws Exception {
- return rbm.listBuilds(getInputStream());
- }
-
- /**
- * {@inheritDoc}
- */
- public void backgroundTaskCompleted(java.util.List<Build> buildList,
- Throwable throwable) {
- ComboBoxModel cbm = null;
- if (throwable == null) {
- cbm = new DefaultComboBoxModel(buildList.toArray());
- } else {
- try {
- String[] options = {
- INFO_RETRY_BUTTON_LABEL.get().toString(),
- INFO_CLOSE_BUTTON_LABEL.get().toString()
- };
- int i = JOptionPane.showOptionDialog(getMainWindow(),
- new BuildListDownloadErrorPanel(rbm,
- throwable),
- INFO_NETWORK_ERROR_TITLE.get().toString(),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.ERROR_MESSAGE,
- null,
- options,
- null);
- if (i == JOptionPane.NO_OPTION ||
- i == JOptionPane.CLOSED_OPTION) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- cboBuild.setRenderer(new BuildListErrorComboBoxRenderer());
- // Disable the remote widgets
- cboBuild.setEnabled(false);
- rbLocal.setSelected(true);
- rbRemote.setSelected(false);
- // grpRemoteLocal.setSelected(rbRemote.getModel(), false);
- rbRemote.setEnabled(false);
- setComponentEnablement();
- }
- });
- } else {
- loadBuildList();
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
- final ComboBoxModel cbmFinal = cbm;
- if (cbm != null) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- loadBuildListAttempted = true;
- cboBuild.setModel(cbmFinal);
- cboBuild.setRenderer(new DefaultListCellRenderer());
- // Disable the remote widgets
- rbLocal.setSelected(false);
- rbRemote.setSelected(true);
- // grpRemoteLocal.setSelected(rbRemote.getModel(), false);
- rbRemote.setEnabled(true);
- setComponentEnablement();
- }
- });
- }
- }
-
- private InputStream getInputStream() throws IOException {
- if (this.in == null) {
- this.in = rbm.getDailyBuildsInputStream(getMainWindow(),
- INFO_UPGRADE_CHOOSE_VERSION_READING_BUILD_INFO.get());
- }
- return this.in;
- }
- }
-
- private void setComponentEnablement() {
- cboBuild.setEnabled(rbRemote.isSelected());
- lblFile.setEnabled(rbLocal.isSelected());
- tfFile.setEnabled(rbLocal.isSelected());
- butBrowse.setEnabled((rbLocal.isSelected()));
- }
-
-// public static void main(String[] args) {
-// final UserData ud = new UpgradeUserData();
-// ud.setServerLocation("XXX/XXXXX/XX/XXXXXXXXXXXX/XXXX");
-// Upgrader app = new Upgrader();
-// app.setUserData(ud);
-// final ChooseVersionPanel p = new ChooseVersionPanel(app);
-// p.initialize();
-// JFrame frame = new JFrame();
-// frame.getContentPane().add(p);
-// frame.addComponentListener(new ComponentAdapter() {
-// public void componentHidden(ComponentEvent componentEvent) {
-// System.exit(0);
-// }
-// });
-// frame.pack();
-// frame.setVisible(true);
-// new Thread(new Runnable() {
-// public void run() {
-// p.beginDisplay(ud);
-// }
-// }).start();
-//
-// }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
deleted file mode 100644
index 6a48422..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader.ui;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.ui.FieldName;
-import org.opends.quicksetup.ui.LabelFieldDescriptor;
-import org.opends.quicksetup.ui.ReviewPanel;
-import org.opends.quicksetup.ui.UIFactory;
-import org.opends.quicksetup.upgrader.Upgrader;
-import org.opends.quicksetup.util.Utils;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * Presents upgrade information to the user to confirm before starting the
- * actual upgrade.
- */
-public class UpgraderReviewPanel extends ReviewPanel {
-
- static private final Logger LOG =
- Logger.getLogger(UpgraderReviewPanel.class.getName());
-
- private static final long serialVersionUID = 5942916658585976799L;
-
- JLabel tcServerLocation = null;
- JLabel tcOldBuild = null;
- JLabel tcNewBuild = null;
- private JCheckBox checkBox;
-
- /**
- * Creates an instance.
- * @param application Application represented by this panel
- */
- public UpgraderReviewPanel(Upgrader application) {
- super(application);
- }
-
- /**
- * {@inheritDoc}
- */
- public void beginDisplay(UserData data) {
- tcServerLocation.setText(getServerToUpgrade());
-
- // Unfortunately these string are different.
- // The new build is the build display name that
- // appears in the available builds information page.
- // It is currently not feasible to correlate these.
- tcOldBuild.setText(getOldBuildString());
- tcNewBuild.setText(getNewBuildString());
-
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getFieldValue(FieldName fieldName) {
- Object value = null;
- if (fieldName == FieldName.SERVER_START_UPGRADER) {
- value = getBottomComponent().isSelected();
- }
- return value;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean blockingBeginDisplay() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getTitle() {
- return INFO_UPGRADE_REVIEW_PANEL_TITLE.get();
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getInstructions() {
- return INFO_UPGRADE_REVIEW_PANEL_INSTRUCTIONS.get();
- }
-
- /**
- * {@inheritDoc}
- */
- protected JPanel createFieldsPanel() {
- JPanel p = UIFactory.makeJPanel();
-
- LabelFieldDescriptor serverDescriptor = new LabelFieldDescriptor(
- INFO_UPGRADE_REVIEW_PANEL_SERVER_LABEL.get(),
- INFO_UPGRADE_REVIEW_PANEL_SERVER_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY,
- 0
- );
-
- LabelFieldDescriptor oldVersionDescriptor = new LabelFieldDescriptor(
- INFO_UPGRADE_REVIEW_PANEL_OLD_VERSION_LABEL.get(),
- INFO_UPGRADE_REVIEW_PANEL_OLD_VERSION_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY,
- 0
- );
-
- LabelFieldDescriptor newVersionDescriptor = new LabelFieldDescriptor(
- INFO_UPGRADE_REVIEW_PANEL_NEW_VERSION_LABEL.get(),
- INFO_UPGRADE_REVIEW_PANEL_NEW_VERSION_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY,
- 0
- );
-
- // Here we use labels instead of calling UIFactory.makeJTextComponent.
- // which supplies us with a JEditorPane for read-only values. We don't
- // know the values of these fields at this time. If we use JEditorPanes
- // here when the panel is made visible there is an effect where the text
- // is seen racing left when first seen.
- tcServerLocation = UIFactory.makeJLabel(serverDescriptor);
- UIFactory.setTextStyle(tcServerLocation, UIFactory.TextStyle.READ_ONLY);
- tcOldBuild = UIFactory.makeJLabel(oldVersionDescriptor);
- UIFactory.setTextStyle(tcOldBuild, UIFactory.TextStyle.READ_ONLY);
- tcNewBuild = UIFactory.makeJLabel(newVersionDescriptor);
- UIFactory.setTextStyle(tcNewBuild, UIFactory.TextStyle.READ_ONLY);
-
- p.setLayout(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.anchor = GridBagConstraints.NORTHWEST;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- LabelFieldDescriptor[] descs = {serverDescriptor, oldVersionDescriptor,
- newVersionDescriptor};
- JLabel[] labels = {tcServerLocation, tcOldBuild, tcNewBuild};
-
- for (int i=0; i<descs.length; i++)
- {
- gbc.gridwidth = GridBagConstraints.RELATIVE;
- gbc.weightx = 0.0;
- if (i > 0)
- {
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- } else
- {
- gbc.insets.top = 0;
- }
- gbc.insets.left = 0;
- gbc.anchor = GridBagConstraints.NORTHWEST;
- p.add(UIFactory.makeJLabel(descs[i]), gbc);
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
-
- gbc.weightx = 1.0;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- p.add(labels[i], gbc);
- }
-
- return p;
- }
-
- private String getServerToUpgrade() {
- return getUserData().getServerLocation();
- }
-
- private String getOldBuildString() {
- return Utils.getBuildString(getApplication().getInstallation());
- }
-
- /**
- * Gets the string by which the new build is known in the
- * available builds page.
- * @return String indicating the new build
- */
- private String getNewBuildString() {
- String b = null;
- try {
- BuildInformation bi = BuildInformation.getCurrent();
- if (bi != null) {
- b = bi.toString();
- }
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "error trying to determine new build string", e);
- }
- if (b == null) {
- b = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- return b;
- }
-
- /**
- * {@inheritDoc}
- */
- protected JCheckBox getBottomComponent()
- {
- if (checkBox == null)
- {
- checkBox =
- UIFactory.makeJCheckBox(INFO_UPGRADE_REVIEW_PANEL_START_SERVER.get(),
- INFO_START_SERVER_TOOLTIP.get(), UIFactory.TextStyle.CHECKBOX);
- checkBox.setSelected(getApplication().getUserData().getStartServer());
- }
- return checkBox;
- }
-
-// public static void main(String[] args) {
-// final UserData ud = new UpgradeUserData();
-// ud.setServerLocation("XXX/XXXXX/XX/XXXXXXXXXXXX/XXXX");
-// Upgrader app = new Upgrader();
-// app.setUserData(ud);
-// final UpgraderReviewPanel p = new UpgraderReviewPanel(app);
-// p.initialize();
-// JFrame frame = new JFrame();
-// frame.getContentPane().add(p);
-// frame.addComponentListener(new ComponentAdapter() {
-// public void componentHidden(ComponentEvent componentEvent) {
-// System.exit(0);
-// }
-// });
-// frame.pack();
-// frame.setVisible(true);
-// new Thread(new Runnable() {
-// public void run() {
-// p.beginDisplay(ud);
-// }
-// }).start();
-//
-// }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
deleted file mode 100644
index 2dcd3c4..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.upgrader.ui;
-
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.ui.*;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.event.BrowseActionListener;
-import org.opends.quicksetup.upgrader.Upgrader;
-import org.opends.server.util.DynamicConstants;
-
-import javax.swing.*;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
-
-/**
- * This panel is used to show a welcome message. If this is the WebStart,
- * allows the user to select a build to upgrade. Otherwise shows the user
- * some readonly information about the current build.
- */
-public class WelcomePanel extends QuickSetupStepPanel {
-
- private static final long serialVersionUID = 8695606871542491768L;
-
- private JLabel lblServerLocation;
-
- private JTextComponent tcServerLocation;
-
- private JTextComponent tcCurrentServerBuildNumber;
-
- /**
- * Default constructor.
- * @param application Upgrader application
- */
- public WelcomePanel(Upgrader application) {
- super(application);
- }
-
- /**
- * {@inheritDoc}
- */
- public void beginDisplay(UserData data) {
- super.beginDisplay(data);
- tcServerLocation.setText(data.getServerLocation());
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getFieldValue(FieldName fieldName) {
- Object v = null;
- if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
- v = tcServerLocation.getText();
- }
- return v;
- }
-
- /**
- * {@inheritDoc}
- */
- public void displayFieldInvalid(FieldName fieldName, boolean invalid) {
- UIFactory.TextStyle style;
- if (invalid) {
- style = UIFactory.TextStyle.PRIMARY_FIELD_INVALID;
- } else {
- style = UIFactory.TextStyle.PRIMARY_FIELD_VALID;
- }
- if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
- UIFactory.setTextStyle(lblServerLocation, style);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getTitle() {
- return INFO_UPGRADE_WELCOME_PANEL_TITLE.get();
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getInstructions() {
- /*
- * We can use org.opends.server.util.DynamicConstants without problems as it
- * has been added to quicksetup.jar during build time.
- */
- return Utils.getCustomizedObject(
- "INFO_UPGRADE_WELCOME_PANEL_WEBSTART_INSTRUCTIONS",
- INFO_UPGRADE_WELCOME_PANEL_WEBSTART_INSTRUCTIONS.get(
- DynamicConstants.COMPACT_VERSION_STRING,
- DynamicConstants.BUILD_ID),
- Message.class);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Component createInputPanel() {
- Component c;
-
- LabelFieldDescriptor serverLocationDescriptor =
- new LabelFieldDescriptor(INFO_UPGRADE_LOCATION_LABEL.get(),
- INFO_UPGRADE_LOCATION_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.TEXTFIELD,
- LabelFieldDescriptor.LabelType.PRIMARY,
- UIFactory.PATH_FIELD_SIZE);
-
- LabelFieldDescriptor serverLocationDescriptorRO =
- new LabelFieldDescriptor(INFO_UPGRADE_LOCATION_LABEL.get(),
- INFO_UPGRADE_LOCATION_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY,
- UIFactory.PATH_FIELD_SIZE);
-
- LabelFieldDescriptor serverBuildDescriptorRO =
- new LabelFieldDescriptor(INFO_UPGRADE_BUILD_ID_LABEL.get(),
- INFO_UPGRADE_BUILD_ID_TOOLTIP.get(),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY,
- UIFactory.PATH_FIELD_SIZE);
-
- JPanel pnlBuildInfo = UIFactory.makeJPanel();
- pnlBuildInfo.setLayout(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- UserData userData = getApplication().getUserData();
-
- // The WebStart version of this tool allows the user to
- // select a build to upgrade. Running the tool from the
- // command line implies a build.
- if (Utils.isWebStart()) {
-
- lblServerLocation = UIFactory.makeJLabel(serverLocationDescriptor);
-
- tcServerLocation =
- UIFactory.makeJTextComponent(serverLocationDescriptor,
- userData.getServerLocation());
-
- JButton butBrowse =
- UIFactory.makeJButton(INFO_BROWSE_BUTTON_LABEL.get(),
- INFO_BROWSE_BUTTON_TOOLTIP.get());
-
- BrowseActionListener l =
- new BrowseActionListener(tcServerLocation,
- BrowseActionListener.BrowseType.LOCATION_DIRECTORY,
- getMainWindow());
- butBrowse.addActionListener(l);
-
- JPanel pnlBrowser = Utilities.createBrowseButtonPanel(
- lblServerLocation,
- tcServerLocation,
- butBrowse);
- pnlBrowser.setOpaque(false);
-
- //pnlBrowser.setBorder(BorderFactory.createLineBorder(Color.GREEN));
- gbc.insets.top = 15; // non-standard but looks better
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
- pnlBuildInfo.add(pnlBrowser, gbc);
-
- gbc.gridy = 1;
- gbc.weighty = 1.0;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
- gbc.anchor = GridBagConstraints.LINE_START;
- JPanel fill = UIFactory.makeJPanel();
- // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
- pnlBuildInfo.add(fill, gbc);
-
- } else {
-
- tcServerLocation = UIFactory.makeJTextComponent(
- serverLocationDescriptorRO, null);
-
- String buildId = null;
- Installation installation = getApplication().getInstallation();
- try {
- buildId = installation.getBuildInformation().getBuildId();
- } catch (Exception e) {
- buildId = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
-
- tcCurrentServerBuildNumber = UIFactory.makeJTextComponent(
- serverBuildDescriptorRO,
- buildId);
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = GridBagConstraints.FIRST_LINE_START;
- gbc.insets.top = 15; // non-standard but looks better
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- pnlBuildInfo.add(UIFactory.makeJLabel(serverLocationDescriptorRO), gbc);
-
-
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.weightx = 1.0;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.PAGE_START;
- pnlBuildInfo.add(tcServerLocation, gbc);
-
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.anchor = GridBagConstraints.LINE_START;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- pnlBuildInfo.add(UIFactory.makeJLabel(serverBuildDescriptorRO), gbc);
-
- gbc.gridx = 1;
- gbc.gridy = 1;
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- pnlBuildInfo.add(tcCurrentServerBuildNumber, gbc);
-
- gbc.gridy = 2;
- gbc.weighty = 1.0;
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.BOTH;
- gbc.anchor = GridBagConstraints.LINE_START;
- JPanel fill = UIFactory.makeJPanel();
- //fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
- pnlBuildInfo.add(fill, gbc);
- }
-
- c = pnlBuildInfo;
-
- return c;
- }
-
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java b/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
deleted file mode 100644
index 63442ec..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
- */
-
-package org.opends.quicksetup.util;
-import org.opends.messages.Message;
-
-import org.opends.quicksetup.Installation;
-import org.opends.server.util.SetupUtils;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.io.File;
-import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-
-/**
- * Class for invoking OpenDS tools in external processes.
- */
-public class ExternalTools {
-
- static private final Logger LOG =
- Logger.getLogger(ServerController.class.getName());
-
- private Installation installation;
-
- /**
- * Creates a new instance that will invoke tools from a particular
- * installation in external JVM processes.
- * @param installation representing the tools location
- */
- public ExternalTools(Installation installation) {
- this.installation = installation;
- }
-
- /**
- * Backs up all the databases to a specified directory.
- * @param backupDir File representing the directory where the backups will
- * be stored
- * @return OperationOutput containing information about the operation
- * @throws java.io.IOException if the process could not be started
- * @throws InterruptedException if the process was prematurely interrupted
- */
- public OperationOutput backup(File backupDir)
- throws IOException, InterruptedException {
- String toolName = Installation.BACKUP;
- List<String> args = new ArrayList<String>();
- args.add(Utils.getScriptPath(
- Utils.getPath(installation.getCommandFile(toolName))));
- args.add("-a"); // backup all
- args.add("-d"); // backup to directory
- args.add(Utils.getPath(backupDir));
- return startProcess(toolName, args);
- }
-
- /**
- * Backs up all the databases to a specified directory.
- * @param source File representing the source data
- * @param target File representing the target data
- * @param otherArgs File representing the output data
- * @return OperationOutput containing information about the operation
- * @throws java.io.IOException if the process could not be started
- * @throws InterruptedException if the process was prematurely interrupted
- */
- public OperationOutput ldifDiff(File source, File target, String... otherArgs)
- throws IOException, InterruptedException {
- String toolName = Installation.LDIF_DIFF;
- List<String> args = new ArrayList<String>();
- args.add(Utils.getPath(installation.getCommandFile(toolName)));
- args.add("-s"); // source LDIF
- args.add(Utils.getScriptPath(Utils.getPath(source)));
- args.add("-t"); // target LDIF
- args.add(Utils.getPath(target));
- if (otherArgs != null) {
- for (String otherArg : otherArgs) {
- args.add(otherArg);
- }
- }
- return startProcess(toolName, args);
- }
-
- private OperationOutput startProcess(final String toolName, List<String> args)
- throws IOException, InterruptedException
- {
- final OperationOutput oo = new OperationOutput();
-
- LOG.log(Level.INFO, "Invoking " + Utils.listToString(args, " "));
-
- ProcessBuilder pb = new ProcessBuilder(args);
- Map<String, String> env = pb.environment();
- env.put(SetupUtils.OPENDJ_JAVA_HOME, System.getProperty("java.home"));
-
- Process p = pb.start();
-
- BufferedReader out =
- new BufferedReader(new InputStreamReader(p.getErrorStream()));
- new OutputReader(out) {
- public void processLine(String line) {
- oo.addErrorMessage(Message.raw(line));
- LOG.log(Level.INFO, toolName + ": " + line);
- }
- };
-
- BufferedReader err =
- new BufferedReader(new InputStreamReader(p.getInputStream()));
- new OutputReader(err) {
- public void processLine(String line) {
- oo.addOutputMessage(Message.raw(line));
- LOG.log(Level.INFO, toolName + ": " + line);
- }
- };
- oo.setReturnCode(p.waitFor());
- return oo;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java b/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
index 9772f09..8e7a483 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.quicksetup.util;
@@ -116,32 +116,6 @@
}
/**
- * Recursively copies any files or directories appearing in
- * <code>source</code> or a subdirectory of <code>source</code>
- * to the corresponding directory under <code>target</code>. Files
- * in under <code>source</code> are not copied to <code>target</code>
- * if a file by the same name already exists in <code>target</code>.
- *
- * @param source source directory
- * @param target target directory
- * @param filter for specifying particular files to synchronize
- * @throws ApplicationException if there is a problem copying files
- */
- public void synchronize(File source, File target, FileFilter filter)
- throws ApplicationException
- {
- if (source != null && target != null) {
- String[] sourceFileNames = source.list();
- if (sourceFileNames != null) {
- for (String sourceFileName : sourceFileNames) {
- File sourceFile = new File(source, sourceFileName);
- copyRecursively(sourceFile, target, filter, false);
- }
- }
- }
- }
-
- /**
* Renames the source file to the target file. If the target file exists
* it is first deleted. The rename and delete operation return values
* are checked for success and if unsuccessful, this method throws an
@@ -243,7 +217,7 @@
File[] children = parentDir.listFiles();
if (children != null) {
for (File child : children) {
- delete(child);
+ deleteRecursively(child);
}
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java b/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
deleted file mode 100644
index 60acb7e..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
- */
-
-package org.opends.quicksetup.util;
-
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-import static org.opends.messages.QuickSetupMessages.*;
-
-import org.opends.quicksetup.*;
-
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.TextErrorLogPublisher;
-import org.opends.server.loggers.TextWriter;
-import org.opends.server.loggers.ErrorLogger;
-import org.opends.server.loggers.TextAccessLogPublisher;
-import org.opends.server.loggers.AccessLogger;
-import org.opends.server.types.Modification;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.InitializationException;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.RawAttribute;
-import org.opends.server.types.SearchScope;
-import org.opends.server.types.SearchFilter;
-import org.opends.server.types.SearchResultEntry;
-import org.opends.server.api.DebugLogPublisher;
-import org.opends.server.api.ErrorLogPublisher;
-import org.opends.server.api.AccessLogPublisher;
-import org.opends.server.util.LDIFException;
-import org.opends.server.util.ModifyChangeRecordEntry;
-import org.opends.server.util.ChangeRecordEntry;
-import org.opends.server.util.AddChangeRecordEntry;
-import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.protocols.internal.InternalSearchOperation;
-import org.opends.server.protocols.ldap.LDAPAttribute;
-import org.opends.server.core.ModifyOperation;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.core.AddOperation;
-import org.opends.server.core.DeleteOperation;
-import org.opends.server.core.CompareOperation;
-import org.opends.server.config.ConfigException;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.io.IOException;
-
-/**
- * Class used to manipulate an OpenDS server in the same JVM process as
- * the client class.
- */
-public class InProcessServerController {
-
- static private final Logger LOG =
- Logger.getLogger(InProcessServerController.class.getName());
-
- /**
- * Indicates that the server has already been started once and that a
- * restart should happen instead.
- */
- static private boolean serverHasBeenStarted = false;
-
- static private ErrorLogPublisher<?> startupErrorPublisher;
-
- static private AccessLogPublisher<?> startupAccessPublisher;
-
- static private DebugLogPublisher<?> startupDebugPublisher;
-
- /**
- * Pushes messages published by the server loggers into OperationOutput.
- */
- static private abstract class ServerControllerTextWriter
- implements TextWriter
- {
-
- private int bytesWritten = 0;
- private OperationOutput output = null;
-
- abstract void storeRecord(String record, OperationOutput output);
-
- ServerControllerTextWriter() {
- // do nothing
- }
-
- public void setOutput(OperationOutput ouput) {
- this.output = ouput;
- }
-
- public void writeRecord(String record) {
- if (record != null) {
- bytesWritten += bytesWritten;
- if (output != null) {
- storeRecord(record, output);
- }
- }
- }
-
- public void flush() {
- // do nothing;
- }
-
- public void shutdown() {
- // do nothing;
- }
-
- public long getBytesWritten() {
- return bytesWritten;
- }
- }
-
- static private ServerControllerTextWriter debugWriter =
- new ServerControllerTextWriter() {
- void storeRecord(String record,
- OperationOutput output) {
- LOG.log(Level.INFO, "server start (debug log): " +
- record);
- output.addDebugMessage(Message.raw(record));
- }};
-
- static private ServerControllerTextWriter errorWriter =
- new ServerControllerTextWriter() {
- void storeRecord(String record,
- OperationOutput output) {
- LOG.log(Level.INFO, "server start (error log): " +
- record);
- output.addErrorMessage(Message.raw(record));
- }
- };
-
- static private ServerControllerTextWriter accessWriter =
- new ServerControllerTextWriter() {
- void storeRecord(String record,
- OperationOutput output) {
- LOG.log(Level.INFO, "server start (access log): " +
- record);
- output.addAccessMessage(Message.raw(record));
- }
- };
-
- private Installation installation;
-
- /**
- * Creates a new instance that will operate on <code>application</code>'s
- * installation.
- * @param installation representing the server instance to control
- * @throws IllegalStateException if the the version of the OpenDS code
- * running in this JVM is not the same version as the code whose bits
- * are stored in <code>installation</code>.
- */
- public InProcessServerController(Installation installation)
- throws IllegalStateException
- {
-
- // Attempting to use DirectoryServer with a configuration file
- // for a different version of the server can cause problems for
- // the server at startup.
- BuildInformation installBi;
- BuildInformation currentBi;
- try {
- installBi = installation.getBuildInformation();
- currentBi = BuildInformation.getCurrent();
- } catch (Exception e) {
- throw new IllegalStateException("Failed to verify the build version of " +
- "the " + installation + " matches the currently executing " +
- "version.");
- }
-
- if (!currentBi.equals(installBi)) {
- throw new IllegalStateException("The build version of the " +
- "installation " + installation + " is " + installBi +
- " and does not match the currently executing version " +
- currentBi);
- }
-
- this.installation=installation;
- }
-
- /**
- * Starts the directory server within this process.
- * @param disableConnectionHandlers boolean that when true starts the
- * the server mode that is otherwise up and running but will not accept any
- * connections from external clients (i.e., does not create or initialize the
- * connection handlers). This could be useful, for example, in an upgrade mode
- * where it might be helpful to start the server but don't want it to appear
- * externally as if the server is online without connection handlers
- * listening.
- * @return OperationOutput object containing output from the start server
- * command invocation.
- * @throws org.opends.server.config.ConfigException
- * If there is a problem with the Directory Server
- * configuration that prevents a critical component
- * from being instantiated.
- *
- * @throws org.opends.server.types.InitializationException
- * If some other problem occurs while
- * attempting to initialize and start the
- * Directory Server.
- */
- public OperationOutput startServer(boolean disableConnectionHandlers)
- throws InitializationException, ConfigException
- {
- LOG.log(Level.INFO, "Starting in process server with connection handlers " +
- (disableConnectionHandlers ? "disabled" : "enabled"));
- System.setProperty(
- "org.opends.server.DisableConnectionHandlers",
- disableConnectionHandlers ? "true" : "false");
- return startServer();
- }
-
- /**
- * Disables the server's connection handlers upon startup. The server
- * when started is otherwise up and running but will not accept any
- * connections from external clients (i.e., does not create or initialize the
- * connection handlers). This could be useful, for example, in an upgrade mode
- * where it might be helpful to start the server but don't want it to appear
- * externally as if the server is online without connection handlers
- * listening.
- * @param disable boolean that when true disables connection handlers when
- * the server is started.
- */
- static public void disableConnectionHandlers(boolean disable) {
- System.setProperty(
- "org.opends.server.DisableConnectionHandlers",
- disable ? "true" : "false");
- }
-
- /**
- * Disables the server's synchronization provider upon startup. The server
- * when started is otherwise up and running but will not accept any
- * synchronization message. This could be useful, for example,
- * in an upgrade mode where it might be helpful to start the server
- * but don't want it to appear externally.
- * @param disable boolean that when true disables synchronization provider
- * when the server is started.
- */
- static public void disableSynchronization(boolean disable) {
- System.setProperty(
- "org.opends.server.DisableSynchronization",
- disable ? "true" : "false");
- }
- /**
- * Disables the admin data synchronization upon startup.
- * @param disable boolean that when true disables connection handlers when
- * the server is started.
- */
- static public void disableAdminDataSynchronization(boolean disable) {
- System.setProperty(
- "org.opends.server.DisableAdminDataSynchronization",
- disable ? "true" : "false");
- }
-
- /**
- * Stops a server that had been running 'in process'.
- */
- public void stopServer() {
- LOG.log(Level.INFO, "Shutting down in process server");
- StandardOutputSuppressor.suppress();
- try {
- DirectoryServer.shutDown(getClass().getName(),
- Message.raw("quicksetup requests shutdown")); // TODO: i18n
-
- // Note: this should not be necessary in the future when a
- // the shutdown method will not return until everything is
- // cleaned up.
-
- // Connection handlers are stopped and started asynchonously.
- // Give the connection handlers time to let go of any resources
- // before continuing.
- try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- // do nothing;
- }
-
- } finally {
- StandardOutputSuppressor.unsuppress();
- }
- }
-
- /**
- * Starts the OpenDS server in this process.
- * @return OperationOutput with the results of the operation.
- * @throws org.opends.server.config.ConfigException
- * If there is a problem with the Directory Server
- * configuration that prevents a critical component
- * from being instantiated.
- *
- * @throws org.opends.server.types.InitializationException
- * If some other problem occurs while
- * attempting to initialize and start the
- * Directory Server.
- */
- public synchronized OperationOutput startServer()
- throws
- InitializationException,
- ConfigException {
- OperationOutput output = new OperationOutput();
- setOutputForWriters(output);
-
- // Properties systemProperties = System.getProperties();
- // systemProperties.list(System.out);
-
- StandardOutputSuppressor.suppress();
- try {
-
- // The server's startServer method should not be called directly
- // more than once since it leave the server corrupted. Restart
- // is the correct choice in this case.
- if (!serverHasBeenStarted) {
-
- // Set the root of the directory server so that the server
- // code will be able to derive its filesystem paths etc.
- DirectoryServer.getEnvironmentConfig().setServerRoot(
- installation.getRootDirectory());
-
- DirectoryServer directoryServer = DirectoryServer.getInstance();
-
- // Bootstrap and start the Directory Server.
- LOG.log(Level.FINER, "Bootstrapping directory server");
- directoryServer.bootstrapServer();
-
- LOG.log(Level.FINER, "Initializing configuration");
- String configClass = "org.opends.server.extensions.ConfigFileHandler";
- String configPath = Utils.getPath(
- installation.getCurrentConfigurationFile());
-
- directoryServer.initializeConfiguration(configClass, configPath);
-
- } else {
- LOG.log(Level.FINER, "Reinitializing the server");
- DirectoryServer.reinitialize();
- }
-
- // Must be done following bootstrap
- registerListenersForOuput();
-
- LOG.log(Level.FINER, "Invoking server start");
-
- // It is important to get a new instance after calling reinitalize()
- DirectoryServer directoryServer = DirectoryServer.getInstance();
-
- directoryServer.startServer();
- serverHasBeenStarted = true;
-
- // Note: this should not be necessary in the future. This
- // seems necessary currenty for the case in which shutdown
- // is called immediately afterward as is done by the upgrader.
-
- // Connection handlers are stopped and started asynchronously.
- // Give the connection handlers time to initialize before
- // continuing.
-
- try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- // do nothing;
- }
-
- } finally {
- StandardOutputSuppressor.unsuppress();
- setOutputForWriters(null);
- }
- return output;
- }
-
- /**
- * Applies modifications contained in an LDIF file to the server.
- *
- * @param cre changes to apply to the directory data
- * @throws IOException if there is an IO Error
- * @throws LDIFException if there is an LDIF error
- * @throws ApplicationException if there is an application specific error
- */
- public void modify(ChangeRecordEntry cre)
- throws IOException, LDIFException, ApplicationException
- {
- InternalClientConnection cc =
- InternalClientConnection.getRootConnection();
- ByteString dnByteString =
- ByteString.valueOf(
- cre.getDN().toString());
- ResultCode rc;
- switch (cre.getChangeOperationType()) {
- case MODIFY:
- LOG.log(Level.INFO, "proparing to modify " + dnByteString);
- ModifyChangeRecordEntry mcre =
- (ModifyChangeRecordEntry) cre;
- ModifyOperation op =
- cc.processModify(dnByteString, mcre.getModifications());
- rc = op.getResultCode();
- if (rc.equals(ResultCode.
- SUCCESS)) {
- LOG.log(Level.INFO, "processed server modification " +
- modListToString(op.getModifications()));
- } else if (rc.equals(
- ResultCode.
- ATTRIBUTE_OR_VALUE_EXISTS)) {
- // ignore this error
- LOG.log(Level.INFO, "ignoring attribute that already exists: " +
- modListToString(op.getModifications()));
- } else if (rc.equals(ResultCode.NO_SUCH_ATTRIBUTE)) {
- // This can happen if for instance the old configuration was
- // changed so that the value of an attribute matches the default
- // value of the attribute in the new configuration.
- // Just log it and move on.
- LOG.log(Level.INFO, "Ignoring attribute not found: " +
- modListToString(op.getModifications()));
- } else {
- // report the error to the user
- MessageBuilder error = op.getErrorMessage();
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR,
- INFO_ERROR_APPLY_LDIF_MODIFY.get(dnByteString.toString(),
- error != null ? error.toString() : ""),
- null);
- }
- break;
- case ADD:
- LOG.log(Level.INFO, "preparing to add " + dnByteString);
- AddChangeRecordEntry acre = (AddChangeRecordEntry) cre;
- List<Attribute> attrs = acre.getAttributes();
- ArrayList<RawAttribute> rawAttrs =
- new ArrayList<RawAttribute>(attrs.size());
- for (Attribute a : attrs) {
- rawAttrs.add(new LDAPAttribute(a));
- }
- AddOperation addOp = cc.processAdd(dnByteString, rawAttrs);
- rc = addOp.getResultCode();
- if (rc.equals(ResultCode.SUCCESS)) {
- LOG.log(Level.INFO, "processed server add " + addOp.getEntryDN());
- } else if (rc.equals(ResultCode.ENTRY_ALREADY_EXISTS)) {
- // Compare the attributes with the existing entry to see if we
- // can ignore this add.
- boolean ignore = true;
- for (RawAttribute attr : rawAttrs) {
- ArrayList<ByteString> values = attr.getValues();
- for (ByteString value : values) {
- CompareOperation compOp =
- cc.processCompare(dnByteString, attr.getAttributeType(), value);
- if (ResultCode.ASSERTION_FAILED.equals(compOp.getResultCode())) {
- ignore = false;
- break;
- }
- }
- }
- if (!ignore) {
- MessageBuilder error = addOp.getErrorMessage();
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR,
- INFO_ERROR_APPLY_LDIF_ADD.get(dnByteString.toString(),
- error != null ? error.toString() : ""),
- null);
- }
- } else {
- boolean ignore = false;
-
- if (rc.equals(ResultCode.ENTRY_ALREADY_EXISTS)) {
-
- // The entry already exists. Compare the attributes with the
- // existing entry to see if we can ignore this add.
- try {
- InternalSearchOperation searchOp =
- cc.processSearch(
- cre.getDN(),
- SearchScope.BASE_OBJECT,
- SearchFilter.createFilterFromString(
- "objectclass=*"));
- LinkedList<SearchResultEntry> se = searchOp.getSearchEntries();
- if (se.size() > 0) {
- SearchResultEntry e = se.get(0);
- List<Attribute> eAttrs = new ArrayList<Attribute>();
- eAttrs.addAll(e.getAttributes());
- eAttrs.add(e.getObjectClassAttribute());
- if (compareUserAttrs(attrs, eAttrs)) {
- LOG.log(Level.INFO, "Ignoring failure to add " +
- dnByteString + " since the existing entry's " +
- "attributes are identical");
- ignore = true;
- }
- }
- } catch (Exception e) {
- LOG.log(Level.INFO, "Error attempting to compare rejected add " +
- "entry with existing entry", e);
- }
- }
-
- if (!ignore) {
- MessageBuilder error = addOp.getErrorMessage();
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR,
- INFO_ERROR_APPLY_LDIF_ADD.get(dnByteString.toString(),
- error != null ? error.toString() : ""),
- null);
- }
- }
- break;
- case DELETE:
- LOG.log(Level.INFO, "preparing to delete " + dnByteString);
- DeleteOperation delOp = cc.processDelete(dnByteString);
- rc = delOp.getResultCode();
- if (rc.equals(ResultCode.SUCCESS)) {
- LOG.log(Level.INFO, "processed server delete " +
- delOp.getEntryDN());
- } else {
- // report the error to the user
- MessageBuilder error = delOp.getErrorMessage();
- throw new ApplicationException(
- ReturnCode.IMPORT_ERROR,
- INFO_ERROR_APPLY_LDIF_DELETE.get(dnByteString.toString(),
- error != null ? error.toString() : ""),
- null);
- }
- break;
- default:
- LOG.log(Level.SEVERE, "Unexpected record type " + cre.getClass());
- throw new ApplicationException(ReturnCode.BUG,
- INFO_BUG_MSG.get(),
- null);
- }
- }
-
- private String modListToString(
- List<Modification> modifications) {
- StringBuilder modsMsg = new StringBuilder();
- for (int i = 0; i < modifications.size(); i++) {
- modsMsg.append(modifications.get(i).toString());
- if (i < modifications.size() - 1) {
- modsMsg.append(" ");
- }
- }
- return modsMsg.toString();
- }
-
- static private void setOutputForWriters(OperationOutput output) {
- debugWriter.setOutput(output);
- errorWriter.setOutput(output);
- accessWriter.setOutput(output);
- }
-
- static private void registerListenersForOuput() {
- try {
- startupDebugPublisher =
- TextDebugLogPublisher.getStartupTextDebugPublisher(debugWriter);
- DebugLogger.addDebugLogPublisher(startupDebugPublisher);
-
- startupErrorPublisher = TextErrorLogPublisher
- .getServerStartupTextErrorPublisher(errorWriter);
- ErrorLogger.addErrorLogPublisher(startupErrorPublisher);
-
- startupAccessPublisher =
- TextAccessLogPublisher.getStartupTextAccessPublisher(
- accessWriter, true);
- AccessLogger.addAccessLogPublisher(startupAccessPublisher);
-
- } catch (Exception e) {
- LOG.log(Level.INFO, "Error installing test log publishers: " +
- e.toString());
- }
- }
-
- /**
- * Compares two lists of attributes for equality. Any non-user attributes
- * are ignored during comparison.
- * @param l1 list of attributes
- * @param l2 list of attributes
- * @return boolean where true means the lists are equal
- */
- private boolean compareUserAttrs(List<Attribute> l1, List<Attribute> l2) {
- return compareUserAttrsInternal(l1, l2) && compareUserAttrsInternal(l2, l1);
- }
-
- /**
- * Determines if all the user attributes in one list are present in another
- * list.
- * @param l1 list of attributes
- * @param l2 list of attributes
- * @return boolean where true means the lists are equal
- */
- private boolean compareUserAttrsInternal(List<Attribute> l1,
- List<Attribute> l2) {
- for (Attribute l1Attr : l1) {
- if (l1Attr.getAttributeType().isOperational()) {
- continue;
- }
-
- // Locate the attribute in l2
- Attribute l2Attr = null;
- String name = l1Attr.getName();
- if (name != null) {
- for (Attribute tmpl2Attr : l2) {
- if (name.equals(tmpl2Attr.getName())) {
- l2Attr = tmpl2Attr;
- break;
- }
- }
-
- // If we found one them compare it
- if (l2Attr == null ||
- (!l2Attr.getAttributeType().isOperational() &&
- !l1Attr.equals(l2Attr))) {
- return false;
- }
-
- } else {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/OperationOutput.java b/opends/src/quicksetup/org/opends/quicksetup/util/OperationOutput.java
deleted file mode 100644
index 1a4b07b..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/util/OperationOutput.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.util;
-import org.opends.messages.Message;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- * Contains information about an operation invoked by this class.
- */
-public class OperationOutput {
-
- private int returnCode = -1;
-
- private Exception exception = null;
-
- private List<Message> outputMessages = new ArrayList<Message>();
- private List<Message> errorMessages = new ArrayList<Message>();
- private List<Message> debugMessages = new ArrayList<Message>();
- private List<Message> accessMessages = new ArrayList<Message>();
-
- /**
- * Gets a list of strings representing error messages obtained
- * by invoking the operation that match <code>regex</code>.
- * @param regex String used to find particular error messages
- * @return List of Strings representing errorMessages that contain
- * the provided <code>regex</code> string.
- */
- public List<Message> getErrorMessages(String regex) {
- List<Message> errorMessagesSubset = new ArrayList<Message>();
- for (Message msg : errorMessages) {
- if (msg.toString().matches(regex)) {
- errorMessagesSubset.add(msg);
- }
- }
- return Collections.unmodifiableList(errorMessagesSubset);
- }
-
- /**
- * Gets a list of strings representing error messages obtained
- * by invoking the operation.
- * @return List of Strings representing errorMessages
- */
- public List<Message> getErrorMessages() {
- return Collections.unmodifiableList(errorMessages);
- }
-
- /**
- * Gets a list of strings representing output messages obtained
- * by invoking the operation.
- * @return List of Strings representing errorMessages
- */
- public List<Message> getOutputMessages() {
- return Collections.unmodifiableList(outputMessages);
- }
-
- /**
- * Gets a list of strings representing error messages obtained
- * by invoking the operation.
- * @return List of Strings representing errorMessages
- */
- public List<Message> getDebugMessages() {
- return Collections.unmodifiableList(debugMessages);
- }
-
- /**
- * Gets a list of strings representing error messages obtained
- * by invoking the operation.
- * @return List of Strings representing errorMessages
- */
- public List<Message> getAccessMessages() {
- return Collections.unmodifiableList(accessMessages);
- }
-
- /**
- * Gets an exception that occurred by invoking the operation. Null
- * if there were no exceptions.
- * @return Exception error
- */
- public Exception getException() {
- return exception;
- }
-
- /**
- * Gets the return code produced by the operation if any.
- * @return int representing any return code returned by the
- * operation. -1 indicates no return code was set.
- */
- public int getReturnCode() {
- return this.returnCode;
- }
-
- /**
- * Sets the exception that occurred during execution. Can be null to
- * indicate no exception was encountered.
- * @param exception Exception that occurred during invocation of the operation
- */
- void setException(Exception exception) {
- this.exception = exception;
- }
-
- /**
- * Adds an error message.
- * @param errorMessage an error message
- */
- void addErrorMessage(Message errorMessage) {
- this.errorMessages.add(errorMessage);
- }
-
- /**
- * Adds an output message.
- * @param outputMessage an error message
- */
- void addOutputMessage(Message outputMessage) {
- this.outputMessages.add(outputMessage);
- }
-
- /**
- * Adds an access message.
- * @param accessMessage an error message
- */
- void addAccessMessage(Message accessMessage) {
- this.accessMessages.add(accessMessage);
- }
-
- /**
- * Adds an error message.
- * @param debugMessage an error message
- */
- void addDebugMessage(Message debugMessage) {
- this.debugMessages.add(debugMessage);
- }
-
-
- /**
- * Sets the list of error messages that occurred during execution.
- * @param accessMessages List of Strings representing error messages
- */
- void setAccessMessages(List<Message> accessMessages) {
- this.accessMessages = accessMessages;
- }
-
- /**
- * Sets the list of error messages that occurred during execution.
- * @param debugMessages List of Strings representing error messages
- */
- void setDebugMessages(List<Message> debugMessages) {
- this.debugMessages = debugMessages;
- }
-
- /**
- * Sets the return code of the operation.
- * @param i int representing the return code
- */
- void setReturnCode(int i) {
- this.returnCode = i;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index 9a39f28..f63bcbe 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup.util;
@@ -45,7 +45,6 @@
import java.util.ArrayList;
import java.util.Map;
-import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.BufferedReader;
@@ -219,6 +218,7 @@
}
catch (Exception ex)
{
+ // do nothing
}
stopped = !installation.getStatus().isServerRunning();
LOG.log(Level.INFO,
@@ -296,26 +296,22 @@
/**
* This methods starts the server.
*
- * @return OperationOutput object containing output from the start server
- * command invocation.
- * @throws org.opends.quicksetup.ApplicationException if something goes wrong.
+ *@throws org.opends.quicksetup.ApplicationException if something goes wrong.
*/
- public OperationOutput startServer() throws ApplicationException {
- return startServer(true, false);
+ public void startServer() throws ApplicationException {
+ startServer(true, false);
}
/**
* This methods starts the server.
* @param suppressOutput boolean indicating that ouput to standard output
* streams from the server should be suppressed.
- * @return OperationOutput object containing output from the start server
- * command invocation.
* @throws org.opends.quicksetup.ApplicationException if something goes wrong.
*/
- public OperationOutput startServer(boolean suppressOutput)
+ public void startServer(boolean suppressOutput)
throws ApplicationException
{
- return startServer(true, suppressOutput);
+ startServer(true, suppressOutput);
}
/**
@@ -324,15 +320,11 @@
* connect to the server after starting to verify that it is listening.
* @param suppressOutput indicating that ouput to standard output streams
* from the server should be suppressed.
- * @return OperationOutput object containing output from the start server
- * command invocation.
* @throws org.opends.quicksetup.ApplicationException if something goes wrong.
*/
- private OperationOutput startServer(boolean verify, boolean suppressOutput)
+ private void startServer(boolean verify, boolean suppressOutput)
throws ApplicationException
{
- OperationOutput output = new OperationOutput();
-
if (suppressOutput && !StandardOutputSuppressor.isSuppressed()) {
StandardOutputSuppressor.suppress();
}
@@ -406,26 +398,6 @@
LOG.log(Level.WARNING, "Started ID could not be found");
}
- // Collect any messages found in the output
- List<Message> errors = errReader.getMessages();
- if (errors != null) {
- for(Message error : errors) {
- output.addErrorMessage(error);
- }
- }
- List<Message> messages = outputReader.getMessages();
- if (messages != null) {
- for (Message msg : messages) {
-
- // NOTE: this may not be the best place to drop these.
- // However upon startup the server seems to log all messages,
- // regardless of whether or not they signal an error condition,
- // to its error log.
-
- output.addErrorMessage(msg);
- }
- }
-
// Check if something wrong occurred reading the starting of the server
ApplicationException ex = errReader.getException();
if (ex == null)
@@ -438,9 +410,7 @@
// the exception below, but in case we change out
// minds later or add the ability to return exceptions
// in the output only instead of throwing...
- output.setException(ex);
throw ex;
-
} else if (verify)
{
/*
@@ -531,6 +501,7 @@
}
catch (Throwable t)
{
+ // do nothing
}
}
}
@@ -542,6 +513,7 @@
}
catch (Throwable t)
{
+ // do nothing
}
}
}
@@ -585,7 +557,6 @@
application.setNotifyListeners(true);
}
}
- return output;
}
/**
@@ -673,8 +644,6 @@
{
private ApplicationException ex;
- private List<Message> messages = new ArrayList<Message>();
-
private boolean isFinished;
private boolean startedIdFound;
@@ -728,14 +697,11 @@
isFirstLine = false;
}
LOG.log(Level.INFO, "server: " + line);
- if (line.toLowerCase().indexOf("=" + startedId) != -1)
+ if (line.toLowerCase().contains("=" + startedId))
{
isFinished = true;
startedIdFound = true;
}
-
- messages.add(Message.raw(line));
-
line = reader.readLine();
}
} catch (Throwable t)
@@ -763,10 +729,6 @@
return ex;
}
- public List<Message> getMessages() {
- return messages;
- }
-
/**
* Returns <CODE>true</CODE> if the server starting process finished
* (successfully or not) and <CODE>false</CODE> otherwise.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java b/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
deleted file mode 100644
index f7a42f5..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.util;
-
-import org.opends.messages.Message;
-import org.opends.messages.Severity;
-
-import org.opends.quicksetup.ReturnCode;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.ApplicationException;
-
-import static org.opends.messages.QuickSetupMessages.*;
-
-import java.util.List;
-
-/**
- * Checks a server health by starting a server and looking through its
- * log messages for signs that things may not be well.
- */
-public class ServerHealthChecker {
-
- private Installation installation = null;
-
- private List<Message> errors = null;
-
- /**
- * Regular expression used to determine whether or not a server
- * is healthy enough for upgrade by looking through its startup
- * logs.
- */
- static private final String UNHEALTHY_SERVER_LOG_REGEX =
- new StringBuilder()
- .append(".*(")
- .append(Severity.FATAL_ERROR.name())
- .append("|")
- .append(Severity.SEVERE_ERROR.name())
- .append(")+.*").toString();
-
-
- /**
- * Creates an instance.
- * @param installation of the server to check
- */
- public ServerHealthChecker(Installation installation) {
- this.installation = installation;
- }
-
- /**
- * Diagnoses the server's health by stopping (if necessary) and starting
- * the server in process and analyzing the resulting log messages.
- * Following the call to this method the server is left in a stopped state.
- * @throws ApplicationException if things go wrong
- */
- public void checkServer() throws ApplicationException {
- InProcessServerController control = null;
- try {
- control = new InProcessServerController(installation);
- if (installation.getStatus().isServerRunning()) {
- new ServerController(installation).stopServer(true);
- }
- OperationOutput op = control.startServer();
- errors = op.getErrorMessages(UNHEALTHY_SERVER_LOG_REGEX);
- } catch (Exception e) {
- if (e instanceof ApplicationException) {
- throw (ApplicationException)e;
- } else {
- throw new ApplicationException(
- ReturnCode.APPLICATION_ERROR,
- INFO_ERROR_SERVER_HEALTH_CHECK_FAILURE.get(), e);
- }
- } finally {
- if (control != null) {
- control.stopServer();
- }
- }
- }
-
- /**
- * Gets a list of Strings representing error messages that resulted
- * from calling <code>checkServer</code>; null if <code>checkServer</code>
- * has not been called.
- * @return List of strings containing error messages
- */
- public List<Message> getProblemMessages() {
- return errors;
- }
-
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/UIKeyStore.java b/opends/src/quicksetup/org/opends/quicksetup/util/UIKeyStore.java
index fa8b29c..af4f201 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/UIKeyStore.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/UIKeyStore.java
@@ -23,14 +23,13 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup.util;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.KeyStore;
@@ -64,7 +63,6 @@
/**
* Returns the KeyStore to be used by graphical applications.
* @return the KeyStore to be used by graphical applications.
- * @throws FileNotFoundException if the key store could not be found.
* @throws IOException if there was a file system access error.
* @throws KeyStoreException if there was a problem while reading the key
* store.
@@ -72,8 +70,8 @@
* @throws NoSuchAlgorithmException if the used algorithm is not supported
* by the system.
*/
- public static KeyStore getInstance() throws FileNotFoundException,
- IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException
+ public static KeyStore getInstance() throws IOException, KeyStoreException,
+ CertificateException, NoSuchAlgorithmException
{
if (keyStore == null)
{
@@ -129,7 +127,6 @@
/**
* Updates the Key Store with the provided certificate chain.
* @param chain the certificate chain to be accepted.
- * @throws FileNotFoundException if the key store could not be found.
* @throws IOException if there was a file system access error.
* @throws KeyStoreException if there was a problem while reading or writing
* to the key store.
@@ -138,23 +135,20 @@
* by the system.
*/
public static void acceptCertificate(X509Certificate[] chain)
- throws FileNotFoundException,
- IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException
+ throws IOException,KeyStoreException, CertificateException,
+ NoSuchAlgorithmException
{
LOG.log(Level.INFO, "Accepting certificate chain.");
KeyStore k = getInstance();
- for (int i = 0; i < chain.length; i++)
- {
- if (!containsCertificate(chain[i], k))
- {
- String alias = chain[i].getSubjectDN().getName();
+ for (X509Certificate aChain : chain) {
+ if (!containsCertificate(aChain, k)) {
+ String alias = aChain.getSubjectDN().getName();
int j = 1;
- while (k.containsAlias(alias))
- {
- alias = chain[i].getSubjectDN().getName()+ "-" + j;
+ while (k.containsAlias(alias)) {
+ alias = aChain.getSubjectDN().getName() + "-" + j;
j++;
}
- k.setCertificateEntry(alias, chain[i]);
+ k.setCertificateEntry(alias, aChain);
}
}
String keyStorePath = getKeyStorePath();
@@ -165,10 +159,7 @@
}
FileOutputStream fos = new FileOutputStream(getKeyStorePath(), false);
k.store(fos, new char[]{});
- if (fos != null)
- {
- fos.close();
- }
+ fos.close();
}
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index a28e6e7..2228310 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.quicksetup.util;
@@ -111,27 +111,6 @@
public static String JNLP_SERVICE_NAME = "javax.jnlp.DownloadService";
/**
- * Enumeration that specify if the operation applies to the install directory
- * only, to the instance directory only, or both.
- */
- public static enum Dir {
- /**
- * all directories.
- */
- ALL,
-
- /**
- * The install directory.
- */
- INSTALL,
-
- /***
- * The instance directory.
- */
- INSTANCE;
- }
-
- /**
* Returns <CODE>true</CODE> if the provided port is free and we can use it,
* <CODE>false</CODE> otherwise.
* @param port the port we are analyzing.
@@ -209,7 +188,7 @@
boolean errorDetected = false;
while (null != (line = reader.readLine())) {
LOG.log(Level.INFO, "The output: "+line);
- if (line.indexOf("ERROR: The detected Java version") != -1)
+ if (line.contains("ERROR: The detected Java version"))
{
if (Utils.isWindows())
{
@@ -309,8 +288,7 @@
* Do a best effort to avoid having a relative representation (for
* instance to avoid having ../../../).
*/
- File canonical = f.getCanonicalFile();
- f = canonical;
+ f = f.getCanonicalFile();
}
catch (IOException ioe)
{
@@ -399,13 +377,10 @@
{
boolean parentExists = false;
File f = new File(path);
- if (f != null)
+ File parentFile = f.getParentFile();
+ if (parentFile != null)
{
- File parentFile = f.getParentFile();
- if (parentFile != null)
- {
- parentExists = parentFile.isDirectory();
- }
+ parentExists = parentFile.isDirectory();
}
return parentExists;
}
@@ -419,13 +394,8 @@
*/
public static boolean fileExists(String path)
{
- boolean isFile = false;
File f = new File(path);
- if (f != null)
- {
- isFile = f.isFile();
- }
- return isFile;
+ return f.isFile();
}
/**
@@ -438,14 +408,9 @@
public static boolean directoryExistsAndIsNotEmpty(String path)
{
boolean directoryExistsAndIsNotEmpty = false;
- boolean isDirectory = false;
File f = new File(path);
- if (f != null)
- {
- isDirectory = f.isDirectory();
- }
- if (isDirectory)
+ if (f.isDirectory())
{
String[] ch = f.list();
@@ -456,33 +421,6 @@
}
/**
- * Returns <CODE>true</CODE> if the the provided path is a directory, exists
- * and is empty <CODE>false</CODE> otherwise.
- * @param path the path that we are analyzing.
- * @return <CODE>true</CODE> if the the provided path is a directory, exists
- * and is empty <CODE>false</CODE> otherwise.
- */
- public static boolean directoryExistsAndIsEmpty(String path)
- {
- boolean directoryExistsAndIsEmpty = false;
- boolean isDirectory = false;
-
- File f = new File(path);
- if (f != null)
- {
- isDirectory = f.isDirectory();
- }
- if (isDirectory)
- {
- String[] ch = f.list();
-
- directoryExistsAndIsEmpty = (ch == null) || (ch.length == 0);
- }
-
- return directoryExistsAndIsEmpty;
- }
-
- /**
* Returns <CODE>true</CODE> if the the provided string is a DN and
* <CODE>false</CODE> otherwise.
* @param dn the String we are analyzing.
@@ -537,35 +475,14 @@
LdapName name1 = new LdapName(dn1);
LdapName name2 = new LdapName(dn2);
areDnsEqual = name1.equals(name2);
- } catch (Exception ex)
- {
+ } catch (Exception ex) {
+ // do nothing
}
return areDnsEqual;
}
/**
- * Creates the parent path for the provided path.
- * @param path the path.
- * @return <CODE>true</CODE> if the parent path was created or already existed
- * and <CODE>false</CODE> otherwise.
- */
- public static boolean createParentPath(String path)
- {
- boolean parentPathExists = true;
- if (!parentDirectoryExists(path))
- {
- File f = new File(path);
- if (f != null)
- {
- File parentFile = f.getParentFile();
- parentPathExists = parentFile.mkdirs();
- }
- }
- return parentPathExists;
- }
-
- /**
* Creates the parent directory if it does not already exist.
* @param f File for which parentage will be insured
* @return boolean indicating whether or not the input <code>f</code>
@@ -597,13 +514,7 @@
} else
{
File parentFile = file.getParentFile();
- if (parentFile != null)
- {
- canWrite = parentFile.canWrite();
- } else
- {
- canWrite = false;
- }
+ canWrite = parentFile != null && parentFile.canWrite();
}
return canWrite;
}
@@ -646,19 +557,6 @@
* @param is the InputStream with the contents of the file.
* @throws IOException if something goes wrong.
*/
- public static void createFile(String path, InputStream is)
- throws IOException
- {
- createFile(new File(path), is);
- }
-
- /**
- * Creates a file on the specified path with the contents of the provided
- * stream.
- * @param path the path where the file will be created.
- * @param is the InputStream with the contents of the file.
- * @throws IOException if something goes wrong.
- */
public static void createFile(File path, InputStream is) throws IOException
{
FileOutputStream out;
@@ -813,7 +711,7 @@
raf.setLength(bytes);
hasEnoughSpace = true;
} catch (IOException ex)
- {
+ { /* do nothing */
} finally
{
if (raf != null)
@@ -822,7 +720,7 @@
{
raf.close();
} catch (IOException ex2)
- {
+ { /* do nothing */
}
}
if (file != null)
@@ -964,46 +862,6 @@
return ConnectionUtils.getHostNameForLdapUrl(host);
}
- // Very limited for the moment: apply only permissions to the current user and
- // does not work in non-English environments... to work in non English we
- // should use xcalcs but it does not come in the windows default install...
- // :-(
- // This method is not called for the moment, but the code works, so that is
- // why is kept.
- private static int changePermissionsWindows(String path, String unixPerm)
- throws IOException, InterruptedException
- {
- String windowsPerm;
- int i = Integer.parseInt(unixPerm.substring(0, 1));
- if (Integer.lowestOneBit(i) == 1)
- {
- // Executable: give full permissions
- windowsPerm = "F";
- } else if (Integer.highestOneBit(i) == 4)
- {
- // Writable
- windowsPerm = "W";
- } else if (Integer.highestOneBit(i) == 2)
- {
- // Readable
- windowsPerm = "R";
- } else
- {
- // No permissions
- windowsPerm = "N";
- }
-
- String user = System.getProperty("user.name");
- String[] args =
- { "cacls", path, "/P", user + ":" + windowsPerm };
- Process p = Runtime.getRuntime().exec(args);
-
- // TODO: This only works in ENGLISH systems!!!!!!
- p.getOutputStream().write("Y\n".getBytes());
- p.getOutputStream().flush();
- return p.waitFor();
- }
-
/**
* Indicates whether we are in a web start installation or not.
*
@@ -1129,24 +987,6 @@
}
- /**
- * Method used to know if we can connect as administrator in a server with a
- * given password and dn.
- * @param ldapUrl the ldap URL of the server.
- * @param dn the dn to be used.
- * @param pwd the password to be used.
- * @param timeout the timeout to establish the connection in milliseconds.
- * Use {@code 0} to express no timeout.
- * @return <CODE>true</CODE> if we can connect and read the configuration and
- * <CODE>false</CODE> otherwise.
- */
- public static boolean canConnectAsAdministrativeUser(String ldapUrl,
- String dn, String pwd, int timeout)
- {
- return ConnectionUtils.canConnectAsAdministrativeUser(ldapUrl, dn, pwd,
- timeout);
- }
-
/**
* Tells whether the provided Throwable was caused because of a problem with
* a certificate while trying to establish a connection.
@@ -1361,7 +1201,7 @@
try
{
reader.close();
- } catch (Exception e) {}
+ } catch (Exception e) { /* do nothing */}
}
}
@@ -1412,7 +1252,7 @@
String msg = t.toString();
if (msg != null)
{
- isOutOfMemory = msg.indexOf("Not enough space") != -1;
+ isOutOfMemory = msg.contains("Not enough space");
}
}
t = t.getCause();
@@ -1432,24 +1272,6 @@
}
/**
- * Determines whether one file is the parent of another.
- * @param ancestor possible parent of <code>descendant</code>
- * @param descendant possible child 0f <code>ancestor</code>
- * @return return true if ancestor is a parent of descendant
- */
- static public boolean isParentOf(File ancestor, File descendant) {
- if (ancestor != null) {
- if (ancestor.equals(descendant)) {
- return false;
- }
- while ((descendant != null) && !ancestor.equals(descendant)) {
- descendant = descendant.getParentFile();
- }
- }
- return (ancestor != null) && (descendant != null);
- }
-
- /**
* Creates a string consisting of the string representation of the
* elements in the <code>list</code> separated by <code>separator</code>.
* @param list the list to print
@@ -1461,35 +1283,6 @@
}
/**
- * Creates a message consisting of the string representation of the
- * elements in the <code>list</code> separated by <code>separator</code>.
- * @param list the list to print
- * @param separator to use in separating elements
- * @param prefix prepended to each individual element in the list before
- * adding to the returned string.
- * @param suffix appended to each individual element in the list before
- * adding to the returned string.
- * @return String representing the list
- */
- static public Message listToMessage(List<Message> list, String separator,
- String prefix, String suffix) {
- MessageBuilder sb = new MessageBuilder();
- for (int i = 0; i < list.size(); i++) {
- if (prefix != null) {
- sb.append(prefix);
- }
- sb.append(list.get(i));
- if (suffix != null) {
- sb.append(suffix);
- }
- if (i < list.size() - 1) {
- sb.append(separator);
- }
- }
- return sb.toMessage();
- }
-
- /**
* Creates a string consisting of the string representation of the
* elements in the <code>list</code> separated by <code>separator</code>.
* @param list the list to print
@@ -1519,34 +1312,6 @@
}
/**
- * Creates a string consisting of the string representation of the
- * elements in the <code>list</code> separated by <code>separator</code>.
- * @param array the list to print
- * @param separator to use in separating elements
- * @return String representing the list
- */
- static public String stringArrayToString(String[] array, String separator) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < array.length; i++) {
- sb.append(array[i]);
- if (i < array.length - 1) {
- sb.append(separator);
- }
- }
- return sb.toString();
- }
-
- /**
- * Returns the file system permissions for a file.
- * @param path the file for which we want the file permissions.
- * @return the file system permissions for the file.
- */
- static public String getFileSystemPermissions(String path)
- {
- return getFileSystemPermissions(new File(path));
- }
-
- /**
* Returns the file system permissions for a file.
* @param file the file for which we want the file permissions.
* @return the file system permissions for the file.
@@ -1580,29 +1345,6 @@
}
/**
- * Returns a string representing the installation's current build information
- * useful for presenting to the user. If the build string could not be
- * determined for any reason a localized String 'unknown' is returned.
- * @param installation whose build information is sought
- * @return String representing the application's build.
- */
- static public String getBuildString(Installation installation) {
- String b = null;
- try {
- BuildInformation bi = installation.getBuildInformation();
- if (bi != null) {
- b = bi.toString();
- }
- } catch (ApplicationException e) {
- LOG.log(Level.INFO, "error trying to determine current build string", e);
- }
- if (b == null) {
- b = INFO_UPGRADE_BUILD_ID_UNKNOWN.get().toString();
- }
- return b;
- }
-
- /**
* Returns the String representation of the first value of an attribute in a
* LDAP entry.
* @param entry the entry.
@@ -1656,7 +1398,7 @@
// First see if there are any spaces counting backward
// from the max line length. If there aren't any, then
// use the first space encountered after the max line
- // lenght.
+ // length.
int p = d.lastIndexOf(' ', maxll);
if (p <= 0) {
p = d.indexOf(' ', maxll);
@@ -1682,7 +1424,7 @@
* @return converted string
*/
static public String convertHtmlBreakToLineSeparator(String s) {
- return s.replaceAll("\\<br\\>", Constants.LINE_SEPARATOR);
+ return s.replaceAll("<br>", Constants.LINE_SEPARATOR);
}
/**
@@ -1701,7 +1443,7 @@
// '<your name here>' or for funky tags like
// '<tag attr="1 > 0">'. See test class for cases that
// might cause problems.
- o = s.replaceAll("\\<.*?\\>","");
+ o = s.replaceAll("<.*?>","");
}
return o;
@@ -1741,7 +1483,6 @@
public static long getServerClock(InitialLdapContext ctx)
{
long time = -1;
- String v = null;
SearchControls ctls = new SearchControls();
ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
ctls.setReturningAttributes(
@@ -1761,7 +1502,7 @@
{
SearchResult sr = (SearchResult)listeners.next();
- v = getFirstValue(sr, "currentTime");
+ String v = getFirstValue(sr, "currentTime");
TimeZone utcTimeZone = TimeZone.getTimeZone("UTC");
@@ -1964,6 +1705,7 @@
}
catch (Exception ex)
{
+ // do nothing
}
}
return value;
@@ -2019,15 +1761,13 @@
{
Message msg;
- boolean createSuffix = false;
-
DataReplicationOptions repl =
userInstallData.getReplicationOptions();
SuffixesToReplicateOptions suf =
userInstallData.getSuffixesToReplicateOptions();
- createSuffix =
+ boolean createSuffix =
repl.getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY ||
repl.getType() == DataReplicationOptions.Type.STANDALONE ||
suf.getType() == SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY;
@@ -2706,6 +2446,7 @@
if (ldapURL.equalsIgnoreCase(
replica.getServer().getAdminConnectorURL()))
{
+ // This is the server we're configuring
found = true;
Set<String> baseDNs = hm.get(replica.getServer());
if (baseDNs == null)
@@ -2731,12 +2472,13 @@
}
if (!found)
{
- for (ReplicaDescriptor replica : suffix.getReplicas())
+ // We haven't found the server yet, just take the first one
+ ReplicaDescriptor replica = suffix.getReplicas().iterator().next();
+ if (replica != null)
{
Set<String> baseDNs = new LinkedHashSet<String>();
hm.put(replica.getServer(), baseDNs);
baseDNs.add(suffix.getDN());
- break;
}
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java b/opends/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java
index e0f0887..a9d3718 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.util;
@@ -52,8 +53,7 @@
Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[]
{ String.class });
- openURL.invoke(null, new Object[]
- { url });
+ openURL.invoke(null, url);
} else if (Utils.isWindows())
{
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/util/package-info.java
index 49fed61..06f3976 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/package-info.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/package-info.java
@@ -23,11 +23,12 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
/**
* Defines the different auxiliary classes that can be used by the different
- * applications (upgrader and installer).
+ * applications (installer).
*/
package org.opends.quicksetup.util;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
index 781ffb4..06ffb03 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.quicksetup.webstart;
@@ -63,16 +64,6 @@
static private final Logger LOG =
Logger.getLogger(WebStartDownloader.class.getName());
- /**
- * Returns the name of the zip file name that contains all the installation.
- * @return the name of the zip file name that contains all the installation.
- */
- static public String getZipFileName()
- {
- // Passed as a java option in the JNLP file
- return System.getProperty(SetupUtils.ZIP_FILE_NAME);
- }
-
private ApplicationException ex;
private boolean isFinished;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/package-info.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/package-info.java
index 1b9bc0c..a196d46 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/package-info.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/webstart/package-info.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
@@ -30,8 +31,7 @@
* Defines the specific classes that are used by both the web start
* applications.
* This package only contains for the moment the class that is used to download
- * the jar files that contain the new installation files (or the files to be
- * used in the upgrade).
+ * the jar files that contain the new installation files.
*
*/
package org.opends.quicksetup.webstart;
diff --git a/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java b/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
index f5ad140..9c728fe 100644
--- a/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
+++ b/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.admin.client.cli;
import org.opends.messages.Message;
@@ -35,12 +36,14 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
import static org.opends.messages.AdminMessages.*;
import static org.opends.messages.DSConfigMessages.*;
import static org.opends.messages.ToolMessages.*;
+
import org.opends.messages.MessageBuilder;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -201,6 +204,17 @@
return SUCCESSFUL.getReturnCode();
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
if (argParser.getSubCommand() == null)
{
Message message = ERR_ERROR_PARSING_ARGS.get(
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 385f641..fd743ff 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -1224,6 +1224,20 @@
public void startServer()
throws ConfigException, InitializationException
{
+ // Checks the version - if upgrade required, cannot launch the server.
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ throw new InitializationException(e.getMessageObject());
+ }
+
synchronized (directoryServer)
{
if (! isBootstrapped)
diff --git a/opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java b/opends/src/server/org/opends/server/loggers/AsynchronousTextWriter.java
similarity index 95%
rename from opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java
rename to opends/src/server/org/opends/server/loggers/AsynchronousTextWriter.java
index 57a8951..baacd4e 100644
--- a/opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java
+++ b/opends/src/server/org/opends/server/loggers/AsynchronousTextWriter.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS.
*/
package org.opends.server.loggers;
@@ -44,7 +45,7 @@
* A Text Writer which writes log records asynchronously to
* character-based stream.
*/
-public class AsyncronousTextWriter
+public class AsynchronousTextWriter
implements ServerShutdownListener, TextWriter
{
/**
@@ -65,7 +66,7 @@
private boolean autoFlush;
/**
- * Construct a new AsyncronousTextWriter wrapper.
+ * Construct a new AsynchronousTextWriter wrapper.
*
* @param name the name of the thread.
* @param capacity the size of the queue before it gets flushed.
@@ -73,7 +74,7 @@
* after the queue is flushed.
* @param writer a character stream used for output.
*/
- public AsyncronousTextWriter(String name, int capacity, boolean autoFlush,
+ public AsynchronousTextWriter(String name, int capacity, boolean autoFlush,
TextWriter writer)
{
this.name = name;
@@ -199,7 +200,7 @@
/**
* Retrieves the wrapped writer.
*
- * @return The wrapped writer used by this asyncronous writer.
+ * @return The wrapped writer used by this asynchronous writer.
*/
public TextWriter getWrappedWriter()
{
@@ -211,7 +212,7 @@
*/
public String getShutdownListenerName()
{
- return "AsyncronousTextWriter Thread " + name;
+ return "AsynchronousTextWriter Thread " + name;
}
/**
diff --git a/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java b/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
index d514328..2ae8ddd 100644
--- a/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
+++ b/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
@@ -153,9 +153,9 @@
TextWriter currentWriter;
// Determine the writer we are using. If we were writing
// asynchronously, we need to modify the underlying writer.
- if (writer instanceof AsyncronousTextWriter)
+ if (writer instanceof AsynchronousTextWriter)
{
- currentWriter = ((AsyncronousTextWriter) writer).getWrappedWriter();
+ currentWriter = ((AsynchronousTextWriter) writer).getWrappedWriter();
}
else if (writer instanceof ParallelTextWriter)
{
@@ -191,11 +191,12 @@
mfWriter.addRetentionPolicy(DirectoryServer.getRetentionPolicy(dn));
}
- if (writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ if (writer instanceof AsynchronousTextWriter
+ && !config.isAsynchronous())
{
// The asynchronous setting is being turned off.
- final AsyncronousTextWriter asyncWriter =
- ((AsyncronousTextWriter) writer);
+ final AsynchronousTextWriter asyncWriter =
+ ((AsynchronousTextWriter) writer);
writer = mfWriter;
asyncWriter.shutdown(false);
}
@@ -208,23 +209,21 @@
asyncWriter.shutdown(false);
}
- if (!(writer instanceof AsyncronousTextWriter)
+ if (!(writer instanceof AsynchronousTextWriter)
&& config.isAsynchronous())
{
// The asynchronous setting is being turned on.
- final AsyncronousTextWriter asyncWriter = new AsyncronousTextWriter(
- "Asyncronous Text Writer for " + config.dn().toNormalizedString(),
- config.getQueueSize(), config.isAutoFlush(), mfWriter);
- writer = asyncWriter;
+ writer = new AsynchronousTextWriter(
+ "Asyncronous Text Writer for " + config.dn().toNormalizedString(),
+ config.getQueueSize(), config.isAutoFlush(), mfWriter);
}
if (!(writer instanceof ParallelTextWriter) && config.isAsynchronous())
{
// The asynchronous setting is being turned on.
- final ParallelTextWriter asyncWriter = new ParallelTextWriter(
+ writer = new ParallelTextWriter(
"Parallel Text Writer for " + config.dn().toNormalizedString(),
config.isAutoFlush(), mfWriter);
- writer = asyncWriter;
}
if ((cfg.isAsynchronous() && config.isAsynchronous())
@@ -299,7 +298,7 @@
{
if (cfg.getQueueSize() > 0)
{
- this.writer = new AsyncronousTextWriter(
+ this.writer = new AsynchronousTextWriter(
"Asyncronous Text Writer for " + cfg.dn().toNormalizedString(),
cfg.getQueueSize(), cfg.isAutoFlush(), theWriter);
}
diff --git a/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java b/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java
index a6b7155..75e19ea 100644
--- a/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java
+++ b/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java
@@ -91,11 +91,11 @@
TextWriter currentWriter;
// Determine the writer we are using. If we were writing
- // asyncronously,
- // we need to modify the underlaying writer.
- if (writer instanceof AsyncronousTextWriter)
+ // asynchronously,
+ // we need to modify the underlying writer.
+ if (writer instanceof AsynchronousTextWriter)
{
- currentWriter = ((AsyncronousTextWriter) writer).getWrappedWriter();
+ currentWriter = ((AsynchronousTextWriter) writer).getWrappedWriter();
}
else
{
@@ -126,22 +126,24 @@
mfWriter.addRetentionPolicy(DirectoryServer.getRetentionPolicy(dn));
}
- if (writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ if (writer instanceof AsynchronousTextWriter
+ && !config.isAsynchronous())
{
// The asynronous setting is being turned off.
- AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter) writer);
+ AsynchronousTextWriter asyncWriter =
+ ((AsynchronousTextWriter) writer);
writer = mfWriter;
asyncWriter.shutdown(false);
}
- if (!(writer instanceof AsyncronousTextWriter)
+ if (!(writer instanceof AsynchronousTextWriter)
&& config.isAsynchronous())
{
- // The asynronous setting is being turned on.
- AsyncronousTextWriter asyncWriter = new AsyncronousTextWriter(
- "Asyncronous Text Writer for " + config.dn().toNormalizedString(),
+ // The asynchronous setting is being turned on.
+ writer = new AsynchronousTextWriter(
+ "Asynchronous Text Writer for " +
+ config.dn().toNormalizedString(),
config.getQueueSize(), config.isAutoFlush(), mfWriter);
- writer = asyncWriter;
}
if ((cfg.isAsynchronous() && config.isAsynchronous())
@@ -218,7 +220,7 @@
if (cfg.isAsynchronous())
{
- this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for "
+ this.writer = new AsynchronousTextWriter("Asynchronous Text Writer for "
+ cfg.dn().toNormalizedString(), cfg.getQueueSize(), cfg
.isAutoFlush(), writer);
}
diff --git a/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java b/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
index 665b7bb..b53f77e 100644
--- a/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
+++ b/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
@@ -152,10 +152,10 @@
if(config.isAsynchronous())
{
- this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for " +
- config.dn().toNormalizedString(), config.getQueueSize(),
- config.isAutoFlush(),
- writer);
+ this.writer = new AsynchronousTextWriter(
+ "Asynchronous Text Writer for " +
+ config.dn().toNormalizedString(),
+ config.getQueueSize(), config.isAutoFlush(), writer);
}
else
{
@@ -508,9 +508,9 @@
TextWriter currentWriter;
// Determine the writer we are using. If we were writing asyncronously,
// we need to modify the underlaying writer.
- if(writer instanceof AsyncronousTextWriter)
+ if(writer instanceof AsynchronousTextWriter)
{
- currentWriter = ((AsyncronousTextWriter)writer).getWrappedWriter();
+ currentWriter = ((AsynchronousTextWriter)writer).getWrappedWriter();
}
else
{
@@ -541,24 +541,22 @@
mfWriter.addRetentionPolicy(DirectoryServer.getRetentionPolicy(dn));
}
- if(writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ if(writer instanceof AsynchronousTextWriter && !config.isAsynchronous())
{
- // The asynronous setting is being turned off.
- AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter)writer);
+ // The asynchronous setting is being turned off.
+ AsynchronousTextWriter asyncWriter = ((AsynchronousTextWriter)writer);
writer = mfWriter;
asyncWriter.shutdown(false);
}
- if(!(writer instanceof AsyncronousTextWriter) &&
+ if(!(writer instanceof AsynchronousTextWriter) &&
config.isAsynchronous())
{
- // The asynronous setting is being turned on.
- AsyncronousTextWriter asyncWriter =
- new AsyncronousTextWriter("Asyncronous Text Writer for " +
- config.dn().toNormalizedString(), config.getQueueSize(),
- config.isAutoFlush(),
- mfWriter);
- writer = asyncWriter;
+ // The asynchronous setting is being turned on.
+ writer = new AsynchronousTextWriter("Asynchronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ mfWriter);
}
if((currentConfig.isAsynchronous() && config.isAsynchronous()) &&
diff --git a/opends/src/server/org/opends/server/loggers/TextHTTPAccessLogPublisher.java b/opends/src/server/org/opends/server/loggers/TextHTTPAccessLogPublisher.java
index efc7b3f..3bbb9e2 100644
--- a/opends/src/server/org/opends/server/loggers/TextHTTPAccessLogPublisher.java
+++ b/opends/src/server/org/opends/server/loggers/TextHTTPAccessLogPublisher.java
@@ -110,9 +110,9 @@
TextWriter currentWriter;
// Determine the writer we are using. If we were writing
// asynchronously, we need to modify the underlying writer.
- if (writer instanceof AsyncronousTextWriter)
+ if (writer instanceof AsynchronousTextWriter)
{
- currentWriter = ((AsyncronousTextWriter) writer).getWrappedWriter();
+ currentWriter = ((AsynchronousTextWriter) writer).getWrappedWriter();
}
else if (writer instanceof ParallelTextWriter)
{
@@ -148,11 +148,12 @@
mfWriter.addRetentionPolicy(DirectoryServer.getRetentionPolicy(dn));
}
- if (writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ if (writer instanceof AsynchronousTextWriter
+ && !config.isAsynchronous())
{
// The asynchronous setting is being turned off.
- final AsyncronousTextWriter asyncWriter =
- ((AsyncronousTextWriter) writer);
+ final AsynchronousTextWriter asyncWriter =
+ ((AsynchronousTextWriter) writer);
writer = mfWriter;
asyncWriter.shutdown(false);
}
@@ -165,13 +166,14 @@
asyncWriter.shutdown(false);
}
- if (!(writer instanceof AsyncronousTextWriter)
+ if (!(writer instanceof AsynchronousTextWriter)
&& config.isAsynchronous())
{
// The asynchronous setting is being turned on.
- final AsyncronousTextWriter asyncWriter = new AsyncronousTextWriter(
- "Asyncronous Text Writer for " + config.dn().toNormalizedString(),
- config.getQueueSize(), config.isAutoFlush(), mfWriter);
+ final AsynchronousTextWriter asyncWriter =
+ new AsynchronousTextWriter("Asynchronous Text Writer for "
+ + config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(), mfWriter);
writer = asyncWriter;
}
@@ -252,8 +254,8 @@
{
if (cfg.getQueueSize() > 0)
{
- this.writer = new AsyncronousTextWriter(
- "Asyncronous Text Writer for " + cfg.dn().toNormalizedString(),
+ this.writer = new AsynchronousTextWriter(
+ "Asynchronous Text Writer for " + cfg.dn().toNormalizedString(),
cfg.getQueueSize(), cfg.isAutoFlush(), theWriter);
}
else
diff --git a/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java b/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
index 5e4b7f1..5b5dd09 100644
--- a/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
+++ b/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
@@ -175,9 +175,9 @@
if(config.isAsynchronous())
{
- this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for " +
- config.dn().toNormalizedString(), config.getQueueSize(),
- config.isAutoFlush(), writer);
+ this.writer = new AsynchronousTextWriter(
+ "Asynchronous Text Writer for " + config.dn().toNormalizedString(),
+ config.getQueueSize(), config.isAutoFlush(), writer);
}
else
{
@@ -324,9 +324,9 @@
TextWriter currentWriter;
// Determine the writer we are using. If we were writing asyncronously,
// we need to modify the underlaying writer.
- if(writer instanceof AsyncronousTextWriter)
+ if(writer instanceof AsynchronousTextWriter)
{
- currentWriter = ((AsyncronousTextWriter)writer).getWrappedWriter();
+ currentWriter = ((AsynchronousTextWriter)writer).getWrappedWriter();
}
else
{
@@ -357,24 +357,23 @@
mfWriter.addRetentionPolicy(DirectoryServer.getRetentionPolicy(dn));
}
- if(writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ if(writer instanceof AsynchronousTextWriter && !config.isAsynchronous())
{
- // The asynronous setting is being turned off.
- AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter)writer);
+ // The asynchronous setting is being turned off.
+ AsynchronousTextWriter asyncWriter =
+ ((AsynchronousTextWriter)writer);
writer = mfWriter;
asyncWriter.shutdown(false);
}
- if(!(writer instanceof AsyncronousTextWriter) &&
+ if(!(writer instanceof AsynchronousTextWriter) &&
config.isAsynchronous())
{
- // The asynronous setting is being turned on.
- AsyncronousTextWriter asyncWriter =
- new AsyncronousTextWriter("Asyncronous Text Writer for " +
- config.dn().toNormalizedString(), config.getQueueSize(),
- config.isAutoFlush(),
- mfWriter);
- writer = asyncWriter;
+ // The asynchronous setting is being turned on.
+ writer = new AsynchronousTextWriter("Asynchronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ mfWriter);
}
if((currentConfig.isAsynchronous() && config.isAsynchronous()) &&
diff --git a/opends/src/server/org/opends/server/tools/BackUpDB.java b/opends/src/server/org/opends/server/tools/BackUpDB.java
index 4e38668..c78c6cf 100644
--- a/opends/src/server/org/opends/server/tools/BackUpDB.java
+++ b/opends/src/server/org/opends/server/tools/BackUpDB.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2013 ForgeRock AS.
*/
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -56,7 +56,9 @@
import org.opends.server.loggers.debug.TextDebugLogPublisher;
import org.opends.server.loggers.debug.DebugLogger;
import static org.opends.server.loggers.ErrorLogger.*;
+
import org.opends.server.types.*;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
@@ -148,7 +150,6 @@
private int process(String[] args, boolean initializeServer,
OutputStream outStream, OutputStream errStream)
{
-
PrintStream out;
if (outStream == null)
{
@@ -326,7 +327,6 @@
return 0;
}
-
// Make sure that either the backUpAll argument was provided or at least one
// backend ID was given. They are mutually exclusive.
if (backUpAll.isPresent())
@@ -428,7 +428,20 @@
return 1;
}
+
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
return process(argParser, initializeServer, out, err);
+
}
/**
diff --git a/opends/src/server/org/opends/server/tools/CreateRCScript.java b/opends/src/server/org/opends/server/tools/CreateRCScript.java
index 9e51919..680373d 100644
--- a/opends/src/server/org/opends/server/tools/CreateRCScript.java
+++ b/opends/src/server/org/opends/server/tools/CreateRCScript.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2010-2012 ForgeRock AS
+ * Portions Copyright 2010-2013 ForgeRock AS
*/
package org.opends.server.tools;
@@ -37,8 +37,10 @@
import org.opends.messages.Message;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.FilePermission;
+import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.OperatingSystem;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.ArgumentParser;
@@ -107,7 +109,6 @@
err = new PrintStream(errStream);
}
-
EmbeddedUtils.initializeForClientUse();
OperatingSystem operatingSystem = DirectoryServer.getOperatingSystem();
@@ -192,6 +193,16 @@
return 0;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
// Determine the path to the Java installation that should be used.
String javaHomeDir;
diff --git a/opends/src/server/org/opends/server/tools/DBTest.java b/opends/src/server/org/opends/server/tools/DBTest.java
index b9f6b69..e303cf6 100644
--- a/opends/src/server/org/opends/server/tools/DBTest.java
+++ b/opends/src/server/org/opends/server/tools/DBTest.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2012 ForgeRock AS
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.tools;
@@ -31,14 +31,19 @@
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.util.StaticUtils.*;
+
import org.opends.server.util.args.*;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
+
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.table.TableBuilder;
import org.opends.server.util.table.TextTablePrinter;
import org.opends.server.types.*;
+
import static org.opends.messages.ToolMessages.*;
import org.opends.messages.Message;
+
import static org.opends.server.tools.ToolConstants.OPTION_SHORT_CONFIG_CLASS;
import static org.opends.server.tools.ToolConstants.OPTION_LONG_CONFIG_CLASS;
import static org.opends.server.tools.ToolConstants.OPTION_SHORT_HELP;
@@ -355,6 +360,7 @@
* problem during the configuration processing.
*/
private int run(String[] args, boolean initializeServer) {
+
// Register global arguments and sub-commands.
try {
initializeGlobalArguments();
@@ -380,6 +386,20 @@
return 0;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ if (debugEnabled()) {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ printMessage(e.getMessageObject());
+ return 1;
+ }
+
// Only initialize the server when run as a standalone
// application.
if (initializeServer) {
diff --git a/opends/src/server/org/opends/server/tools/ExportLDIF.java b/opends/src/server/org/opends/server/tools/ExportLDIF.java
index a7e790b..727820c 100644
--- a/opends/src/server/org/opends/server/tools/ExportLDIF.java
+++ b/opends/src/server/org/opends/server/tools/ExportLDIF.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.server.tools;
@@ -49,6 +49,7 @@
import org.opends.server.loggers.debug.TextDebugLogPublisher;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.types.*;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.IntegerArgument;
@@ -358,6 +359,17 @@
return 0;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
return process(argParser, initializeServer, out, err);
}
diff --git a/opends/src/server/org/opends/server/tools/ImportLDIF.java b/opends/src/server/org/opends/server/tools/ImportLDIF.java
index 3414aa2..45ab123 100644
--- a/opends/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011-2012 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.server.tools;
@@ -73,6 +73,7 @@
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.RawAttribute;
import org.opends.server.types.SearchFilter;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.IntegerArgument;
@@ -507,6 +508,17 @@
out = new PrintStream(NullOutputStream.instance());
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
return process(argParser, initializeServer, out, err);
}
diff --git a/opends/src/server/org/opends/server/tools/InstallDS.java b/opends/src/server/org/opends/server/tools/InstallDS.java
index a8f5cc6..89a6d65 100644
--- a/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -43,11 +43,15 @@
import java.security.KeyStoreException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.naming.ldap.LdapName;
+
import org.opends.messages.Message;
+import org.opends.messages.QuickSetupMessages;
import org.opends.messages.ToolMessages;
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.Constants;
@@ -65,8 +69,6 @@
import org.opends.quicksetup.util.IncompatibleVersionException;
import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
import org.opends.quicksetup.util.Utils;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.DN;
import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
import org.opends.server.util.CertificateManager;
@@ -79,6 +81,9 @@
import org.opends.server.util.cli.Menu;
import org.opends.server.util.cli.MenuBuilder;
import org.opends.server.util.cli.MenuResult;
+
+
+
/**
* This class provides a very simple mechanism for installing the OpenDS
* Directory Service. It performs the following tasks:
@@ -100,10 +105,10 @@
private final PlainTextProgressMessageFormatter formatter =
new PlainTextProgressMessageFormatter();
/** Prefix for log files. */
- static public final String LOG_FILE_PREFIX = "opendj-setup-";
+ static public final String TMP_FILE_PREFIX = "opendj-setup-";
/** Suffix for log files. */
- static public final String LOG_FILE_SUFFIX = ".log";
+ public static final String LOG_FILE_SUFFIX = ".log";
/**
* The enumeration containing the different return codes that the command-line
@@ -262,7 +267,7 @@
public static void main(String[] args)
{
- int retCode = mainCLI(args, true, System.out, System.err, System.in);
+ int retCode = mainCLI(args, System.out, System.err, System.in);
System.exit(retCode);
}
@@ -278,7 +283,7 @@
public static int mainCLI(String[] args)
{
- return mainCLI(args, true, System.out, System.err, System.in);
+ return mainCLI(args, System.out, System.err, System.in);
}
/**
@@ -287,7 +292,6 @@
*
* @param args The command-line arguments provided to this
* program.
- * @param initializeServer Indicates whether to initialize the server.
* @param outStream The output stream to use for standard output, or
* <CODE>null</CODE> if standard output is not
* needed.
@@ -298,7 +302,7 @@
* @return The error code.
*/
- public static int mainCLI(String[] args, boolean initializeServer,
+ public static int mainCLI(String[] args,
OutputStream outStream, OutputStream errStream, InputStream inStream)
{
PrintStream out;
@@ -326,7 +330,7 @@
try {
QuickSetupLog.initLogFileHandler(
QuickSetupLog.isInitialized() ? null :
- File.createTempFile(LOG_FILE_PREFIX, LOG_FILE_SUFFIX));
+ File.createTempFile(TMP_FILE_PREFIX, LOG_FILE_SUFFIX));
} catch (Throwable t) {
System.err.println("Unable to initialize log");
t.printStackTrace();
@@ -334,7 +338,7 @@
InstallDS install = new InstallDS(out, err, inStream);
- return install.execute(args, initializeServer);
+ return install.execute(args);
}
/**
@@ -342,11 +346,9 @@
* run the setup CLI.
*
* @param args the command-line arguments provided to this program.
- * @param initializeServer Indicates whether to initialize the server.
- *
* @return the return code (SUCCESSFUL, USER_DATA_ERROR or BUG).
*/
- public int execute(String[] args, boolean initializeServer)
+ public int execute(String[] args)
{
argParser = new InstallDSArgumentParser(InstallDS.class.getName());
try
@@ -435,7 +437,8 @@
String no = INFO_LICENSE_CLI_ACCEPT_NO.get().toString();
String yesShort = INFO_PROMPT_YES_FIRST_LETTER_ANSWER.get().toString();
String noShort = INFO_PROMPT_NO_FIRST_LETTER_ANSWER.get().toString();
- println(INFO_LICENSE_DETAILS_CLI_LABEL.get());
+ println(QuickSetupMessages.
+ INFO_LICENSE_DETAILS_CLI_LABEL.get());
BufferedReader in = getInputStream();
while (true)
@@ -449,7 +452,8 @@
|| (response.equalsIgnoreCase(noShort))
|| (response.length() == 0))
{
- return ErrorReturnCode.ERROR_LICENSE_NOT_ACCEPTED.getReturnCode();
+ return ErrorReturnCode.ERROR_LICENSE_NOT_ACCEPTED
+ .getReturnCode();
}
else
if (response.equalsIgnoreCase(yes)
@@ -460,31 +464,19 @@
}
else
{
- println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
+ println(QuickSetupMessages
+ .INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
}
}
catch (IOException e)
{
- println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
+ println(QuickSetupMessages.
+ INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
}
}
}
}
- if (initializeServer)
- {
- try
- {
- initializeDirectoryServer(argParser.configFileArg.getValue(),
- argParser.configClassArg.getValue());
- }
- catch (InitializationException ie)
- {
- println(ie.getMessageObject());
- return ErrorReturnCode.ERROR_INITIALIZING_SERVER.getReturnCode();
- }
- }
-
boolean userApproved = false;
UserData uData = new UserData();
@@ -525,7 +517,7 @@
while (isInteractive() && promptAgain)
{
promptAgain = false;
- ConfirmCode confirm = askForConfirmation(uData);
+ ConfirmCode confirm = askForConfirmation();
switch (confirm)
{
case CONTINUE:
@@ -646,64 +638,6 @@
}
/**
- * Initialize the directory server to be able to perform the operations
- * required during the installation.
- * @param configFile the configuration file to be used to initialize the
- * server.
- * @param configClass the configuration class to be used to initialize the
- * server.
- * @throws InitializationException if there was an error during
- * initialization.
- */
- private void initializeDirectoryServer(String configFile, String configClass)
- throws InitializationException
- {
- printlnProgress();
- printProgress(Message.raw(DirectoryServer.getVersionString()));
- printlnProgress();
- printProgress(INFO_INSTALLDS_INITIALIZING.get());
- printlnProgress();
-
- // Perform a base-level initialization that will be required to get
- // minimal functionality like DN parsing to work.
- DirectoryServer directoryServer = DirectoryServer.getInstance();
- DirectoryServer.bootstrapClient();
-
- try
- {
- DirectoryServer.initializeJMX();
- }
- catch (Throwable t)
- {
- Message message = ERR_INSTALLDS_CANNOT_INITIALIZE_JMX.get(
- String.valueOf(configFile), t.getMessage());
- throw new InitializationException(message, t);
- }
-
- try
- {
- directoryServer.initializeConfiguration(configClass, configFile);
- }
- catch (Throwable t)
- {
- Message message = ERR_INSTALLDS_CANNOT_INITIALIZE_CONFIG.get(
- configFile, t.getMessage());
- throw new InitializationException(message, t);
- }
-
- try
- {
- directoryServer.initializeSchema();
- }
- catch (Throwable t)
- {
- Message message = ERR_INSTALLDS_CANNOT_INITIALIZE_SCHEMA.get(
- configFile, t.getMessage());
- throw new InitializationException(message, t);
- }
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -765,8 +699,6 @@
throws UserDataException
{
LinkedList<Message> errorMessages = new LinkedList<Message>();
- uData.setConfigurationClassName(argParser.configClassArg.getValue());
- uData.setConfigurationFile(argParser.configFileArg.getValue());
uData.setQuiet(isQuiet());
uData.setVerbose(isVerbose());
uData.setConnectTimeout(getConnectTimeout());
@@ -775,7 +707,7 @@
try
{
- DN.decode(dmDN);
+ new LdapName(dmDN);
if (dmDN.trim().length() == 0)
{
errorMessages.add(ERR_INSTALLDS_EMPTY_DN_RESPONSE.get());
@@ -801,7 +733,7 @@
{
try
{
- DN.decode(baseDN);
+ new LdapName(baseDN);
}
catch (Exception e)
{
@@ -1056,8 +988,6 @@
*/
private void promptIfRequired(UserData uData) throws UserDataException
{
- uData.setConfigurationClassName(argParser.configClassArg.getValue());
- uData.setConfigurationFile(argParser.configFileArg.getValue());
uData.setQuiet(isQuiet());
uData.setVerbose(isVerbose());
uData.setConnectTimeout(getConnectTimeout());
@@ -1182,7 +1112,7 @@
{
try
{
- DN.decode(dn);
+ new LdapName(dn);
if (dn.trim().length() == 0)
{
toRemove.add(dn);
@@ -1251,7 +1181,7 @@
* This method returns a valid port value. It checks that the provided
* argument contains a valid port. If a valid port is not found it prompts
* the user to provide a valid port.
- * @param arg the Argument that the user provided to specify the port.
+ * @param portArg the Argument that the user provided to specify the port.
* @param promptMsg the prompt message to be displayed.
* @param usedPorts the list of ports the user provided before for other
* connection handlers.
@@ -1714,8 +1644,6 @@
}
// Ask to enable SSL
- ldapsPort = -1;
-
if (!argParser.ldapsPortArg.isPresent())
{
println();
@@ -2092,10 +2020,7 @@
}
else if (certManager.hasRealAliases())
{
- for (int i=0; i<aliases.length; i++)
- {
- nicknameList.add(aliases[i]);
- }
+ Collections.addAll(nicknameList, aliases);
String aliasString = Utils.getStringFromCollection(nicknameList,
", ");
if (certNickname != null)
@@ -2641,11 +2566,10 @@
* This method asks the user to confirm to continue the setup. It basically
* displays the information provided by the user and at the end proposes a
* menu with the different options to choose from.
- * @param uData the UserData that the user provided.
* @return the answer provided by the user: cancel setup, continue setup or
* provide information again.
*/
- private ConfirmCode askForConfirmation(UserData uData)
+ private ConfirmCode askForConfirmation()
{
ConfirmCode returnValue;
@@ -2797,4 +2721,5 @@
{
return argParser.getConnectTimeout();
}
+
}
diff --git a/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java b/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
index 14f739d..aaec993 100644
--- a/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
+++ b/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2011-2012 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.server.tools;
@@ -44,7 +44,6 @@
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.util.Utils;
import org.opends.server.admin.AdministrationConnector;
-import org.opends.server.extensions.ConfigFileHandler;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
@@ -88,8 +87,6 @@
IntegerArgument jmxPortArg;
IntegerArgument sampleDataArg;
StringArgument baseDNArg;
- StringArgument configClassArg;
- StringArgument configFileArg;
StringArgument importLDIFArg;
StringArgument rejectedImportFileArg;
StringArgument skippedImportFileArg;
@@ -138,23 +135,6 @@
cliArg.setPropertyName(OPTION_LONG_CLI);
addArgument(cliArg);
- configFileArg = new StringArgument(
- "configFile".toLowerCase(), 'c', "configFile", false,
- false, true, INFO_CONFIGFILE_PLACEHOLDER.get(), getDefaultConfigFile(),
- "configFile",
- INFO_DESCRIPTION_CONFIG_FILE.get());
- configFileArg.setHidden(true);
- addArgument(configFileArg);
-
- configClassArg = new StringArgument(
- OPTION_LONG_CONFIG_CLASS.toLowerCase(), OPTION_SHORT_CONFIG_CLASS,
- OPTION_LONG_CONFIG_CLASS, false,
- false, true, INFO_CONFIGCLASS_PLACEHOLDER.get(),
- ConfigFileHandler.class.getName(), OPTION_LONG_CONFIG_CLASS,
- INFO_DESCRIPTION_CONFIG_CLASS.get());
- configClassArg.setHidden(true);
- addArgument(configClassArg);
-
String defaultProgName;
if (SetupUtils.isWindows())
{
@@ -461,7 +441,6 @@
if (!isUsageArgumentPresent() && !isVersionArgumentPresent())
{
- checkConfigFileArg(errorMessages);
checkServerPassword(errorMessages);
checkProvidedPorts(errorMessages);
checkImportDataArguments(errorMessages);
@@ -516,23 +495,6 @@
}
/**
- * Checks that we have a config file value (at least the default value).
- * @param errorMessages the list of messages to which we add the error
- * messages describing the problems encountered during the execution of the
- * checking.
- */
- private void checkConfigFileArg(Collection<Message> errorMessages)
- {
- // Make sure the path to the configuration file was given.
- if (configFileArg.getValue() == null)
- {
- Message message = ERR_INSTALLDS_NO_CONFIG_FILE.get(
- configFileArg.getLongIdentifier());
- errorMessages.add(message);
- }
- }
-
- /**
* Checks that there are no conflicts with the directory manager passwords.
* If we are in no prompt mode, check that the password was provided.
* @param errorMessages the list of messages to which we add the error
@@ -785,20 +747,6 @@
}
/**
- * Returns the default config file retrieved by inspecting the class loader.
- * @return the default config file retrieved by inspecting the class loader.
- */
- private String getDefaultConfigFile()
- {
- // Use this instead of Installation.getLocal() because making that call
- // starts a new JVM and the command-line becomes less responsive.
- String a = Utils.getInstallPathFromClasspath();
- String root = Utils.getInstancePathFromInstallPath(a);
- String configDir = Utils.getPath(root, Installation.CONFIG_PATH_RELATIVE);
- return Utils.getPath(configDir, Installation.CURRENT_CONFIG_FILE_NAME);
- }
-
- /**
* Returns the timeout to be used to connect in milliseconds. The method
* must be called after parsing the arguments.
* @return the timeout to be used to connect in milliseconds. Returns
diff --git a/opends/src/server/org/opends/server/tools/ListBackends.java b/opends/src/server/org/opends/server/tools/ListBackends.java
index 6f32044..65b15c8 100644
--- a/opends/src/server/org/opends/server/tools/ListBackends.java
+++ b/opends/src/server/org/opends/server/tools/ListBackends.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012 ForgeRock AS
+ * Portions Copyright 2012-2013 ForgeRock AS
*/
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -47,6 +47,7 @@
import org.opends.server.types.DN;
import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.BooleanArgument;
@@ -245,6 +246,16 @@
return 1;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
// Perform the initial bootstrap of the Directory Server and process the
// configuration.
diff --git a/opends/src/server/org/opends/server/tools/ManageTasks.java b/opends/src/server/org/opends/server/tools/ManageTasks.java
index 665ca65..62a715c 100644
--- a/opends/src/server/org/opends/server/tools/ManageTasks.java
+++ b/opends/src/server/org/opends/server/tools/ManageTasks.java
@@ -23,22 +23,26 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2012 ForgeRock AS
+ * Portions Copyright 2012-2013 ForgeRock AS
*/
package org.opends.server.tools;
import org.opends.messages.Message;
import static org.opends.messages.ToolMessages.*;
+
import org.opends.server.api.ErrorLogPublisher;
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import static org.opends.server.loggers.ErrorLogger.removeErrorLogPublisher;
+
import org.opends.server.protocols.asn1.ASN1Exception;
import static org.opends.server.tools.ToolConstants.*;
import org.opends.server.tools.tasks.TaskClient;
import org.opends.server.tools.tasks.TaskEntry;
+import org.opends.server.types.InitializationException;
import org.opends.server.types.LDAPException;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
import static org.opends.server.util.StaticUtils.filterExitCode;
import org.opends.server.util.args.ArgumentException;
@@ -293,6 +297,17 @@
}
if (!argParser.usageOrVersionDisplayed()) {
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ println(e.getMessageObject());
+ return 1;
+ }
+
try {
LDAPConnectionConsoleInteraction ui =
new LDAPConnectionConsoleInteraction(
diff --git a/opends/src/server/org/opends/server/tools/RebuildIndex.java b/opends/src/server/org/opends/server/tools/RebuildIndex.java
index e6ef057..c8d113f 100644
--- a/opends/src/server/org/opends/server/tools/RebuildIndex.java
+++ b/opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -29,6 +29,8 @@
import org.opends.messages.Message;
import static org.opends.server.util.StaticUtils.wrapText;
+
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.LDAPConnectionArgumentParser;
@@ -246,7 +248,6 @@
return 1;
}
-
// If we should just display usage or version information,
// then print it and exit.
if (argParser.usageOrVersionDisplayed())
@@ -254,9 +255,6 @@
return 0;
}
-
-
-
// If no arguments were provided, then display usage information and exit.
int numArgs = args.length;
if (numArgs == 0)
@@ -265,7 +263,6 @@
return 1;
}
-
if (indexList.getValues().size() <= 0 && !rebuildAll.isPresent()
&& !rebuildDegraded.isPresent())
{
@@ -320,6 +317,17 @@
return 1;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
return process(argParser, initializeServer, out, err);
}
diff --git a/opends/src/server/org/opends/server/tools/RestoreDB.java b/opends/src/server/org/opends/server/tools/RestoreDB.java
index 8e10368..86a1a5a 100644
--- a/opends/src/server/org/opends/server/tools/RestoreDB.java
+++ b/opends/src/server/org/opends/server/tools/RestoreDB.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -54,6 +54,7 @@
import org.opends.server.loggers.debug.TextDebugLogPublisher;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.types.*;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
@@ -279,6 +280,17 @@
return 1;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
return process(argParser, initializeServer, out, err);
}
diff --git a/opends/src/server/org/opends/server/tools/ToolConstants.java b/opends/src/server/org/opends/server/tools/ToolConstants.java
index 1fd5696..5a88cda 100644
--- a/opends/src/server/org/opends/server/tools/ToolConstants.java
+++ b/opends/src/server/org/opends/server/tools/ToolConstants.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.server.tools;
@@ -781,5 +781,25 @@
* The value for the short option advanced.
*/
public static final Character OPTION_DSCFG_SHORT_ADVANCED = null;
+
+ /**
+ * The value for the long option ignore errors.
+ */
+ public static final String OPTION_LONG_IGNORE_ERRORS = "ignoreErrors";
+
+ /**
+ * The value for the long option force upgrade.
+ */
+ public static final String OPTION_LONG_FORCE_UPGRADE = "force";
+
+ /**
+ * The value for the long option restore backup.
+ */
+ public static final String OPTION_LONG_RESTORE_UPGRADE = "restore";
+
+ /**
+ * The value for the long option for backup all.
+ */
+ public static final String OPTION_LONG_BACKUP_ALL = "backupAll";
}
diff --git a/opends/src/server/org/opends/server/tools/VerifyIndex.java b/opends/src/server/org/opends/server/tools/VerifyIndex.java
index 10bdf66..65a7d1e 100644
--- a/opends/src/server/org/opends/server/tools/VerifyIndex.java
+++ b/opends/src/server/org/opends/server/tools/VerifyIndex.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.server.tools;
@@ -46,6 +46,7 @@
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.TraceSettings;
import org.opends.server.types.*;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.BooleanArgument;
@@ -58,6 +59,7 @@
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.messages.ToolMessages.*;
+
import org.opends.messages.Message;
import static org.opends.server.util.ServerConstants.*;
@@ -230,9 +232,6 @@
return 0;
}
-
-
-
// If no arguments were provided, then display usage information and exit.
int numArgs = args.length;
if (numArgs == 0)
@@ -241,7 +240,6 @@
return 1;
}
-
if (cleanMode.isPresent() && indexList.getValues().size() != 1)
{
Message message =
@@ -252,6 +250,17 @@
return 1;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
+
// Perform the initial bootstrap of the Directory Server and process the
// configuration.
DirectoryServer directoryServer = DirectoryServer.getInstance();
diff --git a/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java b/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java
deleted file mode 100644
index 9d06954..0000000
--- a/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
- */
-package org.opends.server.tools.configurator;
-
-
-
-import static org.opends.messages.QuickSetupMessages.*;
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.util.DynamicConstants.MAJOR_VERSION;
-import static org.opends.server.util.DynamicConstants.MINOR_VERSION;
-import static org.opends.server.util.DynamicConstants.POINT_VERSION;
-import static org.opends.server.util.DynamicConstants.REVISION_NUMBER;
-
-import java.io.*;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.opends.messages.Message;
-import org.opends.quicksetup.BuildInformation;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.QuickSetupLog;
-import org.opends.quicksetup.ReturnCode;
-import org.opends.server.util.args.ArgumentException;
-import org.opends.server.util.args.ArgumentParser;
-import org.opends.server.util.args.BooleanArgument;
-import org.opends.server.util.args.StringArgument;
-
-
-
-/**
- * This class is called by the configure command line to move the default
- * Directory Server instance.
- */
-public class CheckInstance
-{
-
- static private final Logger LOG = Logger.getLogger(CheckInstance.class
- .getName());
-
- /** Prefix for log files. */
- static public final String LOG_FILE_PREFIX = "opendj-checkinstance-";
-
- private static String installRootFromSystem;
- private static String instanceRootFromSystem;
- /**
- * The user that launches this application.
- */
- public static final String CURRENT_USER_OPTION_LONG = "currentUser";
- /**
- * The value for the short option 'currentUser'.
- */
- public static final Character CURRENT_USER_OPTION_SHORT = null;
- /**
- * Should version be verified.
- */
- public static final String CHECK_VERSION_OPTION_LONG = "checkVersion";
- /**
- * The value for the short option 'checkVersion'.
- */
- public static final Character CHECK_VERSION_OPTION_SHORT = null;
- private static StringArgument currentUserArg;
- private static BooleanArgument checkVersionArg;
- private static String currentUser;
- private static String instanceOwner;
- private static boolean isWin;
- private static int SUCCESS = 0;
- private static int ARGS_ERROR = 1;
- private static int USER_ERROR = 2;
- private static int VERSION_ERROR = 3;
-
-
-
- /**
- * The main method which is called by the configure command lines.
- *
- * @param args
- * the arguments passed by the command line.
- */
- public static void main(final String[] args)
- {
-
- try
- {
- QuickSetupLog.initLogFileHandler(File.createTempFile(LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- }
- catch (final Throwable t)
- {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
-
- // Create the command-line argument parser for use with this program.
- final Message toolDescription = INFO_CHECK_DESCRIPTION.get();
- final ArgumentParser argParser = new ArgumentParser(
- CheckInstance.class.getName(), toolDescription, false);
-
- installRootFromSystem = System.getProperty("INSTALL_ROOT");
- if (installRootFromSystem == null)
- {
- System.err
- .println(ERR_INTERNAL.get(ERR_INSTALL_ROOT_NOT_SPECIFIED.get()));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- instanceRootFromSystem = System.getProperty("INSTANCE_ROOT");
- if (instanceRootFromSystem == null)
- {
- System.err
- .println(ERR_INTERNAL.get(ERR_INSTANCE_ROOT_NOT_SPECIFIED.get()));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- isWin = System.getProperty("file.separator").equals("\\");
-
- // Initialize all the command-line argument types and register them with the
- // parser.
- try
- {
- if (!isWin)
- {
- currentUserArg = new StringArgument(CURRENT_USER_OPTION_LONG,
- CURRENT_USER_OPTION_SHORT, CURRENT_USER_OPTION_LONG, true, true,
- INFO_CURRENT_USER_PLACEHOLDER.get(),
- INFO_CHECK_DESCRIPTION_CURRENT_USER.get());
- argParser.addArgument(currentUserArg);
- }
- checkVersionArg = new BooleanArgument(CHECK_VERSION_OPTION_LONG,
- CHECK_VERSION_OPTION_SHORT, CHECK_VERSION_OPTION_LONG,
- INFO_CHECK_DESCRIPTION_CHECK_VERSION.get());
- argParser.addArgument(checkVersionArg);
- }
- catch (final ArgumentException ae)
- {
- System.err.println(ERR_INTERNAL.get(ae.getMessageObject()));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- // Parse the command-line arguments provided to this program.
- try
- {
- argParser.parseArguments(args);
- }
- catch (final ArgumentException ae)
- {
- System.err.println(ERR_INTERNAL.get(ae.getMessageObject()));
- System.exit(ARGS_ERROR);
- }
-
- final File confDir = new File(instanceRootFromSystem,
- Installation.CONFIG_PATH_RELATIVE);
-
- if (!isWin)
- {
- // Check user
- final File conf =
- new File(confDir, Installation.CURRENT_CONFIG_FILE_NAME);
- Process proc = null;
- int exit = 0;
-
- InputStreamReader reader = null;
- int c;
- final StringBuilder sb = new StringBuilder();
- final String[] cmdArgs = { "ls", "-l", conf.getAbsolutePath() };
- final StringBuilder cmd = new StringBuilder();
- for (final String arg : cmdArgs)
- {
- if (cmd.length() > 0)
- {
- cmd.append(" ");
- }
- cmd.append(arg);
- }
- try
- {
- proc = Runtime.getRuntime().exec(cmdArgs);
- proc.waitFor();
- reader = new InputStreamReader(proc.getInputStream());
- while (((c = reader.read()) != -1))
- {
- sb.append((char) c);
- }
- exit = proc.exitValue();
- if (exit != 0)
- {
- LOG.log(Level.FINEST, cmd + " error= " + exit);
- System.err.println(ERR_CONFIG_LDIF_NOT_FOUND.get(
- confDir.getAbsolutePath(), installRootFromSystem + File.separator
- + "instance.loc"));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
- catch (final InterruptedException ex)
- {
- LOG.log(Level.SEVERE, "InterruptedException" + ex.getMessage());
- System.err.println(ERR_CONFIG_LDIF_NOT_FOUND.get(
- confDir.getAbsolutePath(), installRootFromSystem + File.separator
- + "instance.loc"));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- catch (final IOException ex)
- {
- LOG.log(Level.SEVERE, "IOException" + ex.getMessage());
- System.err.println(ERR_CONFIG_LDIF_NOT_FOUND.get(
- confDir.getAbsolutePath(), installRootFromSystem + File.separator
- + "instance.loc"));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- LOG.log(Level.FINEST, cmd + " returns [" + sb.toString() + "]");
- final StringTokenizer tok = new StringTokenizer(sb.toString());
- if (tok.hasMoreTokens())
- {
- // access rights
- tok.nextToken();
- if (tok.hasMoreTokens())
- {
- // inode
- tok.nextToken();
- if (tok.hasMoreTokens())
- {
- instanceOwner = tok.nextToken();
- LOG.log(Level.FINEST, "instanceOwner=[" + instanceOwner + "]");
- }
- else
- {
- LOG.log(Level.SEVERE, "no instanceOwner");
- System.err
- .println(ERR_INTERNAL.get(Message.raw("no instanceOwner")));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
- else
- {
- LOG.log(Level.SEVERE, "no inode");
- System.err.println(ERR_INTERNAL.get(Message.raw("no inode")));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
- else
- {
- LOG.log(Level.SEVERE, "no access rights");
- System.err.println(ERR_INTERNAL.get(Message.raw("no access rights")));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- currentUser = currentUserArg.getValue();
- LOG.log(Level.FINEST, "currentUser=[" + currentUser + "]");
-
- if ((currentUser != null) && !(currentUser.equals(instanceOwner)))
- {
- System.err.println(ERR_CHECK_USER_ERROR.get(instanceOwner));
- System.exit(USER_ERROR);
- }
- }
-
- // Initialize buildinfo in not already done (ZIP delivery)
- final BuildInformation installBi = BuildInformation
- .fromBuildString(MAJOR_VERSION + "." + MINOR_VERSION + "."
- + POINT_VERSION + "." + REVISION_NUMBER);
- final File bif = new File(confDir, Installation.BUILDINFO_RELATIVE_PATH);
- if (!bif.exists())
- {
- FileWriter fwriter = null;
- try
- {
- fwriter = new FileWriter(bif, true);
- fwriter.append(installBi.getBuildString());
- }
- catch (final Exception e)
- {
- }
- finally
- {
- try
- {
- fwriter.close();
- }
- catch (final Exception e)
- {
- }
- }
- }
-
- // Check version
- if (checkVersionArg.isPresent())
- {
- BuildInformation instanceBi = installBi;
-
- try
- {
- if (bif.exists())
- {
- final BufferedReader breader =
- new BufferedReader(new FileReader(bif));
-
- // Read the first line and close the file.
- String line;
- try
- {
- line = breader.readLine();
- instanceBi = BuildInformation.fromBuildString(line);
- }
- finally
- {
- try
- {
- breader.close();
- }
- catch (final Exception e)
- {
- }
- }
-
- // For pkg(5) delivery: update the file to avoid overwrite
- // during upgrade
- final FileWriter fwriter = new FileWriter(bif, true);
- try
- {
- fwriter.append('\n');
- }
- finally
- {
- try
- {
- fwriter.close();
- }
- catch (final Exception e)
- {
- }
- }
- }
- }
- catch (final Exception e)
- {
- LOG.log(Level.SEVERE, "error getting build information for "
- + "current instance", e);
- }
-
- if (!installBi.equals(instanceBi))
- {
- System.err.println(ERR_CHECK_VERSION_NOT_MATCH.get());
- System.exit(VERSION_ERROR);
- }
- }
- else
- {
- LOG.log(Level.FINEST, "checkVersion not specified");
- }
-
- // For pkg(5) delivery: if config/upgrade/*.ldif.REV does not exist
- try
- {
- final File upgradeDir = new File(confDir, Installation.UPGRADE_PATH);
- final File tmplUpgradeDir = new File(installRootFromSystem
- + File.separator + Installation.TMPL_INSTANCE_RELATIVE_PATH
- + File.separator + Installation.CONFIG_PATH_RELATIVE + File.separator
- + Installation.UPGRADE_PATH);
-
- final File concatenatedSchema = new File(upgradeDir, "schema.ldif."
- + REVISION_NUMBER);
- if (!concatenatedSchema.exists())
- {
- final File tmplConcatenatedSchema = new File(tmplUpgradeDir,
- "schema.ldif." + REVISION_NUMBER);
- copyFile(tmplConcatenatedSchema, concatenatedSchema);
- }
- else
- {
- LOG.log(Level.INFO, concatenatedSchema.getAbsolutePath()
- + "already exists");
- }
-
- final File initialConfig = new File(upgradeDir, "config.ldif."
- + REVISION_NUMBER);
- if (!initialConfig.exists())
- {
- final File tmplInitialConfig = new File(tmplUpgradeDir, "config.ldif."
- + REVISION_NUMBER);
- copyFile(tmplInitialConfig, initialConfig);
- }
- else
- {
- LOG.log(Level.INFO, initialConfig.getAbsolutePath() + "already exists");
- }
- }
- catch (final Exception e)
- {
- LOG.log(Level.SEVERE, "error initializing config/upgrade files", e);
- }
-
- System.exit(SUCCESS);
-
- }
-
-
-
- /**
- * Creates a copy of the specified file.
- *
- * @param from
- * The source file to be copied.
- * @param to
- * The destination file to be created.
- * @throws IOException
- * If a problem occurs.
- */
- private static void copyFile(final File from, final File to)
- throws IOException
- {
- final byte[] buffer = new byte[4096];
- FileInputStream inputStream = null;
- FileOutputStream outputStream = null;
-
- try
- {
- inputStream = new FileInputStream(from);
- outputStream = new FileOutputStream(to, false);
-
- int bytesRead = inputStream.read(buffer);
- while (bytesRead > 0)
- {
- outputStream.write(buffer, 0, bytesRead);
- bytesRead = inputStream.read(buffer);
- }
- }
- finally
- {
- if (inputStream != null)
- {
- try
- {
- inputStream.close();
- }
- catch (final Exception e)
- {
- }
- }
-
- if (outputStream != null)
- {
- outputStream.close();
- }
- }
- }
-}
diff --git a/opends/src/server/org/opends/server/tools/configurator/Configurator.java b/opends/src/server/org/opends/server/tools/configurator/Configurator.java
deleted file mode 100644
index 796a9e6..0000000
--- a/opends/src/server/org/opends/server/tools/configurator/Configurator.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2012 ForgeRock AS
- */
-package org.opends.server.tools.configurator;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import org.opends.quicksetup.ReturnCode;
-import org.opends.server.util.args.ArgumentException;
-import org.opends.server.util.args.ArgumentParser;
-import org.opends.server.util.args.StringArgument;
-import java.io.InputStreamReader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.opends.messages.Message;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.Launcher;
-import org.opends.quicksetup.util.Utils;
-import org.opends.server.util.ServerConstants;
-import org.opends.server.util.args.BooleanArgument;
-import org.opends.quicksetup.QuickSetupLog;
-
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.tools.ToolConstants.*;
-import static org.opends.messages.QuickSetupMessages.*;
-
-/**
- * This class is called by the configure command line to move the default
- * Directory Server instance.
- */
-public class Configurator extends Launcher {
-
- static private final Logger LOG = Logger.getLogger(
- Configurator.class.getName());
-
- /** Prefix for log files. */
- static public final String LOG_FILE_PREFIX = "opendj-configure-";
-
- private String installRootFromSystem;
-
- /**
- * The path where to create the instance.
- */
- public static final String IPATH_OPTION_LONG = "instancePath";
- /**
- * The value for the short option 'instancePath'.
- */
- public static final Character IPATH_OPTION_SHORT = null;
- /**
- * The name of the owner of the instance.
- */
- public static final String USERNAME_OPTION_LONG = "userName";
- /**
- * The value for the short option 'userName'.
- */
- public static final Character USERNAME_OPTION_SHORT = null;
- /**
- * The group of the owner of the instance.
- */
- public static final String GROUPNAME_OPTION_LONG = "groupName";
- /**
- * The value for the short option 'groupName'.
- */
- public static final Character GROUPNAME_OPTION_SHORT = null;
- private ArgumentParser argParser;
- private StringArgument iPath;
- private StringArgument username;
- private StringArgument groupname;
- private BooleanArgument showUsage;
- private String user;
- private String group;
- private String ipath;
-
- /**
- * The main method which is called by the configure command lines.
- *
- * @param args the arguments passed by the command line.
- */
- public static void main(String[] args) {
-
- try {
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (Throwable t) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
-
- try {
- Configurator configurator;
-
- configurator = new Configurator(args);
- configurator.parseArgs(args);
- configurator.configure();
-
- } catch (ApplicationException ae) {
- LOG.log(Level.SEVERE, "Error during config: " + ae.getMessageObject());
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- private void parseArgs(String[] args) {
-
- String cmd = null;
- Process proc = null;
- int exit = 0;
-
- try {
- argParser.parseArguments(args);
-
- if (argParser.usageOrVersionDisplayed()) {
- System.exit(ReturnCode.PRINT_USAGE.getReturnCode());
- }
-
- /* Check instancePath */
- if (iPath.hasValue()) {
- ipath = iPath.getValue();
- } else {
- ipath = Installation.DEFAULT_INSTANCE_PATH;
- }
- File f = new File(ipath);
- if (f.exists()) {
- if (!f.isDirectory()) {
- System.err.println(
- ERR_CONFIGURE_NOT_DIRECTORY.get(ipath));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- File[] l = f.listFiles();
- if (l.length != 0) {
- System.err.println(
- ERR_CONFIGURE_DIRECTORY_NOT_EMPTY.get(ipath));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- if (!f.canWrite()) {
- System.err.println(
- ERR_CONFIGURE_DIRECTORY_NOT_WRITABLE.get(ipath));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- } else {
- File parent = f;
-
- while ((parent != null) && !parent.exists()) {
- parent = parent.getParentFile();
- }
- if (parent != null) {
- /* Checks f is writable */
- if (!parent.canWrite()) {
- System.err.println(
- ERR_CONFIGURE_DIRECTORY_NOT_WRITABLE.get(parent.getName()));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
- /* Create subdirs */
- f.mkdirs();
- }
-
- /* Check userName/groupName by creating a temporary file and try to
- * set the owner
- */
- File temp = File.createTempFile(Configurator.class.getName(), null);
- if (username.hasValue()) {
- user = username.getValue();
- if (! Character.isLetter(user.charAt(0))) {
- System.err.println(ERR_CONFIGURE_BAD_USER_NAME.get(user));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- cmd = "id " + user;
- proc = Runtime.getRuntime().exec(cmd);
- proc.waitFor();
- exit = proc.exitValue();
- if (exit != 0) {
- LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
- System.err.println(ERR_CONFIGURE_USER_NOT_EXIST.get(user));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- } else {
- user = "ldap";
- cmd = "id " + user;
- proc = Runtime.getRuntime().exec(cmd);
- proc.waitFor();
- exit = proc.exitValue();
- if (exit != 0) {
- LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
- System.err.println(ERR_CONFIGURE_LDAPUSER_NOT_EXIST.get(user));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- if (!groupname.hasValue()) {
- InputStreamReader reader = null;
- int c;
- StringBuilder sb = new StringBuilder();
- cmd = "groups " + user;
- proc = Runtime.getRuntime().exec(cmd);
- proc.waitFor();
- reader = new InputStreamReader(proc.getInputStream());
- while (((c = reader.read()) != -1) && (c != ' ')) {
- sb.append((char) c);
- }
- exit = proc.exitValue();
- if (exit != 0) {
- LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
- System.err.println(ERR_CONFIGURE_GET_GROUP_ERROR.get(user, user));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- group = sb.toString();
- } else {
- group = groupname.getValue();
- }
-
- cmd = "chown " + user + ":" + group + " " + temp.getPath();
- proc = Runtime.getRuntime().exec(cmd);
- proc.waitFor();
- exit = proc.exitValue();
- if (exit != 0) {
- LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
- System.err.println(ERR_CONFIGURE_CHMOD_ERROR.get(user, group,
- user, group));
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- temp.delete();
-
- } catch (InterruptedException ex) {
- System.err.println(ex.getLocalizedMessage());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- } catch (IOException ex) {
- System.err.println(ex.getLocalizedMessage());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- } catch (ArgumentException ae) {
- System.err.println(ae.getMessageObject());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- }
-
- private void configure() throws ApplicationException {
- File templ_dir = new File(installRootFromSystem + "/" +
- Installation.TMPL_INSTANCE_RELATIVE_PATH);
-
- String cmd = null;
- Process proc = null;
- int exit = 0;
- try {
- /* Copy template instance */
- File[] l = templ_dir.listFiles();
- for (int i = 0; i < l.length; i++) {
- File subf = l[i];
-
- if (subf.isDirectory()) {
- cmd = "cp -R " + l[i].getAbsolutePath() + " " + ipath;
- } else {
- cmd = "cp " + l[i].getAbsolutePath() + " " + ipath;
- }
- proc = Runtime.getRuntime().exec(cmd);
- proc.waitFor();
- exit = proc.exitValue();
- if (exit != 0) {
- LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- /* Change owner */
- cmd = "chown -R " + user + ":" + group + " " + ipath;
- proc = Runtime.getRuntime().exec(cmd);
- proc.waitFor();
- exit = proc.exitValue();
- if (exit != 0) {
- LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- /* Create instance.loc */
- File iloc = new File(Installation.INSTANCE_LOCATION_PATH);
- iloc.getParentFile().mkdirs();
- iloc.createNewFile();
- FileWriter instanceLoc = new FileWriter(iloc);
- instanceLoc.write(ipath);
- instanceLoc.close();
-
- } catch (IOException ex) {
- System.err.println(ex.getLocalizedMessage());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- } catch (InterruptedException ex) {
- System.err.println(ex.getLocalizedMessage());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- }
-
- private Configurator(String[] args) {
- super(args);
-
- String scriptName = "configure";
-
- if (Utils.isWindows()) {
- System.err.println("Not supported platform: Windows");
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- } else {
- scriptName = Installation.UNIX_CONFIGURE_FILE_NAME;
- }
- if (System.getProperty(ServerConstants.PROPERTY_SCRIPT_NAME) == null) {
- System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
- }
-
- installRootFromSystem = System.getProperty("INSTALL_ROOT");
-
- if (installRootFromSystem == null) {
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- argParser = new ArgumentParser(getClass().getName(),
- INFO_CONFIGURE_USAGE_DESCRIPTION.get(), false);
-
-
- try {
- iPath = new StringArgument(
- IPATH_OPTION_LONG,
- IPATH_OPTION_SHORT,
- IPATH_OPTION_LONG,
- false, true,
- INFO_IPATH_PLACEHOLDER.get(),
- INFO_CONFIGURE_DESCRIPTION_IPATH.get());
- argParser.addArgument(iPath);
-
- username =
- new StringArgument(
- USERNAME_OPTION_LONG,
- USERNAME_OPTION_SHORT,
- USERNAME_OPTION_LONG,
- false, true,
- INFO_USER_NAME_PLACEHOLDER.get(),
- INFO_CONFIGURE_DESCRIPTION_USERNAME.get());
- argParser.addArgument(username);
-
- groupname =
- new StringArgument(
- GROUPNAME_OPTION_LONG,
- GROUPNAME_OPTION_SHORT,
- GROUPNAME_OPTION_LONG,
- false, true,
- INFO_GROUPNAME_PLACEHOLDER.get(),
- INFO_CONFIGURE_DESCRIPTION_GROUPNAME.get());
- argParser.addArgument(groupname);
-
- showUsage = new BooleanArgument(
- "showusage",
- OPTION_SHORT_HELP,
- OPTION_LONG_HELP,
- INFO_DESCRIPTION_USAGE.get());
- argParser.addArgument(showUsage);
- argParser.setUsageArgument(showUsage);
-
- } catch (ArgumentException ae) {
- System.err.println(ae.getMessageObject());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected void willLaunchGui() {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void guiLaunchFailed(String logFilePath) {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected CliApplication createCliApplication() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getFrameTitle() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public ArgumentParser getArgumentParser() {
- return argParser;
- }
-}
-
diff --git a/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java b/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java
deleted file mode 100644
index ab3178a..0000000
--- a/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
- */
-package org.opends.server.tools.configurator;
-
-import java.io.File;
-import org.opends.quicksetup.ReturnCode;
-import org.opends.server.util.args.ArgumentException;
-import org.opends.server.util.args.ArgumentParser;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.opends.messages.Message;
-import org.opends.quicksetup.ApplicationException;
-import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.Launcher;
-import org.opends.quicksetup.util.Utils;
-import org.opends.server.util.ServerConstants;
-import org.opends.server.util.args.BooleanArgument;
-import org.opends.quicksetup.QuickSetupLog;
-
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.tools.ToolConstants.*;
-import static org.opends.messages.QuickSetupMessages.*;
-
-/**
- * This class is called by the unconfigure command line to move the default
- * Directory Server instance.
- */
-public class Unconfigurator extends Launcher {
-
- static private final Logger LOG = Logger.getLogger(
- Unconfigurator.class.getName());
-
- /** Prefix for log files. */
- static public final String LOG_FILE_PREFIX = "opendj-unconfigure-";
-
- private String installRootFromSystem;
-
- private ArgumentParser argParser;
- private BooleanArgument showUsage;
- private BooleanArgument checkOptions;
-
- /**
- * The main method which is called by the unconfigure command lines.
- *
- * @param args the arguments passed by the command line.
- */
- public static void main(String[] args) {
-
- try {
- QuickSetupLog.initLogFileHandler(
- File.createTempFile(LOG_FILE_PREFIX,
- QuickSetupLog.LOG_FILE_SUFFIX));
- } catch (Throwable t) {
- System.err.println(INFO_ERROR_INITIALIZING_LOG.get());
- t.printStackTrace();
- }
-
- try {
- Unconfigurator unconfigurator;
-
- unconfigurator = new Unconfigurator(args);
- unconfigurator.parseArgs(args);
- unconfigurator.unconfigure();
-
- } catch (ApplicationException ae) {
- LOG.log(Level.SEVERE, "Error during unconfig: " + ae.getMessageObject());
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- private void parseArgs(String[] args) {
-
- try {
- argParser.parseArguments(args);
-
- if (argParser.usageOrVersionDisplayed()) {
- System.exit(ReturnCode.PRINT_USAGE.getReturnCode());
- }
- if (checkOptions.isPresent()) {
- System.exit(ReturnCode.SUCCESSFUL.getReturnCode());
- }
-
- } catch (ArgumentException ae) {
- System.err.println(ae.getMessageObject());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- }
-
- private void unconfigure() throws ApplicationException {
- /* Delete instance.loc */
- File instanceLoc = new File(Installation.INSTANCE_LOCATION_PATH);
- boolean res = instanceLoc.delete();
- if (!res) {
- System.err.println("Unable to delete: " +
- Installation.INSTANCE_LOCATION_PATH);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- private Unconfigurator(String[] args) {
- super(args);
-
- String scriptName = "unconfigure";
-
- if (Utils.isWindows()) {
- System.err.println("Not supported platform: Windows");
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- } else {
- scriptName = Installation.UNIX_CONFIGURE_FILE_NAME;
- }
- if (System.getProperty(ServerConstants.PROPERTY_SCRIPT_NAME) == null) {
- System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
- }
-
- installRootFromSystem = System.getProperty("INSTALL_ROOT");
-
- if (installRootFromSystem == null) {
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
-
- argParser = new ArgumentParser(getClass().getName(),
- INFO_UNCONFIGURE_USAGE_DESCRIPTION.get(), false);
-
-
- try {
- checkOptions = new BooleanArgument("checkOptions", null,
- "checkOptions",
- INFO_DESCRIPTION_CHECK_OPTIONS.get());
- checkOptions.setHidden(true);
- argParser.addArgument(checkOptions);
-
- showUsage = new BooleanArgument(
- "showusage",
- OPTION_SHORT_HELP,
- OPTION_LONG_HELP,
- INFO_DESCRIPTION_USAGE.get());
- argParser.addArgument(showUsage);
- argParser.setUsageArgument(showUsage);
-
- } catch (ArgumentException ae) {
- System.err.println(ae.getMessageObject());
- printUsage(false);
- System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected void willLaunchGui() {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void guiLaunchFailed(String logFilePath) {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected CliApplication createCliApplication() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Message getFrameTitle() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public ArgumentParser getArgumentParser() {
- return argParser;
- }
-}
-
diff --git a/opends/src/server/org/opends/server/tools/configurator/package-info.java b/opends/src/server/org/opends/server/tools/configurator/package-info.java
deleted file mode 100644
index da64dcf..0000000
--- a/opends/src/server/org/opends/server/tools/configurator/package-info.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * 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
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2009 Sun Microsystems, Inc.
- */
-
-/**
- * Defines the specific classes that are used by the configurator.
- */
-package org.opends.server.tools.configurator;
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
index 8cee440..145aea0 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.tools.dsconfig;
@@ -913,11 +914,11 @@
app.println(INFO_DSCFG_CREATE_NAME_PROMPT_NAMING.get(ufn, pd.getName()));
app.println();
- app.println(pd.getSynopsis(), 4);
+ app.printErrln(pd.getSynopsis(), 4);
if (pd.getDescription() != null) {
app.println();
- app.println(pd.getDescription(), 4);
+ app.printErrln(pd.getDescription(), 4);
}
PropertyDefinitionUsageBuilder b =
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java b/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
index 52b398b..4583d4e 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
- * Portions Copyright 2012 ForgeRock AS
+ * Portions Copyright 2012-2013 ForgeRock AS
*/
package org.opends.server.tools.dsconfig;
@@ -73,6 +73,7 @@
import org.opends.server.tools.ClientException;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.InitializationException;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
@@ -717,6 +718,7 @@
* problem during the configuration processing.
*/
private int run(String[] args) {
+
// Register global arguments and sub-commands.
try {
initializeGlobalArguments(args);
@@ -784,6 +786,18 @@
return 1;
}
+
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ println(e.getMessageObject());
+ return 1;
+ }
+
// Check that we can write on the provided path where we write the
// equivalent non-interactive commands.
if (equivalentCommandFileArgument.isPresent())
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
index 5c6daf0..8c69a4c 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2007-2008 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2013 ForgeRock AS
*/
package org.opends.server.tools.dsconfig;
@@ -509,11 +509,11 @@
// Display the property synopsis and description.
app.println();
- app.println(pd.getSynopsis(), 4);
+ app.printErrln(pd.getSynopsis(), 4);
if (pd.getDescription() != null) {
app.println();
- app.println(pd.getDescription(), 4);
+ app.printErrln(pd.getDescription(), 4);
}
if (pd instanceof AggregationPropertyDefinition) {
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java b/opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
index 587769a..e9b843c 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.tools.dsconfig;
@@ -2005,10 +2006,10 @@
app.println();
app.println(INFO_EDITOR_HEADING_CONFIGURE_PROPERTY.get(pd.getName()));
app.println();
- app.println(pd.getSynopsis(), 4);
+ app.printErrln(pd.getSynopsis(), 4);
if (pd.getDescription() != null) {
app.println();
- app.println(pd.getDescription(), 4);
+ app.printErrln(pd.getDescription(), 4);
}
}
diff --git a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index c87cc58..5384e9b 100644
--- a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -138,6 +138,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.OpenDsException;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
@@ -412,6 +413,23 @@
}
}
+ // If we should just display usage or version information,
+ // then print it and exit.
+ if (argParser.usageOrVersionDisplayed()) {
+ return 0;
+ }
+
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ println(e.getMessageObject());
+ return 1;
+ }
+
if (!argParser.usageOrVersionDisplayed())
{
if (returnValue == SUCCESSFUL_NOP)
diff --git a/opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java b/opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
index a9d435b..3ef4bc3 100644
--- a/opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
+++ b/opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.tools.makeldif;
import org.opends.messages.Message;
@@ -39,8 +40,10 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
import org.opends.server.types.ExistingFileBehavior;
+import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.NullOutputStream;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.LDIFWriter;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
@@ -243,6 +246,16 @@
return 0;
}
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+ return 1;
+ }
if (initializeServer)
{
diff --git a/opends/src/server/org/opends/server/tools/status/StatusCli.java b/opends/src/server/org/opends/server/tools/status/StatusCli.java
index 07d7b40..051cca6 100644
--- a/opends/src/server/org/opends/server/tools/status/StatusCli.java
+++ b/opends/src/server/org/opends/server/tools/status/StatusCli.java
@@ -71,8 +71,10 @@
import org.opends.server.tools.ToolConstants;
import org.opends.server.tools.dsconfig.LDAPManagementContextFactory;
import org.opends.server.types.DN;
+import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.OpenDsException;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.cli.ConsoleApplication;
@@ -307,6 +309,17 @@
if (argParser.usageOrVersionDisplayed()) {
return ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode();
}
+
+ // Checks the version - if upgrade required, the tool is unusable
+ try
+ {
+ BuildVersion.checkVersionMismatch();
+ }
+ catch (InitializationException e)
+ {
+ println(e.getMessageObject());
+ return 1;
+ }
int v = argParser.validateGlobalOptions(getErrorStream());
if (v != DsFrameworkCliReturnCode.SUCCESSFUL_NOP.getReturnCode()) {
diff --git a/opends/src/server/org/opends/server/tools/upgrade/FileManager.java b/opends/src/server/org/opends/server/tools/upgrade/FileManager.java
new file mode 100644
index 0000000..973a0ed
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/FileManager.java
@@ -0,0 +1,606 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2008 Sun Microsystems, Inc.
+ * Portions copyright 2012-2013 ForgeRock AS.
+ */
+
+package org.opends.server.tools.upgrade;
+
+
+
+import static org.opends.messages.ToolMessages.*;
+
+import org.opends.messages.Message;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.FilePermission;
+import org.opends.server.util.StaticUtils;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+
+
+/**
+ * Utility class for use by applications containing methods for managing file
+ * system files. This class handles application notifications for interesting
+ * events.
+ */
+public class FileManager
+{
+
+ /**
+ * Describes the approach taken to deleting a file or directory.
+ */
+ public static enum DeletionPolicy
+ {
+
+ /**
+ * Delete the file or directory immediately.
+ */
+ DELETE_IMMEDIATELY,
+
+ /**
+ * Mark the file or directory for deletion after the JVM has exited.
+ */
+ DELETE_ON_EXIT,
+
+ /**
+ * First try to delete the file immediately. If the deletion was
+ * unsuccessful mark the file for deleteion when the JVM has existed.
+ */
+ DELETE_ON_EXIT_IF_UNSUCCESSFUL
+
+ }
+
+
+
+ /**
+ * Upgrade's Log.
+ */
+ static private final Logger LOG = Logger
+ .getLogger(UpgradeCli.class.getName());
+
+
+
+ private FileManager()
+ {
+ // do nothing;
+ }
+
+
+
+ /**
+ * Deletes everything below the specified file.
+ *
+ * @param file
+ * the path to be deleted.
+ * @throws IOException
+ * if something goes wrong.
+ */
+ public static void deleteRecursively(File file) throws IOException
+ {
+ deleteRecursively(file, null, DeletionPolicy.DELETE_IMMEDIATELY);
+ }
+
+
+
+ private static void deleteRecursively(File file, FileFilter filter,
+ DeletionPolicy deletePolicy) throws IOException
+ {
+ operateRecursively(new DeleteOperation(file, deletePolicy), filter);
+ }
+
+
+
+ /**
+ * Copies everything below the specified file.
+ *
+ * @param objectFile
+ * the file to be copied.
+ * @param destDir
+ * the directory to copy the file to
+ * @param overwrite
+ * overwrite destination files.
+ * @return File representing the destination
+ * @throws IOException
+ * if something goes wrong.
+ */
+ public static File copy(File objectFile, File destDir, boolean overwrite)
+ throws IOException
+ {
+ CopyOperation co = new CopyOperation(objectFile, destDir, overwrite);
+ co.apply();
+ return co.getDestination();
+ }
+
+
+
+ private static void operateRecursively(FileOperation op, FileFilter filter)
+ throws IOException
+ {
+ File file = op.getObjectFile();
+ if (file.exists())
+ {
+ if (file.isFile())
+ {
+ if (filter != null)
+ {
+ if (filter.accept(file))
+ {
+ op.apply();
+ }
+ }
+ else
+ {
+ op.apply();
+ }
+ }
+ else
+ {
+ File[] children = file.listFiles();
+ if (children != null)
+ {
+ for (File aChildren : children)
+ {
+ FileOperation newOp = op.copyForChild(aChildren);
+ operateRecursively(newOp, filter);
+ }
+ }
+ if (filter != null)
+ {
+ if (filter.accept(file))
+ {
+ op.apply();
+ }
+ }
+ else
+ {
+ op.apply();
+ }
+ }
+ }
+ else
+ {
+ LOG.log(Level.INFO, new StringBuilder("File '").append(file.toString())
+ .append("' does not exist").toString());
+ }
+ }
+
+
+
+ /**
+ * Renames the source file to the target file. If the target file exists it is
+ * first deleted. The rename and delete operation return values are checked
+ * for success and if unsuccessful, this method throws an exception.
+ *
+ * @param fileToRename
+ * The file to rename.
+ * @param target
+ * The file to which <code>fileToRename</code> will be moved.
+ * @throws IOException
+ * If a problem occurs while attempting to rename the file. On the
+ * Windows platform, this typically indicates that the file is in
+ * use by this or another application.
+ */
+ public static void rename(File fileToRename, File target) throws IOException
+ {
+ if (fileToRename != null && target != null)
+ {
+ synchronized (target)
+ {
+ if (target.exists())
+ {
+ if (!target.delete())
+ {
+ throw new IOException(INFO_ERROR_DELETING_FILE.get(
+ UpgradeUtils.getPath(target)).toString());
+ }
+ }
+ }
+ if (!fileToRename.renameTo(target))
+ {
+ throw new IOException(INFO_ERROR_RENAMING_FILE.get(
+ UpgradeUtils.getPath(fileToRename), UpgradeUtils.getPath(target))
+ .toString());
+ }
+ }
+ }
+
+
+
+ /**
+ * A file operation.
+ */
+ private static abstract class FileOperation
+ {
+
+ private File objectFile = null;
+
+
+
+ /**
+ * Creates a new file operation.
+ *
+ * @param objectFile
+ * to be operated on
+ */
+ public FileOperation(File objectFile)
+ {
+ this.objectFile = objectFile;
+ }
+
+
+
+ /**
+ * Gets the file to be operated on.
+ *
+ * @return File to be operated on
+ */
+ protected File getObjectFile()
+ {
+ return objectFile;
+ }
+
+
+
+ /**
+ * Make a copy of this class for the child file.
+ *
+ * @param child
+ * to act as the new file object
+ * @return FileOperation as the same type as this class
+ */
+ abstract public FileOperation copyForChild(File child);
+
+
+
+ /**
+ * Execute this operation.
+ *
+ * @throws IOException
+ * if there is a problem.
+ */
+ abstract public void apply() throws IOException;
+
+ }
+
+
+
+ /**
+ * A copy operation.
+ */
+ private static class CopyOperation extends FileOperation
+ {
+
+ private File destination;
+
+ private boolean overwrite;
+
+
+
+ /**
+ * Create a new copy operation.
+ *
+ * @param objectFile
+ * to copy
+ * @param destDir
+ * to copy to
+ * @param overwrite
+ * if true copy should overwrite any existing file
+ */
+ public CopyOperation(File objectFile, File destDir, boolean overwrite)
+ {
+ super(objectFile);
+ this.destination = new File(destDir, objectFile.getName());
+ this.overwrite = overwrite;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public FileOperation copyForChild(File child)
+ {
+ return new CopyOperation(child, destination, overwrite);
+ }
+
+
+
+ /**
+ * Returns the destination file that is the result of copying
+ * <code>objectFile</code> to <code>destDir</code>.
+ *
+ * @return The destination file.
+ */
+ public File getDestination()
+ {
+ return this.destination;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void apply() throws IOException
+ {
+ File objectFile = getObjectFile();
+ if (objectFile.isDirectory())
+ {
+ if (!destination.exists())
+ {
+ destination.mkdirs();
+ }
+ }
+ else
+ {
+
+ // If overwriting and the destination exists then kill it
+ if (destination.exists() && overwrite)
+ {
+ deleteRecursively(destination);
+ }
+
+ if (!destination.exists())
+ {
+ if (insureParentsExist(destination))
+ {
+ final Message message = Message.raw("Copying file '%s' to '%s'",
+ objectFile.getAbsolutePath(), destination.getAbsolutePath());
+ LOG.log(Level.INFO, message.toString());
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
+ try
+ {
+ fis = new FileInputStream(objectFile);
+ fos = new FileOutputStream(destination);
+ byte[] buf = new byte[1024];
+ int i;
+ while ((i = fis.read(buf)) != -1)
+ {
+ fos.write(buf, 0, i);
+ }
+ if (destination.exists())
+ {
+ // TODO: set the file's permissions. This is made easier in
+ // Java 1.6 but until then use the TestUtilities methods
+ if (UpgradeUtils.isUnix())
+ {
+ FilePermission permissions =
+ getFileSystemPermissions(objectFile);
+ FilePermission.setPermissions(destination, permissions);
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ final Message errMsg = INFO_ERROR_COPYING_FILE.get(
+ objectFile.getAbsolutePath(), destination.getAbsolutePath());
+ LOG.log(Level.SEVERE, message.toString());
+ throw new IOException(errMsg.toString());
+ }
+ finally
+ {
+ StaticUtils.close(fis, fos);
+ }
+ }
+ else
+ {
+ final Message errMsg = INFO_ERROR_COPYING_FILE.get(
+ objectFile.getAbsolutePath(), destination.getAbsolutePath());
+ LOG.log(Level.SEVERE, errMsg.toString());
+ throw new IOException(errMsg.toString());
+ }
+ }
+ else
+ {
+ final Message message = Message.raw(
+ "Ignoring file '%s' since '%s' already exists",
+ objectFile.getAbsolutePath(), destination.getAbsolutePath());
+
+ LOG.log(Level.INFO, message.toString());
+ }
+ }
+ }
+
+ }
+
+
+
+ /**
+ * Returns the file permission on the selected file.
+ *
+ * @param file
+ * The file of which we want to extract the permissions.
+ * @return A file permission about the concerned file.
+ * @throws DirectoryException
+ * If the provided string is not a valid three-digit UNIX mode.
+ */
+ private static FilePermission getFileSystemPermissions(final File file)
+ throws DirectoryException
+ {
+ final String name = file.getName();
+ if (file.getParent().endsWith(
+ File.separator + Installation.WINDOWS_BINARIES_PATH_RELATIVE)
+ || file.getParent().endsWith(
+ File.separator + Installation.UNIX_BINARIES_PATH_RELATIVE))
+ {
+ if (name.endsWith(".bat"))
+ {
+ return FilePermission.decodeUNIXMode("644");
+ }
+ return FilePermission.decodeUNIXMode("755");
+
+ }
+ else if (name.endsWith(".sh"))
+ {
+ return FilePermission.decodeUNIXMode("755");
+ }
+ else if (name.endsWith(Installation.UNIX_SETUP_FILE_NAME)
+ || name.endsWith(Installation.UNIX_UNINSTALL_FILE_NAME)
+ || name.endsWith(Installation.UNIX_UPGRADE_FILE_NAME))
+ {
+ return FilePermission.decodeUNIXMode("755");
+ }
+ else if (name.endsWith(Installation.MAC_JAVA_APP_STUB_NAME))
+ {
+ return FilePermission.decodeUNIXMode("755");
+ }
+ return FilePermission.decodeUNIXMode("644");
+ }
+
+
+
+ /**
+ * Creates the parent directory if it does not already exist.
+ *
+ * @param f
+ * File for which parentage will be insured
+ * @return boolean indicating whether or not the input <code>f</code> has a
+ * parent after this method is invoked.
+ */
+ private static boolean insureParentsExist(File f)
+ {
+ File parent = f.getParentFile();
+ boolean b = parent.exists();
+ if (!b)
+ {
+ b = parent.mkdirs();
+ }
+ return b;
+ }
+
+
+
+ /**
+ * A delete operation.
+ */
+ private static class DeleteOperation extends FileOperation
+ {
+
+ private DeletionPolicy deletionPolicy;
+
+
+
+ /**
+ * Creates a delete operation.
+ *
+ * @param objectFile
+ * to delete
+ * @param deletionPolicy
+ * describing how files will be deleted is to take place after this
+ * program exists. This is useful for cleaning up files that are
+ * currently in use.
+ */
+ public DeleteOperation(File objectFile, DeletionPolicy deletionPolicy)
+ {
+ super(objectFile);
+ this.deletionPolicy = deletionPolicy;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public FileOperation copyForChild(File child)
+ {
+ return new DeleteOperation(child, deletionPolicy);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void apply() throws IOException
+ {
+ File file = getObjectFile();
+ boolean isFile = file.isFile();
+
+ LOG.log(Level.INFO, "deleting " + (isFile ? " file " : " directory ")
+ + file.getAbsolutePath());
+
+ boolean delete = false;
+ /*
+ * Sometimes the server keeps some locks on the files. TODO: remove this
+ * code once stop-ds returns properly when server is stopped.
+ */
+ int nTries = 5;
+ for (int i = 0; i < nTries && !delete; i++)
+ {
+ if (DeletionPolicy.DELETE_ON_EXIT.equals(deletionPolicy))
+ {
+ file.deleteOnExit();
+ delete = true;
+ }
+ else
+ {
+ delete = file.delete();
+ if (!delete
+ && DeletionPolicy.DELETE_ON_EXIT_IF_UNSUCCESSFUL
+ .equals(deletionPolicy))
+ {
+ file.deleteOnExit();
+ delete = true;
+ }
+ }
+ if (!delete)
+ {
+ try
+ {
+ Thread.sleep(1000);
+ }
+ catch (Exception ex)
+ {
+ // do nothing;
+ }
+ }
+ }
+
+ if (!delete)
+ {
+ Message errMsg;
+ if (isFile)
+ {
+ errMsg = INFO_ERROR_DELETING_FILE.get(file.getAbsolutePath());
+ }
+ else
+ {
+ errMsg = INFO_ERROR_DELETING_DIRECTORY.get(file.getAbsolutePath());
+ }
+ throw new IOException(errMsg.toString());
+ }
+ }
+ }
+
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/FormattedNotificationCallback.java b/opends/src/server/org/opends/server/tools/upgrade/FormattedNotificationCallback.java
new file mode 100644
index 0000000..ad864ba
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/FormattedNotificationCallback.java
@@ -0,0 +1,89 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+package org.opends.server.tools.upgrade;
+
+import javax.security.auth.callback.TextOutputCallback;
+
+import org.opends.messages.Message;
+
+/**
+ * A formatted notification callback for display title and more...
+ */
+public class FormattedNotificationCallback extends TextOutputCallback
+{
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 1L;
+
+ static final int TITLE_CALLBACK = 5;
+
+ static final int SUBTITLE_CALLBACK = 6;
+
+ static final int NOTICE_CALLBACK = 7;
+
+ /**
+ * An integer representing the message's sub-type.
+ */
+ private int messageSubType;
+
+ /**
+ * A progress notification constructor.
+ *
+ * @param message
+ * The message to display
+ * @param messageSubType
+ * An integer representing the sub-type of this message.
+ */
+ public FormattedNotificationCallback(final Message message,
+ final int messageSubType)
+ {
+ super(TextOutputCallback.INFORMATION, message.toString());
+ this.messageSubType = messageSubType;
+ }
+
+ /**
+ * Returns an integer which represents the message's sub-type.
+ *
+ * @return An integer which represents the message's sub-type.
+ */
+ public int getMessageSubType()
+ {
+ return messageSubType;
+ }
+
+ /**
+ * Sets the message's sub-type.
+ *
+ * @param messageSubType
+ * The message's sub-type.
+ */
+ public void setMessageSubType(int messageSubType)
+ {
+ this.messageSubType = messageSubType;
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/Installation.java b/opends/src/server/org/opends/server/tools/upgrade/Installation.java
new file mode 100644
index 0000000..35f7914
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/Installation.java
@@ -0,0 +1,166 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+/**
+ * This class represents the physical state of an OpenDJ installation. All the
+ * operations are dependent upon the root directory that is specified in the
+ * constructor.
+ */
+public final class Installation
+{
+
+ /**
+ * Relative path to OpenDJ jar files.
+ */
+ public static final String[] OPEN_DS_JAR_RELATIVE_PATHS = {
+ "lib/quicksetup.jar", "lib/OpenDJ.jar", "lib/je.jar" };
+
+ /**
+ * The relative path where all the Windows binaries (batch files) are.
+ */
+ public static final String WINDOWS_BINARIES_PATH_RELATIVE = "bat";
+
+ /**
+ * The relative path where all the UNIX binaries (scripts) are.
+ */
+ public static final String UNIX_BINARIES_PATH_RELATIVE = "bin";
+
+ /**
+ * The relative path where the database files are.
+ */
+ public static final String DATABASES_PATH_RELATIVE = "db";
+
+ /**
+ * The relative path where the log files are.
+ */
+ public static final String LOGS_PATH_RELATIVE = "logs";
+
+ /**
+ * The relative path where the config files are.
+ */
+ public static final String CONFIG_PATH_RELATIVE = "config";
+
+ /**
+ * The relative path where the config files are.
+ */
+ public static final String HISTORY_PATH_RELATIVE = "history";
+
+ /**
+ * Path to the config/upgrade directory where upgrade base files are stored.
+ */
+ public static final String UPGRADE_PATH = "upgrade";
+
+ /**
+ * Relative path to the change log database directory.
+ */
+ public static final String CHANGELOG_PATH_RELATIVE = "changelogDb";
+
+ /**
+ * Relative path to the locks directory.
+ */
+ public static final String LOCKS_PATH_RELATIVE = "locks";
+
+ /**
+ * Relative path to the locks directory.
+ */
+ public static final String TMP_PATH_RELATIVE = "tmp";
+
+ /**
+ * The relative path to the current Configuration LDIF file.
+ */
+ public static final String CURRENT_CONFIG_FILE_NAME = "config.ldif";
+
+ /**
+ * The path to the default instance.
+ */
+ public static final String DEFAULT_INSTANCE_PATH = "/var/opendj";
+
+ /**
+ * The relative path to the instance.loc file.
+ */
+ public static final String INSTANCE_LOCATION_PATH_RELATIVE = "instance.loc";
+
+ /**
+ * The path to the instance.loc file.
+ */
+ public static final String INSTANCE_LOCATION_PATH = "/etc/opendj/"
+ + INSTANCE_LOCATION_PATH_RELATIVE;
+
+ /**
+ * The relative path to tmpl_instance.
+ */
+ public static final String TEMPLATE_RELATIVE_PATH = "template";
+
+ /**
+ * Relative path to the schema directory.
+ */
+ public static final String SCHEMA_PATH_RELATIVE = "schema";
+
+ /**
+ * The relative path to buildinfo file.
+ */
+ public static final String BUILDINFO_RELATIVE_PATH = "buildinfo";
+
+ /**
+ * The UNIX setup script file name.
+ */
+ public static final String UNIX_SETUP_FILE_NAME = "setup";
+
+ /**
+ * The UNIX upgrade script file name.
+ */
+ public static final String UNIX_UPGRADE_FILE_NAME = "upgrade";
+
+ /**
+ * The UNIX uninstall script file name.
+ */
+ public static final String UNIX_UNINSTALL_FILE_NAME = "uninstall";
+
+ /**
+ * The Windows upgrade batch file name.
+ */
+ public static final String WINDOWS_UPGRADE_FILE_NAME = "upgrade.bat";
+
+ /**
+ * The UNIX configure script file name.
+ */
+ public static final String UNIX_CONFIGURE_FILE_NAME = "configure";
+
+ /**
+ * The MacOS X Java application stub name.
+ */
+ public static final String MAC_JAVA_APP_STUB_NAME = "JavaApplicationStub";
+
+ /**
+ * Generic name for the backup tool.
+ */
+ public static final String BACKUP = "backup";
+
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java b/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java
new file mode 100644
index 0000000..435da16
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/LicenseFile.java
@@ -0,0 +1,229 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS.
+ */
+
+package org.opends.server.tools.upgrade;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.opends.server.util.StaticUtils;
+
+/**
+ * Represents information about the license file.
+ */
+public class LicenseFile
+{
+ /**
+ * Get the directory in which legal files are stored.
+ */
+ private static String getLegalDirectory()
+ {
+ String installRootFromSystem = System.getProperty("INSTALL_ROOT");
+
+ if (installRootFromSystem == null)
+ {
+ installRootFromSystem = System.getenv("INSTALL_ROOT");
+ }
+
+ if (installRootFromSystem == null)
+ {
+ installRootFromSystem = "";
+ }
+
+ return installRootFromSystem + File.separatorChar + "Legal";
+ }
+
+ /**
+ * Get the directory in which legal files are stored.
+ */
+ private static String getInstanceLegalDirectory()
+ {
+ String installDirName = System.getProperty("INSTALL_ROOT");
+
+ if (installDirName == null)
+ {
+ installDirName = System.getenv("INSTALL_ROOT");
+ }
+
+ if (installDirName == null)
+ {
+ installDirName = ".";
+ }
+
+ final String instanceDirname =
+ UpgradeUtils.getInstancePathFromInstallPath(installDirName);
+ StringBuilder instanceLegalDirName =
+ new StringBuilder(instanceDirname).append(File.separator).append(
+ "Legal");
+ final File instanceLegalDir = new File(instanceLegalDirName.toString());
+ if (!instanceLegalDir.exists())
+ {
+ instanceLegalDir.mkdir();
+ }
+
+ return instanceLegalDirName.toString();
+ }
+
+ /**
+ * The File object related to the license file.
+ */
+ static private File licFile = null;
+
+ /**
+ * The license file approval state.
+ */
+ static private boolean approved = false;
+
+ /**
+ * Returns the license file name.
+ */
+ static private String getName()
+ {
+ return new StringBuilder(getLegalDirectory()).append(File.separatorChar)
+ .append("license_to_accept.txt").toString();
+ }
+
+ /**
+ * Returns the license file object.
+ */
+ static private File getFile()
+ {
+ if (licFile == null)
+ {
+ licFile = new File(getName());
+ }
+
+ return licFile;
+ }
+
+ /**
+ * Checks if the license file exists.
+ *
+ * @return <CODE>true</CODE> a license file license_to_accept.txt exists in
+ * the Legal directory in the top level installation directory
+ * <CODE>false</CODE> otherwise.
+ */
+ static public boolean exists()
+ {
+ return getFile().exists();
+ }
+
+ /**
+ * Get the textual contents of the license file.
+ *
+ * @return the textual contents of the license file.
+ */
+ static public String getText()
+ {
+ FileReader reader;
+
+ try
+ {
+ reader = new FileReader(getFile());
+ }
+ catch (Exception e)
+ {
+ return "";
+ }
+
+ int fileLen = (int) getFile().length();
+
+ char[] charArray = new char[fileLen];
+
+ try
+ {
+ reader.read(charArray);
+ }
+ catch (IOException ioe)
+ {
+ System.out.println("Could not read license file");
+ }
+ finally
+ {
+ StaticUtils.close(reader);
+ }
+
+ return new String(charArray);
+ }
+
+ /**
+ * Get the license approval status.
+ *
+ * @return <CODE>true</CODE> if the license has been accepted by the user
+ * <CODE>false</CODE> otherwise.
+ */
+ static public boolean getApproval()
+ {
+ return approved;
+ }
+
+ /**
+ * Sets the license approval status.
+ *
+ * @param p_approved
+ * the license approval status
+ */
+ static public void setApproval(boolean p_approved)
+ {
+ approved = p_approved;
+ }
+
+ /**
+ * Create a file which indicates that the license has been approved.
+ */
+ static public void createFileLicenseApproved()
+ {
+ if (getApproval())
+ {
+ try
+ {
+ new File(getInstanceLegalDirectory() + File.separatorChar
+ + "licenseAccepted").createNewFile();
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ }
+
+ /**
+ * Indicate if the license had already been approved..
+ *
+ * @return <CODE>true</CODE> if the license had already been approved by the
+ * user <CODE>false</CODE> otherwise.
+ */
+ static public boolean isAlreadyApproved()
+ {
+ File f =
+ new File(getInstanceLegalDirectory() + File.separatorChar
+ + "licenseAccepted");
+ return f.exists();
+ }
+
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/ProgressNotificationCallback.java b/opends/src/server/org/opends/server/tools/upgrade/ProgressNotificationCallback.java
new file mode 100644
index 0000000..979e21a
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/ProgressNotificationCallback.java
@@ -0,0 +1,99 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+package org.opends.server.tools.upgrade;
+
+import javax.security.auth.callback.TextOutputCallback;
+
+import org.opends.messages.Message;
+
+/**
+ * A progress notification callback.
+ */
+public class ProgressNotificationCallback extends TextOutputCallback
+{
+ /**
+ * The serial version uid.
+ */
+ private static final long serialVersionUID = 55L;
+
+ /**
+ * An integer representing the percentage of the task's process.
+ */
+ private int progress;
+
+ /**
+ * A progress notification constructor.
+ *
+ * @param messageType
+ * The type of the message, usually INFORMATION.
+ * @param message
+ * The message to display
+ * @param progress
+ * An integer representing the percentage of the task's progress.
+ */
+ public ProgressNotificationCallback(final int messageType,
+ final Message message, final int progress)
+ {
+ super(messageType, message.toString());
+ this.progress = progress;
+ }
+
+ /**
+ * Returns an integer which represents the task's progress percentage.
+ *
+ * @return An integer which represents the task's progress percentage.
+ */
+ public int getProgress()
+ {
+ return progress;
+ }
+
+ /**
+ * Sets the percentage's progress.
+ *
+ * @param progress
+ * The percentage's progress.
+ */
+ public void setProgress(int progress)
+ {
+ this.progress = progress;
+ }
+
+ /**
+ * Change the progress on an existing progress notification callback.
+ *
+ * @param progress
+ * The new value of the progress.
+ * @return A progress Notification Callback
+ */
+ public ProgressNotificationCallback changeProgress(int progress)
+ {
+ this.progress = progress;
+ return this;
+ }
+
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java b/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java
new file mode 100644
index 0000000..9b4413c
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java
@@ -0,0 +1,632 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+
+
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.tools.upgrade.FormattedNotificationCallback.*;
+import static org.opends.server.tools.upgrade.UpgradeTasks.*;
+import static org.opends.server.tools.upgrade.VerificationCallback.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.ConfirmationCallback;
+
+import org.opends.messages.Message;
+import org.opends.server.core.LockFileManager;
+import org.opends.server.tools.ClientException;
+import org.opends.server.util.BuildVersion;
+import org.opends.server.util.StaticUtils;
+
+
+
+/**
+ * This class contains the table of upgrade tasks that need performing when
+ * upgrading from one version to another.
+ */
+public final class Upgrade
+{
+ /**
+ * Upgrade's logger.
+ */
+ private final static Logger LOG = Logger
+ .getLogger(UpgradeCli.class.getName());
+
+ /**
+ * Upgrade supports version from 2.4.5.
+ */
+ private final static BuildVersion UPGRADESUPPORTSVERSIONFROM = BuildVersion
+ .valueOf("2.4.5.0000");
+
+ /**
+ * The success exit code value.
+ */
+ public static final int EXIT_CODE_SUCCESS = 0;
+
+ /**
+ * The error exit code value.
+ */
+ public static final int EXIT_CODE_ERROR = 1;
+
+ /**
+ * The exit code value that will be used if upgrade requires manual
+ * intervention.
+ */
+ public static final int EXIT_CODE_MANUAL_INTERVENTION = 2;
+
+ /**
+ * Developers should register upgrade tasks below.
+ */
+ private static final NavigableMap<BuildVersion, List<UpgradeTask>> TASKS =
+ new TreeMap<BuildVersion, List<UpgradeTask>>();
+ private static final List<UpgradeTask> MANDATORY_TASKS =
+ new LinkedList<UpgradeTask>();
+
+ static
+ {
+ // @formatter:off
+ register("2.5.0.6869",
+ modifyConfigEntry(INFO_UPGRADE_TASK_6869_SUMMARY.get(),
+ "(objectClass= ds-cfg-collation-matching-rule)",
+ "add: ds-cfg-collation",
+ "ds-cfg-collation: de:1.3.6.1.4.1.42.2.27.9.4.28.1",
+ "ds-cfg-collation: de-DE:1.3.6.1.4.1.42.2.27.9.4.28.1",
+ "-",
+ "delete: ds-cfg-collation",
+ "ds-cfg-collation: de:1.3.6.1.4.1.142.2.27.9.4.28.1",
+ "ds-cfg-collation: de-DE:1.3.6.1.4.1.142.2.27.9.4.28.1"));
+
+ register("2.5.0.7192",
+ modifyConfigEntry(INFO_UPGRADE_TASK_7192_SUMMARY.get(),
+ "(objectClass= ds-cfg-password-policy)",
+ "add: objectClass",
+ "objectClass: ds-cfg-authentication-policy",
+ "-",
+ "add: ds-cfg-java-class",
+ "ds-cfg-java-class: org.opends.server.core.PasswordPolicyFactory"));
+
+ register("2.5.0.7364",
+ modifyConfigEntry(INFO_UPGRADE_TASK_7364_SUMMARY.get(),
+ "(ds-cfg-java-class= org.opends.server.loggers.TextAuditLogPublisher)",
+ "add: objectClass",
+ "objectClass: ds-cfg-file-based-audit-log-publisher",
+ "-",
+ "delete: objectClass",
+ "objectClass: ds-cfg-file-based-access-log-publisher"));
+
+ register("2.5.0.7748",
+ newAttributeTypes(INFO_UPGRADE_TASK_7748_1_SUMMARY.get(),
+ "00-core.ldif", "etag"),
+ addConfigEntry(INFO_UPGRADE_TASK_7748_2_SUMMARY.get(),
+ "dn: cn=etag,cn=Virtual Attributes,cn=config",
+ "changetype: add",
+ "objectClass: top",
+ "objectClass: ds-cfg-virtual-attribute",
+ "objectClass: ds-cfg-entity-tag-virtual-attribute",
+ "cn: etag",
+ "ds-cfg-java-class: org.opends.server.extensions."
+ + "EntityTagVirtualAttributeProvider",
+ "ds-cfg-enabled: true",
+ "ds-cfg-attribute-type: etag",
+ "ds-cfg-conflict-behavior: real-overrides-virtual",
+ "ds-cfg-checksum-algorithm: adler-32",
+ "ds-cfg-excluded-attribute: ds-sync-hist"));
+
+ register("2.5.0.7834",
+ addConfigEntry(INFO_UPGRADE_TASK_7834_SUMMARY.get(),
+ "dn: cn=Password Expiration Time,cn=Virtual Attributes,cn=config",
+ "changetype: add",
+ "objectClass: top",
+ "objectClass: ds-cfg-virtual-attribute",
+ "objectClass: ds-cfg-password-expiration-time-virtual-attribute",
+ "cn: Password Expiration Time",
+ "ds-cfg-java-class: org.opends.server.extensions."
+ + "PasswordExpirationTimeVirtualAttributeProvider",
+ "ds-cfg-enabled: true",
+ "ds-cfg-attribute-type: ds-pwp-password-expiration-time",
+ "ds-cfg-conflict-behavior: virtual-overrides-real"));
+
+ register("2.5.0.7979",
+ modifyConfigEntry(INFO_UPGRADE_TASK_7979_SUMMARY.get(),
+ "(ds-cfg-java-class= org.opends.server.schema.CertificateSyntax)",
+ "add: objectClass",
+ "objectClass: ds-cfg-certificate-attribute-syntax",
+ "-",
+ "add: ds-cfg-strict-format",
+ "ds-cfg-strict-format: false"));
+
+ register("2.5.0.8124",
+ modifyConfigEntry(INFO_UPGRADE_TASK_8124_SUMMARY.get(),
+ "(ds-cfg-java-class= org.opends.server.schema.JPEGSyntax)",
+ "add: objectClass",
+ "objectClass: ds-cfg-jpeg-attribute-syntax",
+ "-",
+ "add: ds-cfg-strict-format",
+ "ds-cfg-strict-format: false"));
+
+ register("2.5.0.8133",
+ modifyConfigEntry(INFO_UPGRADE_TASK_8133_SUMMARY.get(),
+ "(ds-cfg-java-class= org.opends.server.schema.CountryStringSyntax)",
+ "add: objectClass",
+ "objectClass: ds-cfg-country-string-attribute-syntax",
+ "-",
+ "add: ds-cfg-strict-format",
+ "ds-cfg-strict-format: false"));
+
+ register("2.5.0.8214",
+ modifyConfigEntryOptional(INFO_UPGRADE_TASK_8214_SUMMARY.get(),
+ INFO_UPGRADE_TASK_8214_DESCRIPTION.get(),
+ "(ds-cfg-java-class=org.opends.server.extensions."
+ + "IsMemberOfVirtualAttributeProvider)",
+ "add: ds-cfg-filter",
+ "ds-cfg-filter: (|(objectClass=person)(objectClass=groupOfNames)"
+ + "(objectClass=groupOfUniqueNames)(objectClass=groupOfEntries))",
+ "-",
+ "delete: ds-cfg-filter",
+ "ds-cfg-filter: (objectClass=person)"));
+
+ register("2.5.0.8387",
+ modifyConfigEntry(INFO_UPGRADE_TASK_8387_SUMMARY.get(),
+ "(objectClass= ds-cfg-dictionary-password-validator)",
+ "add: ds-cfg-check-substrings",
+ "ds-cfg-check-substrings: false"));
+
+ register("2.5.0.8389",
+ modifyConfigEntry(INFO_UPGRADE_TASK_8389_SUMMARY.get(),
+ "(objectClass= ds-cfg-attribute-value-password-validator)",
+ "add: ds-cfg-check-substrings",
+ "ds-cfg-check-substrings: false"));
+
+ register("2.5.0.8487",
+ addConfigEntry(INFO_UPGRADE_TASK_8487_SUMMARY.get(),
+ "dn: cn=PBKDF2,cn=Password Storage Schemes,cn=config",
+ "changetype: add",
+ "objectClass: top",
+ "objectClass: ds-cfg-password-storage-scheme",
+ "objectClass: ds-cfg-pbkdf2-password-storage-scheme",
+ "cn: PBKDF2",
+ "ds-cfg-java-class: org.opends.server.extensions."
+ + "PBKDF2PasswordStorageScheme",
+ "ds-cfg-enabled: true"));
+
+ /*
+ * All upgrades will refresh the server configuration schema and generate
+ * a new upgrade folder.
+ */
+ registerLast(
+ copySchemaFile("02-config.ldif"),
+ updateConfigUpgradeFolder());
+
+ // TODO for tests.
+ /*register("2.5.0.8657",
+ rebuildAllIndexes(Message.raw("This is fake Rebuild Task")));*/
+
+ // FIXME: HTTP connection handler and access logger when complete.
+
+ // @formatter:on
+ }
+
+
+
+ /**
+ * Returns a list containing all the tasks which are required in order to
+ * upgrade from {@code fromVersion} to {@code toVersion}.
+ *
+ * @param fromVersion
+ * The old version.
+ * @param toVersion
+ * The new version.
+ * @return A list containing all the tasks which are required in order to
+ * upgrade from {@code fromVersion} to {@code toVersion}.
+ */
+ public static List<UpgradeTask> getUpgradeTasks(
+ final BuildVersion fromVersion, final BuildVersion toVersion)
+ {
+ final List<UpgradeTask> tasks = new LinkedList<UpgradeTask>();
+ for (final List<UpgradeTask> subList : TASKS.subMap(fromVersion, false,
+ toVersion, true).values())
+ {
+ tasks.addAll(subList);
+ }
+ tasks.addAll(MANDATORY_TASKS);
+ return tasks;
+ }
+
+
+
+ /**
+ * Upgrades the server from {@code fromVersion} to {@code toVersion}.
+ *
+ * @param fromVersion
+ * The old version.
+ * @param toVersion
+ * The new version.
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @throws ClientException
+ * If an error occurred while performing the upgrade.
+ */
+ public static void upgrade(final BuildVersion fromVersion,
+ final BuildVersion toVersion, final CallbackHandler handler)
+ throws ClientException
+ {
+ /*
+ * Context through which tasks can interact with the server installation
+ * (e.g. config).
+ */
+ UpgradeContext context = new UpgradeContext(fromVersion, toVersion);
+
+ // Checks and validate the version number.
+ isVersionCanBeUpdated(context, handler);
+
+ // Server offline ?
+ checkIfServerIsRunning();
+
+ context.notify(handler, INFO_UPGRADE_TITLE.get(), TITLE_CALLBACK);
+ context.notify(handler, INFO_UPGRADE_SUMMARY.get(context.getFromVersion()
+ .toString(), context.getToVersion().toString()), NOTICE_CALLBACK);
+ context.notify(handler, INFO_UPGRADE_GENERAL_SEE_FOR_DETAILS
+ .get(UpgradeUtils.getInstallationPath() + File.separator
+ + UpgradeLog.UPGRADELOGNAME), NOTICE_CALLBACK);
+
+ // Checks License.
+ checkLicence(context, handler);
+
+ /*
+ * Get the list of required upgrade tasks.
+ */
+ final List<UpgradeTask> tasks = getUpgradeTasks(context.getFromVersion(),
+ context.getToVersion());
+ if (tasks.isEmpty())
+ {
+ changeBuildInfoVersion(context, handler);
+ return;
+ }
+
+ /*
+ * Verify tasks requirements.
+ * Eg. if a task requires mandatory user interaction, like rebuild index,
+ * and the application is non-interactive then, the process
+ * may abort immediately.
+ */
+ verify(context, tasks, handler);
+
+ /*
+ * Asking upgrade requirements if needed to user.
+ */
+ context.notify(handler, INFO_UPGRADE_REQUIREMENTS.get(), TITLE_CALLBACK);
+ interact(context, tasks, handler);
+
+ // Starts upgrade.
+ final int userResponse = context.confirmYN(handler,
+ INFO_UPGRADE_DISPLAY_CONFIRM_START.get(), ConfirmationCallback.YES);
+ if (userResponse == ConfirmationCallback.NO)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ INFO_UPGRADE_ABORTED_BY_USER.get());
+ }
+
+ try
+ {
+ // If the ignore errors mode is selected.
+ if (context.checkCLIUserOption(handler, IGNORE_ERRORS_MODE)
+ == ConfirmationCallback.YES)
+ {
+ context = new UpgradeContext(fromVersion, toVersion, true);
+ }
+
+ /*
+ * Perform the upgrade tasks.
+ */
+ context.notify(handler, INFO_UPGRADE_PERFORMING_TASKS.get(),
+ TITLE_CALLBACK);
+
+ perform(context, tasks, handler);
+ if (UpgradeTasks.countErrors == 0)
+ {
+ // At the end, and if only if succeed, we need to change the buildInfo
+ // file with the version number updated.
+ changeBuildInfoVersion(context, handler);
+ }
+ else
+ {
+ context.notify(handler,
+ ERR_UPGRADE_FAILS.get(UpgradeTasks.countErrors), TITLE_CALLBACK);
+ }
+ }
+ catch (final ClientException e)
+ {
+ LOG.log(Level.SEVERE, e.getMessage());
+ context.notify(handler, e.getMessageObject());
+ throw e;
+ }
+ catch (final Exception e)
+ {
+ LOG.log(Level.SEVERE, e.getMessage());
+ context.notify(handler, ERR_UPGRADE_TASKS_FAIL.get(e.getMessage()));
+ throw new ClientException(EXIT_CODE_ERROR, Message.raw(e.getMessage()));
+ }
+ finally
+ {
+ context.notify(handler, INFO_UPGRADE_GENERAL_SEE_FOR_DETAILS
+ .get(UpgradeUtils.getInstallationPath() + File.separator
+ + UpgradeLog.UPGRADELOGNAME), NOTICE_CALLBACK);
+ }
+ }
+
+
+
+ private static void perform(final UpgradeContext context,
+ final List<UpgradeTask> tasks, final CallbackHandler handler)
+ throws ClientException
+ {
+ /*
+ * Notify each task that the upgrade is about to be started.
+ */
+ for (final UpgradeTask task : tasks)
+ {
+ task.start(context, handler);
+ }
+
+ /*
+ * Perform each task.
+ */
+ for (final UpgradeTask task : tasks)
+ {
+ task.perform(context, handler);
+ }
+
+ /*
+ * Notify each task that the upgrade has completed. Tasks may do cleanup
+ * work here, such as removing files.
+ */
+ for (final UpgradeTask task : tasks)
+ {
+ task.end(context, handler);
+ }
+ }
+
+
+
+ private static void register(final String versionString,
+ final UpgradeTask... tasks)
+ {
+ final BuildVersion version = version(versionString);
+ List<UpgradeTask> taskList = TASKS.get(version);
+ if (taskList == null)
+ {
+ TASKS.put(version, (taskList = new LinkedList<UpgradeTask>()));
+ }
+ taskList.addAll(Arrays.asList(tasks));
+ }
+
+ private static void registerLast(final UpgradeTask... tasks)
+ {
+ MANDATORY_TASKS.addAll(Arrays.asList(tasks));
+ }
+
+ private static void interact(final UpgradeContext context,
+ final List<UpgradeTask> tasks, final CallbackHandler handler)
+ throws ClientException
+ {
+ /*
+ * Let tasks interact with the user in order to obtain user's selection.
+ */
+ for (final UpgradeTask task : tasks)
+ {
+ task.interact(context, handler);
+ }
+ }
+
+
+
+ private static void verify(final UpgradeContext context,
+ final List<UpgradeTask> tasks, final CallbackHandler handler)
+ throws ClientException
+ {
+ /*
+ * Let tasks interact with CLI to check if command line is correct.
+ */
+ for (final UpgradeTask task : tasks)
+ {
+ task.verify(context, handler);
+ }
+ }
+
+
+
+ private static BuildVersion version(final String version)
+ {
+ // TODO Need to change it when change to GIT.
+ return BuildVersion.valueOf(version);
+ }
+
+
+
+ /**
+ * The server must be offline during the upgrade.
+ *
+ * @throws ClientException
+ * An exception is thrown if the server is currently running.
+ */
+ private final static void checkIfServerIsRunning() throws ClientException
+ {
+ final String lockFile = LockFileManager.getServerLockFileName();
+
+ final Message message = ERR_UPGRADE_REQUIRES_SERVER_OFFLINE.get();
+ try
+ {
+ final StringBuilder failureReason = new StringBuilder();
+ if (!LockFileManager.acquireExclusiveLock(lockFile, failureReason))
+ {
+ throw new ClientException(EXIT_CODE_ERROR, message);
+ }
+ }
+ catch (Exception e)
+ {
+ // Assume that if we cannot acquire the lock file the server is
+ // running.
+ throw new ClientException(EXIT_CODE_ERROR, message);
+ }
+ }
+
+
+
+ /**
+ * Checks if the version can be updated.
+ *
+ * @param context
+ * The current context which running the upgrade.
+ * @param callbackHandler
+ * The callback handler in use.
+ * @throws ClientException
+ * If an exception occurs - stops the process.
+ */
+ private static void isVersionCanBeUpdated(final UpgradeContext context,
+ final CallbackHandler callbackHandler) throws ClientException
+ {
+ if (context.getFromVersion().equals(context.getToVersion()))
+ {
+ /*
+ * If the server is already up to date then treat it as a successful
+ * upgrade so that upgrade is idempotent.
+ */
+ final Message message = ERR_UPGRADE_VERSION_UP_TO_DATE.get(context
+ .getToVersion().toString());
+ throw new ClientException(EXIT_CODE_SUCCESS, message);
+ }
+
+ // TODO The upgrade only supports version >= 2.4.5.
+ if (context.getFromVersion().compareTo(UPGRADESUPPORTSVERSIONFROM) < 0)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ INFO_UPGRADE_VERSION_IS_NOT_SUPPORTED.get(UPGRADESUPPORTSVERSIONFROM
+ .toString(), UPGRADESUPPORTSVERSIONFROM.toString()));
+ }
+ }
+
+
+
+ /**
+ * Writes the up to date's version number within the build info file.
+ *
+ * @param context
+ * The current context which running the upgrade.
+ * @param callbackHandler
+ * The callback handler in use.
+ * @throws ClientException
+ * If an exception occurs when displaying the message.
+ * @throws IOException
+ * If an exception occurs when trying to write the file.
+ */
+ private static void changeBuildInfoVersion(final UpgradeContext context,
+ final CallbackHandler callbackHandler) throws ClientException
+ {
+ FileWriter buildInfo = null;
+ try
+ {
+ buildInfo = new FileWriter(new File(UpgradeUtils.configDirectory,
+ Installation.BUILDINFO_RELATIVE_PATH), false);
+
+ // Write the new version
+ buildInfo.write(context.getToVersion().toString());
+
+ context.notify(callbackHandler, INFO_UPGRADE_SUCCESSFUL.get(context
+ .getFromVersion().toString(), context.getToVersion().toString()),
+ TITLE_CALLBACK);
+
+ }
+ catch (IOException e)
+ {
+ throw new ClientException(EXIT_CODE_ERROR, Message.raw(e.getMessage()));
+ }
+ finally
+ {
+ StaticUtils.close(buildInfo);
+ }
+ }
+
+
+
+ private static void checkLicence(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Check license
+ if (!LicenseFile.isAlreadyApproved())
+ {
+ if (LicenseFile.exists())
+ {
+ context.notify(handler, Message.raw(LicenseFile.getText()));
+
+ // If the user asks for no-prompt. We just display the license text.
+ // User doesn't asks for no-prompt. We just display the license text
+ // and force to accept it.
+ context.notify(handler, INFO_LICENSE_DETAILS_CLI_LABEL.get());
+
+ final int answer = context.confirmYN(handler,
+ INFO_LICENSE_ACCEPT.get(), ConfirmationCallback.NO);
+
+ if (answer == ConfirmationCallback.NO)
+ {
+ System.exit(EXIT_CODE_SUCCESS);
+ }
+ else if (answer == ConfirmationCallback.YES)
+ {
+ // Creates the file
+ LicenseFile.setApproval(true);
+ LicenseFile.createFileLicenseApproved();
+ }
+ else
+ {
+ context.notify(handler,
+ INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
+ }
+ }
+ }
+ }
+
+
+
+ // Prevent instantiation.
+ private Upgrade()
+ {
+ // Nothing to do.
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/UpgradeCli.java b/opends/src/server/org/opends/server/tools/upgrade/UpgradeCli.java
new file mode 100644
index 0000000..9834d20
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/UpgradeCli.java
@@ -0,0 +1,595 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+package org.opends.server.tools.upgrade;
+
+import static org.opends.messages.ToolMessages.*;
+
+import static org.opends.server.tools.ToolConstants.*;
+import static org.opends.server.util.StaticUtils.filterExitCode;
+import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.SEVERE;
+import static org.opends.server.tools.upgrade.
+FormattedNotificationCallback.NOTICE_CALLBACK;
+import static org.opends.server.tools.upgrade.
+FormattedNotificationCallback.SUBTITLE_CALLBACK;
+import static org.opends.server.tools.upgrade.
+FormattedNotificationCallback.TITLE_CALLBACK;
+import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_ERROR;
+import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_SUCCESS;
+import static org.opends.server.tools.upgrade.VerificationCallback.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.ConfirmationCallback;
+import javax.security.auth.callback.TextOutputCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.opends.messages.Message;
+import org.opends.server.extensions.ConfigFileHandler;
+import org.opends.server.tools.ClientException;
+import org.opends.server.util.BuildVersion;
+import org.opends.server.util.ServerConstants;
+import org.opends.server.util.StaticUtils;
+import org.opends.server.util.args.ArgumentException;
+import org.opends.server.util.args.BooleanArgument;
+import org.opends.server.util.args.StringArgument;
+import org.opends.server.util.args.SubCommandArgumentParser;
+import org.opends.server.util.cli.CLIException;
+import org.opends.server.util.cli.ConsoleApplication;
+
+/**
+ * This class provides the CLI used for upgrading the OpenDJ product.
+ */
+public final class UpgradeCli extends ConsoleApplication implements
+ CallbackHandler
+{
+ /**
+ * Upgrade's logger.
+ */
+ static private final Logger LOG = Logger
+ .getLogger(UpgradeCli.class.getName());
+
+ // The command-line argument parser.
+ private final SubCommandArgumentParser parser;
+
+ // The argument which should be used to specify the config class.
+ private StringArgument configClass;
+
+ // The argument which should be used to specify the config file.
+ private StringArgument configFile;
+
+ //The argument which should be used to specify non interactive mode.
+ private BooleanArgument noPrompt;
+ private BooleanArgument ignoreErrors;
+ private BooleanArgument force;
+ private BooleanArgument quietMode;
+ private BooleanArgument verbose;
+
+
+ // The argument which should be used to request usage information.
+ private BooleanArgument showUsageArgument;
+
+ // Flag indicating whether or not the global arguments have
+ // already been initialized.
+ private boolean globalArgumentsInitialized = false;
+
+ private UpgradeCli(InputStream in, OutputStream out, OutputStream err)
+ {
+ super(in, out, err);
+
+ this.parser =
+ new SubCommandArgumentParser(this.getClass().getName(),
+ INFO_UPGRADE_DESCRIPTION_CLI.get(), false);
+
+ }
+
+ /**
+ * Provides the command-line arguments to the main application for processing.
+ *
+ * @param args
+ * The set of command-line arguments provided to this program.
+ */
+ public static void main(String[] args)
+ {
+ final int exitCode = main(args, true, System.out, System.err);
+ if (exitCode != 0)
+ {
+ System.exit(filterExitCode(exitCode));
+ }
+ }
+
+ /**
+ * Provides the command-line arguments to the main application for processing
+ * and returns the exit code as an integer.
+ *
+ * @param args
+ * The set of command-line arguments provided to this program.
+ * @param initializeServer
+ * Indicates whether to perform basic initialization (which should
+ * not be done if the tool is running in the same JVM as the server).
+ * @param outStream
+ * The output stream for standard output.
+ * @param errStream
+ * The output stream for standard error.
+ * @return Zero to indicate that the program completed successfully, or
+ * non-zero to indicate that an error occurred.
+ */
+ public static int main(String[] args, boolean initializeServer,
+ OutputStream outStream, OutputStream errStream)
+ {
+ final UpgradeCli app = new UpgradeCli(System.in, outStream, errStream);
+
+ // Run the application.
+ return app.run(args, initializeServer);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isAdvancedMode()
+ {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isInteractive()
+ {
+ return !noPrompt.isPresent();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isMenuDrivenMode()
+ {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isQuiet()
+ {
+ return quietMode.isPresent();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isScriptFriendly()
+ {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isVerbose()
+ {
+ return verbose.isPresent();
+ }
+
+ /**
+ * Force the upgrade. All answers will be forced to 'yes'.
+ *
+ * @return {@code true} if the upgrade process is forced.
+ */
+ public boolean isForceUpgrade()
+ {
+ return force.isPresent();
+ }
+
+ /**
+ * Force to ignore the errors during the upgrade process.
+ *
+ * @return {@code true} if the errors are forced to be ignored.
+ */
+ public boolean isIgnoreErrors()
+ {
+ return ignoreErrors.isPresent();
+ }
+
+ // Displays the provided message followed by a help usage reference.
+ private void displayMessageAndUsageReference(final Message message)
+ {
+ println(message);
+ println();
+ println(parser.getHelpUsageReference());
+ }
+
+ // Initialize arguments provided by the command line.
+ private void initializeGlobalArguments() throws ArgumentException
+ {
+ if (!globalArgumentsInitialized)
+ {
+ configClass =
+ new StringArgument("configclass", OPTION_SHORT_CONFIG_CLASS,
+ OPTION_LONG_CONFIG_CLASS, true, false, true,
+ INFO_CONFIGCLASS_PLACEHOLDER.get(), ConfigFileHandler.class
+ .getName(), null, INFO_DESCRIPTION_CONFIG_CLASS.get());
+ configClass.setHidden(true);
+
+ configFile =
+ new StringArgument("configfile", 'f', "configFile", true, false,
+ true, INFO_CONFIGFILE_PLACEHOLDER.get(), null, null,
+ INFO_DESCRIPTION_CONFIG_FILE.get());
+ configFile.setHidden(true);
+
+ noPrompt =
+ new BooleanArgument(OPTION_LONG_NO_PROMPT, OPTION_SHORT_NO_PROMPT,
+ OPTION_LONG_NO_PROMPT, INFO_UPGRADE_DESCRIPTION_NO_PROMPT.get());
+
+ verbose =
+ new BooleanArgument(OPTION_LONG_VERBOSE, OPTION_SHORT_VERBOSE,
+ OPTION_LONG_VERBOSE, INFO_DESCRIPTION_VERBOSE.get());
+
+ quietMode =
+ new BooleanArgument(OPTION_LONG_QUIET, OPTION_SHORT_QUIET,
+ OPTION_LONG_QUIET, INFO_DESCRIPTION_QUIET.get());
+
+ ignoreErrors =
+ new BooleanArgument(OPTION_LONG_IGNORE_ERRORS, null,
+ OPTION_LONG_IGNORE_ERRORS, INFO_UPGRADE_OPTION_IGNORE_ERRORS
+ .get());
+
+ force = new BooleanArgument(OPTION_LONG_FORCE_UPGRADE, null,
+ OPTION_LONG_FORCE_UPGRADE,
+ INFO_UPGRADE_OPTION_FORCE.get(OPTION_LONG_NO_PROMPT));
+
+ showUsageArgument =
+ new BooleanArgument("help", OPTION_SHORT_HELP, OPTION_LONG_HELP,
+ INFO_DESCRIPTION_USAGE.get());
+
+ // Register the global arguments.
+ parser.addGlobalArgument(showUsageArgument);
+ parser.setUsageArgument(showUsageArgument, this.getOutputStream());
+ parser.addGlobalArgument(configClass);
+ parser.addGlobalArgument(configFile);
+ parser.addGlobalArgument(noPrompt);
+ parser.addGlobalArgument(verbose);
+ parser.addGlobalArgument(quietMode);
+ parser.addGlobalArgument(force);
+ parser.addGlobalArgument(ignoreErrors);
+
+ globalArgumentsInitialized = true;
+ }
+ }
+
+ private int run(String[] args, boolean initializeServer)
+ {
+ // Initialize the arguments
+ try
+ {
+ initializeGlobalArguments();
+ }
+ catch (ArgumentException e)
+ {
+ final Message message = ERR_CANNOT_INITIALIZE_ARGS.get(e.getMessage());
+ this.getOutputStream().print(message);
+ return EXIT_CODE_ERROR;
+ }
+
+ // Parse the command-line arguments provided to this program.
+ try
+ {
+ parser.parseArguments(args);
+ if (isInteractive() && isQuiet())
+ {
+ final Message message =
+ ERR_UPGRADE_INCOMPATIBLE_ARGS.get(OPTION_LONG_QUIET,
+ "interactive mode");
+ this.getOutputStream().println(message);
+ return EXIT_CODE_ERROR;
+ }
+ if (isInteractive() && isForceUpgrade())
+ {
+ final Message message =
+ ERR_UPGRADE_INCOMPATIBLE_ARGS.get(OPTION_LONG_FORCE_UPGRADE,
+ "interactive mode");
+ this.getOutputStream().println(message);
+ return EXIT_CODE_ERROR;
+ }
+ if (isQuiet() && isVerbose())
+ {
+ final Message message =
+ ERR_UPGRADE_INCOMPATIBLE_ARGS.get(OPTION_LONG_QUIET,
+ OPTION_LONG_VERBOSE);
+ this.getOutputStream().println(message);
+ return EXIT_CODE_ERROR;
+ }
+ }
+ catch (ArgumentException ae)
+ {
+ final Message message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+ displayMessageAndUsageReference(message);
+ return EXIT_CODE_ERROR;
+ }
+
+ // If the usage/version argument was provided, then we don't need
+ // to do anything else.
+ if (parser.usageOrVersionDisplayed())
+ {
+ return EXIT_CODE_SUCCESS;
+ }
+
+ // Main process
+ try
+ {
+ // Creates the log file.
+ UpgradeLog.initLogFileHandler();
+
+ // Starts upgrade.
+ Upgrade.upgrade(BuildVersion.instanceVersion(), BuildVersion
+ .binaryVersion(), this);
+ }
+ catch (ClientException ex)
+ {
+ LOG.log(SEVERE, ex.getMessage());
+ println(ERROR, ex.getMessageObject(), 0);
+
+ return ex.getExitCode();
+ }
+ catch (Exception ex)
+ {
+ LOG.log(SEVERE, ex.getMessage());
+ println(ERROR, ERR_UPGRADE_MAIN_UPGRADE_PROCESS.get(ex.getMessage()), 0);
+
+ return EXIT_CODE_ERROR;
+ }
+ return EXIT_CODE_SUCCESS;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException
+ {
+ for (final Callback c : callbacks)
+ {
+ // Displays progress eg. for a task.
+ if (c instanceof ProgressNotificationCallback)
+ {
+ final ProgressNotificationCallback pnc =
+ (ProgressNotificationCallback) c;
+ final Message msg = Message.raw(" " + pnc.getMessage());
+ printProgress(msg);
+ printProgressBar(msg.length(), pnc.getProgress());
+ }
+ else if (c instanceof FormattedNotificationCallback)
+ {
+ // Displays formatted notifications.
+ final FormattedNotificationCallback fnc =
+ (FormattedNotificationCallback) c;
+ LOG.log(INFO, fnc.getMessage());
+ switch (fnc.getMessageSubType())
+ {
+ case TITLE_CALLBACK:
+ println(TITLE, Message.raw(fnc.getMessage()), 0);
+ break;
+ case SUBTITLE_CALLBACK:
+ println(SUBTITLE, Message.raw(fnc.getMessage()), 4);
+ break;
+ case NOTICE_CALLBACK:
+ println(NOTICE, Message.raw(fnc.getMessage()), 0);
+ break;
+ default:
+ LOG.log(SEVERE, "Unsupported message type: "
+ + fnc.getMessage());
+ throw new IOException("Unsupported message type: ");
+ }
+ }
+ else if (c instanceof TextOutputCallback)
+ {
+ // Usual output text.
+ final TextOutputCallback toc = (TextOutputCallback) c;
+ if(toc.getMessageType() == TextOutputCallback.INFORMATION) {
+ LOG.log(INFO, toc.getMessage());
+ printlnProgress(Message.raw(toc.getMessage()));
+ } else {
+ LOG.log(SEVERE, "Unsupported message type: "
+ + toc.getMessage());
+ throw new IOException("Unsupported message type: ");
+ }
+ }
+ else if (c instanceof VerificationCallback)
+ {
+ final VerificationCallback cc = (VerificationCallback) c;
+ // Checks user's options.
+ if (cc.getRequiredOptions() != null)
+ {
+ for (final int opt : cc.getRequiredOptions())
+ {
+ if (opt == NEED_USER_INTERACTION)
+ {
+ if (!isInteractive())
+ {
+ cc.setSelectedIndex(cc.getDefaultOption());
+ return;
+ }
+ }
+
+ if (opt == MANDATORY_USER_INTERACTION)
+ {
+ if (!isInteractive() && !isForceUpgrade())
+ {
+ println(ERROR, ERR_UPGRADE_USER_INTERACTION_REQUIRED.get(
+ OPTION_LONG_NO_PROMPT, OPTION_LONG_FORCE_UPGRADE), 0);
+ cc.setSelectedIndex(ConfirmationCallback.NO);
+ return;
+ }
+ else if (!isInteractive() && isForceUpgrade())
+ {
+ cc.setSelectedIndex(ConfirmationCallback.YES);
+ }
+ }
+
+ if (opt == TAKE_LONG_TIME_TO_COMPLETE
+ || opt == CANNOT_BE_REVERTED)
+ {
+ if (!isInteractive() && !isForceUpgrade())
+ {
+ println(ERROR, ERR_UPGRADE_USER_INTERACTION_REQUIRED.get(
+ OPTION_LONG_NO_PROMPT, OPTION_LONG_FORCE_UPGRADE), 0);
+ cc.setSelectedIndex(ConfirmationCallback.NO);
+ return;
+ }
+ }
+
+ // Does the user specify the ignore errors mode ?
+ if(opt == IGNORE_ERRORS_MODE) {
+ if (!isIgnoreErrors())
+ {
+ cc.setSelectedIndex(ConfirmationCallback.NO);
+ return;
+ }
+ cc.setSelectedIndex(ConfirmationCallback.YES);
+ }
+ }
+ return;
+ }
+ }
+ else if (c instanceof ConfirmationCallback)
+ {
+ final ConfirmationCallback cc = (ConfirmationCallback) c;
+ List<String> choices = new ArrayList<String>();
+
+ final String defaultOption =
+ UpgradeContext.getDefaultOption(cc.getDefaultOption());
+
+ StringBuilder prompt =
+ new StringBuilder(StaticUtils.wrapText(cc.getPrompt(),
+ ServerConstants.MAX_LINE_WIDTH, 2));
+
+ // Default answers.
+ final List<String> yesNoDefaultResponses =
+ StaticUtils.arrayToList(new String[] {
+ INFO_PROMPT_YES_COMPLETE_ANSWER.get().toString(),
+ INFO_PROMPT_YES_FIRST_LETTER_ANSWER.get().toString(),
+ INFO_PROMPT_NO_COMPLETE_ANSWER.get().toString(),
+ INFO_PROMPT_NO_FIRST_LETTER_ANSWER.get().toString() });
+
+ // Generating prompt and possible answers list.
+ prompt.append(" ").append("(");
+ if (cc.getOptionType() == ConfirmationCallback.YES_NO_OPTION)
+ {
+ choices.addAll(yesNoDefaultResponses);
+ prompt.append(INFO_PROMPT_YES_COMPLETE_ANSWER.get().toString())
+ .append("/")
+ .append(INFO_PROMPT_NO_COMPLETE_ANSWER.get().toString());
+ }
+ else if (cc.getOptionType()
+ == ConfirmationCallback.YES_NO_CANCEL_OPTION)
+ {
+ choices.addAll(yesNoDefaultResponses);
+ choices.addAll(StaticUtils
+ .arrayToList(new String[] { INFO_TASKINFO_CMD_CANCEL_CHAR.get()
+ .toString() }));
+
+ prompt.append(" ").append("(").append(
+ INFO_PROMPT_YES_COMPLETE_ANSWER.get().toString()).append("/")
+ .append(INFO_PROMPT_NO_COMPLETE_ANSWER.get().toString())
+ .append("/").append(
+ INFO_TASKINFO_CMD_CANCEL_CHAR.get().toString());
+ }
+ prompt.append(")");
+
+ LOG.log(INFO, cc.getPrompt());
+
+ // Displays the output and
+ // while it hasn't a valid response, question is repeated.
+ if (isInteractive())
+ {
+ while (true)
+ {
+ String value = null;
+ try
+ {
+ value = readInput(Message.raw(prompt), defaultOption, SUBTITLE);
+ }
+ catch (CLIException e)
+ {
+ LOG.log(SEVERE, e.getMessage());
+ break;
+ }
+
+ if ((value.toLowerCase().equals(
+ INFO_PROMPT_YES_FIRST_LETTER_ANSWER.get().toString()) || value
+ .toLowerCase().equals(
+ INFO_PROMPT_YES_COMPLETE_ANSWER.get().toString()))
+ && choices.contains(value))
+ {
+ cc.setSelectedIndex(ConfirmationCallback.YES);
+ break;
+ }
+ else if ((value.toLowerCase().equals(
+ INFO_PROMPT_NO_FIRST_LETTER_ANSWER.get().toString()) || value
+ .toLowerCase().equals(
+ INFO_PROMPT_NO_COMPLETE_ANSWER.get().toString()))
+ && choices.contains(value))
+ {
+ cc.setSelectedIndex(ConfirmationCallback.NO);
+ break;
+ }
+ else if ((value.toLowerCase().equals(INFO_TASKINFO_CMD_CANCEL_CHAR
+ .get().toString()))
+ && choices.contains(value))
+ {
+ cc.setSelectedIndex(ConfirmationCallback.CANCEL);
+ break;
+ }
+ LOG.log(INFO, value);
+ }
+ }
+ else
+ {
+ // Non interactive mode
+ if (isForceUpgrade())
+ {
+ cc.setSelectedIndex(ConfirmationCallback.YES);
+ }
+ else
+ {
+ cc.setSelectedIndex(cc.getDefaultOption());
+ }
+ // Displays the prompt
+ prompt.append(" ").append(
+ UpgradeContext.getDefaultOption(cc.getSelectedIndex()));
+ println(SUBTITLE, Message.raw(prompt), 0);
+ LOG.log(INFO, UpgradeContext.getDefaultOption(cc.getSelectedIndex()));
+ }
+ }
+ else
+ {
+ LOG.log(SEVERE, "Unrecognized Callback");
+ throw new UnsupportedCallbackException(c, "Unrecognized Callback");
+ }
+ }
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/UpgradeContext.java b/opends/src/server/org/opends/server/tools/upgrade/UpgradeContext.java
new file mode 100644
index 0000000..28eebaf
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/UpgradeContext.java
@@ -0,0 +1,304 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+import static org.opends.messages.ToolMessages.
+ ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR;
+import static org.opends.messages.ToolMessages.
+ ERR_UPGRADE_DISPLAY_CONFIRM_ERROR;
+import static org.opends.messages.ToolMessages.ERR_UPGRADE_DISPLAY_CHECK_ERROR;
+import static org.opends.messages.ToolMessages.INFO_PROMPT_NO_COMPLETE_ANSWER;
+import static org.opends.messages.ToolMessages.INFO_PROMPT_YES_COMPLETE_ANSWER;
+import static org.opends.messages.ToolMessages.INFO_TASKINFO_CMD_CANCEL_CHAR;
+import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_ERROR;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.ConfirmationCallback;
+import javax.security.auth.callback.TextOutputCallback;
+
+import org.opends.messages.Message;
+import org.opends.server.tools.ClientException;
+import org.opends.server.util.BuildVersion;
+
+/**
+ * Context information which is passed to upgrade tasks. This might include
+ * server configuration, etc.
+ */
+public final class UpgradeContext
+{
+
+ /**
+ * The version we upgrade from.
+ */
+ private final BuildVersion fromVersion;
+
+ /**
+ * The version we want to upgrade to.
+ */
+ private final BuildVersion toVersion;
+
+ /**
+ * If ignore errors is enabled.
+ */
+ private final boolean isIgnoreErrorsMode;
+
+ /**
+ * Constructor for the upgrade context.
+ *
+ * @param fromVersion
+ * The version number from we upgrade from.
+ * @param toVersion
+ * The version number we want to upgrade to.
+ */
+ UpgradeContext(final BuildVersion fromVersion, final BuildVersion toVersion)
+ {
+ this.fromVersion = fromVersion;
+ this.toVersion = toVersion;
+ this.isIgnoreErrorsMode = false;
+ }
+
+ /**
+ * Constructor for the upgrade context.
+ *
+ * @param fromVersion
+ * The version number from we upgrade from.
+ * @param toVersion
+ * The version number we want to upgrade to.
+ * @param isIgnoreErrorsMode
+ * If ignore error mode is enabled.
+ */
+ UpgradeContext(final BuildVersion fromVersion, final BuildVersion toVersion,
+ final boolean isIgnoreErrorsMode)
+ {
+ this.fromVersion = fromVersion;
+ this.toVersion = toVersion;
+ this.isIgnoreErrorsMode = isIgnoreErrorsMode;
+ }
+
+ /**
+ * Returns the old version.
+ *
+ * @return The old version.
+ */
+ public BuildVersion getFromVersion()
+ {
+ return fromVersion;
+ }
+
+ /**
+ * Returns the new version.
+ *
+ * @return The new version.
+ */
+ public BuildVersion getToVersion()
+ {
+ return toVersion;
+ }
+
+ /**
+ * Returns the ignore error mode.
+ *
+ * @return {@true} if ignore error mode is activated.
+ */
+ public boolean isIgnoreErrorsMode()
+ {
+ return isIgnoreErrorsMode;
+ }
+
+ /**
+ * Sends notification message to the application via the call-back handler.
+ *
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @param message
+ * The message to be reported.
+ * @throws ClientException
+ * If an error occurred while reporting the message.
+ */
+ public void notify(final CallbackHandler handler, final Message message)
+ throws ClientException
+ {
+ try
+ {
+ handler.handle(new Callback[] { new TextOutputCallback(
+ TextOutputCallback.INFORMATION, message.toString()) });
+ }
+ catch (final Exception e)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR.get(e.getMessage()));
+ }
+ }
+
+ /**
+ * Sends notification message to the application via the call-back handler
+ * containing specific sub type message.
+ *
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @param message
+ * The message to be reported.
+ * @param msgType
+ * The sub type message. The message to be reported.
+ * @throws ClientException
+ * If an error occurred while reporting the message.
+ */
+ public void notify(final CallbackHandler handler, final Message message,
+ final int msgType) throws ClientException
+ {
+ try
+ {
+ handler.handle(new Callback[] { new FormattedNotificationCallback(
+ message, msgType) });
+ }
+ catch (final Exception e)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR.get(e.getMessage()));
+ }
+ }
+
+ /**
+ * Displays a progress callback.
+ *
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @param callback
+ * The callback to display.
+ * @throws ClientException
+ * If an error occurred while reporting the message.
+ */
+ public void notifyProgress(final CallbackHandler handler,
+ final ProgressNotificationCallback callback) throws ClientException
+ {
+ try
+ {
+ handler.handle(new Callback[] { callback });
+ }
+ catch (final Exception e)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR.get(e.getMessage()));
+ }
+ }
+
+ /**
+ * Asks a confirmation to the user. Answer is yes or no.
+ *
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @param message
+ * The message to be reported.
+ * @param defaultOption
+ * The default selected option for this callback.
+ * @throws ClientException
+ * If an error occurred while reporting the message.
+ * @return an integer corresponding to the user's answer.
+ */
+ public int confirmYN(final CallbackHandler handler, final Message message,
+ final int defaultOption) throws ClientException
+ {
+ final ConfirmationCallback confirmYNCallback =
+ new ConfirmationCallback(message.toString(),
+ ConfirmationCallback.WARNING, ConfirmationCallback.YES_NO_OPTION,
+ defaultOption);
+ try
+ {
+ handler.handle(new Callback[] { confirmYNCallback });
+ }
+ catch (final Exception e)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_DISPLAY_CONFIRM_ERROR.get(e.getMessage()));
+ }
+ return confirmYNCallback.getSelectedIndex();
+ }
+
+ /**
+ * Checks the user's options. If a required option is not present in the
+ * user's options list, stops the process.
+ *
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @param options
+ * The options which should be present in the user's upgrade options.
+ * @throws ClientException
+ * If an error occurred while reporting the message.
+ * @return An integer which represents the user selected index.
+ */
+ public int checkCLIUserOption(final CallbackHandler handler,
+ final int... options) throws ClientException
+ {
+ final VerificationCallback checkCLICallback =
+ new VerificationCallback(VerificationCallback.WARNING,
+ ConfirmationCallback.OK_CANCEL_OPTION, ConfirmationCallback.OK,
+ options);
+
+ try
+ {
+ handler.handle(new Callback[] { checkCLICallback });
+ }
+ catch (final Exception e)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_DISPLAY_CHECK_ERROR.get(e.getMessage()));
+ }
+ return checkCLICallback.getSelectedIndex();
+
+ }
+
+ /**
+ * Returns the default option string.
+ *
+ * @param defaultOption
+ * The default option int value.
+ * @return The default option string.
+ */
+ public static String getDefaultOption(final int defaultOption)
+ {
+ if (defaultOption == ConfirmationCallback.YES)
+ {
+ return INFO_PROMPT_YES_COMPLETE_ANSWER.get().toString();
+ }
+ else if (defaultOption == ConfirmationCallback.NO)
+ {
+ return INFO_PROMPT_NO_COMPLETE_ANSWER.get().toString();
+ }
+ else if (defaultOption == ConfirmationCallback.CANCEL)
+ {
+ return INFO_TASKINFO_CMD_CANCEL_CHAR.get().toString();
+ }
+ return null;
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/UpgradeLog.java b/opends/src/server/org/opends/server/tools/upgrade/UpgradeLog.java
new file mode 100644
index 0000000..1e03d1d
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/UpgradeLog.java
@@ -0,0 +1,107 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.logging.FileHandler;
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.opends.messages.RuntimeMessages;
+
+/**
+ * Creates a historical log about the upgrade. If file does not exist an attempt
+ * will be made to create it.
+ */
+class UpgradeLog
+{
+ static private File logFile = null;
+ static private FileHandler fileHandler = null;
+ final static String UPGRADELOGNAME = "upgrade.log";
+
+ /**
+ * Creates a new file handler for writing log messages into
+ * {@value #UPGRADELOGNAME} file.
+ */
+ static void initLogFileHandler()
+ {
+ final Logger logger = Logger.getLogger(UpgradeCli.class.getName());
+
+ final String SPACE = " ";
+
+ if (logFile == null)
+ {
+ logFile =
+ new File(new StringBuilder(UpgradeUtils.getInstallationPath())
+ .append(File.separator).append(UPGRADELOGNAME).toString());
+ }
+ try
+ {
+ fileHandler = new FileHandler(logFile.getCanonicalPath(), true);
+ }
+ catch (IOException e)
+ {
+ logger.log(Level.SEVERE, e.getMessage());
+ }
+ fileHandler.setFormatter(new Formatter()
+ {
+ /** {@inheritDoc} */
+ @Override
+ public String format(LogRecord record)
+ {
+ // Format the log ~like the errors logger.
+ StringBuffer sb = new StringBuffer();
+ final SimpleDateFormat dateFormat =
+ new SimpleDateFormat("[dd/MMM/yyyy:HH:mm:ss Z]");
+ sb.append(dateFormat.format(record.getMillis())).append(SPACE);
+ sb.append("category=UPGRADE").append(SPACE).append("sq=").append(
+ record.getSequenceNumber()).append(SPACE).append("severity=")
+ .append(record.getLevel().toString().toUpperCase());
+ sb.append(SPACE).append("src=").append(record.getSourceClassName())
+ .append(SPACE).append(record.getSourceMethodName()).append("\n");
+ sb.append(SPACE).append("msg=").append(record.getMessage())
+ .append("\n");
+ return sb.toString();
+ }
+ });
+ logger.setLevel(Level.CONFIG);
+ logger.addHandler(fileHandler);
+
+ logger.setUseParentHandlers(false);
+ // Log Config info.
+ logger.log(Level.CONFIG, "**** Upgrade of OpenDJ started ****");
+ logger.log(Level.CONFIG, RuntimeMessages.NOTE_INSTALL_DIRECTORY.get(
+ UpgradeUtils.getInstallationPath()).toString());
+ logger.log(Level.CONFIG, RuntimeMessages.NOTE_INSTANCE_DIRECTORY.get(
+ UpgradeUtils.getInstancePath()).toString());
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/UpgradeTask.java b/opends/src/server/org/opends/server/tools/upgrade/UpgradeTask.java
new file mode 100644
index 0000000..60278f1
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/UpgradeTask.java
@@ -0,0 +1,120 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+import javax.security.auth.callback.CallbackHandler;
+
+import org.opends.server.tools.ClientException;
+
+/**
+ * An upgrade task.
+ */
+public interface UpgradeTask
+{
+
+ /**
+ * Notifies this task that the upgrade has completed. This method will be
+ * invoked after all upgrade tasks have completed successfully. Most task
+ * implementation will not need to do anything.
+ *
+ * @param context
+ * Context through which tasks can interact with the server
+ * installation.
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @throws ClientException
+ * If an error occurred while performing the task.
+ */
+ void end(UpgradeContext context, CallbackHandler handler)
+ throws ClientException;
+
+ /**
+ * Performs this upgrade task.
+ *
+ * @param context
+ * Context through which tasks can interact with the server
+ * installation.
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @throws ClientException
+ * If an error occurred while performing the task.
+ */
+ void perform(UpgradeContext context, CallbackHandler handler)
+ throws ClientException;
+
+ /**
+ * Notifies this task that the upgrade is about to start. This method will be
+ * invoked before any upgrade tasks have been performed. Most task
+ * implementation will not need to do anything.
+ *
+ * @param context
+ * Context through which tasks can interact with the server
+ * installation.
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @throws ClientException
+ * If an error occurred while starting the task.
+ */
+ void start(UpgradeContext context, CallbackHandler handler)
+ throws ClientException;
+
+ /**
+ * Verifies that this upgrade task can be completed or not.
+ *
+ * @param context
+ * Context through which tasks can interact with the server
+ * installation.
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @throws ClientException
+ * If the upgrade cannot proceed.
+ */
+ void verify(UpgradeContext context, CallbackHandler handler)
+ throws ClientException;
+
+ /**
+ * Interacts with the user where needed (e.g. in order to ask for
+ * confirmation), and throw a {@code ClientException} if the upgrade cannot
+ * proceed.
+ *
+ * @param context
+ * Context through which tasks can interact with the server
+ * installation.
+ * @param handler
+ * The call-back handler for interacting with the upgrade
+ * application.
+ * @throws ClientException
+ * If the upgrade cannot proceed.
+ */
+ void interact(UpgradeContext context, CallbackHandler handler)
+ throws ClientException;
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java b/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
new file mode 100644
index 0000000..57151a3
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -0,0 +1,864 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+
+
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.tools.upgrade.FileManager.copy;
+import static org.opends.server.tools.upgrade.Upgrade.*;
+import static org.opends.server.tools.upgrade.UpgradeUtils.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.ConfirmationCallback;
+
+import org.opends.messages.Message;
+import org.opends.server.controls.PersistentSearchChangeType;
+import org.opends.server.protocols.ldap.LDAPFilter;
+import org.opends.server.tools.ClientException;
+
+
+
+/**
+ * Factory methods for create new upgrade tasks.
+ */
+public final class UpgradeTasks
+{
+ /**
+ * An errors counter in case of ignore errors mode.
+ */
+ static int countErrors = 0;
+
+ /**
+ * Upgrade's logger.
+ */
+ static private final Logger LOG = Logger
+ .getLogger(UpgradeCli.class.getName());
+
+
+
+ /**
+ * Returns a new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ *
+ * @param summary
+ * The summary of this upgrade task.
+ * @param ldif
+ * The LDIF record which will be applied to matching entries.
+ * @return A new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ */
+ public static UpgradeTask addConfigEntry(final Message summary,
+ final String... ldif)
+ {
+ return addConfigEntry0(summary, summary, false, ldif);
+ }
+
+
+
+ /**
+ * Returns a new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ *
+ * @param summary
+ * The summary of this upgrade task.
+ * @param description
+ * The detailed description of this upgrade task.
+ * @param ldif
+ * The LDIF record which will be applied to matching entries.
+ * @return A new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ */
+ public static UpgradeTask addConfigEntryOptional(final Message summary,
+ final Message description, final String... ldif)
+ {
+ return addConfigEntry0(summary, description, true, ldif);
+ }
+
+
+
+ /**
+ * This task copies the file placed in parameter within the config / schema
+ * folder. If the file already exists, it's overwritten.
+ *
+ * @param fileName
+ * The name of the file which need to be copied.
+ * @return A task which copy the the file placed in parameter within the
+ * config / schema folder. If the file already exists, it's
+ * overwritten.
+ */
+ public static UpgradeTask copySchemaFile(final String fileName)
+ {
+ return new UpgradeTask()
+ {
+
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ final Message msg = INFO_UPGRADE_TASK_REPLACE_SCHEMA_FILE.get(fileName);
+ LOG.log(Level.INFO, msg.toString());
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, msg, 0);
+
+ final File schemaFileTemplate = new File(templateConfigSchemaDirectory,
+ fileName);
+
+ try
+ {
+ context.notifyProgress(handler, pnc.changeProgress(20));
+
+ copy(schemaFileTemplate, configSchemaDirectory, true);
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final IOException e)
+ {
+ manageTaskException(
+ context,
+ handler,
+ ERR_UPGRADE_COPYSCHEMA_FAILS.get(schemaFileTemplate.getName(),
+ e.getMessage()), pnc);
+ }
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+ };
+ }
+
+
+
+ /**
+ * Returns a new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ *
+ * @param summary
+ * The summary of this upgrade task.
+ * @param filter
+ * The LDAP filter which configuration entries must match.
+ * @param ldif
+ * The LDIF record which will be applied to matching entries.
+ * @return A new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ */
+ public static UpgradeTask modifyConfigEntry(final Message summary,
+ final String filter, final String... ldif)
+ {
+ return modifyConfigEntry(summary, summary, false, filter, ldif);
+ }
+
+
+
+ /**
+ * Returns a new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ *
+ * @param summary
+ * The summary of this upgrade task.
+ * @param description
+ * The detailed description of this upgrade task.
+ * @param filter
+ * The LDAP filter which configuration entries must match.
+ * @param ldif
+ * The LDIF record which will be applied to matching entries.
+ * @return A new upgrade task which applies an LDIF record to all
+ * configuration entries matching the provided filter.
+ */
+ public static UpgradeTask modifyConfigEntryOptional(final Message summary,
+ final Message description, final String filter, final String... ldif)
+ {
+ return modifyConfigEntry(summary, description, true, filter, ldif);
+ }
+
+
+
+ /**
+ * This task adds a new attribute type (must exists in the original file) to
+ * the specified file placed in parameter. The destination must be a file
+ * contained in the config/schema folder. E.g : This example adds a new
+ * attribute type named 'etag' in the 00.core.ldif. The 'etag' attribute
+ * already exists in the 00-core.ldif template schema file.
+ *
+ * <pre>
+ * register(
+ * "2.5.0.7192",
+ * newAttributeTypes(Message.raw("New attribute etag"), false,
+ * "00-core.ldif",
+ * "etag"));
+ * </pre>
+ *
+ * @param summary
+ * The summary of the task.
+ * @param fileName
+ * The file where to add the new attribute types. This file must be
+ * contained in the config/schema folder.
+ * @param names
+ * The names of the new attributes to add to.
+ * @return An upgrade task which adds new attribute types, defined previously
+ * in the config template files, reads the definition and adds it onto
+ * the specified file in parameter.
+ */
+ public static UpgradeTask newAttributeTypes(final Message summary,
+ final String fileName, final String... names)
+ {
+ return new UpgradeTask()
+ {
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ LOG.log(Level.INFO, summary.toString());
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, summary, 20);
+ context.notifyProgress(handler, pnc);
+
+ final File schemaFileTemplate = new File(templateConfigSchemaDirectory,
+ fileName);
+
+ final File pathDestination = new File(configSchemaDirectory, fileName);
+ try
+ {
+ final int changeCount = updateSchemaFile(schemaFileTemplate,
+ pathDestination, names, null);
+
+ displayChangeCount(pathDestination.getPath(), changeCount);
+
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final IOException e)
+ {
+ manageTaskException(context, handler,
+ ERR_UPGRADE_ADDATTRIBUTE_FAILS.get(schemaFileTemplate.getName(),
+ e.getMessage()), pnc);
+ }
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+ };
+ }
+
+
+
+ /**
+ * This task adds a new object class (must exists in the original file) to the
+ * specified file placed in parameter. The destination must be a file
+ * contained in the config/schema folder.
+ *
+ * @param summary
+ * The summary of the task.
+ * @param fileName
+ * The file where to add the new object classes. This file must be
+ * contained in the config/schema folder.
+ * @param names
+ * The names of the new object classes to add to.
+ * @return An upgrade task which adds new object classes, defined previously
+ * in the config template files, reads the definition and adds it onto
+ * the specified file in parameter.
+ */
+ public static UpgradeTask newObjectClasses(final Message summary,
+ final String fileName, final String... names)
+ {
+ return new UpgradeTask()
+ {
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ LOG.log(Level.INFO, summary.toString());
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, summary, 20);
+ context.notifyProgress(handler, pnc);
+
+ final File schemaFileTemplate = new File(templateConfigSchemaDirectory,
+ fileName);
+
+ final File pathDestination = new File(configSchemaDirectory, fileName);
+
+ context.notifyProgress(handler, pnc.changeProgress(20));
+
+ try
+ {
+ final int changeCount = updateSchemaFile(schemaFileTemplate,
+ pathDestination, null, names);
+
+ displayChangeCount(pathDestination.getPath(), changeCount);
+
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final IOException e)
+ {
+ manageTaskException(context, handler,
+ ERR_UPGRADE_ADDOBJECTCLASS_FAILS.get(
+ schemaFileTemplate.getName(), e.getMessage()), pnc);
+ }
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+ };
+ }
+
+
+
+ /**
+ * Creates a rebuild all indexes task.
+ *
+ * @param summary
+ * The summary of this upgrade task.
+ * @return An Upgrade task which rebuild all the indexes.
+ */
+ public static UpgradeTask rebuildAllIndexes(final Message summary)
+ {
+ return new UpgradeTask()
+ {
+
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // TODO
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ context.notify(handler, summary);
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // This task which may take a long time to complete,
+ // we need to check user CLI options.
+ final int res = context.checkCLIUserOption(handler,
+ VerificationCallback.TAKE_LONG_TIME_TO_COMPLETE);
+
+ // The option is not present ? Stops the process.
+ if (res == ConfirmationCallback.NO)
+ {
+ throw new ClientException(EXIT_CODE_MANUAL_INTERVENTION,
+ ERR_UPGRADE_INVALID_USER_OPTIONS_SELECTED.get());
+ }
+ }
+ };
+ }
+
+
+
+ /**
+ * Creates a file object representing config/upgrade/schema.ldif.current which
+ * the server creates the first time it starts if there are schema
+ * customizations.
+ *
+ * @return An upgrade task which upgrade the config/upgrade folder, creating a
+ * new schema.ldif.rev which is needed after schema customization for
+ * starting correctly the server.
+ */
+ public static UpgradeTask updateConfigUpgradeFolder()
+ {
+ return new UpgradeTask()
+ {
+
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ final Message msg = INFO_UPGRADE_TASK_REFRESH_UPGRADE_DIRECTORY.get();
+ LOG.log(Level.INFO, msg.toString());
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, msg, 20);
+ context.notifyProgress(handler, pnc);
+
+ try
+ {
+ updateConfigUpgradeSchemaFile(configSchemaDirectory,
+ String.valueOf(context.getToVersion().getRevisionNumber()));
+
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final Exception ex)
+ {
+ manageTaskException(context, handler,
+ ERR_UPGRADE_CONFIG_ERROR_UPGRADE_FOLDER.get(ex.getMessage()),
+ pnc);
+ }
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+ };
+ }
+
+
+
+ private static UpgradeTask addConfigEntry0(final Message summary,
+ final Message description, final boolean needsUserConfirmation,
+ final String... ldif)
+ {
+ return new UpgradeTask()
+ {
+ private boolean userConfirmation = true;
+
+
+
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler)
+ {
+ // Nothing to do: no cleanup required.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ if (needsUserConfirmation)
+ {
+ // This task require an interaction with the user
+ // Which means it needs to check if CLI/GUI selected
+ // options are correct.
+ final int res = context.checkCLIUserOption(handler,
+ VerificationCallback.NEED_USER_INTERACTION);
+
+ // Process needs to have user's response to perform the current
+ // modification.
+ final int answer = context.confirmYN(handler,
+ INFO_UPGRADE_TASK_NEEDS_USER_CONFIRM.get(description),
+ ConfirmationCallback.YES);
+
+ // If the CLI/GUI options are not correct, stops the process
+ // which can happens if user selected non-interactive mode for ex.
+ if (res == ConfirmationCallback.NO)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_INVALID_USER_OPTIONS_SELECTED.get());
+ }
+
+ // The user refuses to perform this task.
+ if (answer == ConfirmationCallback.NO)
+ {
+ userConfirmation = false;
+ }
+ }
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ if (userConfirmation)
+ {
+ displayTaskLogInformation(summary.toString(), null, ldif);
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, summary, 20);
+
+ context.notifyProgress(handler, pnc);
+
+ try
+ {
+ // TODO change the directory to the config if it exists.
+ final File configFile = new File(configDirectory,
+ Installation.CURRENT_CONFIG_FILE_NAME);
+
+ final int changeCount = updateConfigFile(configFile.getPath(),
+ null, PersistentSearchChangeType.ADD, ldif);
+
+ displayChangeCount(configFile.getPath(), changeCount);
+
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final Exception e)
+ {
+ manageTaskException(context, handler,
+ Message.fromObject(e.getMessage()), pnc);
+ }
+ }
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+ };
+ }
+
+
+
+ private static void displayChangeCount(final String fileName,
+ final int changeCount)
+ {
+ if (changeCount != 0)
+ {
+ LOG.log(
+ Level.INFO,
+ INFO_UPGRADE_CHANGE_DONE_IN_SPECIFIC_FILE.get(fileName,
+ String.valueOf(changeCount)).toString());
+ }
+ else
+ {
+ LOG.log(Level.INFO,
+ INFO_UPGRADE_NO_CHANGE_DONE_IN_SPECIFIC_FILE.get(
+ fileName).toString());
+ }
+ }
+
+
+
+ private static void displayTaskLogInformation(final String summary,
+ final String filter, final String... ldif)
+ {
+ LOG.log(Level.INFO, summary);
+ if (filter != null)
+ {
+ LOG.log(Level.INFO, filter.toString());
+ }
+ if (ldif != null)
+ {
+ LOG.log(Level.INFO, Arrays.asList(ldif).toString());
+ }
+ }
+
+
+
+ private static void manageTaskException(final UpgradeContext context,
+ final CallbackHandler handler, final Message message,
+ final ProgressNotificationCallback pnc) throws ClientException
+ {
+ countErrors++;
+ context.notifyProgress(handler, pnc.changeProgress(-100));
+ LOG.log(Level.SEVERE, message.toString());
+ if (!context.isIgnoreErrorsMode())
+ {
+ throw new ClientException(EXIT_CODE_ERROR, message);
+ }
+ }
+
+
+
+ private static UpgradeTask modifyConfigEntry(final Message summary,
+ final Message description, final boolean needsUserConfirmation,
+ final String filter, final String... ldif)
+ {
+ return new UpgradeTask()
+ {
+ private boolean userConfirmation = true;
+
+
+
+ @Override
+ public void end(final UpgradeContext context,
+ final CallbackHandler handler)
+ {
+ // Nothing to do: no cleanup required.
+ }
+
+
+
+ @Override
+ public void interact(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ if (needsUserConfirmation)
+ {
+ // This task require an interaction with the user
+ // Which means it needs to check if CLI/GUI selected
+ // options are correct.
+ final int res = context.checkCLIUserOption(handler,
+ VerificationCallback.NEED_USER_INTERACTION);
+
+ // Process needs to have user's response to perform the current
+ // modification.
+ final int answer = context.confirmYN(handler,
+ INFO_UPGRADE_TASK_NEEDS_USER_CONFIRM.get(description),
+ ConfirmationCallback.YES);
+
+ // If the CLI/GUI options are not correct, stops the process
+ // which can happen if user selected non-interactive mode for ex.
+ if (res == ConfirmationCallback.NO)
+ {
+ throw new ClientException(EXIT_CODE_ERROR,
+ ERR_UPGRADE_INVALID_USER_OPTIONS_SELECTED.get());
+ }
+
+ // The user refuses to perform this task.
+ if (answer == ConfirmationCallback.NO)
+ {
+ userConfirmation = false;
+ }
+ }
+ }
+
+
+
+ @Override
+ public void perform(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ if (userConfirmation)
+ {
+ displayTaskLogInformation(summary.toString(), filter, ldif);
+
+ final ProgressNotificationCallback pnc =
+ new ProgressNotificationCallback(0, summary, 20);
+
+ context.notifyProgress(handler, pnc);
+
+ try
+ {
+ final File configFile = new File(configDirectory,
+ Installation.CURRENT_CONFIG_FILE_NAME);
+
+ final int changeCount = updateConfigFile(configFile.getPath(),
+ LDAPFilter.decode(filter), PersistentSearchChangeType.MODIFY,
+ ldif);
+
+ displayChangeCount(configFile.getPath(), changeCount);
+
+ context.notifyProgress(handler, pnc.changeProgress(100));
+ }
+ catch (final Exception e)
+ {
+ manageTaskException(context, handler,
+ Message.fromObject(e.getMessage()), pnc);
+ }
+ }
+ }
+
+
+
+ @Override
+ public void start(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+
+
+
+ @Override
+ public void verify(final UpgradeContext context,
+ final CallbackHandler handler) throws ClientException
+ {
+ // Nothing to do.
+ }
+ };
+ }
+
+
+
+ // Prevent instantiation.
+ private UpgradeTasks()
+ {
+ // Do nothing.
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java b/opends/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java
new file mode 100644
index 0000000..9d9d21e
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java
@@ -0,0 +1,805 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+
+package org.opends.server.tools.upgrade;
+
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.messages.ConfigMessages.INFO_CONFIG_FILE_HEADER;
+import static org.opends.server.tools.upgrade.FileManager.deleteRecursively;
+import static org.opends.server.tools.upgrade.FileManager.rename;
+import static org.opends.server.tools.upgrade.Installation.*;
+import static org.opends.server.util.ServerConstants.EOL;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.Entries;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.LinkedHashMapEntry;
+import org.forgerock.opendj.ldap.Matcher;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.Requests;
+import org.forgerock.opendj.ldap.schema.Schema;
+import org.forgerock.opendj.ldap.schema.SchemaBuilder;
+import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy;
+import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
+import org.forgerock.opendj.ldif.LDIFEntryReader;
+import org.forgerock.opendj.ldif.LDIFEntryWriter;
+import org.opends.server.controls.PersistentSearchChangeType;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.ldap.LDAPFilter;
+import org.opends.server.util.SetupUtils;
+import org.opends.server.util.StaticUtils;
+
+/**
+ * Common utility methods needed by the upgrade.
+ */
+final class UpgradeUtils
+{
+
+ /**
+ * Upgrade's logger.
+ */
+ private final static Logger LOG = Logger
+ .getLogger(UpgradeCli.class.getName());
+
+ // The config folder of the current installation.
+ static final File configDirectory = new File(getInstallationPath(),
+ Installation.CONFIG_PATH_RELATIVE);
+
+ // The config/schema folder of the current installation.
+ static final File configSchemaDirectory = new File(getInstallationPath(),
+ Installation.CONFIG_PATH_RELATIVE + File.separator
+ + Installation.SCHEMA_PATH_RELATIVE);
+
+ // The template folder of the current installation.
+ static final File templateDirectory = new File(getInstallationPath(),
+ Installation.CONFIG_PATH_RELATIVE + File.separator
+ + Installation.TEMPLATE_RELATIVE_PATH);
+
+ // The template/config/schema folder of the current installation.
+ static final File templateConfigSchemaDirectory = new File(
+ getInstallationPath(), Installation.TEMPLATE_RELATIVE_PATH
+ + File.separator + Installation.CONFIG_PATH_RELATIVE + File.separator
+ + Installation.SCHEMA_PATH_RELATIVE);
+
+ /**
+ * Returns the path of the installation of the directory server. Note that
+ * this method assumes that this code is being run locally.
+ *
+ * @return the path of the installation of the directory server.
+ */
+ public static String getInstallPathFromClasspath()
+ {
+ String installPath = DirectoryServer.getServerRoot();
+ if (installPath != null)
+ {
+ return installPath;
+ }
+
+ /* Get the install path from the Class Path */
+ final String sep = System.getProperty("path.separator");
+ final String[] classPaths =
+ System.getProperty("java.class.path").split(sep);
+ String path = null;
+ for (int i = 0; i < classPaths.length && (path == null); i++)
+ {
+ for (int j = 0; j < Installation.OPEN_DS_JAR_RELATIVE_PATHS.length
+ && (path == null); j++)
+ {
+ final String normPath = classPaths[i].replace(File.separatorChar, '/');
+ if (normPath.endsWith(Installation.OPEN_DS_JAR_RELATIVE_PATHS[j]))
+ {
+ path = classPaths[i];
+ }
+ }
+ }
+ if (path != null)
+ {
+ final File f = new File(path).getAbsoluteFile();
+ final File librariesDir = f.getParentFile();
+
+ /*
+ * Do a best effort to avoid having a relative representation (for
+ * instance to avoid having ../../../).
+ */
+ try
+ {
+ installPath = librariesDir.getParentFile().getCanonicalPath();
+ }
+ catch (IOException ioe)
+ {
+ // Best effort
+ installPath = librariesDir.getParent();
+ }
+ }
+ return installPath;
+ }
+
+ /**
+ * Returns the path of the installation of the directory server. Note that
+ * this method assumes that this code is being run locally.
+ *
+ * @param installPath
+ * The installation path
+ * @return the path of the installation of the directory server.
+ */
+ public static String getInstancePathFromInstallPath(final String installPath)
+ {
+ String instancePathFileName = Installation.INSTANCE_LOCATION_PATH;
+ final File configureScriptPath =
+ new File(installPath + File.separator
+ + Installation.UNIX_CONFIGURE_FILE_NAME);
+
+ // look for /etc/opt/opends/instance.loc
+ File f = new File(instancePathFileName);
+ if (!configureScriptPath.exists() || !f.exists())
+ {
+ // look for <installPath>/instance.loc
+ instancePathFileName =
+ installPath + File.separator
+ + Installation.INSTANCE_LOCATION_PATH_RELATIVE;
+ f = new File(instancePathFileName);
+ if (!f.exists())
+ {
+ return installPath;
+ }
+ }
+
+ BufferedReader reader;
+ try
+ {
+ reader = new BufferedReader(new FileReader(instancePathFileName));
+ }
+ catch (Exception e)
+ {
+ return installPath;
+ }
+
+ // Read the first line and close the file.
+ String line;
+ try
+ {
+ line = reader.readLine();
+ File instanceLoc = new File(line.trim());
+ if (instanceLoc.isAbsolute())
+ {
+ return instanceLoc.getAbsolutePath();
+ }
+ else
+ {
+ return new File(installPath + File.separator + instanceLoc.getPath())
+ .getAbsolutePath();
+ }
+ }
+ catch (Exception e)
+ {
+ return installPath;
+ }
+ finally
+ {
+ StaticUtils.close(reader);
+ }
+ }
+
+ /**
+ * Returns the absolute path for the given file. It tries to get the canonical
+ * file path. If it fails it returns the string representation.
+ *
+ * @param f
+ * File to get the path
+ * @return the absolute path for the given file.
+ */
+ public static String getPath(File f)
+ {
+ String path = null;
+ if (f != null)
+ {
+ try
+ {
+ /*
+ * Do a best effort to avoid having a relative representation (for
+ * instance to avoid having ../../../).
+ */
+ File canonical = f.getCanonicalFile();
+ f = canonical;
+ }
+ catch (IOException ioe)
+ {
+ /*
+ * This is a best effort to get the best possible representation of the
+ * file: reporting the error is not necessary.
+ */
+ }
+ path = f.toString();
+ }
+ return path;
+ }
+
+ /**
+ * Returns the absolute path for the given parentPath and relativePath.
+ *
+ * @param parentPath
+ * the parent path.
+ * @param relativePath
+ * the relative path.
+ * @return the absolute path for the given parentPath and relativePath.
+ */
+ public static String getPath(final String parentPath,
+ final String relativePath)
+ {
+ return getPath(new File(new File(parentPath), relativePath));
+ }
+
+ /**
+ * Returns <CODE>true</CODE> if we are running under windows and
+ * <CODE>false</CODE> otherwise.
+ *
+ * @return <CODE>true</CODE> if we are running under windows and
+ * <CODE>false</CODE> otherwise.
+ */
+ public static boolean isWindows()
+ {
+ return SetupUtils.isWindows();
+ }
+
+ /**
+ * Returns <CODE>true</CODE> if we are running under Unix and
+ * <CODE>false</CODE> otherwise.
+ *
+ * @return <CODE>true</CODE> if we are running under Unix and
+ * <CODE>false</CODE> otherwise.
+ */
+ public static boolean isUnix()
+ {
+ return SetupUtils.isUnix();
+ }
+
+ /**
+ * Determines whether one file is the parent of another.
+ *
+ * @param ancestor
+ * possible parent of <code>descendant</code>
+ * @param descendant
+ * possible child 0f <code>ancestor</code>
+ * @return return true if ancestor is a parent of descendant
+ */
+ static public boolean isParentOf(final File ancestor, File descendant)
+ {
+ if (ancestor != null)
+ {
+ if (ancestor.equals(descendant))
+ {
+ return false;
+ }
+ while ((descendant != null) && !ancestor.equals(descendant))
+ {
+ descendant = descendant.getParentFile();
+ }
+ }
+ return (ancestor != null) && (descendant != null);
+ }
+
+ /**
+ * Returns <CODE>true</CODE> if the first provided path is under the second
+ * path in the file system.
+ * @param descendant the descendant candidate path.
+ * @param path the path.
+ * @return <CODE>true</CODE> if the first provided path is under the second
+ * path in the file system; <code>false</code> otherwise or if
+ * either of the files are null
+ */
+ public static boolean isDescendant(File descendant, File path) {
+ boolean isDescendant = false;
+ if (descendant != null && path != null) {
+ File parent = descendant.getParentFile();
+ while ((parent != null) && !isDescendant) {
+ isDescendant = path.equals(parent);
+ if (!isDescendant) {
+ parent = parent.getParentFile();
+ }
+ }
+ }
+ return isDescendant;
+ }
+
+ /**
+ * Returns the instance root directory (the path where the instance is
+ * installed).
+ *
+ * @return the instance root directory (the path where the instance is
+ * installed).
+ */
+ static final String getInstancePath()
+ {
+ final String installPath = getInstallationPath();
+ if (installPath == null)
+ {
+ return null;
+ }
+
+ return getInstancePathFromInstallPath(installPath);
+ }
+
+ /**
+ * Returns the server's installation path.
+ *
+ * @return The server's installation path.
+ */
+ static final String getInstallationPath()
+ {
+ // The upgrade runs from the bits extracted by BuildExtractor
+ // in the staging directory. However
+ // we still want the Installation to point at the build being
+ // upgraded so the install path reported in [installroot].
+ String installationPath = System.getProperty("INSTALL_ROOT");
+ if (installationPath == null)
+ {
+ final String path = getInstallPathFromClasspath();
+ if (path != null)
+ {
+ final File f = new File(path);
+ if (f.getParentFile() != null
+ && f.getParentFile().getParentFile() != null
+ && new File(f.getParentFile().getParentFile(),
+ Installation.LOCKS_PATH_RELATIVE).exists())
+ {
+ installationPath = getPath(f.getParentFile().getParentFile());
+ }
+ else
+ {
+ installationPath = path;
+ }
+ }
+ }
+ return installationPath;
+ }
+
+ // This function is not in use actually but may be useful later
+ // eg. for rebuild index task.
+ @SuppressWarnings("unused")
+ private static final SortedMap<String, LinkedList<String>> getLocalBackends()
+ {
+ // Config.ldif path
+ final File configLdif = new File(configDirectory,
+ CURRENT_CONFIG_FILE_NAME);
+ SortedMap<String, LinkedList<String>> result =
+ new TreeMap<String, LinkedList<String>>();
+
+ LDIFEntryReader entryReader = null;
+ try
+ {
+ entryReader = new LDIFEntryReader(new FileInputStream(configLdif));
+ final Filter filter =
+ Filter.equality("objectclass", "ds-cfg-local-db-backend");
+ final Matcher includeFilter = filter.matcher();
+ entryReader.setIncludeFilter(includeFilter);
+
+ Entry entry = null;
+ while (entryReader.hasNext())
+ {
+ LinkedList<String> dataRelativesToBck = new LinkedList<String>();
+ entry = entryReader.readEntry();
+ // db path
+ dataRelativesToBck.add(entry.getAttribute("ds-cfg-db-directory")
+ .firstValueAsString());
+ // enabled ?
+ dataRelativesToBck.add(entry.getAttribute("ds-cfg-enabled")
+ .firstValueAsString());
+ // backend name
+ result.put(
+ entry.getAttribute("ds-cfg-backend-id").firstValueAsString(),
+ dataRelativesToBck);
+ }
+ }
+ catch (Exception ex)
+ {
+ LOG.log(Level.SEVERE, ex.getMessage());
+ }
+ finally
+ {
+ StaticUtils.close(entryReader);
+ }
+
+ return result;
+ }
+
+ /**
+ * Updates the config file during the upgrade process.
+ *
+ * @param configPath
+ * The original path to the file.
+ * @param filter
+ * The filter to avoid files.
+ * @param changeType
+ * The change type which must be applied to ldif lines.
+ * @param lines
+ * The change record ldif lines.
+ * @throws IOException
+ * If an Exception occurs during the input output methods.
+ * @return The changes number that have occurred.
+ */
+ static final int updateConfigFile(final String configPath,
+ final LDAPFilter filter, final PersistentSearchChangeType changeType,
+ final String... lines) throws IOException
+ {
+ final File original = new File(configPath);
+ final File copyConfig =
+ File.createTempFile("copyConfig", ".tmp", original.getParentFile());
+
+ int changeCount = 0;
+ LDIFEntryReader entryReader = null;
+ LDIFEntryWriter writer = null;
+ try
+ {
+ entryReader = new LDIFEntryReader(new FileInputStream(configPath));
+ entryReader.setSchemaValidationPolicy(SchemaValidationPolicy.ignoreAll());
+
+ writer = new LDIFEntryWriter(new FileOutputStream(copyConfig));
+ writer.setWrapColumn(80);
+
+ // Writes the header on the new file.
+ writer.writeComment(INFO_CONFIG_FILE_HEADER.get());
+ writer.setWrapColumn(0);
+
+ Entry entry = null;
+
+ boolean alreadyExist = false;
+ while (entryReader.hasNext())
+ {
+ entry = entryReader.readEntry();
+ // Searching for the related entries
+ if (filter != null
+ && Filter.valueOf(filter.toString()).matches(entry)
+ == ConditionResult.TRUE)
+ {
+ try
+ {
+ final ModifyRequest mr =
+ Requests.newModifyRequest(readLDIFLines(entry.getName(),
+ changeType, lines));
+ entry = Entries.modifyEntryPermissive(entry, mr.getModifications());
+ changeCount++;
+ }
+ catch (Exception ex)
+ {
+ LOG.log(Level.SEVERE, ex.getMessage());
+ }
+ }
+ if (filter == null && changeType == PersistentSearchChangeType.ADD)
+ {
+ if (new StringBuilder("dn: ").append(entry.getName().toString())
+ .toString().equals(lines[0]))
+ {
+ LOG.log(Level.INFO, String.format("Entry %s found", entry.getName()
+ .toString()));
+ alreadyExist = true;
+ }
+ }
+ writer.writeEntry(entry);
+ }
+
+ if (filter == null && changeType == PersistentSearchChangeType.ADD
+ && !alreadyExist)
+ {
+ final AddRequest ar = Requests.newAddRequest(lines);
+ writer.writeEntry(ar);
+ LOG.log(Level.INFO, String.format("Entry successfully added %s in %s",
+ entry.getName().toString(), original.getAbsolutePath()));
+ changeCount++;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new IOException(ex.getMessage());
+ }
+ finally
+ {
+ // The reader and writer must be close before writing files.
+ // This causes exceptions under windozs OS.
+ StaticUtils.close(entryReader, writer);
+ }
+
+ try
+ {
+ // Renaming the file, overwriting previous one.
+ rename(copyConfig, new File(configPath));
+ }
+ catch (IOException e)
+ {
+ LOG.log(Level.SEVERE, e.getMessage());
+ deleteRecursively(original);
+ throw e;
+ }
+
+ return changeCount;
+ }
+
+ /**
+ * This task adds new attributes / object classes to the specified destination
+ * file. The new attributes and object classes must be originaly defined in
+ * the template file.
+ *
+ * @param templateFile
+ * The file in which the new attribute/object definition can be read.
+ * @param destination
+ * The file where we want to add the new definitions.
+ * @param attributes
+ * Those attributes needed to be inserted into the new destination
+ * file.
+ * @param objectClasses
+ * Those object classes needed to be inserted into the new
+ * destination file.
+ * @return An integer which represents each time an attribute / object class
+ * is inserted successfully to the destination file.
+ * @throws IOException
+ * If an unexpected IO error occurred while reading the entry.
+ */
+ static int updateSchemaFile(final File templateFile, final File destination,
+ final String[] attributes, final String[] objectClasses)
+ throws IOException
+ {
+ int changeCount = 0;
+ LDIFEntryReader reader = null;
+ BufferedReader br = null;
+ FileWriter fw = null;
+ final File copy =
+ File.createTempFile("copySchema", ".tmp",
+ destination.getParentFile());
+ try
+ {
+ reader = new LDIFEntryReader(new FileInputStream(templateFile));
+
+ LinkedList<String> definitionsList = new LinkedList<String>();
+
+ final Entry schemaEntry = reader.readEntry();
+ Schema schema = null;
+
+ schema =
+ new SchemaBuilder(Schema.getCoreSchema())
+ .addSchema(schemaEntry, true).toSchema();
+ if (attributes != null)
+ {
+ for (final String att : attributes)
+ {
+ try
+ {
+ final String definition =
+ new StringBuilder("attributeTypes: ").append(
+ schema.getAttributeType(att).toString()).toString();
+ definitionsList.add(definition);
+ LOG.log(Level.INFO, String.format("Added : %s", definition));
+ }
+ catch (UnknownSchemaElementException e)
+ {
+ LOG.log(Level.SEVERE, ERR_UPGRADE_UNKNOWN_OC_ATT.get("attribute",
+ att).toString());
+ }
+ }
+ }
+
+ if (objectClasses != null)
+ {
+ for (final String oc : objectClasses)
+ {
+ try
+ {
+ final String definition = new StringBuilder("objectClasses: ")
+ .append(schema.getObjectClass(oc).toString()).toString();
+ definitionsList.add(definition);
+ LOG.log(Level.INFO, String.format("Added : %s", definition));
+ }
+ catch (UnknownSchemaElementException e)
+ {
+ LOG.log(Level.SEVERE, ERR_UPGRADE_UNKNOWN_OC_ATT.get(
+ "object class", oc).toString());
+ }
+ }
+ }
+ // Then, open the destination file and write the new attribute
+ // or objectClass definitions
+
+ br = new BufferedReader(new FileReader(destination));
+ fw = new FileWriter(copy);
+ String line = null;
+ if (definitionsList != null)
+ {
+ line = br.readLine();
+ while (line != null && !line.equals(""))
+ {
+ fw.write(line + EOL);
+ line = br.readLine();
+ }
+ for (final String definition : definitionsList)
+ {
+ writeLine(fw, definition, 80);
+ changeCount++;
+ }
+ // Must be ended with a blank line
+ fw.write(EOL);
+ }
+ }
+ finally
+ {
+ // The reader and writer must be close before writing files.
+ // This causes exceptions under windows OS.
+ StaticUtils.close(br, fw, reader);
+ }
+
+ // Writes the schema file.
+ try
+ {
+ rename(copy, destination);
+ }
+ catch (IOException e)
+ {
+ LOG.log(Level.SEVERE, e.getMessage());
+ deleteRecursively(copy);
+ throw e;
+ }
+
+ return changeCount;
+ }
+
+ /**
+ * Creates a new file in the config/upgrade folder. The new file is a
+ * concatenation of entries of all files contained in the config/schema
+ * folder.
+ *
+ * @param folder
+ * The folder containing the schema files.
+ * @param revision
+ * The revision number of the current binary version.
+ * @throws IOException
+ * If we cannot read the files contained in the folder where the
+ * schema files are supposed to be.
+ */
+ static void updateConfigUpgradeSchemaFile(final File folder,
+ final String revision) throws IOException
+ {
+ // We need to upgrade the schema.ldif.<rev> file contained in the
+ // config/upgrade folder otherwise, we cannot enable the backend at
+ // server's start. We need to read all files contained in config/schema
+ // and add all attribute/object classes in this new super entry which
+ // will be read at start-up.
+ Entry theNewSchemaEntry = new LinkedHashMapEntry();
+ LDIFEntryReader reader = null;
+ LDIFEntryWriter writer = null;
+ try
+ {
+ if (folder.isDirectory())
+ {
+ for (final File f : folder.listFiles())
+ {
+ LOG.log(Level.INFO, String.format("Processing %s", f
+ .getAbsolutePath()));
+ reader = new LDIFEntryReader(new FileInputStream(f));
+ while (reader.hasNext())
+ {
+ try
+ {
+ final Entry entry = reader.readEntry();
+ theNewSchemaEntry.setName(entry.getName());
+ for (final Attribute at : entry.getAllAttributes())
+ {
+ theNewSchemaEntry.addAttribute(at);
+ }
+ }
+ catch (Exception ex)
+ {
+ LOG.log(Level.SEVERE, ex.getMessage());
+ }
+ }
+ }
+
+ // Creates a File object representing
+ // config/upgrade/schema.ldif.revision which the server creates
+ // the first time it starts if there are schema customizations.
+ final File destination =
+ new File(configDirectory, Installation.UPGRADE_PATH
+ + File.separator + "schema.ldif." + revision);
+ writer = new LDIFEntryWriter(new FileOutputStream(destination));
+ writer.writeEntry(theNewSchemaEntry);
+
+ LOG.log(Level.INFO, String.format("%s file created successfully.",
+ destination.getAbsolutePath()));
+ }
+ }
+ finally
+ {
+ reader.close();
+ writer.close();
+ }
+ }
+
+ private static String[] readLDIFLines(final DN dn,
+ final PersistentSearchChangeType changeType, final String... lines)
+ {
+ final String[] modifiedLines = new String[lines.length + 2];
+
+ int index = 0;
+ if (changeType == PersistentSearchChangeType.MODIFY)
+ {
+ modifiedLines[0] =
+ new StringBuilder("dn: ").append(dn.toString()).toString();
+ modifiedLines[1] = "changetype: modify";
+ index = 2;
+ }
+ for (final String line : lines)
+ {
+ modifiedLines[index] = line;
+ index++;
+ }
+ return modifiedLines;
+ }
+
+ private static void writeLine(final FileWriter fw, final String line,
+ final int wrapColumn) throws IOException
+ {
+ final int length = line.length();
+ if (length > wrapColumn)
+ {
+ fw.write(line.subSequence(0, wrapColumn).toString());
+ fw.write(EOL);
+ int pos = wrapColumn;
+ while (pos < length)
+ {
+ final int writeLength = Math.min(wrapColumn - 1, length - pos);
+ fw.write(" ");
+ fw.write(line.subSequence(pos, pos + writeLength).toString());
+ fw.write(EOL);
+ pos += wrapColumn - 1;
+ }
+ }
+ else
+ {
+ fw.write(line);
+ fw.write(EOL);
+ }
+ }
+
+ // Prevent instantiation.
+ private UpgradeUtils()
+ {
+ throw new AssertionError();
+ }
+}
diff --git a/opends/src/server/org/opends/server/tools/upgrade/VerificationCallback.java b/opends/src/server/org/opends/server/tools/upgrade/VerificationCallback.java
new file mode 100644
index 0000000..642cbcf
--- /dev/null
+++ b/opends/src/server/org/opends/server/tools/upgrade/VerificationCallback.java
@@ -0,0 +1,113 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2013 ForgeRock AS
+ */
+package org.opends.server.tools.upgrade;
+
+import javax.security.auth.callback.ConfirmationCallback;
+
+/**
+ * <p>
+ * Underlying security services instantiate and pass a
+ * <code>VerificationCallback</code> to the <code>handle</code> method of a
+ * <code>CallbackHandler</code> to verify user's options.
+ */
+public class VerificationCallback extends ConfirmationCallback
+{
+ /**
+ * The serial version UID.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * An identifier of a task which need a user interaction.
+ */
+ public static final int NEED_USER_INTERACTION = 0;
+
+ /**
+ * An identifier of a task which require long time to complete.
+ */
+ public static final int TAKE_LONG_TIME_TO_COMPLETE = 1;
+
+ /**
+ * An identifier of a task which cannot be reverted once started.
+ */
+ public static final int CANNOT_BE_REVERTED = 2;
+
+ /**
+ * The identifier of ignore errors mode.
+ */
+ public static final int IGNORE_ERRORS_MODE = 5;
+
+ /**
+ * The identifier of mandatory user interaction.
+ */
+ public static final int MANDATORY_USER_INTERACTION = 6;
+
+ // The required options for the verification callback.
+ private int[] requiredOptions;
+
+ /**
+ * Construct a verification callback, which checks user options selected with
+ * required options needed by the process.
+ *
+ * @param messageType
+ * The type of the message.
+ * @param optionType
+ * The type of the option.
+ * @param defaultOption
+ * The default selected option.
+ * @param requiredOptions
+ * The required option.
+ */
+ public VerificationCallback(int messageType, int optionType,
+ int defaultOption, int... requiredOptions)
+ {
+ super(messageType, optionType, defaultOption);
+ this.requiredOptions = requiredOptions;
+ }
+
+ /**
+ * Returns options required in user's options.
+ *
+ * @return The options required which need to be verified.
+ */
+ public int[] getRequiredOptions()
+ {
+ return requiredOptions;
+ }
+
+ /**
+ * Sets the required options which must be present in the user's options.
+ *
+ * @param requiredOptions
+ * The options required which need to be verified.
+ */
+ public void setRequiredOptions(final int... requiredOptions)
+ {
+ this.requiredOptions = requiredOptions;
+ }
+
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/package-info.java b/opends/src/server/org/opends/server/tools/upgrade/package-info.java
similarity index 70%
rename from opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/package-info.java
rename to opends/src/server/org/opends/server/tools/upgrade/package-info.java
index ad3fefb..bb942f6 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/package-info.java
+++ b/opends/src/server/org/opends/server/tools/upgrade/package-info.java
@@ -22,12 +22,16 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2013 ForgeRock SAS
*/
-
/**
- * Defines the specific graphical classes for the upgrader. These classes are
- * basically the different panels that are displayed in the upgrader.
+ * Defines the specific classes that are used by the upgrade tool.
+ * This includes CLI, engine and several helper classes
+ * which are used to perform the full strategy of the upgrade
+ * of the OpenDJ server.
*/
-package org.opends.quicksetup.upgrader.ui;
+@org.opends.server.types.PublicAPI(
+ stability = org.opends.server.types.StabilityLevel.PRIVATE)
+package org.opends.server.tools.upgrade;
+
diff --git a/opends/src/server/org/opends/server/util/BuildVersion.java b/opends/src/server/org/opends/server/util/BuildVersion.java
index d7d744f..24f4f41 100644
--- a/opends/src/server/org/opends/server/util/BuildVersion.java
+++ b/opends/src/server/org/opends/server/util/BuildVersion.java
@@ -23,54 +23,167 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS.
*/
package org.opends.server.util;
+import static org.opends.messages.ToolMessages.ERR_BUILDVERSION_NOT_FOUND;
+import static org.opends.messages.ToolMessages.ERR_BUILDVERSION_MALFORMED;
+import static org.opends.messages.ToolMessages.ERR_BUILDVERSION_MISMATCH;
+import static org.opends.server.config.ConfigConstants.CONFIG_DIR_NAME;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.types.InitializationException;
+
/**
- * Represents a particular version of OpenDS useful for making
- * comparisons between versions.
+ * Represents a particular version of OpenDJ useful for making comparisons
+ * between versions.
*/
@org.opends.server.types.PublicAPI(
- stability=org.opends.server.types.StabilityLevel.VOLATILE,
- mayInstantiate=false,
- mayExtend=false,
- mayInvoke=true)
-public final class BuildVersion implements Comparable<BuildVersion> {
+ stability = org.opends.server.types.StabilityLevel.VOLATILE,
+ mayInstantiate = false, mayExtend = false, mayInvoke = true)
+public final class BuildVersion implements Comparable<BuildVersion>
+{
- /** Major release number. */
- int major;
-
- /** Minor release number. */
- int minor;
-
- /** Point release number. */
- int point;
-
- /** Subversion revision number. */
- long rev;
+ private final int major;
+ private final int minor;
+ private final int point;
+ private final long rev;
+ private static final BuildVersion BINARY_VERSION = new BuildVersion(
+ DynamicConstants.MAJOR_VERSION, DynamicConstants.MINOR_VERSION,
+ DynamicConstants.POINT_VERSION, DynamicConstants.REVISION_NUMBER);
/**
- * Creates a new instance using current build data.
+ * Returns the build version as specified by the dynamic constants.
*
- * @return BuildVersion representing current data
+ * @return The build version as specified by the dynamic constants.
*/
- static public BuildVersion getCurrent() {
- return new BuildVersion(
- DynamicConstants.MAJOR_VERSION,
- DynamicConstants.MINOR_VERSION,
- DynamicConstants.POINT_VERSION,
- DynamicConstants.REVISION_NUMBER);
+ public static BuildVersion binaryVersion()
+ {
+ return BINARY_VERSION;
}
/**
- * Constructs an instance from build data.
- * @param major release number
- * @param minor release number
- * @param point release number
- * @param rev Subversion revision number
+ * Reads the instance version from config/buildinfo.
+ *
+ * @return The instance version from config/buildinfo.
+ * @throws InitializationException
+ * If an error occurred while reading or parsing the version.
*/
- public BuildVersion(int major, int minor, int point, long rev) {
+ public static BuildVersion instanceVersion() throws InitializationException
+ {
+ final String buildInfo =
+ DirectoryServer.getInstanceRoot() + File.separator + CONFIG_DIR_NAME
+ + File.separator + "buildinfo";
+ BufferedReader reader = null;
+ try
+ {
+ reader = new BufferedReader(new FileReader(buildInfo));
+ final String s = reader.readLine();
+ if (s != null)
+ {
+ return valueOf(s);
+ }
+ else
+ {
+ throw new InitializationException(ERR_BUILDVERSION_MALFORMED
+ .get(buildInfo));
+ }
+ }
+ catch (IOException e)
+ {
+ throw new InitializationException(ERR_BUILDVERSION_NOT_FOUND
+ .get(buildInfo));
+ }
+ catch (final IllegalArgumentException e)
+ {
+ throw new InitializationException(ERR_BUILDVERSION_MALFORMED
+ .get(buildInfo));
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ }
+ catch (final Exception e)
+ {
+ // Ignore.
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if the binary version is the same than the instance version.
+ *
+ * @throws InitializationException
+ * Sends an exception if the version mismatch.
+ */
+ public static void checkVersionMismatch() throws InitializationException
+ {
+ if (!BuildVersion.binaryVersion().toString().equals(
+ BuildVersion.instanceVersion().toString()))
+ {
+ throw new InitializationException(ERR_BUILDVERSION_MISMATCH.get(
+ BuildVersion.binaryVersion().toString(), BuildVersion
+ .instanceVersion().toString()));
+ }
+ }
+
+ /**
+ * Parses the string argument as a build version. The string must be of the
+ * form:
+ *
+ * <pre>
+ * major.minor.point.rev
+ * </pre>
+ *
+ * @param s
+ * The string to be parsed as a build version.
+ * @return The parsed build version.
+ * @throws IllegalArgumentException
+ * If the string does not contain a parsable build version.
+ */
+ public static BuildVersion valueOf(final String s)
+ throws IllegalArgumentException
+ {
+ final String[] fields = s.split("\\.");
+ if (fields.length != 4)
+ {
+ throw new IllegalArgumentException("Invalid version string " + s);
+ }
+ final int major = Integer.parseInt(fields[0]);
+ final int minor = Integer.parseInt(fields[1]);
+ final int point = Integer.parseInt(fields[2]);
+ final long rev = Long.parseLong(fields[3]);
+ return new BuildVersion(major, minor, point, rev);
+ }
+
+ /**
+ * Creates a new build version using the provided version information.
+ *
+ * @param major
+ * Major release version number.
+ * @param minor
+ * Minor release version number.
+ * @param point
+ * Point release version number.
+ * @param rev
+ * VCS revision number.
+ */
+ public BuildVersion(final int major, final int minor, final int point,
+ final long rev)
+ {
this.major = major;
this.minor = minor;
this.point = point;
@@ -78,69 +191,126 @@
}
/**
- * Gets the major release number.
- * @return int major release number
+ * {@inheritDoc}
*/
- public int getMajorVersion() {
+ public int compareTo(final BuildVersion version)
+ {
+ if (major == version.major)
+ {
+ if (minor == version.minor)
+ {
+ if (point == version.point)
+ {
+ if (rev == version.rev)
+ {
+ return 0;
+ }
+ else if (rev < version.rev)
+ {
+ return -1;
+ }
+ }
+ else if (point < version.point)
+ {
+ return -1;
+ }
+ }
+ else if (minor < version.minor)
+ {
+ return -1;
+ }
+ }
+ else if (major < version.major)
+ {
+ return -1;
+ }
+ return 1;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(final Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ else if (obj instanceof BuildVersion)
+ {
+ final BuildVersion other = (BuildVersion) obj;
+ return (major == other.major) && (minor == other.minor)
+ && (point == other.point) && (rev == other.rev);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the major release version number.
+ *
+ * @return The major release version number.
+ */
+ public int getMajorVersion()
+ {
return major;
}
/**
- * Gets the minor release number.
- * @return int minor release number
+ * Returns the minor release version number.
+ *
+ * @return The minor release version number.
*/
- public int getMinorVersion() {
+ public int getMinorVersion()
+ {
return minor;
}
/**
- * Gets the point release number.
- * @return int point release number
+ * Returns the point release version number.
+ *
+ * @return The point release version number.
*/
- public int getPointVersion() {
+ public int getPointVersion()
+ {
return point;
}
/**
- * Gets the Subversion revision number.
- * @return long Subversion revision number
+ * Returns the VCS revision number.
+ *
+ * @return The VCS revision number.
*/
- public long getRevisionNumber() {
+ public long getRevisionNumber()
+ {
return rev;
}
/**
- * Retrieves an integer value that indicates the relative order between this
- * build version and the provided build version object.
- *
- * @param version The build version object for which to make the
- * determination.
- *
- * @return A negative integer if this build version should be ordered before
- * the provided build version in a sorted list, a positive integer if
- * this build version should be ordered after the provided build
- * version in a sorted list, or zero if there is no difference in the
- * relative order between the build version objects.
+ * {@inheritDoc}
*/
- public int compareTo(BuildVersion version) {
- if (major == version.major) {
- if (minor == version.minor) {
- if (point == version.point) {
- if (rev == version.rev) {
- return 0;
- } else if (rev < version.rev) {
- return -1;
- }
- } else if (point < version.point) {
- return -1;
- }
- } else if (minor < version.minor) {
- return -1;
- }
- } else if (major < version.major) {
- return -1;
- }
- return 1;
+ public int hashCode()
+ {
+ return Arrays.hashCode(new int[] { major, minor, point, (int) (rev >>> 32),
+ (int) (rev & 0xFFFFL) });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(major);
+ builder.append('.');
+ builder.append(minor);
+ builder.append('.');
+ builder.append(point);
+ builder.append('.');
+ builder.append(rev);
+ return builder.toString();
}
}
diff --git a/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java b/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
index 302502d..cdc916c 100644
--- a/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2013 ForgeRock AS
*/
package org.opends.server.util.args;
import org.opends.messages.Message;
@@ -741,11 +741,17 @@
int numArguments = rawArguments.length;
for (int i=0; i < numArguments; i++)
{
- String arg = rawArguments[i];
+ final String arg = rawArguments[i];
if (inTrailingArgs)
{
trailingArguments.add(arg);
+
+ if (subCommand == null)
+ {
+ throw new ArgumentException(ERR_ARG_SUBCOMMAND_INVALID.get());
+ }
+
if ((subCommand.getMaxTrailingArguments() > 0) &&
(trailingArguments.size() > subCommand.getMaxTrailingArguments()))
{
diff --git a/opends/src/server/org/opends/server/util/cli/ConsoleApplication.java b/opends/src/server/org/opends/server/util/cli/ConsoleApplication.java
index 0ed28cb..3d9b5e8 100644
--- a/opends/src/server/org/opends/server/util/cli/ConsoleApplication.java
+++ b/opends/src/server/org/opends/server/util/cli/ConsoleApplication.java
@@ -23,12 +23,10 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2012 ForgeRock AS
+ * Portions Copyright 2012-2013 ForgeRock AS
*/
package org.opends.server.util.cli;
-
-
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.DSConfigMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
@@ -70,37 +68,65 @@
import org.opends.server.util.PasswordReader;
import org.opends.server.util.SetupUtils;
-
/**
- * This class provides an abstract base class which can be used as the
- * basis of a console-based application.
+ * This class provides an abstract base class which can be used as the basis of
+ * a console-based application.
*/
-public abstract class ConsoleApplication {
+public abstract class ConsoleApplication
+{
/**
* A null reader.
*/
- private static final class NullReader extends Reader {
+ private static final class NullReader extends Reader
+ {
/**
* {@inheritDoc}
*/
@Override
- public void close() throws IOException {
+ public void close() throws IOException
+ {
// Do nothing.
}
-
-
/**
* {@inheritDoc}
*/
@Override
- public int read(char[] cbuf, int off, int len) throws IOException {
+ public int read(char[] cbuf, int off, int len) throws IOException
+ {
return -1;
}
}
+ /**
+ * Defines a title in the console application.
+ */
+ public final static int TITLE = 0;
+ /**
+ * Defines a subtitle in the console application.
+ */
+ public final static int SUBTITLE = 1;
+ /**
+ * Defines a notice in the console application.
+ */
+ public final static int NOTICE = 2;
+ /**
+ * Defines a normal line in the console application.
+ */
+ public final static int NORMAL = 3;
+
+ /**
+ * Defines an error line in the console application.
+ */
+ public final static int ERROR = 4;
+
+ /**
+ * Defines a break line in the console application.
+ */
+ public final static int BREAKLINE = 5;
+
// The error stream which this application should use.
private final PrintStream err;
@@ -111,7 +137,7 @@
private final PrintStream out;
/**
- * The maximum number of times we try to confirm.
+ * The maximum number of times we try to confirm.
*/
protected final static int CONFIRMATION_MAX_TRIES = 5;
@@ -121,9 +147,8 @@
/**
* The String used to write comments in a shell (or batch) script.
*/
- protected static final String SHELL_COMMENT_SEPARATOR =
- SetupUtils.isWindows() ?
- COMMENT_BATCH_WINDOWS : COMMENT_SHELL_UNIX;
+ protected static final String SHELL_COMMENT_SEPARATOR = SetupUtils
+ .isWindows() ? COMMENT_BATCH_WINDOWS : COMMENT_SHELL_UNIX;
/**
* Creates a new console application instance.
@@ -136,28 +161,36 @@
* The application error stream.
*/
protected ConsoleApplication(BufferedReader in, PrintStream out,
- PrintStream err) {
- if (in != null) {
+ PrintStream err)
+ {
+ if (in != null)
+ {
this.in = in;
- } else {
+ }
+ else
+ {
this.in = new BufferedReader(new NullReader());
}
- if (out != null) {
+ if (out != null)
+ {
this.out = out;
- } else {
+ }
+ else
+ {
this.out = NullOutputStream.printStream();
}
- if (err != null) {
+ if (err != null)
+ {
this.err = out;
- } else {
+ }
+ else
+ {
this.err = NullOutputStream.printStream();
}
}
-
-
/**
* Creates a new console application instance.
*
@@ -169,70 +202,89 @@
* The application error stream.
*/
protected ConsoleApplication(InputStream in, OutputStream out,
- OutputStream err) {
- if (in != null) {
+ OutputStream err)
+ {
+ if (in != null)
+ {
this.in = new BufferedReader(new InputStreamReader(in));
- } else {
+ }
+ else
+ {
this.in = new BufferedReader(new NullReader());
}
- if (out != null) {
+ if (out != null)
+ {
this.out = new PrintStream(out);
- } else {
+ }
+ else
+ {
this.out = NullOutputStream.printStream();
}
- if (err != null) {
+ if (err != null)
+ {
this.err = new PrintStream(err);
- } else {
+ }
+ else
+ {
this.err = NullOutputStream.printStream();
}
}
-
-
/**
- * Interactively confirms whether a user wishes to perform an
- * action. If the application is non-interactive, then the provided
- * default is returned automatically.
+ * Interactively confirms whether a user wishes to perform an action. If the
+ * application is non-interactive, then the provided default is returned
+ * automatically.
*
* @param prompt
* The prompt describing the action.
* @param defaultValue
- * The default value for the confirmation message. This
- * will be returned if the application is non-interactive
- * or if the user just presses return.
- * @return Returns <code>true</code> if the user wishes the action
- * to be performed, or <code>false</code> if they refused,
- * or if an exception occurred.
+ * The default value for the confirmation message. This will be
+ * returned if the application is non-interactive or if the user just
+ * presses return.
+ * @return Returns <code>true</code> if the user wishes the action to be
+ * performed, or <code>false</code> if they refused, or if an
+ * exception occurred.
* @throws CLIException
- * If the user's response could not be read from the
- * console for some reason.
+ * If the user's response could not be read from the console for
+ * some reason.
*/
public final boolean confirmAction(Message prompt, final boolean defaultValue)
- throws CLIException {
- if (!isInteractive()) {
+ throws CLIException
+ {
+ if (!isInteractive())
+ {
return defaultValue;
}
final Message yes = INFO_GENERAL_YES.get();
final Message no = INFO_GENERAL_NO.get();
final Message errMsg = ERR_CONSOLE_APP_CONFIRM.get(yes, no);
- prompt = INFO_MENU_PROMPT_CONFIRM.get(prompt, yes, no, defaultValue ? yes
- : no);
+ prompt =
+ INFO_MENU_PROMPT_CONFIRM.get(prompt, yes, no, defaultValue ? yes : no);
- ValidationCallback<Boolean> validator = new ValidationCallback<Boolean>() {
+ ValidationCallback<Boolean> validator = new ValidationCallback<Boolean>()
+ {
@Override
- public Boolean validate(ConsoleApplication app, String input) {
+ public Boolean validate(ConsoleApplication app, String input)
+ {
String ninput = input.toLowerCase().trim();
- if (ninput.length() == 0) {
+ if (ninput.length() == 0)
+ {
return defaultValue;
- } else if (no.toString().toLowerCase().startsWith(ninput)) {
+ }
+ else if (no.toString().toLowerCase().startsWith(ninput))
+ {
return false;
- } else if (yes.toString().toLowerCase().startsWith(ninput)) {
+ }
+ else if (yes.toString().toLowerCase().startsWith(ninput))
+ {
return true;
- } else {
+ }
+ else
+ {
// Try again...
app.println();
app.println(errMsg);
@@ -246,165 +298,217 @@
return readValidatedInput(prompt, validator, CONFIRMATION_MAX_TRIES);
}
-
-
/**
* Gets the application error stream.
*
* @return Returns the application error stream.
*/
- public final PrintStream getErrorStream() {
+ public final PrintStream getErrorStream()
+ {
return err;
}
-
-
/**
* Gets the application input stream.
*
* @return Returns the application input stream.
*/
- public final BufferedReader getInputStream() {
+ public final BufferedReader getInputStream()
+ {
return in;
}
-
-
/**
* Gets the application output stream.
*
* @return Returns the application output stream.
*/
- public final PrintStream getOutputStream() {
+ public final PrintStream getOutputStream()
+ {
return out;
}
-
-
/**
* Indicates whether or not the user has requested advanced mode.
*
- * @return Returns <code>true</code> if the user has requested
- * advanced mode.
+ * @return Returns <code>true</code> if the user has requested advanced mode.
*/
public abstract boolean isAdvancedMode();
-
-
/**
- * Indicates whether or not the user has requested interactive
- * behavior.
+ * Indicates whether or not the user has requested interactive behavior.
*
- * @return Returns <code>true</code> if the user has requested
- * interactive behavior.
+ * @return Returns <code>true</code> if the user has requested interactive
+ * behavior.
*/
public abstract boolean isInteractive();
-
-
/**
- * Indicates whether or not this console application is running in
- * its menu-driven mode. This can be used to dictate whether output
- * should go to the error stream or not. In addition, it may also
- * dictate whether or not sub-menus should display a cancel option
- * as well as a quit option.
+ * Indicates whether or not this console application is running in its
+ * menu-driven mode. This can be used to dictate whether output should go to
+ * the error stream or not. In addition, it may also dictate whether or not
+ * sub-menus should display a cancel option as well as a quit option.
*
- * @return Returns <code>true</code> if this console application
- * is running in its menu-driven mode.
+ * @return Returns <code>true</code> if this console application is running in
+ * its menu-driven mode.
*/
public abstract boolean isMenuDrivenMode();
-
-
/**
* Indicates whether or not the user has requested quiet output.
*
- * @return Returns <code>true</code> if the user has requested
- * quiet output.
+ * @return Returns <code>true</code> if the user has requested quiet output.
*/
public abstract boolean isQuiet();
-
-
/**
- * Indicates whether or not the user has requested script-friendly
- * output.
+ * Indicates whether or not the user has requested script-friendly output.
*
- * @return Returns <code>true</code> if the user has requested
- * script-friendly output.
+ * @return Returns <code>true</code> if the user has requested script-friendly
+ * output.
*/
public abstract boolean isScriptFriendly();
-
-
/**
* Indicates whether or not the user has requested verbose output.
*
- * @return Returns <code>true</code> if the user has requested
- * verbose output.
+ * @return Returns <code>true</code> if the user has requested verbose output.
*/
public abstract boolean isVerbose();
-
-
/**
- * Interactively prompts the user to press return to continue. This
- * method should be called in situations where a user needs to be
- * given a chance to read some documentation before continuing
- * (continuing may cause the documentation to be scrolled out of
- * view).
+ * Interactively prompts the user to press return to continue. This method
+ * should be called in situations where a user needs to be given a chance to
+ * read some documentation before continuing (continuing may cause the
+ * documentation to be scrolled out of view).
*/
- public final void pressReturnToContinue() {
+ public final void pressReturnToContinue()
+ {
Message msg = INFO_MENU_PROMPT_RETURN_TO_CONTINUE.get();
- try {
+ try
+ {
readLineOfInput(msg);
- } catch (CLIException e) {
+ }
+ catch (CLIException e)
+ {
// Ignore the exception - applications don't care.
}
}
-
-
/**
* Displays a blank line to the error stream.
*/
- public final void println() {
+ public final void println()
+ {
err.println();
}
-
-
/**
* Displays a message to the error stream.
*
* @param msg
* The message.
*/
- public final void println(Message msg) {
+ public final void println(Message msg)
+ {
err.println(wrapText(msg, MAX_LINE_WIDTH));
}
-
/**
* Displays a message to the error stream.
*
* @param msg
* The message.
*/
- public final void print(Message msg) {
+ public final void print(Message msg)
+ {
err.print(wrapText(msg, MAX_LINE_WIDTH));
}
/**
+ * Print a line with EOL in the output stream.
+ *
+ * @param msg
+ * The message to display in normal mode.
+ * @param indent
+ * The indentation.
+ */
+ public final void println(final Message msg, final int indent)
+ {
+ println(0, msg, indent);
+ }
+
+ /**
+ * Print a line with EOL in the output stream.
+ *
+ * @param typeMessage
+ * The type of formatted output desired.
+ * @param msg
+ * The message to display in normal mode.
+ * @param indent
+ * The indentation.
+ */
+ public final void println(final int typeMessage, final Message msg,
+ final int indent)
+ {
+ if (!isQuiet())
+ {
+ if (typeMessage == TITLE)
+ {
+ out.println();
+ out.println(">>>> " + wrapText(msg, MAX_LINE_WIDTH, indent));
+ out.println();
+ }
+ else if (typeMessage == SUBTITLE)
+ {
+ out.println(wrapText(msg, MAX_LINE_WIDTH, indent));
+ out.println();
+ }
+ else if (typeMessage == NOTICE)
+ {
+ out.println(wrapText(" * " + msg, MAX_LINE_WIDTH, indent));
+ }
+ else if (typeMessage == ERROR)
+ {
+ out.println();
+ out.println(wrapText("** " + msg, MAX_LINE_WIDTH, indent));
+ }
+ else if (typeMessage == BREAKLINE)
+ {
+ out.println();
+ }
+ else
+ {
+ out.println(wrapText(msg, MAX_LINE_WIDTH, indent));
+ }
+ }
+ }
+
+ /**
* Displays a blank line to the output stream if we are not in quiet mode.
*/
- public final void printlnProgress() {
+ public final void printlnProgress()
+ {
if (!isQuiet())
{
out.println();
}
}
+ /**
+ * Displays a message to the output stream if we are not in quiet mode.
+ * Message is wrap to max line width.
+ *
+ * @param msg
+ * The message.
+ */
+ public final void printlnProgress(Message msg)
+ {
+ if (!isQuiet())
+ {
+ out.println(wrapText(msg, MAX_LINE_WIDTH));
+ }
+ }
/**
* Displays a message to the output stream if we are not in quiet mode.
@@ -412,7 +516,8 @@
* @param msg
* The message.
*/
- public final void printProgress(Message msg) {
+ public final void printProgress(final Message msg)
+ {
if (!isQuiet())
{
out.print(msg);
@@ -420,13 +525,67 @@
}
/**
- * Display the batch progress string to the error stream, if we are not
- * in quiet mode.
+ * Prints a progress bar on the same output stream line if not in quiet mode.
+ *
+ * <pre>
+ * Like
+ * msg...... 50%
+ * if progress is up to 100 :
+ * msg..................... 100%
+ * if progress is < 0 :
+ * msg.... FAIL
+ * msg..................... FAIL
+ * </pre>
+ *
+ * @param linePos
+ * The progress bar starts at this position on the line.
+ * @param progress
+ * The current percentage progress to print.
+ */
+ public final void printProgressBar(final int linePos, final int progress)
+ {
+ if (!isQuiet())
+ {
+ final int spacesLeft = MAX_LINE_WIDTH - linePos - 10;
+ StringBuilder bar = new StringBuilder();
+ if (progress != 0)
+ {
+ for (int i = 0; i < 50; i++)
+ {
+ if ((i < (Math.abs(progress) / 2)) && (bar.length() < spacesLeft))
+ {
+ bar.append(".");
+ }
+ }
+ }
+ bar.append(". ");
+ if(progress >= 0) {
+ bar.append(progress).append("% ");
+ } else {
+ bar.append("FAIL");
+ }
+ final int endBuilder = linePos + bar.length();
+ for (int i = 0; i < endBuilder; i++)
+ {
+ bar.append("\b");
+ }
+ if (progress >= 100 || progress < 0)
+ {
+ bar.append(EOL);
+ }
+ out.print(bar.toString());
+ }
+ }
+
+ /**
+ * Display the batch progress string to the error stream, if we are not in
+ * quiet mode.
*
* @param s
* The string to display
*/
- public final void printlnBatchProgress(String s) {
+ public final void printlnBatchProgress(String s)
+ {
if (!isQuiet())
{
err.println(s);
@@ -434,98 +593,164 @@
}
/**
- * Displays a message to the error stream indented by the specified
- * number of columns.
+ * Displays a message to the error stream indented by the specified number of
+ * columns.
*
* @param msg
* The message.
* @param indent
* The number of columns to indent.
*/
- public final void println(Message msg, int indent) {
+ public final void printErrln(Message msg, int indent)
+ {
err.println(wrapText(msg, MAX_LINE_WIDTH, indent));
}
-
-
/**
- * Displays a message to the error stream if verbose mode is
- * enabled.
+ * Displays a message to the error stream if verbose mode is enabled.
*
* @param msg
* The verbose message.
*/
- public final void printVerboseMessage(Message msg) {
- if (isVerbose() || isInteractive()) {
+ public final void printVerboseMessage(Message msg)
+ {
+ if (isVerbose() || isInteractive())
+ {
err.println(wrapText(msg, MAX_LINE_WIDTH));
}
}
-
-
/**
* Interactively retrieves a line of input from the console.
*
* @param prompt
* The prompt.
- * @return Returns the line of input, or <code>null</code> if the
- * end of input has been reached.
+ * @return Returns the line of input, or <code>null</code> if the end of input
+ * has been reached.
* @throws CLIException
- * If the line of input could not be retrieved for some
- * reason.
+ * If the line of input could not be retrieved for some reason.
*/
- public final String readLineOfInput(Message prompt) throws CLIException {
+ public final String readLineOfInput(Message prompt) throws CLIException
+ {
if (prompt != null)
{
err.print(wrapText(prompt, MAX_LINE_WIDTH));
err.print(" ");
}
- try {
+ try
+ {
String s = in.readLine();
- if (s == null) {
+ if (s == null)
+ {
throw CLIException
.adaptInputException(new EOFException("End of input"));
- } else {
+ }
+ else
+ {
return s;
}
- } catch (IOException e) {
+ }
+ catch (IOException e)
+ {
throw CLIException.adaptInputException(e);
}
}
+ /**
+ * Displays a message and read the user's input from output.
+ *
+ * @param prompt
+ * The message to display.
+ * @param defaultValue
+ * The default answer by default.
+ * @param formattedOutput
+ * The formatted style chosen.
+ * @return The user's input as a string.
+ * @throws CLIException
+ * If an Exception occurs during the process.
+ */
+ public final String readInput(final Message prompt,
+ final String defaultValue, final int formattedOutput) throws CLIException
+ {
+ String answer = null;
+ final Message messageToDisplay =
+ INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(), defaultValue);
+ if (formattedOutput == TITLE)
+ {
+ println();
+ }
+ print(messageToDisplay);
+ out.print(" ");
+
+ try
+ {
+ // Reads the user input.
+ answer = in.readLine();
+ }
+ catch (IOException e)
+ {
+ throw CLIException.adaptInputException(e);
+ }
+
+ if (formattedOutput == TITLE || formattedOutput == SUBTITLE)
+ {
+ println();
+ }
+
+ if ("".equals(answer))
+ {
+ if (defaultValue == null)
+ {
+ println(INFO_ERROR_EMPTY_RESPONSE.get());
+ }
+ else
+ {
+ return defaultValue;
+ }
+ }
+ return answer;
+ }
/**
* Commodity method that interactively prompts (on error output) the user to
- * provide a string value. Any non-empty string will be allowed (the empty
+ * provide a string value. Any non-empty string will be allowed (the empty
* string will indicate that the default should be used, if there is one).
*
- * @param prompt The prompt to present to the user.
- * @param defaultValue The default value to assume if the user presses ENTER
- * without typing anything, or <CODE>null</CODE> if
- * there should not be a default and the user must
- * explicitly provide a value.
- *
+ * @param prompt
+ * The prompt to present to the user.
+ * @param defaultValue
+ * The default value to assume if the user presses ENTER without
+ * typing anything, or <CODE>null</CODE> if there should not be a
+ * default and the user must explicitly provide a value.
* @throws CLIException
- * If the line of input could not be retrieved for some
- * reason.
- * @return The string value read from the user.
+ * If the line of input could not be retrieved for some reason.
+ * @return The string value read from the user.
*/
public String readInput(Message prompt, String defaultValue)
- throws CLIException {
- while (true) {
- if (defaultValue != null) {
- prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(),
- defaultValue);
+ throws CLIException
+ {
+ while (true)
+ {
+ if (defaultValue != null)
+ {
+ prompt =
+ INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(), defaultValue);
}
String response = readLineOfInput(prompt);
- if ("".equals(response)) {
- if (defaultValue == null) {
+ if ("".equals(response))
+ {
+ if (defaultValue == null)
+ {
println(INFO_ERROR_EMPTY_RESPONSE.get());
- } else {
+ }
+ else
+ {
return defaultValue;
}
- } else {
+ }
+ else
+ {
return response;
}
}
@@ -533,18 +758,19 @@
/**
* Commodity method that interactively prompts (on error output) the user to
- * provide a string value. Any non-empty string will be allowed (the empty
- * string will indicate that the default should be used, if there is one).
- * If an error occurs a message will be logged to the provided logger.
+ * provide a string value. Any non-empty string will be allowed (the empty
+ * string will indicate that the default should be used, if there is one). If
+ * an error occurs a message will be logged to the provided logger.
*
- * @param prompt The prompt to present to the user.
- * @param defaultValue The default value to assume if the user presses ENTER
- * without typing anything, or <CODE>null</CODE> if
- * there should not be a default and the user must
- * explicitly provide a value.
- *
- * @param logger the Logger to be used to log the error message.
- * @return The string value read from the user.
+ * @param prompt
+ * The prompt to present to the user.
+ * @param defaultValue
+ * The default value to assume if the user presses ENTER without
+ * typing anything, or <CODE>null</CODE> if there should not be a
+ * default and the user must explicitly provide a value.
+ * @param logger
+ * the Logger to be used to log the error message.
+ * @return The string value read from the user.
*/
public String readInput(Message prompt, String defaultValue, Logger logger)
{
@@ -555,7 +781,7 @@
}
catch (CLIException ce)
{
- logger.log(Level.WARNING, "Error reading input: "+ce, ce);
+ logger.log(Level.WARNING, "Error reading input: " + ce, ce);
}
return s;
}
@@ -569,25 +795,30 @@
* @throws CLIException
* If the password could not be retrieved for some reason.
*/
- public final String readPassword(Message prompt) throws CLIException {
+ public final String readPassword(Message prompt) throws CLIException
+ {
err.print(wrapText(prompt + " ", MAX_LINE_WIDTH));
char[] pwChars;
- try {
+ try
+ {
pwChars = PasswordReader.readPassword();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw CLIException.adaptInputException(e);
}
return new String(pwChars);
}
/**
- * Commodity method that interactively retrieves a password from the
- * console. If there is an error an error message is logged to the provided
- * Logger and <CODE>null</CODE> is returned.
+ * Commodity method that interactively retrieves a password from the console.
+ * If there is an error an error message is logged to the provided Logger and
+ * <CODE>null</CODE> is returned.
*
* @param prompt
* The password prompt.
- * @param logger the Logger to be used to log the error message.
+ * @param logger
+ * the Logger to be used to log the error message.
* @return Returns the password.
*/
protected final String readPassword(Message prompt, Logger logger)
@@ -599,7 +830,7 @@
}
catch (CLIException ce)
{
- logger.log(Level.WARNING, "Error reading input: "+ce, ce);
+ logger.log(Level.WARNING, "Error reading input: " + ce, ce);
}
return pwd;
}
@@ -616,7 +847,7 @@
* If the port could not be retrieved for some reason.
*/
public final int readPort(Message prompt, final int defaultValue)
- throws CLIException
+ throws CLIException
{
ValidationCallback<Integer> callback = new ValidationCallback<Integer>()
{
@@ -653,9 +884,11 @@
};
- if (defaultValue != -1) {
- prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(),
- String.valueOf(defaultValue));
+ if (defaultValue != -1)
+ {
+ prompt =
+ INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(), String
+ .valueOf(defaultValue));
}
return readValidatedInput(prompt, callback, CONFIRMATION_MAX_TRIES);
@@ -663,23 +896,28 @@
/**
* Returns a message object for the given NamingException.
- * @param ne the NamingException.
- * @param hostPort the hostPort representation of the server we were
- * contacting when the NamingException occurred.
+ *
+ * @param ne
+ * the NamingException.
+ * @param hostPort
+ * the hostPort representation of the server we were contacting when
+ * the NamingException occurred.
* @return a message object for the given NamingException.
*/
- protected Message getMessageForException(NamingException ne,
- String hostPort)
+ protected Message getMessageForException(NamingException ne, String hostPort)
{
return Utils.getMessageForException(ne, hostPort);
}
/**
* Commodity method used to repeatidly ask the user to provide a port value.
- * @param prompt the prompt message.
- * @param defaultValue the default value of the port to be proposed to the
- * user.
- * @param logger the logger where the errors will be written.
+ *
+ * @param prompt
+ * the prompt message.
+ * @param defaultValue
+ * the default value of the port to be proposed to the user.
+ * @param logger
+ * the logger where the errors will be written.
* @return the port value provided by the user.
*/
protected int askPort(Message prompt, int defaultValue, Logger logger)
@@ -694,66 +932,71 @@
catch (CLIException ce)
{
port = -1;
- logger.log(Level.WARNING, "Error reading input: "+ce, ce);
+ logger.log(Level.WARNING, "Error reading input: " + ce, ce);
}
}
return port;
}
/**
- * Interactively prompts for user input and continues until valid
- * input is provided.
+ * Interactively prompts for user input and continues until valid input is
+ * provided.
*
* @param <T>
* The type of decoded user input.
* @param prompt
- * The interactive prompt which should be displayed on each
- * input attempt.
+ * The interactive prompt which should be displayed on each input
+ * attempt.
* @param validator
- * An input validator responsible for validating and
- * decoding the user's response.
+ * An input validator responsible for validating and decoding the
+ * user's response.
* @return Returns the decoded user's response.
* @throws CLIException
- * If an unexpected error occurred which prevented
- * validation.
+ * If an unexpected error occurred which prevented validation.
*/
public final <T> T readValidatedInput(Message prompt,
- ValidationCallback<T> validator) throws CLIException {
- while (true) {
+ ValidationCallback<T> validator) throws CLIException
+ {
+ while (true)
+ {
String response = readLineOfInput(prompt);
T value = validator.validate(this, response);
- if (value != null) {
+ if (value != null)
+ {
return value;
}
}
}
/**
- * Interactively prompts for user input and continues until valid
- * input is provided.
+ * Interactively prompts for user input and continues until valid input is
+ * provided.
*
* @param <T>
* The type of decoded user input.
* @param prompt
- * The interactive prompt which should be displayed on each
- * input attempt.
+ * The interactive prompt which should be displayed on each input
+ * attempt.
* @param validator
- * An input validator responsible for validating and
- * decoding the user's response.
+ * An input validator responsible for validating and decoding the
+ * user's response.
* @param maxTries
* The maximum number of tries that we can make.
* @return Returns the decoded user's response.
* @throws CLIException
- * If an unexpected error occurred which prevented
- * validation or if the maximum number of tries was reached.
+ * If an unexpected error occurred which prevented validation or if
+ * the maximum number of tries was reached.
*/
public final <T> T readValidatedInput(Message prompt,
- ValidationCallback<T> validator, int maxTries) throws CLIException {
+ ValidationCallback<T> validator, int maxTries) throws CLIException
+ {
int nTries = 0;
- while (nTries < maxTries) {
+ while (nTries < maxTries)
+ {
String response = readLineOfInput(prompt);
T value = validator.validate(this, response);
- if (value != null) {
+ if (value != null)
+ {
return value;
}
nTries++;
@@ -764,21 +1007,22 @@
/**
* Commodity method that interactively confirms whether a user wishes to
* perform an action. If the application is non-interactive, then the provided
- * default is returned automatically. If there is an error an error message
- * is logged to the provided Logger and the defaul value is returned.
+ * default is returned automatically. If there is an error an error message is
+ * logged to the provided Logger and the defaul value is returned.
*
* @param prompt
* The prompt describing the action.
* @param defaultValue
- * The default value for the confirmation message. This
- * will be returned if the application is non-interactive
- * or if the user just presses return.
- * @param logger the Logger to be used to log the error message.
- * @return Returns <code>true</code> if the user wishes the action
- * to be performed, or <code>false</code> if they refused.
- * @throws CLIException if the user did not provide valid answer after
- * a certain number of tries
- * (ConsoleApplication.CONFIRMATION_MAX_TRIES)
+ * The default value for the confirmation message. This will be
+ * returned if the application is non-interactive or if the user just
+ * presses return.
+ * @param logger
+ * the Logger to be used to log the error message.
+ * @return Returns <code>true</code> if the user wishes the action to be
+ * performed, or <code>false</code> if they refused.
+ * @throws CLIException
+ * if the user did not provide valid answer after a certain number
+ * of tries (ConsoleApplication.CONFIRMATION_MAX_TRIES)
*/
protected final boolean askConfirmation(Message prompt, boolean defaultValue,
Logger logger) throws CLIException
@@ -799,14 +1043,14 @@
catch (CLIException ce)
{
if (ce.getMessageObject().getDescriptor().equals(
- ERR_CONFIRMATION_TRIES_LIMIT_REACHED) ||
- ce.getMessageObject().getDescriptor().equals(
+ ERR_CONFIRMATION_TRIES_LIMIT_REACHED)
+ || ce.getMessageObject().getDescriptor().equals(
ERR_TRIES_LIMIT_REACHED))
{
throw ce;
}
- logger.log(Level.WARNING, "Error reading input: "+ce, ce);
-// Try again...
+ logger.log(Level.WARNING, "Error reading input: " + ce, ce);
+ // Try again...
println();
}
}
@@ -814,53 +1058,63 @@
if (!done)
{
// This means we reached the maximum number of tries
- throw new CLIException(ERR_CONFIRMATION_TRIES_LIMIT_REACHED.get(
- CONFIRMATION_MAX_TRIES));
+ throw new CLIException(ERR_CONFIRMATION_TRIES_LIMIT_REACHED
+ .get(CONFIRMATION_MAX_TRIES));
}
return v;
}
/**
- * Returns an InitialLdapContext using the provided parameters. We try
- * to guarantee that the connection is able to read the configuration.
- * @param host the host name.
- * @param port the port to connect.
- * @param useSSL whether to use SSL or not.
- * @param useStartTLS whether to use StartTLS or not.
- * @param bindDn the bind dn to be used.
- * @param pwd the password.
- * @param connectTimeout the timeout in milliseconds to connect to the server.
- * @param trustManager the trust manager.
+ * Returns an InitialLdapContext using the provided parameters. We try to
+ * guarantee that the connection is able to read the configuration.
+ *
+ * @param host
+ * the host name.
+ * @param port
+ * the port to connect.
+ * @param useSSL
+ * whether to use SSL or not.
+ * @param useStartTLS
+ * whether to use StartTLS or not.
+ * @param bindDn
+ * the bind dn to be used.
+ * @param pwd
+ * the password.
+ * @param connectTimeout
+ * the timeout in milliseconds to connect to the server.
+ * @param trustManager
+ * the trust manager.
* @return an InitialLdapContext connected.
- * @throws NamingException if there was an error establishing the connection.
+ * @throws NamingException
+ * if there was an error establishing the connection.
*/
protected InitialLdapContext createAdministrativeContext(String host,
int port, boolean useSSL, boolean useStartTLS, String bindDn, String pwd,
int connectTimeout, ApplicationTrustManager trustManager)
- throws NamingException
+ throws NamingException
{
InitialLdapContext ctx;
String ldapUrl = ConnectionUtils.getLDAPUrl(host, port, useSSL);
if (useSSL)
{
- ctx = Utils.createLdapsContext(ldapUrl, bindDn, pwd,
- connectTimeout, null, trustManager);
+ ctx =
+ Utils.createLdapsContext(ldapUrl, bindDn, pwd, connectTimeout, null,
+ trustManager);
}
else if (useStartTLS)
{
- ctx = Utils.createStartTLSContext(ldapUrl, bindDn, pwd,
- connectTimeout, null, trustManager,
- null);
+ ctx =
+ Utils.createStartTLSContext(ldapUrl, bindDn, pwd, connectTimeout,
+ null, trustManager, null);
}
else
{
- ctx = Utils.createLdapContext(ldapUrl, bindDn, pwd,
- connectTimeout, null);
+ ctx = Utils.createLdapContext(ldapUrl, bindDn, pwd, connectTimeout, null);
}
if (!ConnectionUtils.connectedAsAdministrativeUser(ctx))
{
- throw new NoPermissionException(
- ERR_NOT_ADMINISTRATIVE_USER.get().toString());
+ throw new NoPermissionException(ERR_NOT_ADMINISTRATIVE_USER.get()
+ .toString());
}
return ctx;
}
@@ -868,33 +1122,39 @@
/**
* Creates an Initial LDAP Context interacting with the user if the
* application is interactive.
- * @param ci the LDAPConnectionConsoleInteraction object that is assumed
- * to have been already run.
- * @return the initial LDAP context or <CODE>null</CODE> if the user did
- * not accept to trust the certificates.
- * @throws ClientException if there was an error establishing the connection.
+ *
+ * @param ci
+ * the LDAPConnectionConsoleInteraction object that is assumed to
+ * have been already run.
+ * @return the initial LDAP context or <CODE>null</CODE> if the user did not
+ * accept to trust the certificates.
+ * @throws ClientException
+ * if there was an error establishing the connection.
*/
protected InitialLdapContext createInitialLdapContextInteracting(
LDAPConnectionConsoleInteraction ci) throws ClientException
{
- return createInitialLdapContextInteracting(ci, isInteractive() &&
- ci.isTrustStoreInMemory());
+ return createInitialLdapContextInteracting(ci, isInteractive()
+ && ci.isTrustStoreInMemory());
}
/**
* Creates an Initial LDAP Context interacting with the user if the
* application is interactive.
- * @param ci the LDAPConnectionConsoleInteraction object that is assumed
- * to have been already run.
- * @param promptForCertificate whether we should prompt for the certificate
- * or not.
- * @return the initial LDAP context or <CODE>null</CODE> if the user did
- * not accept to trust the certificates.
- * @throws ClientException if there was an error establishing the connection.
+ *
+ * @param ci
+ * the LDAPConnectionConsoleInteraction object that is assumed to
+ * have been already run.
+ * @param promptForCertificate
+ * whether we should prompt for the certificate or not.
+ * @return the initial LDAP context or <CODE>null</CODE> if the user did not
+ * accept to trust the certificates.
+ * @throws ClientException
+ * if there was an error establishing the connection.
*/
protected InitialLdapContext createInitialLdapContextInteracting(
- LDAPConnectionConsoleInteraction ci,
- boolean promptForCertificate) throws ClientException
+ LDAPConnectionConsoleInteraction ci, boolean promptForCertificate)
+ throws ClientException
{
// Interact with the user though the console to get
// LDAP connection information
@@ -914,9 +1174,10 @@
{
try
{
- ctx = ConnectionUtils.createLdapsContext(ldapsUrl, bindDN,
- bindPassword, ci.getConnectTimeout(), null,
- trustManager, keyManager);
+ ctx =
+ ConnectionUtils.createLdapsContext(ldapsUrl, bindDN,
+ bindPassword, ci.getConnectTimeout(), null, trustManager,
+ keyManager);
ctx.reconnect(null);
break;
}
@@ -931,11 +1192,10 @@
if (trustManager instanceof ApplicationTrustManager)
{
ApplicationTrustManager appTrustManager =
- (ApplicationTrustManager)trustManager;
+ (ApplicationTrustManager) trustManager;
authType = appTrustManager.getLastRefusedAuthType();
}
- if (ci.checkServerCertificate(oce.getChain(), authType,
- hostName))
+ if (ci.checkServerCertificate(oce.getChain(), authType, hostName))
{
// If the certificate is trusted, update the trust manager.
trustManager = ci.getTrustManager();
@@ -952,33 +1212,32 @@
}
if (e.getCause() != null)
{
- if (!isInteractive() &&
- !ci.isTrustAll())
+ if (!isInteractive() && !ci.isTrustAll())
{
- if (getCertificateRootException(e) != null ||
- (e.getCause() instanceof SSLHandshakeException))
+ if (getCertificateRootException(e) != null
+ || (e.getCause() instanceof SSLHandshakeException))
{
Message message =
- ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_NOT_TRUSTED.get(
- hostName, String.valueOf(portNumber));
+ ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_NOT_TRUSTED.get(
+ hostName, String.valueOf(portNumber));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
if (e.getCause() instanceof SSLException)
{
Message message =
- ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_WRONG_PORT.get(
- hostName, String.valueOf(portNumber));
+ ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_WRONG_PORT.get(
+ hostName, String.valueOf(portNumber));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
String hostPort =
- ServerDescriptor.getServerRepresentation(hostName, portNumber);
+ ServerDescriptor.getServerRepresentation(hostName, portNumber);
Message message = Utils.getMessageForException(e, hostPort);
- throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ message);
}
}
}
@@ -989,9 +1248,10 @@
{
try
{
- ctx = ConnectionUtils.createStartTLSContext(ldapUrl, bindDN,
- bindPassword, ConnectionUtils.getDefaultLDAPTimeout(), null,
- trustManager, keyManager, null);
+ ctx =
+ ConnectionUtils.createStartTLSContext(ldapUrl, bindDN,
+ bindPassword, ConnectionUtils.getDefaultLDAPTimeout(), null,
+ trustManager, keyManager, null);
ctx.reconnect(null);
break;
}
@@ -1006,18 +1266,17 @@
if (trustManager instanceof ApplicationTrustManager)
{
ApplicationTrustManager appTrustManager =
- (ApplicationTrustManager)trustManager;
+ (ApplicationTrustManager) trustManager;
authType = appTrustManager.getLastRefusedAuthType();
}
- if (ci.checkServerCertificate(oce.getChain(), authType,
- hostName))
+ if (ci.checkServerCertificate(oce.getChain(), authType, hostName))
{
// If the certificate is trusted, update the trust manager.
trustManager = ci.getTrustManager();
// Try to connect again.
- continue ;
+ continue;
}
else
{
@@ -1027,16 +1286,18 @@
}
else
{
- Message message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(
- hostName, String.valueOf(portNumber));
+ Message message =
+ ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, String
+ .valueOf(portNumber));
throw new ClientException(
LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
- Message message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(
- hostName, String.valueOf(portNumber));
- throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ Message message =
+ ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, String
+ .valueOf(portNumber));
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ message);
}
}
}
@@ -1047,17 +1308,19 @@
{
try
{
- ctx = ConnectionUtils.createLdapContext(ldapUrl, bindDN,
- bindPassword, ConnectionUtils.getDefaultLDAPTimeout(), null);
+ ctx =
+ ConnectionUtils.createLdapContext(ldapUrl, bindDN, bindPassword,
+ ConnectionUtils.getDefaultLDAPTimeout(), null);
ctx.reconnect(null);
break;
}
catch (NamingException e)
{
- Message message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(
- hostName, String.valueOf(portNumber));
- throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ Message message =
+ ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, String
+ .valueOf(portNumber));
+ throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ message);
}
}
}
@@ -1067,20 +1330,21 @@
/**
* Returns the message to be displayed in the file with the equivalent
* command-line with information about the current time.
- * @return the message to be displayed in the file with the equivalent
- * command-line with information about the current time.
+ *
+ * @return the message to be displayed in the file with the equivalent
+ * command-line with information about the current time.
*/
protected String getCurrentOperationDateMessage()
{
String date = formatDateTimeStringForEquivalentCommand(new Date());
- return INFO_OPERATION_START_TIME_MESSAGE.get(date).
- toString();
+ return INFO_OPERATION_START_TIME_MESSAGE.get(date).toString();
}
/**
* Formats a Date to String representation in "dd/MMM/yyyy:HH:mm:ss Z".
*
- * @param date to format; null if <code>date</code> is null
+ * @param date
+ * to format; null if <code>date</code> is null
* @return string representation of the date
*/
protected String formatDateTimeStringForEquivalentCommand(Date date)
@@ -1089,7 +1353,7 @@
if (date != null)
{
SimpleDateFormat dateFormat =
- new SimpleDateFormat(DATE_FORMAT_LOCAL_TIME);
+ new SimpleDateFormat(DATE_FORMAT_LOCAL_TIME);
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
timeStr = dateFormat.format(date);
}
@@ -1098,13 +1362,14 @@
/**
* Prompts the user to give the Global Administrator UID.
- * @param defaultValue the default value that will be proposed in the prompt
- * message.
- * @param logger the Logger to be used to log the error message.
+ *
+ * @param defaultValue
+ * the default value that will be proposed in the prompt message.
+ * @param logger
+ * the Logger to be used to log the error message.
* @return the Global Administrator UID as provided by the user.
*/
- protected String askForAdministratorUID(String defaultValue,
- Logger logger)
+ protected String askForAdministratorUID(String defaultValue, Logger logger)
{
String s = defaultValue;
try
@@ -1113,14 +1378,16 @@
}
catch (CLIException ce)
{
- logger.log(Level.WARNING, "Error reading input: "+ce, ce);
+ logger.log(Level.WARNING, "Error reading input: " + ce, ce);
}
return s;
}
/**
* Prompts the user to give the Global Administrator password.
- * @param logger the Logger to be used to log the error message.
+ *
+ * @param logger
+ * the Logger to be used to log the error message.
* @return the Global Administrator password as provided by the user.
*/
protected String askForAdministratorPwd(Logger logger)
@@ -1137,23 +1404,25 @@
t = t.getCause();
if (t instanceof OpendsCertificateException)
{
- oce = (OpendsCertificateException)t;
+ oce = (OpendsCertificateException) t;
}
}
return oce;
}
-
/**
- * Commodity method used to repeatidly ask the user to provide an
- * integer value.
- * @param prompt the prompt message.
- * @param defaultValue the default value to be proposed to the user.
- * @param logger the logger where the errors will be written.
+ * Commodity method used to repeatidly ask the user to provide an integer
+ * value.
+ *
+ * @param prompt
+ * the prompt message.
+ * @param defaultValue
+ * the default value to be proposed to the user.
+ * @param logger
+ * the logger where the errors will be written.
* @return the value provided by the user.
*/
- protected int askInteger(Message prompt, int defaultValue,
- Logger logger)
+ protected int askInteger(Message prompt, int defaultValue, Logger logger)
{
int newInt = -1;
while (newInt == -1)
@@ -1165,7 +1434,7 @@
catch (CLIException ce)
{
newInt = -1;
- logger.log(Level.WARNING, "Error reading input: "+ce, ce);
+ logger.log(Level.WARNING, "Error reading input: " + ce, ce);
}
}
return newInt;
@@ -1183,7 +1452,7 @@
* If the value could not be retrieved for some reason.
*/
public final int readInteger(Message prompt, final int defaultValue)
- throws CLIException
+ throws CLIException
{
ValidationCallback<Integer> callback = new ValidationCallback<Integer>()
{
@@ -1220,12 +1489,13 @@
};
- if (defaultValue != -1) {
- prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(),
- String.valueOf(defaultValue));
+ if (defaultValue != -1)
+ {
+ prompt =
+ INFO_PROMPT_SINGLE_DEFAULT.get(prompt.toString(), String
+ .valueOf(defaultValue));
}
return readValidatedInput(prompt, callback, CONFIRMATION_MAX_TRIES);
}
-
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index f1904d7..19f6e89 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -112,6 +112,7 @@
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.OperatingSystem;
import org.opends.server.types.ResultCode;
+import org.opends.server.util.BuildVersion;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.LDIFReader;
@@ -385,7 +386,7 @@
{
copyDirectory(libDir, testLibDir);
copyDirectory(new File(resourceDir, "bin"), testBinDir);
- copyDirectory(new File(resourceDir, "config"), testConfigDir);
+ copyDirectory(new File(resourceDir, "config"), testConfigDir );
copyDirectory(new File(resourceDir, "schema"),
new File(testSchemaDir, "schema"));
copyDirectory(new File(resourceDir, "MakeLDIF"),
@@ -540,6 +541,11 @@
TextDebugLogPublisher.getStartupTextDebugPublisher(
DEBUG_TEXT_WRITER));
+ // Writing the buildinfo with the current version.
+ final FileWriter buildInfoWriter = new FileWriter (new File(testConfigDir, "buildinfo"));
+ buildInfoWriter.write(BuildVersion.binaryVersion().toString());
+ buildInfoWriter.close();
+
EmbeddedUtils.startServer(config);
assertTrue(InvocationCounterPlugin.startupCalled());
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/UpgradeTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/UpgradeTestCase.java
new file mode 100644
index 0000000..483f77e
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/UpgradeTestCase.java
@@ -0,0 +1,109 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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
+ *
+ *
+ * Portions Copyright 2013 ForgeRock AS.
+ */
+package org.opends.server.tools;
+
+import java.io.IOException;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.config.ConfigException;
+import org.opends.server.tools.upgrade.UpgradeCli;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.InitializationException;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+/**
+ * A set of test cases for the Upgrade tool.
+ */
+public class UpgradeTestCase extends ToolsTestCase
+{
+ /**
+ * Tests the Upgrade tool with an argument that will simply cause it to
+ * display usage information.
+ */
+ @Test()
+ public void testUpgradeToolHelpUsage()
+ {
+ String[] args = { "--help" };
+ assertEquals(UpgradeCli.main(args, true, System.out, System.err), 0);
+
+ args = new String[] { "-H" };
+ assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
+
+ args = new String[] { "-?" };
+ assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
+ }
+
+ /**
+ * Tests the Upgrade tool with wrong sub-command.
+ */
+ @Test()
+ public void testUpgradeToolWrongSubcommand()
+ {
+ String[] args = { "-- wrong" };
+ assertEquals(UpgradeCli.main(args, true, System.out, System.err), 1);
+
+ args = new String[]{ "--wrong" };
+ assertEquals(UpgradeCli.main(args, true, System.out, System.err), 1);
+ }
+
+ /**
+ * Tests the Upgrade tool with unauthorized usage.
+ */
+ @Test()
+ public void testUpgradeToolUnauthorizedUsage()
+ {
+ // Interactive mode is not compatible with forceUpgrade mode.
+ String[] args = { "--forceUpgrade" };
+ assertEquals(UpgradeCli.main(args, true, System.out, System.err), 1);
+ }
+
+ /**
+ * Tests the Upgrade tool with a running server throws an error.
+ */
+ @Test()
+ public void testUpgradeRequiresServerOffline() throws InitializationException,
+ ConfigException, DirectoryException, IOException
+ {
+ TestCaseUtils.startServer();
+ String[] args = { "" };
+ assertEquals(UpgradeCli.main(args, true, System.out, System.err), 1);
+ TestCaseUtils.shutdownServer("End of upgrade test.");
+ }
+
+ /**
+ * Tests the Upgrade tool with a running server throws an error.
+ */
+ @Test()
+ public void testUpgradeServerOffline() throws InitializationException,
+ ConfigException, DirectoryException, IOException
+ {
+ String[] args = { "" };
+ assertEquals(UpgradeCli.main(args, true, System.out, System.err), 1);
+ }
+}
--
Gitblit v1.10.0