svn merge https://svn.forgerock.org/opendj/trunk/opends@8851 https://svn.forgerock.org/opendj/branches/native-packaging@8851 .
50 files deleted
21 files added
2 files renamed
104 files modified
| | |
| | | ! |
| | | ! 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" |
| | |
| | | |
| | | <delete dir="${build.dir}" /> |
| | | <delete file="${dynconstants.file}" /> |
| | | <fileset dir="${lib.dir}"> |
| | | <include name="*.jar" /> |
| | | </fileset> |
| | | </target> |
| | | |
| | | |
| | |
| | | <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" /> |
| | |
| | | <mkdir dir="${pdir}/lib/extensions" /> |
| | | <mkdir dir="${pdir}/locks" /> |
| | | <mkdir dir="${pdir}/logs" /> |
| | | <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" /> |
| | |
| | | <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"> |
| | |
| | | </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> |
| | | |
| | |
| | | </fileset> |
| | | </path> |
| | | </foreach> |
| | | <chmod perm="444"> |
| | | <fileset dir="${pdir}/template" /> |
| | | </chmod> |
| | | </target> |
| | | |
| | | |
| | |
| | | <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"/> |
| | | |
| | |
| | | |
| | | <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"> |
| | | <classpath> |
| | |
| | | </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}" |
| | |
| | | overwrite="true"> |
| | | </genrpm> |
| | | |
| | | <rpm |
| | | specfile="specFile" |
| | | <rpm specfile="specFile" |
| | | topdir="${build.dir}/rpm" |
| | | quiet="true" |
| | | /> |
| | | quiet="true"> |
| | | </rpm> |
| | | |
| | | <copy todir="${package.dir}"> |
| | | <fileset dir="${build.dir}/rpm/RPMS/noarch"> |
| | |
| | | </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" |
| | |
| | | <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> |
| | | |
| | |
| | | <ivy:cleancache/> |
| | | </target> |
| | | |
| | | |
| | | <import file="build-svr4.xml"/> |
| | | <import file="build-pkg.xml"/> |
| | | </project> |
| | |
| | | ! |
| | | ! 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" |
| | |
| | | # |
| | | # |
| | | # 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 |
| | |
| | | # 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 |
| | |
| | | # |
| | | # |
| | | # 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 |
| | |
| | | # 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 |
| | |
| | | # 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | |
| | | |
| | | :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 |
| | |
| | | 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 |
| | |
| | | |
| | | |
| | | :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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | # |
| | | # |
| | | # Copyright 2008-2010 Sun Microsystems, Inc. |
| | | # Portions Copyright 2010-2011 ForgeRock AS |
| | | # Portions Copyright 2010-2013 ForgeRock AS |
| | | |
| | | # |
| | | # Display an error message |
| | |
| | | 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 |
| | |
| | | # |
| | | # |
| | | # 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. |
| | |
| | | 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" "${@}" |
| | |
| | | # |
| | | # |
| | | # 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. |
| | |
| | | SCRIPT_NAME="dsjavaproperties" |
| | | export SCRIPT_NAME |
| | | |
| | | NO_CHECK=0 |
| | | export NO_CHECK |
| | | |
| | | SCRIPT_DIR=`dirname "${0}"` |
| | | "${SCRIPT_DIR}/../lib/_client-script.sh" "${@}" |
| | |
| | | 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" %* |
| | |
| | | # |
| | | # |
| | | # 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. |
| | |
| | | INSTALL_ROOT=`pwd` |
| | | export INSTALL_ROOT |
| | | |
| | | NO_CHECK=1 |
| | | export NO_CHECK |
| | | |
| | | # Set environment variables |
| | | . "${INSTALL_ROOT}/lib/_script-util.sh" |
| | | RETURN_CODE=$? |
| | |
| | | # 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 |
| New file |
| | |
| | | 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. |
| New file |
| | |
| | | #!/bin/sh |
| | | set -e |
| | | # Post install script |
| | | # Insert your post installation code here. |
| | | # End post install script |
| | | echo |
| New file |
| | |
| | | #!/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 |
| New file |
| | |
| | | #!/bin/sh |
| | | set -e |
| | | # Pre installation section |
| | | # Insert your pre installation code here. |
| | | echo |
| | | # End of the pre installation section |
| New file |
| | |
| | | #!/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 |
| | |
| | | # 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" "${@}" |
| | |
| | | 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 |
| | |
| | | * |
| | | * |
| | | * 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 |
| | | * 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() |
| | |
| | | versionString.append("-build"); |
| | | versionString.append(new DecimalFormat("000").format(buildNumber)); |
| | | } |
| | | } catch (NumberFormatException nfe) {} |
| | | } |
| | | catch (NumberFormatException nfe) |
| | | { |
| | | } |
| | | |
| | | getProject().setNewProperty(propertyName, versionString.toString()); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Delta-Victor Consultants |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.build.tools; |
| | | |
| | |
| | | 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 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; |
| | | } |
| | | |
| | |
| | | * {@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 _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("OpenDS Directory Server" + 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 installation" + EOL); |
| | | sb.append("# Pre & Post Install" + 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("# 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 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("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 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("# PRE UNINSTALL" + 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("${RPM_INSTALL_PREFIX}/OpenDS-1.0.0/bin/stop-ds" + EOL); |
| | | sb.append( EOL); |
| | | sb.append("# POST UNINSTALL" + 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("rm -rf ${RPM_INSTALL_PREFIX}/" + opendsDir + EOL); |
| | | sb.append("rmdir --ignore-fail-on-non-empty ${RPM_INSTALL_PREFIX}" + 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("cd "+ topDirAbsolutePath +"/SOURCES" + prefix + |
| | | " ; cp -r " + sourceDirName + " ." + EOL); |
| | | sb.append("%build" + 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("# Files Layout" + EOL); |
| | | sb.append("# =========================" + EOL); |
| | | sb.append("%files" + EOL); |
| | | sb.append(dirPrefix + EOL); |
| | | generatedLevel("", rootDir); |
| | | // 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(); |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | 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); |
| | |
| | | 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 \ |
| | |
| | | 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 |
| | |
| | | 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 \ |
| | |
| | | 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. \ |
| | |
| | | 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. |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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. |
| | |
| | | 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 |
| | |
| | | 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>. |
| | |
| | | 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 |
| | |
| | | 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. |
| | |
| | | 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 |
| | |
| | | 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>. |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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. |
| | |
| | | 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. |
| | |
| | | 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. |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | | 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 |
| | |
| | | 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 |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | /** |
| | | * 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 { |
| | | |
| | |
| | | |
| | | private Installation installation; |
| | | |
| | | private ServerController serverController; |
| | | |
| | | private ApplicationTrustManager trustManager; |
| | | |
| | | private boolean notifyListeners = true; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | | */ |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | ServerLoader loader = new ServerLoader(adsProperties, dn, pwd, |
| | | trustManager, timeout, cnx, filter); |
| | | |
| | | InitialLdapContext ctx = null; |
| | | InitialLdapContext ctx; |
| | | try |
| | | { |
| | | ctx = loader.createContext(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // do nothing |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // do nothing |
| | | } |
| | | } |
| | | pointAdderStopped = true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | 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(); |
| | | } |
| | | |
| | | /** |
| | |
| | | Object returnValue = null; |
| | | boolean menuDisplayed = false; |
| | | while (returnValue == null) { |
| | | int respInt = -1; |
| | | int respInt; |
| | | try |
| | | { |
| | | if (menuDisplayed) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | 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) { |
| | |
| | | if (index2 != -1) { |
| | | String sPort = |
| | | contents.substring(attrWithPoints.length() + |
| | | index1, |
| | | index2).trim(); |
| | | index1, index2).trim(); |
| | | try { |
| | | port = Integer.parseInt(sPort); |
| | | } catch (NumberFormatException nfe) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | // 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | /** 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>"; |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | } else |
| | | { |
| | | Installation installation = Installation.getLocal(); |
| | | boolean dbFileExists = false; |
| | | ArrayList<Message> msgs = new ArrayList<Message>(); |
| | | |
| | | if (installation.getStatus().isServerRunning()) |
| | |
| | | |
| | | 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()? |
| | |
| | | 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 : |
| | |
| | | |
| | | |
| | | /** |
| | | * 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)); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * 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.*; |
| | | |
| | |
| | | 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. |
| | |
| | | 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"; |
| | |
| | | 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"; |
| | |
| | | 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"; |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | 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"; |
| | |
| | | "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"; |
| | | |
| | | /** |
| | | * The MacOS X Java application stub name. |
| | | */ |
| | | public static final String MAC_JAVA_APP_STUB_NAME = "JavaApplicationStub"; |
| | |
| | | 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"; |
| | |
| | | /** |
| | | * 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); |
| | | } |
| | | } |
| | | } 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 |
| | |
| | | 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); |
| | |
| | | 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; |
| | | |
| | |
| | | |
| | | 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) { |
| | | 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 |
| | |
| | | |
| | | // 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 |
| | |
| | | |
| | | // 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 |
| | | * |
| | | * @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 |
| | | * 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 |
| | | * 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); |
| | | } |
| | | 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 { |
| | | } |
| | | else |
| | | { |
| | | stopCommandFile = new File(getBinariesDirectory(), |
| | | 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 { |
| | | } |
| | | 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); |
| | | } |
| | | 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 |
| | | { |
| | | 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 { |
| | | 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) { |
| | | } |
| | | 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); |
| | | |
| | | 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup; |
| | | |
| | |
| | | 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(); |
| | |
| | | { |
| | | 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)); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | */ |
| | | 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(); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | // do nothing |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | */ |
| | | 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; |
| | | |
| | |
| | | |
| | | static private String getInitialLogRecord() { |
| | | // Note; currently the logs are not internationalized. |
| | | StringBuilder sb = new StringBuilder() |
| | | .append("QuickSetup application launched " + |
| | | return "QuickSetup application launched " + |
| | | DateFormat.getDateTimeInstance(DateFormat.LONG, |
| | | DateFormat.LONG). |
| | | format(new Date())); |
| | | return sb.toString(); |
| | | DateFormat.LONG).format(new Date()); |
| | | } |
| | | |
| | | private static boolean disableLoggingToConsole() |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | 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); |
| | |
| | | private int code; |
| | | |
| | | /** |
| | | * Creates a new parameterized instance. |
| | | * Creates a new parametrized instance. |
| | | * |
| | | * @param code to return |
| | | */ |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | |
| | | /** |
| | | * 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 |
| | | { |
| | |
| | | |
| | | private boolean forceOnError; |
| | | |
| | | private String configurationFile; |
| | | |
| | | private String configurationClass; |
| | | |
| | | private Map<String, JavaArguments> hmJavaArguments; |
| | | private Map<String, JavaArguments> hmDefaultJavaArguments; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | | */ |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | |
| | |
| | | */ |
| | | FIRST_IN_TOPOLOGY, |
| | | /** |
| | | * Replicate Contents of the new Suffix with existings server. |
| | | * Replicate Contents of the new Suffix with existing server. |
| | | */ |
| | | IN_EXISTING_TOPOLOGY |
| | | } |
| | |
| | | { |
| | | authenticationData.setDn(Constants.DIRECTORY_MANAGER_DN); |
| | | authenticationData.setPort(4444); |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Private constructor for the DataReplicationOptions object. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.quicksetup.installer; |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean canQuit(WizardStep step) { |
| | | return step != PROGRESS && |
| | | step != FINISHED; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isSubStep(WizardStep step) |
| | | { |
| | | return SUBSTEPS.contains(step); |
| | |
| | | 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>(); |
| | |
| | | @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, |
| | |
| | | { |
| | | 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) |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | checkAbort(); |
| | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String getHostNameFile() |
| | | { |
| | | String file = Utils.getPath( |
| | | return Utils.getPath( |
| | | getInstallation().getRootDirectory().getAbsolutePath(), |
| | | SetupUtils.HOST_NAME_FILE); |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | catch (Throwable t1) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | throw new ApplicationException( |
| | | ReturnCode.CONFIGURATION_ERROR, failedMsg, t); |
| | |
| | | finally |
| | | { |
| | | try{ rCtx.close(); } |
| | | catch (Throwable t){} |
| | | catch (Throwable t){ /* do nothing */ } |
| | | } |
| | | } |
| | | |
| | |
| | | rCtx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | Thread.sleep(3000); |
| | | } |
| | | catch (Throwable t) {} |
| | | catch (Throwable t) { /* do nothing */ } |
| | | int nTries = 5; |
| | | boolean initDone = false; |
| | | while (!initDone) |
| | |
| | | Thread.sleep((5 - nTries) * 3000); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | nTries--; |
| | |
| | | } |
| | | } |
| | | catch (Throwable t1) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | throw ae; |
| | | } |
| | |
| | | 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 |
| | | { |
| | |
| | | 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 */ } |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | { |
| | | /* 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>(); |
| | |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | nEntriesValid = n >= MIN_NUMBER_ENTRIES && n <= MAX_NUMBER_ENTRIES; |
| | | } catch (NumberFormatException nfe) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | |
| | | if (!nEntriesValid) |
| | |
| | | * @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. |
| | |
| | | Thread.sleep(500); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | if (canceled) |
| | | { |
| | |
| | | */ |
| | | private String getConfigurationFile() |
| | | { |
| | | String file = getUserData().getConfigurationFile(); |
| | | if (file == null) |
| | | { |
| | | file = getPath(getInstallation().getCurrentConfigurationFile()); |
| | | } |
| | | return file; |
| | | return getPath(getInstallation().getCurrentConfigurationFile()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | 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() |
| | |
| | | dirCtx.close(); |
| | | } |
| | | catch (NameAlreadyBoundException x) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | |
| | | Thread.sleep(500); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | try |
| | | { |
| | |
| | | helper.isStoppedByError(state)) |
| | | { |
| | | LOG.log(Level.WARNING, "Error: "+errorMsg); |
| | | ApplicationException ae = new ApplicationException( |
| | | throw new ApplicationException( |
| | | ReturnCode.APPLICATION_ERROR, errorMsg, |
| | | null); |
| | | throw ae; |
| | | } |
| | | } |
| | | } |
| | |
| | | Thread.sleep(100); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | 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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | fileProperties.load(fs); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | finally |
| | | { |
| | |
| | | fs.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 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; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | |
| | |
| | | */ |
| | | public LinkedList<String> getLDIFPaths() |
| | | { |
| | | LinkedList<String> copy = new LinkedList<String>(ldifPaths); |
| | | return copy; |
| | | return new LinkedList<String>(ldifPaths); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public LinkedList<String> getBaseDns() |
| | | { |
| | | LinkedList<String> copy = new LinkedList<String>(baseDns); |
| | | return copy; |
| | | return new LinkedList<String>(baseDns); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | */ |
| | | private Object getDefaultValue(FieldName fieldName) |
| | | { |
| | | Object value = null; |
| | | Object value; |
| | | AuthenticationData auth = |
| | | defaultUserData.getReplicationOptions().getAuthenticationData(); |
| | | switch (fieldName) |
| | |
| | | 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); |
| | | } |
| | | }); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | */ |
| | | private String getDefaultValue(FieldName fieldName) |
| | | { |
| | | String value = null; |
| | | String value; |
| | | switch (fieldName) |
| | | { |
| | | case GLOBAL_ADMINISTRATOR_UID: |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private JTextArea detailsTextArea; |
| | | private JCheckBox acceptCheck; |
| | | |
| | | /** |
| | |
| | | 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); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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) |
| | | { |
| | |
| | | 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()); |
| | |
| | | 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() == |
| | |
| | | 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.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()); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | |
| | | private boolean isCheckingVisible; |
| | | |
| | | private final int MAX_VALUE_32_BIT = 2048; |
| | | |
| | | private static boolean userAgreedWithWebStart; |
| | | |
| | | /** |
| | |
| | | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | 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())); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.quicksetup.installer.ui; |
| | | |
| | |
| | | // 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. |
| | |
| | | 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; |
| | |
| | | { |
| | | 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; |
| | |
| | | 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) |
| | | 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>"; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | 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; |
| | |
| | | } |
| | | 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)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.ui; |
| | |
| | | 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 = |
| | |
| | | /** |
| | | * {@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); |
| | |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | | { |
| | | lastFocusComponent.requestFocusInWindow(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the components of this panel. |
| | | */ |
| | | private void createComponents() |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer.webstart; |
| | |
| | | } |
| | | |
| | | /** |
| | | * {@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. |
| | | */ |
| | |
| | | * |
| | | * |
| | | * 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). |
| | | * |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | * 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; |
| | |
| | | /** |
| | | * 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. |
| | | */ |
| | |
| | | gbc.gridwidth = 3; |
| | | gbc.fill = GridBagConstraints.NONE; |
| | | gbc.weightx = 0.0; |
| | | acceptSessionButton = |
| | | UIFactory.makeJButton( |
| | | 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( |
| | | 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(); |
| | | } |
| | | }); |
| | |
| | | DateFormat df = DateFormat.getDateTimeInstance(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) |
| | | { |
| | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | 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. |
| | |
| | | */ |
| | | SECURITY_OPTIONS, |
| | | /** |
| | | * The value associated with this is a DataOptions.Type. |
| | | * The value associated with this is a data options.Type. |
| | | */ |
| | | DATA_OPTIONS, |
| | | /** |
| | |
| | | /** |
| | | * 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. |
| | |
| | | /** |
| | | * 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 |
| | | } |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | |
| | | 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; |
| | |
| | | /** |
| | | * 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 { |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | | */ |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | |
| | | private JEditorPane detailsTextArea; |
| | | |
| | | private JScrollPane scroll; |
| | | |
| | | private Message lastText; |
| | | |
| | | private JFrame parent; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | | */ |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | 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(); |
| | | // |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | 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. |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | gbc.anchor = GridBagConstraints.NORTHWEST; |
| | | gbc.insets.left = 0; |
| | | add(inputContainer, gbc); |
| | | somethingAdded = true; |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * 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.*; |
| | | |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | 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. |
| | |
| | | { |
| | | 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()) |
| | | { |
| | |
| | | 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 " |
| | | return "<div style=\"margin:" + top + "px " + right + "px " + bottom + "px " |
| | | + left + "px;\">" + html + DIV_CLOSE; |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private static String getIconPath(IconType iconType) |
| | | { |
| | | Message key = null; |
| | | Message key; |
| | | switch (iconType) |
| | | { |
| | | case CURRENT_STEP: |
| | |
| | | */ |
| | | private static Message getIconDescription(IconType iconType) |
| | | { |
| | | Message description = null; |
| | | Message description; |
| | | switch (iconType) |
| | | { |
| | | case CURRENT_STEP: |
| | |
| | | |
| | | private static ListCellRenderer makeCellRenderer(final TextStyle textStyle) |
| | | { |
| | | ListCellRenderer renderer = new ListCellRenderer() |
| | | return new ListCellRenderer() |
| | | { |
| | | public Component getListCellRendererComponent(JList list, |
| | | Object value, |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | File[] children = parentDir.listFiles(); |
| | | if (children != null) { |
| | | for (File child : children) { |
| | | delete(child); |
| | | deleteRecursively(child); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | |
| | | 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; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // do nothing |
| | | } |
| | | stopped = !installation.getStatus().isServerRunning(); |
| | | LOG.log(Level.INFO, |
| | |
| | | /** |
| | | * 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. |
| | | */ |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 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(); |
| | | } |
| | |
| | | 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) |
| | |
| | | // 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) |
| | | { |
| | | /* |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // do nothing |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // do nothing |
| | | } |
| | | } |
| | | } |
| | |
| | | application.setNotifyListeners(true); |
| | | } |
| | | } |
| | | return output; |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | private ApplicationException ex; |
| | | |
| | | private List<Message> messages = new ArrayList<Message>(); |
| | | |
| | | private boolean isFinished; |
| | | |
| | | private boolean startedIdFound; |
| | |
| | | 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) |
| | |
| | | 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. |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | /** |
| | | * 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. |
| | |
| | | * @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) |
| | | { |
| | |
| | | /** |
| | | * 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. |
| | |
| | | * 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(); |
| | |
| | | } |
| | | FileOutputStream fos = new FileOutputStream(getKeyStorePath(), false); |
| | | k.store(fos, new char[]{}); |
| | | if (fos != null) |
| | | { |
| | | fos.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the path where we store the keystore for the graphical |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.quicksetup.util; |
| | | |
| | |
| | | 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. |
| | |
| | | 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()) |
| | | { |
| | |
| | | * 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) |
| | | { |
| | |
| | | { |
| | | boolean parentExists = false; |
| | | File f = new File(path); |
| | | if (f != null) |
| | | { |
| | | File parentFile = f.getParentFile(); |
| | | if (parentFile != null) |
| | | { |
| | | parentExists = parentFile.isDirectory(); |
| | | } |
| | | } |
| | | return parentExists; |
| | | } |
| | | |
| | |
| | | */ |
| | | 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(); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | 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> |
| | |
| | | } else |
| | | { |
| | | File parentFile = file.getParentFile(); |
| | | if (parentFile != null) |
| | | { |
| | | canWrite = parentFile.canWrite(); |
| | | } else |
| | | { |
| | | canWrite = false; |
| | | } |
| | | canWrite = parentFile != null && parentFile.canWrite(); |
| | | } |
| | | return canWrite; |
| | | } |
| | |
| | | * @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; |
| | |
| | | raf.setLength(bytes); |
| | | hasEnoughSpace = true; |
| | | } catch (IOException ex) |
| | | { |
| | | { /* do nothing */ |
| | | } finally |
| | | { |
| | | if (raf != null) |
| | |
| | | { |
| | | raf.close(); |
| | | } catch (IOException ex2) |
| | | { |
| | | { /* do nothing */ |
| | | } |
| | | } |
| | | if (file != null) |
| | |
| | | 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. |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | | * @param t the Throwable to analyze. |
| | |
| | | try |
| | | { |
| | | reader.close(); |
| | | } catch (Exception e) {} |
| | | } catch (Exception e) { /* do nothing */} |
| | | } |
| | | } |
| | | |
| | |
| | | String msg = t.toString(); |
| | | if (msg != null) |
| | | { |
| | | isOutOfMemory = msg.indexOf("Not enough space") != -1; |
| | | isOutOfMemory = msg.contains("Not enough space"); |
| | | } |
| | | } |
| | | t = t.getCause(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | // 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); |
| | |
| | | * @return converted string |
| | | */ |
| | | static public String convertHtmlBreakToLineSeparator(String s) { |
| | | return s.replaceAll("\\<br\\>", Constants.LINE_SEPARATOR); |
| | | return s.replaceAll("<br>", Constants.LINE_SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | |
| | | // '<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; |
| | |
| | | public static long getServerClock(InitialLdapContext ctx) |
| | | { |
| | | long time = -1; |
| | | String v = null; |
| | | SearchControls ctls = new SearchControls(); |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | ctls.setReturningAttributes( |
| | |
| | | { |
| | | SearchResult sr = (SearchResult)listeners.next(); |
| | | |
| | | v = getFirstValue(sr, "currentTime"); |
| | | String v = getFirstValue(sr, "currentTime"); |
| | | |
| | | TimeZone utcTimeZone = TimeZone.getTimeZone("UTC"); |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // do nothing |
| | | } |
| | | } |
| | | return value; |
| | |
| | | { |
| | | 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; |
| | |
| | | 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) |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.util; |
| | |
| | | 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()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.webstart; |
| | |
| | | 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | */ |
| | | |
| | | |
| | |
| | | * 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.cli; |
| | | import org.opends.messages.Message; |
| | |
| | | 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.*; |
| | |
| | | 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( |
| | |
| | | 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) |
| File was renamed from opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * A Text Writer which writes log records asynchronously to |
| | | * character-based stream. |
| | | */ |
| | | public class AsyncronousTextWriter |
| | | public class AsynchronousTextWriter |
| | | implements ServerShutdownListener, TextWriter |
| | | { |
| | | /** |
| | |
| | | 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. |
| | |
| | | * 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; |
| | |
| | | /** |
| | | * 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() |
| | | { |
| | |
| | | */ |
| | | public String getShutdownListenerName() |
| | | { |
| | | return "AsyncronousTextWriter Thread " + name; |
| | | return "AsynchronousTextWriter Thread " + name; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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) |
| | | { |
| | |
| | | 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); |
| | | } |
| | |
| | | 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( |
| | | writer = new AsynchronousTextWriter( |
| | | "Asyncronous Text Writer for " + config.dn().toNormalizedString(), |
| | | config.getQueueSize(), config.isAutoFlush(), mfWriter); |
| | | writer = asyncWriter; |
| | | } |
| | | |
| | | 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()) |
| | |
| | | { |
| | | if (cfg.getQueueSize() > 0) |
| | | { |
| | | this.writer = new AsyncronousTextWriter( |
| | | this.writer = new AsynchronousTextWriter( |
| | | "Asyncronous Text Writer for " + cfg.dn().toNormalizedString(), |
| | | cfg.getQueueSize(), cfg.isAutoFlush(), theWriter); |
| | | } |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | 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()) |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | 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 |
| | | { |
| | |
| | | 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 " + |
| | | // 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((currentConfig.isAsynchronous() && config.isAsynchronous()) && |
| | |
| | | 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) |
| | | { |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | { |
| | | 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 |
| | |
| | | |
| | | 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 |
| | | { |
| | |
| | | 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 |
| | | { |
| | |
| | | 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 " + |
| | | // 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((currentConfig.isAsynchronous() && config.isAsynchronous()) && |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | 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; |
| | |
| | | private int process(String[] args, boolean initializeServer, |
| | | OutputStream outStream, OutputStream errStream) |
| | | { |
| | | |
| | | PrintStream out; |
| | | if (outStream == null) |
| | | { |
| | |
| | | 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()) |
| | |
| | | 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); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2012 ForgeRock AS |
| | | * Portions Copyright 2010-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | 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; |
| | |
| | | err = new PrintStream(errStream); |
| | | } |
| | | |
| | | |
| | | EmbeddedUtils.initializeForClientUse(); |
| | | |
| | | OperatingSystem operatingSystem = DirectoryServer.getOperatingSystem(); |
| | |
| | | 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; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | 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; |
| | |
| | | * problem during the configuration processing. |
| | | */ |
| | | private int run(String[] args, boolean initializeServer) { |
| | | |
| | | // Register global arguments and sub-commands. |
| | | try { |
| | | initializeGlobalArguments(); |
| | |
| | | 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) { |
| | |
| | | * |
| | | * |
| | | * 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.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; |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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: |
| | |
| | | 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 |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @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. |
| | |
| | | * @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; |
| | |
| | | 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(); |
| | |
| | | |
| | | InstallDS install = new InstallDS(out, err, inStream); |
| | | |
| | | return install.execute(args, initializeServer); |
| | | return install.execute(args); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 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 |
| | |
| | | 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) |
| | |
| | | || (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) |
| | |
| | | } |
| | | 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(); |
| | |
| | | while (isInteractive() && promptAgain) |
| | | { |
| | | promptAgain = false; |
| | | ConfirmCode confirm = askForConfirmation(uData); |
| | | ConfirmCode confirm = askForConfirmation(); |
| | | switch (confirm) |
| | | { |
| | | case CONTINUE: |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | 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()); |
| | |
| | | |
| | | try |
| | | { |
| | | DN.decode(dmDN); |
| | | new LdapName(dmDN); |
| | | if (dmDN.trim().length() == 0) |
| | | { |
| | | errorMessages.add(ERR_INSTALLDS_EMPTY_DN_RESPONSE.get()); |
| | |
| | | { |
| | | try |
| | | { |
| | | DN.decode(baseDN); |
| | | new LdapName(baseDN); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | */ |
| | | 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()); |
| | |
| | | { |
| | | try |
| | | { |
| | | DN.decode(dn); |
| | | new LdapName(dn); |
| | | if (dn.trim().length() == 0) |
| | | { |
| | | toRemove.add(dn); |
| | |
| | | * 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. |
| | |
| | | } |
| | | |
| | | // Ask to enable SSL |
| | | ldapsPort = -1; |
| | | |
| | | if (!argParser.ldapsPortArg.isPresent()) |
| | | { |
| | | println(); |
| | |
| | | } |
| | | 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) |
| | |
| | | * 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; |
| | | |
| | |
| | | { |
| | | return argParser.getConnectTimeout(); |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | 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; |
| | |
| | | IntegerArgument jmxPortArg; |
| | | IntegerArgument sampleDataArg; |
| | | StringArgument baseDNArg; |
| | | StringArgument configClassArg; |
| | | StringArgument configFileArg; |
| | | StringArgument importLDIFArg; |
| | | StringArgument rejectedImportFileArg; |
| | | StringArgument skippedImportFileArg; |
| | |
| | | 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()) |
| | | { |
| | |
| | | |
| | | if (!isUsageArgumentPresent() && !isVersionArgumentPresent()) |
| | | { |
| | | checkConfigFileArg(errorMessages); |
| | | checkServerPassword(errorMessages); |
| | | checkProvidedPorts(errorMessages); |
| | | checkImportDataArguments(errorMessages); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | 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; |
| | |
| | | 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. |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | } |
| | | |
| | | 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( |
| | |
| | | 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; |
| | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | // If we should just display usage or version information, |
| | | // then print it and exit. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // If no arguments were provided, then display usage information and exit. |
| | | int numArgs = args.length; |
| | | if (numArgs == 0) |
| | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | if (indexList.getValues().size() <= 0 && !rebuildAll.isPresent() |
| | | && !rebuildDegraded.isPresent()) |
| | | { |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | * 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"; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * 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.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; |
| | |
| | | |
| | | 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.*; |
| | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // If no arguments were provided, then display usage information and exit. |
| | | int numArgs = args.length; |
| | | if (numArgs == 0) |
| | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | if (cleanMode.isPresent() && indexList.getValues().size() != 1) |
| | | { |
| | | Message message = |
| | |
| | | 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(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.dsconfig; |
| | | |
| | |
| | | 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 = |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.dsconfig; |
| | | |
| | |
| | | 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; |
| | |
| | | * problem during the configuration processing. |
| | | */ |
| | | private int run(String[] args) { |
| | | |
| | | // Register global arguments and sub-commands. |
| | | try { |
| | | initializeGlobalArguments(args); |
| | |
| | | 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()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.dsconfig; |
| | | |
| | |
| | | |
| | | // 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) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.dsconfig; |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | // 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) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | 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; |
| | |
| | | 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) |
| | | { |
| | |
| | | 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; |
| | |
| | | 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()) { |
| New file |
| | |
| | | /* |
| | | * 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()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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"; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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. |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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"); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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. |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | } |
| | | |
| | | } |
| File was renamed from opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/package-info.java |
| | |
| | | * 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; |
| | | |
| | |
| | | * |
| | | * |
| | | * 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> { |
| | | 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; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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; |
| | | public int hashCode() |
| | | { |
| | | return Arrays.hashCode(new int[] { major, minor, point, (int) (rev >>> 32), |
| | | (int) (rev & 0xFFFFL) }); |
| | | } |
| | | } 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 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(); |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * 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; |
| | |
| | | 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())) |
| | | { |
| | |
| | | * |
| | | * |
| | | * 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.*; |
| | |
| | | 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; |
| | | |
| | |
| | | /** |
| | | * 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. |
| | |
| | | * 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. |
| | | * |
| | |
| | | * 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); |
| | |
| | | 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. |
| | |
| | | * @param msg |
| | | * The message. |
| | | */ |
| | | public final void printProgress(Message msg) { |
| | | public final void printProgress(final Message msg) |
| | | { |
| | | if (!isQuiet()) |
| | | { |
| | | out.print(msg); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | | * 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. |
| | | * 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; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 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. |
| | | * 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. |
| | | * @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) |
| | |
| | | * @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) |
| | |
| | | |
| | | }; |
| | | |
| | | 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); |
| | |
| | | |
| | | /** |
| | | * 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) |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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++; |
| | |
| | | /** |
| | | * 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 |
| | |
| | | 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; |
| | |
| | | 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, |
| | |
| | | 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; |
| | | } |
| | |
| | | /** |
| | | * 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 |
| | |
| | | { |
| | | 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; |
| | | } |
| | |
| | | (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(); |
| | |
| | | } |
| | | 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( |
| | |
| | | String hostPort = |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | ctx = ConnectionUtils.createStartTLSContext(ldapUrl, bindDN, |
| | | ctx = |
| | | ConnectionUtils.createStartTLSContext(ldapUrl, bindDN, |
| | | bindPassword, ConnectionUtils.getDefaultLDAPTimeout(), null, |
| | | trustManager, keyManager, null); |
| | | ctx.reconnect(null); |
| | |
| | | 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(); |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 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. |
| | | */ |
| | | 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) |
| | |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | |
| | | /** |
| | | * 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) |
| | |
| | | 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) |
| | |
| | | |
| | | }; |
| | | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | 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()); |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | } |