opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
@@ -358,8 +358,7 @@ ERR_INCOMPATIBLE_JAVA_VERSION=The minimum Java version required is %s.%n%n\ The 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. java.properties file INFO_DESCRIPTION_CONNECTION_TIMEOUT=Maximum length of time (in \ milliseconds) that can be taken to establish a connection. Use '0' to \ specify no time out opendj-doc-generated-ref/pom.xml
@@ -426,16 +426,6 @@ </tool> <tool> <name>dsjavaproperties</name> <application>org.opends.server.tools.JavaPropertiesTool</application> <trailingSectionPaths> <trailingSectionPath>dsjavaproperties-files.xml</trailingSectionPath> <trailingSectionPath>exit-codes-0-gt0.xml</trailingSectionPath> <trailingSectionPath>dsjavaproperties-examples.xml</trailingSectionPath> </trailingSectionPaths> </tool> <tool> <name>dsreplication</name> <application>org.opends.server.tools.dsreplication.ReplicationCliMain </application> opendj-doc-generated-ref/src/main/docbkx/man-pages/index.xml
@@ -12,7 +12,7 @@ Header, with the fields enclosed by brackets [] replaced by your own identifying information: "Portions Copyright [year] [name of copyright owner]". Copyright 2015 ForgeRock AS. Copyright 2015-2016 ForgeRock AS. --> <book xml:id="reference" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en" @@ -68,9 +68,6 @@ <xinclude:include href="man-dsconfig.xml"> <xinclude:fallback><!-- Failed to include page --></xinclude:fallback> </xinclude:include> <xinclude:include href="man-dsjavaproperties.xml"> <xinclude:fallback><!-- Failed to include page --></xinclude:fallback> </xinclude:include> <xinclude:include href="man-dsreplication.xml"> <xinclude:fallback><!-- Failed to include page --></xinclude:fallback> </xinclude:include> opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateRefEntriesMojo.java
@@ -125,7 +125,7 @@ commands.add("-classpath"); commands.add(getClasspath()); commands.add(toolClass); commands.add(getUsageArgument(toolScript)); commands.add("--help"); getLog().info("Writing man page: " + manPage.getPath()); try { @@ -224,15 +224,6 @@ } /** * Returns the usage argument. * @param scriptName The name of the tool. * @return The usage argument. */ private String getUsageArgument(final String scriptName) { return scriptName.equals("dsjavaproperties") ? "-H" : "-?"; } /** * Write the content of the input stream to the output file. * @param input The input stream to write. * @param output The file to write it to. opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
@@ -1,145 +1,136 @@ @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2008-2009 Sun Microsystems, Inc. rem Portions copyright 2013-2016 ForgeRock AS. set SET_JAVA_HOME_AND_ARGS_DONE=false set SET_ENVIRONMENT_VARS_DONE=false set SET_CLASSPATH_DONE=false if "%INSTALL_ROOT%" == "" goto setInstanceRoot :scriptBegin if "%SCRIPT_UTIL_CMD%" == "set-full-environment-and-test-java" goto setFullEnvironmentAndTestJava if "%SCRIPT_UTIL_CMD%" == "set-full-environment" goto setFullEnvironment if "%SCRIPT_UTIL_CMD%" == "set-java-home-and-args" goto setJavaHomeAndArgs 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 :setInstanceRoot setlocal for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.. set INSTALL_ROOT=%DIR_HOME% set CUR_DIR=%~dp0 cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% goto scriptBegin :setClassPath if "%SET_CLASSPATH_DONE%" == "true" goto prepareCheck 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 FOR %%x in ("%INSTALL_ROOT%\resources\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH% :setClassPathDone set SET_CLASSPATH_DONE=true goto scriptBegin :setFullEnvironment 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 :setFullEnvironmentAndTestJava 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 testJava :setJavaHomeAndArgs if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto prepareCheck if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto checkEnvJavaArgs call "%INSTANCE_ROOT%\lib\set-java-home.bat" if "%OPENDJ_JAVA_BIN%" == "" goto checkEnvJavaArgs :endJavaHomeAndArgs set SET_JAVA_HOME_AND_ARGS_DONE=true goto scriptBegin :checkEnvJavaArgs if "%OPENDJ_JAVA_BIN%" == "" goto checkOpenDJJavaHome if not exist "%OPENDJ_JAVA_BIN%" goto checkOpenDJJavaHome goto endJavaHomeAndArgs :checkOpenDJJavaHome if "%OPENDJ_JAVA_HOME%" == "" goto checkJavaBin if not exist "%OPENDJ_JAVA_HOME%\bin\java.exe" goto checkJavaBin set OPENDJ_JAVA_BIN=%OPENDJ_JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkJavaBin if "%JAVA_BIN%" == "" goto checkJavaHome if not exist "%JAVA_BIN%" goto checkJavaHome set OPENDJ_JAVA_BIN=%JAVA_BIN% goto endJavaHomeAndArgs :checkJavaHome if "%JAVA_HOME%" == "" goto checkJavaPath if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaFound set OPENDJ_JAVA_BIN=%JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkJavaPath java.exe -version > NUL 2>&1 if not %errorlevel% == 0 goto noJavaFound set OPENDJ_JAVA_BIN=java.exe goto endJavaHomeAndArgs :noJavaFound echo ERROR: Could not find a valid Java binary to be used. echo You must specify the path to a valid Java 5.0 or higher version. echo The procedure to follow is: echo 1. Delete the file %INSTANCE_ROOT%\lib\set-java-home.bat if it exists. echo 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid echo Java 5.0 installation. echo If you want to have specific Java settings for each command line you must echo follow the steps 3 and 4. echo 3. Edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. echo 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat pause exit /B 1 :setEnvironmentVars if %SET_ENVIRONMENT_VARS_DONE% == "true" goto prepareCheck set PATH=%SystemRoot%;%PATH% set SCRIPT_NAME_ARG=-Dcom.forgerock.opendj.ldap.tools.scriptName=%SCRIPT_NAME% set SET_ENVIRONMENT_VARS_DONE=true goto scriptBegin :isVersionOrHelp if [%1] == [] goto end 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 :end exit /B 0 @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2008-2009 Sun Microsystems, Inc. rem Portions copyright 2013-2016 ForgeRock AS. set SET_JAVA_HOME_AND_ARGS_DONE=false set SET_ENVIRONMENT_VARS_DONE=false set SET_CLASSPATH_DONE=false if "%INSTALL_ROOT%" == "" goto setInstanceRoot :scriptBegin if "%SCRIPT_UTIL_CMD%" == "set-full-environment-and-test-java" goto setFullEnvironmentAndTestJava if "%SCRIPT_UTIL_CMD%" == "set-full-environment" goto setFullEnvironment if "%SCRIPT_UTIL_CMD%" == "set-java-home-and-args" goto setJavaHomeAndArgs 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 :setInstanceRoot setlocal for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.. set INSTALL_ROOT=%DIR_HOME% set CUR_DIR=%~dp0 cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% goto scriptBegin :setClassPath if "%SET_CLASSPATH_DONE%" == "true" goto prepareCheck 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 FOR %%x in ("%INSTALL_ROOT%\resources\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH% :setClassPathDone set SET_CLASSPATH_DONE=true goto scriptBegin :setFullEnvironment 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 :setFullEnvironmentAndTestJava 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 testJava :setJavaHomeAndArgs if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto prepareCheck if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto checkEnvJavaArgs call "%INSTANCE_ROOT%\lib\set-java-home.bat" if "%OPENDJ_JAVA_BIN%" == "" goto checkEnvJavaArgs :endJavaHomeAndArgs set SET_JAVA_HOME_AND_ARGS_DONE=true goto scriptBegin :checkEnvJavaArgs if "%OPENDJ_JAVA_BIN%" == "" goto checkOpenDJJavaHome if not exist "%OPENDJ_JAVA_BIN%" goto checkOpenDJJavaHome goto endJavaHomeAndArgs :checkOpenDJJavaHome if "%OPENDJ_JAVA_HOME%" == "" goto checkJavaBin if not exist "%OPENDJ_JAVA_HOME%\bin\java.exe" goto checkJavaBin set OPENDJ_JAVA_BIN=%OPENDJ_JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkJavaBin if "%JAVA_BIN%" == "" goto checkJavaHome if not exist "%JAVA_BIN%" goto checkJavaHome set OPENDJ_JAVA_BIN=%JAVA_BIN% goto endJavaHomeAndArgs :checkJavaHome if "%JAVA_HOME%" == "" goto checkJavaPath if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaFound set OPENDJ_JAVA_BIN=%JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkJavaPath java.exe -version > NUL 2>&1 if not %errorlevel% == 0 goto noJavaFound set OPENDJ_JAVA_BIN=java.exe goto endJavaHomeAndArgs :noJavaFound echo ERROR: Could not find a valid Java binary to be used. echo You must set the environment variable OPENDJ_JAVA_HOME echo to the root of a valid Java 7 (or higher) installation. pause exit /B 1 :setEnvironmentVars if %SET_ENVIRONMENT_VARS_DONE% == "true" goto prepareCheck set PATH=%SystemRoot%;%PATH% set SCRIPT_NAME_ARG=-Dcom.forgerock.opendj.ldap.tools.scriptName=%SCRIPT_NAME% set SET_ENVIRONMENT_VARS_DONE=true goto scriptBegin :isVersionOrHelp if [%1] == [] goto end 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 :end exit /B 0 opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
@@ -13,6 +13,7 @@ # information: "Portions Copyright [year] [name of copyright owner]". # # Copyright 2008-2009 Sun Microsystems, Inc. # Portions Copyright 2016 ForgeRock AS. # # function that sets the java home @@ -35,9 +36,7 @@ then export OPENDJ_JAVA_BIN else echo "Please set OPENDJ_JAVA_HOME to the root of a Java 5 (or later) installation" echo "or edit the java.properties file and then run the dsjavaproperties script to" echo "specify the Java version to be used" echo "Please set OPENDJ_JAVA_HOME to the root of a Java 7 (or later) installation" exit 1 fi else opendj-server-legacy/resource/bin/_mixed-script.bat
@@ -1,90 +1,61 @@ @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2006-2010 Sun Microsystems, Inc. rem Portions Copyright 2011-2012 ForgeRock AS. rem This script is used to invoke various server-side processes. It should not rem be invoked directly by end users. setlocal set DIR_HOME=%~dp0.. set INSTALL_ROOT=%DIR_HOME% set INSTANCE_DIR= if exist "%INSTALL_ROOT%\instance.loc" ( set /p INSTANCE_DIR=<"%INSTALL_ROOT%\instance.loc" ) else ( set INSTANCE_DIR=. ) set CUR_DIR=%CD% cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% if "%OPENDJ_INVOKE_CLASS%" == "" goto noInvokeClass set OLD_SCRIPT_NAME=%SCRIPT_NAME% set SCRIPT_NAME=%OLD_SCRIPT_NAME%.online rem We keep this values to reset the environment before calling _script-util.bat. set ORIGINAL_JAVA_ARGS=%OPENDJ_JAVA_ARGS% set ORIGINAL_JAVA_HOME=%OPENDJ_JAVA_HOME% set ORIGINAL_JAVA_BIN=%OPENDJ_JAVA_BIN% set SCRIPT_UTIL_CMD=set-full-environment call "%INSTALL_ROOT%\lib\_script-util.bat" %* if NOT %errorlevel% == 0 exit /B %errorlevel% set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=%OLD_SCRIPT_NAME%" rem Check whether is local or remote "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDJ_INVOKE_CLASS% --configFile "%INSTANCE_ROOT%\config\config.ldif" --testIfOffline %* if %errorlevel% == 51 goto launchoffline if %errorlevel% == 52 goto launchonline exit /B %errorlevel% :noInvokeClass echo Error: OPENDJ_INVOKE_CLASS environment variable is not set. pause goto end :launchonline "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDJ_INVOKE_CLASS% --configFile "%INSTANCE_ROOT%\config\config.ldif" %* goto end :launchoffline set SCRIPT_NAME=%OLD_SCRIPT_NAME%.offline rem Set the original values that the user had on the environment in order to be rem sure that the script works with the proper arguments (in particular rem if the user specified not to overwrite the environment). set OPENDJ_JAVA_ARGS=%ORIGINAL_JAVA_ARGS% set OPENDJ_JAVA_HOME=%ORIGINAL_JAVA_HOME% set OPENDJ_JAVA_BIN=%ORIGINAL_JAVA_BIN% set SCRIPT_UTIL_CMD=set-full-environment call "%INSTALL_ROOT%\lib\_script-util.bat" %* if NOT %errorlevel% == 0 exit /B %errorlevel% set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=%OLD_SCRIPT_NAME%" "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_ARGS% %SCRIPT_NAME_ARG% %OPENDJ_INVOKE_CLASS% --configFile "%INSTANCE_ROOT%\config\config.ldif" %* goto end :end @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2006-2010 Sun Microsystems, Inc. rem Portions Copyright 2011-2016 ForgeRock AS. rem This script is used to invoke various server-side processes. It should not rem be invoked directly by end users. setlocal set DIR_HOME=%~dp0.. set INSTALL_ROOT=%DIR_HOME% set INSTANCE_DIR= if exist "%INSTALL_ROOT%\instance.loc" ( set /p INSTANCE_DIR=<"%INSTALL_ROOT%\instance.loc" ) else ( set INSTANCE_DIR=. ) set CUR_DIR=%CD% cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% if "%OPENDJ_INVOKE_CLASS%" == "" ( echo Error: OPENDJ_INVOKE_CLASS environment variable is not set. pause goto end ) set ORIGIN_SCRIPT_NAME=%SCRIPT_NAME% set SCRIPT_NAME=%ORIGIN_SCRIPT_NAME%.online rem Check whether is local or remote FOR %%x in (%*) DO ( if /I "%%x" == "--offline" ( set SCRIPT_NAME=%ORIGIN_SCRIPT_NAME%.offline ) ) set SCRIPT_UTIL_CMD=set-full-environment call "%INSTALL_ROOT%\lib\_script-util.bat" %* if NOT %errorlevel% == 0 exit /B %errorlevel% set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=%ORIGIN_SCRIPT_NAME%" "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDJ_INVOKE_CLASS% --configFile "%INSTANCE_ROOT%\config\config.ldif" %* :end opendj-server-legacy/resource/bin/_mixed-script.sh
@@ -13,7 +13,7 @@ # information: "Portions Copyright [year] [name of copyright owner]". # # Copyright 2008-2010 Sun Microsystems, Inc. # Portions Copyright 2011-2013 ForgeRock AS. # Portions Copyright 2011-2016 ForgeRock AS. # This script is used to invoke processes that might be run on server or @@ -40,16 +40,19 @@ cd "${WORKING_DIR}" OLD_SCRIPT_NAME=${SCRIPT_NAME} SCRIPT_NAME=${OLD_SCRIPT_NAME}.online ORIGIN_SCRIPT_NAME=${SCRIPT_NAME} SCRIPT_NAME=${ORIGIN_SCRIPT_NAME}.online for opt in `echo $*` do `echo ${opt}|grep -iq "\-\-offline"` ret_code=$? if test ${ret_code} -eq 0 then SCRIPT_NAME=${ORIGIN_SCRIPT_NAME}.offline fi done export SCRIPT_NAME # We keep this values to reset the environment before calling _script-util.sh # for the second time. ORIGINAL_JAVA_ARGS=${OPENDJ_JAVA_ARGS} ORIGINAL_JAVA_HOME=${OPENDJ_JAVA_HOME} ORIGINAL_JAVA_BIN=${OPENDJ_JAVA_BIN} # Set environment variables SCRIPT_UTIL_CMD=set-full-environment export SCRIPT_UTIL_CMD @@ -60,50 +63,8 @@ exit ${RETURN_CODE} fi MUST_CALL_AGAIN="false" SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${OLD_SCRIPT_NAME} SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${ORIGIN_SCRIPT_NAME} export SCRIPT_NAME_ARG # Check whether is local or remote "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} "${OPENDJ_INVOKE_CLASS}" \ --configFile "${INSTANCE_ROOT}/config/config.ldif" --testIfOffline "${@}" EC=${?} if test ${EC} -eq 51 then # Set the original values that the user had on the environment in order to be # sure that the script works with the proper arguments (in particular # if the user specified not to overwrite the environment). OPENDJ_JAVA_ARGS=${ORIGINAL_JAVA_ARGS} OPENDJ_JAVA_HOME=${ORIGINAL_JAVA_HOME} OPENDJ_JAVA_BIN=${ORIGINAL_JAVA_BIN} # Set the environment to use the offline properties SCRIPT_NAME=${OLD_SCRIPT_NAME}.offline export SCRIPT_NAME . "${INSTALL_ROOT}/lib/_script-util.sh" RETURN_CODE=$? if test ${RETURN_CODE} -ne 0 then exit ${RETURN_CODE} fi MUST_CALL_AGAIN="true" else if test ${EC} -eq 52 then MUST_CALL_AGAIN="true" else # This is likely a problem with the provided arguments. exit ${EC} fi fi if test ${MUST_CALL_AGAIN} = "true" then SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${OLD_SCRIPT_NAME} export SCRIPT_NAME_ARG # Launch the server utility. "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} "${OPENDJ_INVOKE_CLASS}" \ --configFile "${INSTANCE_ROOT}/config/config.ldif" "${@}" fi "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} "${OPENDJ_INVOKE_CLASS}" \ --configFile "${INSTANCE_ROOT}/config/config.ldif" "${@}" opendj-server-legacy/resource/bin/_script-util.bat
@@ -1,230 +1,236 @@ @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2008-2010 Sun Microsystems, Inc. rem Portions Copyright 2011-2015 ForgeRock AS. set SET_JAVA_HOME_AND_ARGS_DONE=false set SET_ENVIRONMENT_VARS_DONE=false set SET_CLASSPATH_DONE=false if "%INSTALL_ROOT%" == "" goto setInstanceRoot :scriptBegin if "%SCRIPT_UTIL_CMD%" == "set-full-environment-and-test-java" goto setFullEnvironmentAndTestJava if "%SCRIPT_UTIL_CMD%" == "set-full-server-environment-and-test-java" goto setFullServerEnvironmentAndTestJava if "%SCRIPT_UTIL_CMD%" == "set-full-environment" goto setFullEnvironment if "%SCRIPT_UTIL_CMD%" == "set-java-home-and-args" goto setJavaHomeAndArgs 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 end :setInstanceRoot setlocal set DIR_HOME=%~dp0.. set INSTALL_ROOT=%DIR_HOME% set INSTANCE_DIR= if exist "%INSTALL_ROOT%\instance.loc" ( set /p INSTANCE_DIR=<"%INSTALL_ROOT%\instance.loc" ) else ( set INSTANCE_DIR=. ) set CUR_DIR=%CD% cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% goto scriptBegin rem Configure the appropriate CLASSPATH for client, using java.util.logging logger. :setClassPath if "%SET_CLASSPATH_DONE%" == "true" goto end rem get the absolute paths before building the classpath rem it also helps comparing the two paths FOR /F "delims=" %%i IN ("%INSTALL_ROOT%") DO set INSTALL_ROOT=%%~dpnxi FOR /F "delims=" %%i IN ("%INSTANCE_ROOT%") DO set INSTANCE_ROOT=%%~dpnxi call "%INSTALL_ROOT%\lib\setcp.bat" %INSTALL_ROOT%\lib\bootstrap-client.jar set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH% if "%INSTALL_ROOT%" == "%INSTANCE_ROOT%" goto setClassPathDone FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x :setClassPathDone set SET_CLASSPATH_DONE=true goto scriptBegin rem Configure the appropriate CLASSPATH for server, using Opend DJ logger. :setClassPathWithOpenDJLogger if "%SET_CLASSPATH_DONE%" == "true" goto end rem get the absolute paths before building the classpath rem it also helps comparing the two paths FOR /F "delims=" %%i IN ("%INSTALL_ROOT%") DO set INSTALL_ROOT=%%~dpnxi FOR /F "delims=" %%i IN ("%INSTANCE_ROOT%") DO set INSTANCE_ROOT=%%~dpnxi call "%INSTALL_ROOT%\lib\setcp.bat" %INSTALL_ROOT%\lib\bootstrap.jar set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH% if "%INSTALL_ROOT%" == "%INSTANCE_ROOT%" goto setClassPathWithOpenDJLoggerDone FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x :setClassPathWithOpenDJLoggerDone set SET_CLASSPATH_DONE=true goto scriptBegin :setFullEnvironment 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 end :setFullEnvironmentAndTestJava 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 testJava :setFullServerEnvironmentAndTestJava if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "false" goto setJavaHomeAndArgs if "%SET_CLASSPATH_DONE%" == "false" goto setClassPathWithOpenDJLogger if "%SET_ENVIRONMENT_VARS_DONE%" == "false" goto setEnvironmentVars :setJavaHomeAndArgs 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 :endJavaHomeAndArgs set SET_JAVA_HOME_AND_ARGS_DONE=true goto scriptBegin :checkEnvJavaHome if "%OPENDJ_JAVA_BIN%" == "" goto checkEnvLegacyJavaHome if not exist "%OPENDJ_JAVA_BIN%" goto checkEnvLegacyJavaHome goto endJavaHomeAndArgs :checkEnvLegacyJavaHome if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDJJavaHome if not exist "%OPENDS_JAVA_BIN%" goto checkOpenDJJavaHome set OPENDJ_JAVA_BIN=%OPENDS_JAVA_BIN% goto endJavaHomeAndArgs :checkOpenDJJavaHome if "%OPENDJ_JAVA_HOME%" == "" goto checkLegacyOpenDSJavaHome if not exist "%OPENDJ_JAVA_HOME%\bin\java.exe" goto checkLegacyOpenDSJavaHome set OPENDJ_JAVA_BIN=%OPENDJ_JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkLegacyOpenDSJavaHome if "%OPENDS_JAVA_HOME%" == "" goto checkJavaPath if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaPath set OPENDJ_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkJavaPath java.exe -version > NUL 2>&1 if not %errorlevel% == 0 goto checkJavaBin set OPENDJ_JAVA_BIN=java.exe goto endJavaHomeAndArgs :checkJavaBin if "%JAVA_BIN%" == "" goto checkJavaHome if not exist "%JAVA_BIN%" goto checkJavaHome set OPENDJ_JAVA_BIN=%JAVA_BIN% goto endJavaHomeAndArgs :checkJavaHome if "%JAVA_HOME%" == "" goto noJavaFound if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaFound set OPENDJ_JAVA_BIN=%JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :noJavaFound echo ERROR: Could not find a valid Java binary to be used. echo You must specify the path to a valid Java 7.0 or higher version. echo The procedure to follow is: echo 1. Delete the file %INSTANCE_ROOT%\lib\set-java-home.bat if it exists. echo 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid echo Java 7.0 installation. echo If you want to have specific Java settings for each command line you must echo follow the steps 3 and 4. echo 3. Edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. echo 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat pause exit /B 1 :setEnvironmentVars 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 goto scriptBegin :testJava if "%OPENDJ_JAVA_ARGS%" == "" goto checkLegacyArgs :continueTestJava "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.CheckJVMVersion > NUL 2>&1 set RESULT_CODE=%errorlevel% if %RESULT_CODE% == 13 goto notSupportedJavaHome if not %RESULT_CODE% == 0 goto noValidJavaHome goto end :checkLegacyArgs if "%OPENDS_JAVA_ARGS%" == "" goto continueTestJava set OPENDJ_JAVA_ARGS=%OPENDS_JAVA_ARGS% goto continueTestJava :noValidJavaHome if NOT "%OPENDJ_JAVA_ARGS%" == "" goto noValidHomeWithArgs echo ERROR: The detected Java version could not be used. The detected echo Java binary is: echo %OPENDJ_JAVA_BIN% echo You must specify the path to a valid Java 7.0 or higher version. echo The procedure to follow is: echo 1. Delete the file %INSTANCE_ROOT%\lib\set-java-home.bat if it exists. echo 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid echo Java 7.0 installation. echo If you want to have specific Java settings for each command line you must echo follow the steps 3 and 4. echo 3. Edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. echo 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat pause exit /B 1 :notSupportedJavaHome rem We get here when the java version is 6 (or up) but not supported. We run rem InstallDS again to see a localized message. "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.InstallDS --testonly pause exit /B 1 :noValidHomeWithArgs echo ERROR: The detected Java version could not be used with the set of Java echo arguments %OPENDJ_JAVA_ARGS%. echo The detected Java binary is: echo %OPENDJ_JAVA_BIN% echo You must specify the path to a valid Java 7.0 or higher version. echo The procedure to follow is: echo 1. Delete the file %INSTANCE_ROOT%\lib\set-java-home.bat if it exists. echo 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid echo Java 7.0 installation. echo If you want to have specific Java settings for each command line you must echo follow the steps 3 and 4. echo 3. Edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. echo 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat pause exit /B 1 :end exit /B 0 @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2008-2010 Sun Microsystems, Inc. rem Portions Copyright 2011-2016 ForgeRock AS. set SET_JAVA_HOME_AND_ARGS_DONE=false set SET_ENVIRONMENT_VARS_DONE=false set SET_CLASSPATH_DONE=false if "%INSTALL_ROOT%" == "" goto setInstanceRoot :scriptBegin if "%SCRIPT_UTIL_CMD%" == "set-full-environment-and-test-java" goto setFullEnvironmentAndTestJava if "%SCRIPT_UTIL_CMD%" == "set-full-server-environment-and-test-java" goto setFullServerEnvironmentAndTestJava if "%SCRIPT_UTIL_CMD%" == "set-full-environment" goto setFullEnvironment if "%SCRIPT_UTIL_CMD%" == "set-java-home-and-args" goto setJavaHomeAndArgs 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 end :setInstanceRoot setlocal set DIR_HOME=%~dp0.. set INSTALL_ROOT=%DIR_HOME% set INSTANCE_DIR= if exist "%INSTALL_ROOT%\instance.loc" ( set /p INSTANCE_DIR=<"%INSTALL_ROOT%\instance.loc" ) else ( set INSTANCE_DIR=. ) set CUR_DIR=%CD% cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% goto scriptBegin rem Configure the appropriate CLASSPATH for client, using java.util.logging logger. :setClassPath if "%SET_CLASSPATH_DONE%" == "true" goto end rem get the absolute paths before building the classpath rem it also helps comparing the two paths FOR /F "delims=" %%i IN ("%INSTALL_ROOT%") DO set INSTALL_ROOT=%%~dpnxi FOR /F "delims=" %%i IN ("%INSTANCE_ROOT%") DO set INSTANCE_ROOT=%%~dpnxi call "%INSTALL_ROOT%\lib\setcp.bat" %INSTALL_ROOT%\lib\bootstrap-client.jar set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH% if "%INSTALL_ROOT%" == "%INSTANCE_ROOT%" goto setClassPathDone FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x :setClassPathDone set SET_CLASSPATH_DONE=true goto scriptBegin rem Configure the appropriate CLASSPATH for server, using Opend DJ logger. :setClassPathWithOpenDJLogger if "%SET_CLASSPATH_DONE%" == "true" goto end rem get the absolute paths before building the classpath rem it also helps comparing the two paths FOR /F "delims=" %%i IN ("%INSTALL_ROOT%") DO set INSTALL_ROOT=%%~dpnxi FOR /F "delims=" %%i IN ("%INSTANCE_ROOT%") DO set INSTANCE_ROOT=%%~dpnxi call "%INSTALL_ROOT%\lib\setcp.bat" %INSTALL_ROOT%\lib\bootstrap.jar set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH% if "%INSTALL_ROOT%" == "%INSTANCE_ROOT%" goto setClassPathWithOpenDJLoggerDone FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x :setClassPathWithOpenDJLoggerDone set SET_CLASSPATH_DONE=true goto scriptBegin :setFullEnvironment 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 end :setFullEnvironmentAndTestJava 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 testJava :setFullServerEnvironmentAndTestJava if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "false" goto setJavaHomeAndArgs if "%SET_CLASSPATH_DONE%" == "false" goto setClassPathWithOpenDJLogger if "%SET_ENVIRONMENT_VARS_DONE%" == "false" goto setEnvironmentVars :setJavaHomeAndArgs if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto end if not "%OPENDJ_JAVA_ARGS%" == "" goto checkEnvJavaHome set SCRIPT_JAVA_ARGS_PROPERTY=%SCRIPT_NAME%.java-args call:readProperty %SCRIPT_JAVA_ARGS_PROPERTY% set OPENDJ_JAVA_ARGS=%PROPERTY_VALUE% if not "%OPENDJ_JAVA_ARGS%" == "" goto checkEnvJavaHome call:readProperty default.java-args set OPENDJ_JAVA_ARGS=%PROPERTY_VALUE% if "%OPENDJ_JAVA_BIN%" == "" goto checkEnvJavaHome :endJavaHomeAndArgs set SET_JAVA_HOME_AND_ARGS_DONE=true goto scriptBegin :checkEnvJavaHome if "%OPENDJ_JAVA_BIN%" == "" goto checkOpenDJJavaHome if not exist "%OPENDJ_JAVA_BIN%" goto checkOpenDJJavaHome goto endJavaHomeAndArgs :checkOpenDJJavaHome if "%OPENDJ_JAVA_HOME%" == "" goto checkScriptPropertyJavaHome if not exist "%OPENDJ_JAVA_HOME%\bin\java.exe" goto checkScriptPropertyJavaHome set OPENDJ_JAVA_BIN=%OPENDJ_JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :checkScriptPropertyJavaHome set SCRIPT_JAVA_HOME_PROPERTY=%SCRIPT_NAME%.java-home call:readProperty %SCRIPT_JAVA_HOME_PROPERTY% if "%PROPERTY_VALUE%" == "" goto checkDefaultPropertyJavaHome if not exist "%PROPERTY_VALUE%\bin\java.exe" goto checkDefaultPropertyJavaHome set OPENDJ_JAVA_BIN=%PROPERTY_VALUE%\bin\java.exe goto endJavaHomeAndArgs :checkDefaultPropertyJavaHome call:readProperty default.java-home if "%PROPERTY_VALUE%" == "" goto checkJavaPath if not exist "%PROPERTY_VALUE%\bin\java.exe" goto checkJavaPath set OPENDJ_JAVA_BIN=%PROPERTY_VALUE%\bin\java.exe goto endJavaHomeAndArgs :checkJavaPath java.exe -version > NUL 2>&1 if not %errorlevel% == 0 goto checkJavaBin set OPENDJ_JAVA_BIN=java.exe goto endJavaHomeAndArgs :checkJavaBin if "%JAVA_BIN%" == "" goto checkJavaHome if not exist "%JAVA_BIN%" goto checkJavaHome set OPENDJ_JAVA_BIN=%JAVA_BIN% goto endJavaHomeAndArgs :checkJavaHome if "%JAVA_HOME%" == "" goto noJavaFound if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaFound set OPENDJ_JAVA_BIN=%JAVA_HOME%\bin\java.exe goto endJavaHomeAndArgs :noJavaFound echo ERROR: Could not find a valid Java binary to be used. echo You must specify the path to a valid Java 7 or higher version. echo The procedure to follow is to set the environment variable OPENDJ_JAVA_HOME echo to the root of a valid Java 7 installation. echo If you want to have specific Java settings for each command line you must echo edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. pause exit /B 1 :setEnvironmentVars 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 goto scriptBegin :testJava if "%OPENDJ_JAVA_ARGS%" == "" goto checkLegacyArgs :continueTestJava "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.CheckJVMVersion > NUL 2>&1 set RESULT_CODE=%errorlevel% if %RESULT_CODE% == 13 goto notSupportedJavaHome if not %RESULT_CODE% == 0 goto noValidJavaHome goto end :checkLegacyArgs if "%OPENDS_JAVA_ARGS%" == "" goto continueTestJava set OPENDJ_JAVA_ARGS=%OPENDS_JAVA_ARGS% goto continueTestJava :noValidJavaHome if NOT "%OPENDJ_JAVA_ARGS%" == "" goto noValidHomeWithArgs echo ERROR: The detected Java version could not be used. The detected echo Java binary is: echo %OPENDJ_JAVA_BIN% echo You must specify the path to a valid Java 7 or higher version. echo The procedure to follow is to set the environment variable OPENDJ_JAVA_HOME echo to the root of a valid Java 7 installation. echo If you want to have specific Java settings for each command line you must echo edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. pause exit /B 1 :notSupportedJavaHome rem We get here when the java version is 6 (or up) but not supported. We run rem InstallDS again to see a localized message. "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.InstallDS --testonly pause exit /B 1 :noValidHomeWithArgs echo ERROR: The detected Java version could not be used with the set of Java echo arguments %OPENDJ_JAVA_ARGS%. echo The detected Java binary is: echo %OPENDJ_JAVA_BIN% echo You must specify the path to a valid Java 7 or higher version. echo The procedure to follow is to set the environment variable OPENDJ_JAVA_HOME echo to the root of a valid Java 7 installation. echo If you want to have specific Java settings for each command line you must echo edit the properties file specifying the Java binary and the Java arguments echo for each command line. The Java properties file is located in: echo %INSTANCE_ROOT%\config\java.properties. pause exit /B 1 :end exit /B 0 rem read the provided property from the configuration/java.properties and stores it in PROPERTY_VALUE variable :readProperty set PROPERTY_VALUE= set JAVA_PROPERTIES="%INSTALL_ROOT%\config\java.properties" if not exist %JAVA_PROPERTIES% goto:eof set CMD="findstr /b [^#]*%~1=.* %JAVA_PROPERTIES%" for /f "tokens=2 delims==" %%a in ( '%CMD%' ) do set PROPERTY_VALUE=%%a goto:eof opendj-server-legacy/resource/bin/_script-util.sh
@@ -13,142 +13,95 @@ # information: "Portions Copyright [year] [name of copyright owner]". # # Copyright 2008-2010 Sun Microsystems, Inc. # Portions Copyright 2010-2015 ForgeRock AS. # Portions Copyright 2010-2016 ForgeRock AS. # # Display an error message # display_java_not_found_error() { echo "Please set OPENDJ_JAVA_HOME to the root of a Java 7 (or higher) installation" echo "or edit the java.properties file and then run the dsjavaproperties script to" echo "specify the Java version to be used" echo "or edit the java.properties file to specify the Java version to be used" } # # function that tests the JAVA_HOME env variable. # test_java_home() { if test -z "${JAVA_HOME}" get_property() { # Read standard variables from config/java.properties file if test -f "${INSTANCE_ROOT}/config/java.properties" then display_java_not_found_error exit 1 else OPENDJ_JAVA_BIN="${JAVA_HOME}/bin/java" if test -f "${OPENDJ_JAVA_BIN}" then export OPENDJ_JAVA_BIN else display_java_not_found_error exit 1 fi PROPERTY_VALUE= PROPERTY_VALUE=`grep "^\s*${1}=" "${INSTANCE_ROOT}/config/java.properties" |cut -d'=' -f2 2> /dev/null` fi } # # function that tests the JAVA_BIN env variable. # test_java_bin() { if test -z "${JAVA_BIN}" then test_java_home else OPENDJ_JAVA_BIN="${JAVA_BIN}" if test -f "${OPENDJ_JAVA_BIN}" then export OPENDJ_JAVA_BIN else test_java_home fi fi } # # function that tests the java executable in the PATH env variable. # test_java_path() { OPENDJ_JAVA_BIN=`which java 2> /dev/null` if test -f "${OPENDJ_JAVA_BIN}" # Function that sets the OPENDJ_JAVA_BIN to the java path on the running machine according to the following order: # 1 - use OPENDJ_JAVA_BIN if defined and points to an existing regular file # 2 - use OPENDJ_JAVA_HOME if defined and OPENDJ_JAVA_HOME/bin/java points to an existing regular file # 3 - use the 'SCRIPT_NAME.java-home' property from the config/java.properties file # is defined and 'SCRIPT_NAME.java-home'/bin/java points to a regular file # 4 - use the 'default.java-home' property from the config/java.properties file # is defined and 'default.java-home'/bin/java points to a regular file # 5 - use `which java` command to find java path # 6 - use JAVA_BIN if defined and points to an existing regular file # 7 - use JAVA_HOME if defined and JAVA_HOME/bin/java points to a regural file # 8 - Displays an error message which says that java was not found on the running machine set_opendj_java_bin() { if test ! -z "${OPENDJ_JAVA_BIN}" -a -f "${OPENDJ_JAVA_BIN}" then export OPENDJ_JAVA_BIN else test_java_bin fi } # # function that tests legacy OPENDS_JAVA_HOME env variable. # test_opends_java_home() { if test -z "${OPENDS_JAVA_HOME}" elif test ! -z "${OPENDJ_JAVA_HOME}" -a -f "${OPENDJ_JAVA_HOME}/bin/java" then test_java_path OPENDJ_JAVA_BIN=${OPENDJ_JAVA_HOME}/bin/java else OPENDJ_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java" if test -f "${OPENDJ_JAVA_BIN}" eval JAVA_HOME_PROPERTY=${SCRIPT_NAME}.java-home get_property ${JAVA_HOME_PROPERTY} if test ! -z "${PROPERTY_VALUE}" -a -f "${PROPERTY_VALUE}/bin/java" then export OPENDJ_JAVA_BIN OPENDJ_JAVA_BIN=${PROPERTY_VALUE}/bin/java else test_java_path fi fi } # # function that tests the OPENDJ_JAVA_HOME env variable. # test_opendj_java_home() { if test -z "${OPENDJ_JAVA_HOME}" then test_opends_java_home else OPENDJ_JAVA_BIN="${OPENDJ_JAVA_HOME}/bin/java" if test -f "${OPENDJ_JAVA_BIN}" then export OPENDJ_JAVA_BIN else test_java_path fi fi } # # function that tests the OPENDJ_JAVA_BIN env variable. # test_opendj_java_bin() { if test -z "${OPENDJ_JAVA_BIN}" then # Check for legacy OPENDS_JAVA_BIN if test -z "${OPENDS_JAVA_BIN}" then test_opendj_java_home else if test -f "${OPENDS_JAVA_BIN}" get_property default.java-home if test ! -z "${PROPERTY_VALUE}" -a -f "${PROPERTY_VALUE}/bin/java" then OPENDJ_JAVA_BIN="${OPENDS_JAVA_BIN}" export OPENDJ_JAVA_BIN OPENDJ_JAVA_BIN=${PROPERTY_VALUE}/bin/java else test_opendj_java_home TEST_JAVA_PATH=`which java 2> /dev/null` if test ! -z ${TEST_JAVA_PATH} -a -f ${TEST_JAVA_PATH} then OPENDJ_JAVA_BIN=${TEST_JAVA_PATH} elif test ! -z "${JAVA_BIN}" -a -f "${JAVA_BIN}" then OPENDJ_JAVA_BIN=${JAVA_BIN} elif test ! -z "${JAVA_HOME}" -a -f "${JAVA_HOME}/bin/java" then OPENDJ_JAVA_BIN=${JAVA_HOME}/bin/java else display_java_not_found_error exit 1 fi fi fi else if test -f "${OPENDJ_JAVA_BIN}" then export OPENDJ_JAVA_BIN else test_opends_java_home fi fi export OPENDJ_JAVA_BIN } # # function that sets the java home # set_java_home_and_args() { if test -f "${INSTANCE_ROOT}/lib/set-java-home" # See if the environment variables for arguments are set. if test -z "${OPENDJ_JAVA_ARGS}" then . "${INSTANCE_ROOT}/lib/set-java-home" # Use java.properties file to set java args for the specific script SCRIPT_NAME_ARGS_PROPERTY="${SCRIPT_NAME}".java-args get_property ${SCRIPT_NAME_ARGS_PROPERTY} if test ! -z "${PROPERTY_VALUE}" then OPENDJ_JAVA_ARGS="${PROPERTY_VALUE}" else get_property default.java-args OPENDJ_JAVA_ARGS="${PROPERTY_VALUE}" fi fi test_opendj_java_bin set_opendj_java_bin } # Function that sets OPENDJ_JAVA_ARGS if not yet set but OPENDS_JAVA_ARGS is. @@ -163,6 +116,22 @@ fi } print_error_message() { if test -z "${OPENDJ_JAVA_BIN}" then echo "No Java binary found on your machine." else echo "The detected Java binary is: ${OPENDJ_JAVA_BIN}" fi echo "You must specify the path to a valid Java 7 or higher version." echo "The procedure to follow is to set the environment variable OPENDJ_JAVA_HOME" echo "to the root of a valid Java 7 installation." echo "If you want to have specific Java settings for each command line you must" echo "edit the properties file specifying the Java binary and/or the Java arguments" echo "for each command line. The Java properties file is located in:" echo "${INSTANCE_ROOT}/config/java.properties." } # Determine whether the detected Java environment is acceptable for use. test_java() { if test -z "${OPENDJ_JAVA_ARGS}" @@ -177,20 +146,8 @@ exit 1 elif test ${RESULT_CODE} -ne 0 then echo "ERROR: The detected Java version could not be used. The detected" echo "Java binary is:" echo "${OPENDJ_JAVA_BIN}" echo "You must specify the path to a valid Java 7.0 or higher version." echo "The procedure to follow is:" echo "1. Delete the file ${INSTANCE_ROOT}/lib/set-java-home" if it exists. echo "2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid " echo "Java 7.0 installation." echo "If you want to have specific Java settings for each command line you must" echo "follow the steps 3 and 4." echo "3. Edit the properties file specifying the Java binary and the Java arguments" echo "for each command line. The Java properties file is located in:" echo "${INSTANCE_ROOT}/config/java.properties." echo "4. Run the command-line ${INSTANCE_ROOT}/bin/dsjavaproperties" echo "ERROR: The detected Java version could not be used." print_error_message exit 1 fi else @@ -206,19 +163,7 @@ then echo "ERROR: The detected Java version could not be used with the set of Java" echo "arguments ${OPENDJ_JAVA_ARGS}." echo "The detected Java binary is:" echo "${OPENDJ_JAVA_BIN}" echo "You must specify the path to a valid Java 7.0 or higher version." echo "The procedure to follow is:" echo "1. Delete the file ${INSTANCE_ROOT}/lib/set-java-home" if it exists. echo "2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid " echo "Java 7.0 installation." echo "If you want to have specific Java settings for each command line you must" echo "follow the steps 3 and 4." echo "3. Edit the properties file specifying the Java binary and the Java arguments" echo "for each command line. The Java properties file is located in:" echo "${INSTANCE_ROOT}/config/java.properties." echo "4. Run the command-line ${INSTANCE_ROOT}/bin/dsjavaproperties" print_error_message exit 1 fi fi opendj-server-legacy/resource/bin/dsjavaproperties
File was deleted opendj-server-legacy/resource/bin/dsjavaproperties.bat
File was deleted opendj-server-legacy/resource/bin/stop-ds.bat
@@ -1,133 +1,131 @@ @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2006-2010 Sun Microsystems, Inc. rem Portions Copyright 2011-2014 ForgeRock AS. setlocal set PATH=%SystemRoot% set OPENDJ_INVOKE_CLASS="org.opends.server.tools.StopDS" set SCRIPT_NAME=stop-ds set DIR_HOME=%~dp0.. rem We keep this values to reset the environment before calling start-ds. set ORIGINAL_JAVA_ARGS=%OPENDJ_JAVA_ARGS% set ORIGINAL_JAVA_HOME=%OPENDJ_JAVA_HOME% set ORIGINAL_JAVA_BIN=%OPENDJ_JAVA_BIN% set INSTALL_ROOT=%DIR_HOME% set INSTANCE_DIR= if exist "%INSTALL_ROOT%\instance.loc" ( set /p INSTANCE_DIR=<"%INSTALL_ROOT%\instance.loc" ) else ( set INSTANCE_DIR=. ) set CUR_DIR=%CD% cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% set TEMP_LOG=%TEMP%\logs\ if NOT EXIST "%INSTANCE_ROOT%\logs\" ( if NOT EXIST "%TEMP_LOG%" ( md "%TEMP_LOG%" ) set LOG="%TEMP_LOG%native-windows.out" ) ELSE ( set LOG="%INSTANCE_ROOT%\logs\native-windows.out" ) set SCRIPT=stop-ds.bat rem This is the template to use for logging. Make sure to use >> rem echo %SCRIPT%: your-message-here >> %LOG% echo %SCRIPT%: invoked >> %LOG% rem Set environment variables set SCRIPT_UTIL_CMD=set-full-server-environment-and-test-java call "%INSTALL_ROOT%\lib\_script-util.bat" %* if NOT %errorlevel% == 0 exit /B %errorlevel% echo %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG% "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.tools.StopDS --checkStoppability %* if %errorlevel% == 98 goto serverAlreadyStopped if %errorlevel% == 99 goto startUsingSystemCall if %errorlevel% == 100 goto stopUsingSystemCall if %errorlevel% == 101 goto restartUsingSystemCall if %errorlevel% == 102 goto stopUsingProtocol if %errorlevel% == 103 goto stopAsWindowsService if %errorlevel% == 104 goto restartAsWindowsService rem An error or we display usage goto writeLastLine :serverAlreadyStopped echo %SCRIPT%: server already stopped >> %LOG% if exist "%INSTANCE_ROOT%\logs\server.pid" erase "%INSTANCE_ROOT%\logs\server.pid" goto writeLastLine :startUsingSystemCall echo %SCRIPT%: start using system call >> %LOG% rem Set the original values that the user had on the environment in order to be rem sure that the start-ds script works with the proper arguments (in particular rem if the user specified not to overwrite the environment). set OPENDJ_JAVA_ARGS=%ORIGINAL_JAVA_ARGS% set OPENDJ_JAVA_HOME=%ORIGINAL_JAVA_HOME% set OPENDJ_JAVA_BIN=%ORIGINAL_JAVA_BIN% "%INSTALL_ROOT%\bat\start-ds.bat" goto writeLastLine :stopUsingSystemCall echo %SCRIPT%: stop using system call >> %LOG% "%INSTALL_ROOT%\lib\winlauncher.exe" stop "%INSTANCE_ROOT%" goto end :restartUsingSystemCall echo %SCRIPT%: restart using system call >> %LOG% "%INSTALL_ROOT%\lib\winlauncher.exe" stop "%INSTANCE_ROOT%" if not %errorlevel% == 0 goto end goto startUsingSystemCall :stopUsingProtocol echo %SCRIPT%: stop using protocol >> %LOG% set CLASSPATH="" call "%INSTALL_ROOT%\lib\_client-script.bat" %* goto end :stopAsWindowsService echo %SCRIPT%: stop as windows service >> %LOG% "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.StopWindowsService goto end :restartAsWindowsService echo %SCRIPT%: restart as windows service, stopping >> %LOG% "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.StopWindowsService if not %errorlevel% == 0 goto end echo %SCRIPT%: restart as windows service, starting >> %LOG% "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.StartWindowsService "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.startingservice" rem Type the contents the winwervice.out file and delete it. if exist "%INSTANCE_ROOT%\logs\winservice.out" type "%INSTANCE_ROOT%\logs\winservice.out" if exist "%INSTANCE_ROOT%\logs\winservice.out" erase "%INSTANCE_ROOT%\logs\winservice.out" goto end :writeLastLine echo %SCRIPT%: finished >> %LOG% goto end :end @echo off rem The contents of this file are subject to the terms of the Common Development and rem Distribution License (the License). You may not use this file except in compliance with the rem License. rem rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the rem specific language governing permission and limitations under the License. rem rem When distributing Covered Software, include this CDDL Header Notice in each file and include rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL rem Header, with the fields enclosed by brackets [] replaced by your own identifying rem information: "Portions Copyright [year] [name of copyright owner]". rem rem Copyright 2006-2010 Sun Microsystems, Inc. rem Portions Copyright 2011-2014 ForgeRock AS. setlocal set OPENDJ_INVOKE_CLASS="org.opends.server.tools.StopDS" set SCRIPT_NAME=stop-ds set DIR_HOME=%~dp0.. rem We keep this values to reset the environment before calling start-ds. set ORIGINAL_JAVA_ARGS=%OPENDJ_JAVA_ARGS% set ORIGINAL_JAVA_HOME=%OPENDJ_JAVA_HOME% set ORIGINAL_JAVA_BIN=%OPENDJ_JAVA_BIN% set INSTALL_ROOT=%DIR_HOME% set INSTANCE_DIR= if exist "%INSTALL_ROOT%\instance.loc" ( set /p INSTANCE_DIR=<"%INSTALL_ROOT%\instance.loc" ) else ( set INSTANCE_DIR=. ) set CUR_DIR=%CD% cd /d %INSTALL_ROOT% cd /d %INSTANCE_DIR% set INSTANCE_ROOT=%CD% cd /d %CUR_DIR% set TEMP_LOG=%TEMP%\logs\ if NOT EXIST "%INSTANCE_ROOT%\logs\" ( if NOT EXIST "%TEMP_LOG%" ( md "%TEMP_LOG%" ) set LOG="%TEMP_LOG%native-windows.out" ) ELSE ( set LOG="%INSTANCE_ROOT%\logs\native-windows.out" ) set SCRIPT=stop-ds.bat rem This is the template to use for logging. Make sure to use >> rem echo %SCRIPT%: your-message-here >> %LOG% echo %SCRIPT%: invoked >> %LOG% rem Set environment variables set SCRIPT_UTIL_CMD=set-full-server-environment-and-test-java call "%INSTALL_ROOT%\lib\_script-util.bat" %* if NOT %errorlevel% == 0 exit /B %errorlevel% echo %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG% "%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.tools.StopDS --checkStoppability %* if %errorlevel% == 98 goto serverAlreadyStopped if %errorlevel% == 99 goto startUsingSystemCall if %errorlevel% == 100 goto stopUsingSystemCall if %errorlevel% == 101 goto restartUsingSystemCall if %errorlevel% == 102 goto stopUsingProtocol if %errorlevel% == 103 goto stopAsWindowsService if %errorlevel% == 104 goto restartAsWindowsService rem An error or we display usage goto writeLastLine :serverAlreadyStopped echo %SCRIPT%: server already stopped >> %LOG% if exist "%INSTANCE_ROOT%\logs\server.pid" erase "%INSTANCE_ROOT%\logs\server.pid" goto writeLastLine :startUsingSystemCall echo %SCRIPT%: start using system call >> %LOG% rem Set the original values that the user had on the environment in order to be rem sure that the start-ds script works with the proper arguments (in particular rem if the user specified not to overwrite the environment). set OPENDJ_JAVA_ARGS=%ORIGINAL_JAVA_ARGS% set OPENDJ_JAVA_HOME=%ORIGINAL_JAVA_HOME% set OPENDJ_JAVA_BIN=%ORIGINAL_JAVA_BIN% "%INSTALL_ROOT%\bat\start-ds.bat" goto writeLastLine :stopUsingSystemCall echo %SCRIPT%: stop using system call >> %LOG% "%INSTALL_ROOT%\lib\winlauncher.exe" stop "%INSTANCE_ROOT%" goto end :restartUsingSystemCall echo %SCRIPT%: restart using system call >> %LOG% "%INSTALL_ROOT%\lib\winlauncher.exe" stop "%INSTANCE_ROOT%" if not %errorlevel% == 0 goto end goto startUsingSystemCall :stopUsingProtocol echo %SCRIPT%: stop using protocol >> %LOG% set CLASSPATH="" call "%INSTALL_ROOT%\lib\_client-script.bat" %* goto end :stopAsWindowsService echo %SCRIPT%: stop as windows service >> %LOG% "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.StopWindowsService goto end :restartAsWindowsService echo %SCRIPT%: restart as windows service, stopping >> %LOG% "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.StopWindowsService if not %errorlevel% == 0 goto end echo %SCRIPT%: restart as windows service, starting >> %LOG% "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.StartWindowsService "%OPENDJ_JAVA_BIN%" -client org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.startingservice" rem Type the contents the winwervice.out file and delete it. if exist "%INSTANCE_ROOT%\logs\winservice.out" type "%INSTANCE_ROOT%\logs\winservice.out" if exist "%INSTANCE_ROOT%\logs\winservice.out" erase "%INSTANCE_ROOT%\logs\winservice.out" goto end :writeLastLine echo %SCRIPT%: finished >> %LOG% goto end :end opendj-server-legacy/resource/config/java.properties
@@ -11,7 +11,7 @@ # information: "Portions Copyright [year] [name of copyright owner]". # # Copyright 2008-2010 Sun Microsystems, Inc. # Portions Copyright 2011 ForgeRock AS. # Portions Copyright 2011-2016 ForgeRock AS. # # This file contains the java properties that the different command lines will @@ -39,21 +39,7 @@ # modes (for instance import-ldif.offline.java-args and # import-ldif.online.java-args). # # IMPORTANT NOTE: Once you have modified this file and set the java properties # that you want the command-lines to use you must run the command-line # bin/dsjavaproperties for the different scripts to be updated with the # specified settings. # # Examples: # Specify to overwrite the content of the environment variable OPENDJ_JAVA_HOME # (i.e. the contents of this properties file for the java home will be analyzed # before checking whether OPENDJ_JAVA_HOME is specified in the environment): # overwrite-env-java-home=true # # Specify to overwrite the content of the environment variable OPENDJ_JAVA_ARGS # (i.e. the contents of this properties file for the java args will be analyzed # before checking whether OPENDJ_JAVA_ARGS is specified in the environment): # overwrite-env-java-args=true # # Specify to use a particular Java Virtual Machine for the offline import: # import-ldif.offline.java-home=/usr/jdk1.7 @@ -72,3 +58,9 @@ # an associated property defined: # default.java-args=-client default.java-home=$JAVA_HOME default.java-args=-Xms32m -client import-ldif.offline.java-args=-server rebuild-index.offline.java-args=-server start-ds.java-args=-server ldifdiff.java-args=-server opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -17,61 +17,15 @@ package org.opends.guitools.controlpanel.ui; import static org.opends.messages.AdminToolMessages.*; import static org.opends.server.util.CollectionUtils.*; import static com.forgerock.opendj.util.OperatingSystem.isWindows; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Properties; import java.util.Set; import java.util.TreeSet; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingUtilities; import org.forgerock.i18n.LocalizableMessage; import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; import org.opends.guitools.controlpanel.datamodel.SortableTableModel; import org.opends.guitools.controlpanel.event.BrowseActionListener; import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; import org.opends.guitools.controlpanel.task.Task; import org.opends.guitools.controlpanel.ui.components.LabelWithHelpIcon; import org.opends.guitools.controlpanel.ui.renderer.AttributeCellEditor; import org.opends.guitools.controlpanel.ui.renderer.LDAPEntryTableCellRenderer; import org.opends.guitools.controlpanel.util.BackgroundTask; import org.opends.guitools.controlpanel.util.Utilities; import org.opends.quicksetup.Installation; import org.opends.quicksetup.util.Utils; import org.opends.server.tools.JavaPropertiesTool; import org.opends.server.types.OpenDsException; import org.opends.server.util.SetupUtils; import org.opends.server.util.StaticUtils; /** * The panel where the user can specify the java arguments and java home to be @@ -80,59 +34,10 @@ public class JavaPropertiesPanel extends StatusGenericPanel { private static final long serialVersionUID = -7886215660289880597L; private JTextField javaHome; private JRadioButton useOpenDSJavaHome; private JRadioButton useSpecifiedJavaHome; private JButton browse; private JLabel lJavaHome; private JRadioButton useOpenDSJavaArgs; private JRadioButton useSpecifiedJavaArgs; private JLabel lJavaArgs; private JTable argumentsTable; private JavaArgumentsTableModel argumentsTableModel; private JScrollPane argumentsScroll; private AttributeCellEditor editor; private JEditorPane lInitContents; private JCheckBox showAll; private Set<JavaArgumentsDescriptor> readJavaArguments = new HashSet<>(); private Set<JavaArgumentsDescriptor> currentJavaArguments = new HashSet<>(); private final Set<String> allScriptNames = newHashSet( "start-ds", "import-ldif.offline", "backup.online", "base64", "create-rc-script", "dsconfig", "dsreplication", "export-ldif.online", "import-ldif.online", "ldapcompare", "ldapdelete", "ldapmodify", "ldappasswordmodify", "ldapsearch", "list-backends", "manage-account", "manage-tasks", "restore.online", "stop-ds", "status", "control-panel", "uninstall", "setup", "backup.offline", "encode-password", "export-ldif.offline", "ldifdiff", "ldifmodify", "ldifsearch", "makeldif", "rebuild-index", "restore.offline", "upgrade", "verify-index", "backendstat" ); private final Set<String> relevantScriptNames = newHashSet( "start-ds", "import-ldif.offline", "backup.offline", "export-ldif.offline", "ldifdiff", "makeldif", "rebuild-index", "restore.offline", "verify-index", "backendstat" ); private String readJavaHome; private boolean readUseOpenDSJavaHome; private boolean readUseOpenDSJavaArgs; private JLabel javaHome; private boolean initialized; private boolean previousLocal = true; private final LocalizableMessage READING_JAVA_SETTINGS = INFO_CTRL_PANEL_READING_JAVA_SETTINGS_SUMMARY.get(); private JComponent[] comps; /** Default constructor. */ public JavaPropertiesPanel() { @@ -141,6 +46,12 @@ } @Override public void okClicked() { cancelClicked(); } @Override public LocalizableMessage getTitle() { return INFO_CTRL_PANEL_JAVA_PROPERTIES_TITLE.get(); @@ -158,267 +69,18 @@ return false; } @Override public void setInfo(ControlPanelInfo info) { super.setInfo(info); if (editor != null) { editor.setInfo(info); } } /** Creates the layout of the panel (but the contents are not populated here). */ private void createLayout() { GridBagConstraints gbc = new GridBagConstraints(); lJavaHome = Utilities.createPrimaryLabel( INFO_CTRL_PANEL_JAVA_HOME_LABEL.get()); useOpenDSJavaHome = Utilities.createRadioButton(LocalizableMessage.EMPTY); useOpenDSJavaHome.setOpaque(false); useOpenDSJavaHome.getAccessibleContext().setAccessibleName( INFO_CTRL_PANEL_USE_OPENDS_JAVA_HOME.get()+" "+ INFO_CTRL_PANEL_USE_OPENDS_JAVA_HOME_HELP.get()); lJavaHome.setLabelFor(useOpenDSJavaHome); javaHome = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_EDIT_JAVA_PROPERTIES_FILE.get()); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.gridwidth = 1; add(lJavaHome, gbc); gbc.insets.left = 10; gbc.gridx ++; add(useOpenDSJavaHome, gbc); gbc.gridwidth = 3; gbc.gridx ++; LabelWithHelpIcon useOpenDSJavaHomeLabel = new LabelWithHelpIcon(INFO_CTRL_PANEL_USE_OPENDS_JAVA_HOME.get(), INFO_CTRL_PANEL_USE_OPENDS_JAVA_HOME_HELP.get()); gbc.insets.left = 0; add(useOpenDSJavaHomeLabel, gbc); gbc.gridx = 1; gbc.gridy ++; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0.0; gbc.insets.top = 10; gbc.gridwidth = 1; useSpecifiedJavaHome = Utilities.createRadioButton(LocalizableMessage.EMPTY); useSpecifiedJavaHome.setOpaque(false); useSpecifiedJavaHome.getAccessibleContext().setAccessibleName( INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME.get() + " "+INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME_HELP.get()); useOpenDSJavaHomeLabel.setLabelFor(useSpecifiedJavaHome); LabelWithHelpIcon useSpecifiedJavaHomeLabel = new LabelWithHelpIcon( INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME.get(), INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME_HELP.get()); gbc.insets.left = 10; add(useSpecifiedJavaHome, gbc); gbc.gridx ++; gbc.insets.left = 0; add(useSpecifiedJavaHomeLabel, gbc); gbc.gridx ++; javaHome = Utilities.createTextField(); useSpecifiedJavaHomeLabel.setLabelFor(javaHome); gbc.weightx = 1.0; gbc.insets.left = 5; add(javaHome, gbc); gbc.weightx = 0.0; browse = Utilities.createButton(INFO_CTRL_PANEL_BROWSE_BUTTON_LABEL.get()); browse.addActionListener( new BrowseActionListener(javaHome, BrowseActionListener.BrowseType.LOCATION_DIRECTORY, this)); browse.setOpaque(false); gbc.gridx ++; add(browse, gbc); ButtonGroup group = new ButtonGroup(); group.add(useSpecifiedJavaHome); group.add(useOpenDSJavaHome); gbc.insets.top = 10; gbc.insets.left = 0; gbc.gridx = 0; gbc.gridwidth = 5; gbc.gridy ++; add(new JSeparator(), gbc); gbc.gridy ++; JPanel p = new JPanel(new GridBagLayout()); p.setOpaque(false); gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; add(p, gbc); gbc.insets.top = 10; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; lJavaArgs = Utilities.createPrimaryLabel( INFO_CTRL_PANEL_JAVA_ARGUMENTS_LABEL.get()); useSpecifiedJavaArgs = Utilities.createRadioButton(LocalizableMessage.EMPTY); useSpecifiedJavaArgs.getAccessibleContext().setAccessibleName( INFO_CTRL_PANEL_USE_OPENDS_JAVA_ARGS.get() + " "+INFO_CTRL_PANEL_USE_OPENDS_JAVA_ARGS_HELP.get()); useSpecifiedJavaArgs.setOpaque(false); useOpenDSJavaArgs = Utilities.createRadioButton(LocalizableMessage.EMPTY); useOpenDSJavaArgs.setOpaque(false); lJavaArgs.setLabelFor(useOpenDSJavaArgs); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0.0; gbc.insets.top = 10; p.add(lJavaArgs, gbc); gbc.insets.left = 10; gbc.gridx ++; gbc.gridwidth = 1; p.add(useOpenDSJavaArgs, gbc); gbc.gridx ++; LabelWithHelpIcon useOpenDSJavaArgsLabel = new LabelWithHelpIcon( INFO_CTRL_PANEL_USE_OPENDS_JAVA_ARGS.get(), INFO_CTRL_PANEL_USE_OPENDS_JAVA_ARGS_HELP.get()); gbc.insets.left = 0; p.add(useOpenDSJavaArgsLabel, gbc); gbc.gridx = 1; gbc.gridy ++; gbc.insets.top = 10; gbc.insets.left = 10; p.add(useSpecifiedJavaArgs, gbc); useOpenDSJavaArgsLabel.setLabelFor(useSpecifiedJavaArgs); useSpecifiedJavaArgs.getAccessibleContext().setAccessibleName( INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS.get() + " "+INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS_HELP.get()); gbc.gridx ++; LabelWithHelpIcon useSpecifiedJavaArgsLabel = new LabelWithHelpIcon( INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS.get(), INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS_HELP.get()); gbc.insets.left = 0; p.add(useSpecifiedJavaArgsLabel, gbc); group = new ButtonGroup(); group.add(useSpecifiedJavaArgs); group.add(useOpenDSJavaArgs); useSpecifiedJavaArgsLabel.setLabelFor(useOpenDSJavaArgs); argumentsTableModel = new JavaArgumentsTableModel(); LDAPEntryTableCellRenderer renderer = new LDAPEntryTableCellRenderer(); argumentsTable = Utilities.createSortableTable(argumentsTableModel, renderer); editor = new AttributeCellEditor(); if (getInfo() != null) { editor.setInfo(getInfo()); } argumentsTable.getColumnModel().getColumn(1).setCellEditor(editor); renderer.setTable(argumentsTable); gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.gridx = 1; gbc.insets.top = 10; gbc.gridy ++; gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 2; argumentsScroll = Utilities.createScrollPane(argumentsTable); p.add(argumentsScroll, gbc); lInitContents = Utilities.makePlainTextPane( READING_JAVA_SETTINGS.toString(), ColorAndFontConstants.defaultFont); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.CENTER; p.add(lInitContents, gbc); lInitContents.setVisible(false); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.WEST; showAll = Utilities.createCheckBox(INFO_CTRL_PANEL_DISPLAY_ALL_COMMAND_LINES.get()); showAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { editor.stopCellEditing(); currentJavaArguments = getCurrentJavaArguments(); argumentsTableModel.setData(filterJavaArguments(currentJavaArguments)); Utilities.updateTableSizes(argumentsTable, 7); } }); gbc.gridy ++; gbc.insets.top = 5; p.add(showAll, gbc); JLabel inlineHelp = Utilities.createInlineHelpLabel( INFO_CTRL_PANEL_ONLINE_COMMAND_HELP.get()); gbc.insets.top = 3; gbc.gridy ++; p.add(inlineHelp, gbc); inlineHelp = Utilities.createInlineHelpLabel( INFO_CTRL_PANEL_OFFLINE_COMMAND_HELP.get()); gbc.gridy ++; p.add(inlineHelp, gbc); // Just to create space. Set<JavaArgumentsDescriptor> fakeArguments = new HashSet<>(); fakeArguments.add( new JavaArgumentsDescriptor("start-ds", "-server -XM256j")); fakeArguments.add( new JavaArgumentsDescriptor("stop-ds", "-client")); fakeArguments.add( new JavaArgumentsDescriptor("import-ds.online", "-server")); fakeArguments.add( new JavaArgumentsDescriptor("import-ds.offline", "-server")); fakeArguments.add( new JavaArgumentsDescriptor("export-ds.online", "-server")); argumentsTableModel.setData(fakeArguments); Utilities.updateTableSizes(argumentsTable, 7); comps = new JComponent[] { javaHome, useOpenDSJavaHome, useSpecifiedJavaHome, browse, useOpenDSJavaArgs, useSpecifiedJavaArgs, showAll }; } @Override public void configurationChanged(ConfigurationChangeEvent ev) { final boolean isLocal = ev.getNewDescriptor().isLocal(); if (isLocal != previousLocal) { previousLocal = isLocal; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (!isLocal) { displayErrorMessage(INFO_CTRL_PANEL_SERVER_REMOTE_SUMMARY.get(), INFO_CTRL_PANEL_SERVER_MUST_BE_LOCAL_JAVA_PROPERTIES_SUMMARY.get()); setEnabledOK(false); } else { displayMainPanel(); setEnabledOK(true); } } }); } } @Override @@ -429,1015 +91,15 @@ { isLocal = getInfo().getServerDescriptor().isLocal(); } if (visible && isLocal && (!initialized || !updatedByUser())) if (visible && isLocal && !initialized) { initialized = true; initContents(); } } /** * Returns the names of all the command-line that can be displayed by this * panel. * @return the names of all the command-line that can be displayed by this * panel. */ private Set<String> getAllCommandLineNames() { return allScriptNames; } /** * Returns the names of the most important command-line to be displayed by * this panel. * @return the names of the most important command-line to be displayed by * this panel. */ private Set<String> getRelevantCommandLineNames() { return relevantScriptNames; } /** * Returns <CODE>true</CODE> if the user updated the contents and * <CODE>false</CODE> otherwise. * @return <CODE>true</CODE> if the user updated the contents and * <CODE>false</CODE> otherwise. */ private boolean updatedByUser() { return !javaHome.getText().equals(readJavaHome) || useOpenDSJavaHome.isSelected() != readUseOpenDSJavaHome || useOpenDSJavaArgs.isSelected() != readUseOpenDSJavaArgs || !readJavaArguments.equals(getCurrentJavaArguments()); } /** * Returns the java arguments specified by the user. * @return the java arguments specified by the user. */ private Set<JavaArgumentsDescriptor> getCurrentJavaArguments() { HashSet<JavaArgumentsDescriptor> args = new HashSet<>(currentJavaArguments); HashSet<JavaArgumentsDescriptor> tableArgs = new HashSet<>(); for (int i=0; i<argumentsTableModel.getRowCount(); i++) { tableArgs.add(argumentsTableModel.getJavaArguments(i)); } for (JavaArgumentsDescriptor arg : tableArgs) { JavaArgumentsDescriptor foundJavaArgument = null; for (JavaArgumentsDescriptor arg1 : args) { if (arg1.getCommandName().equals(arg.getCommandName())) { foundJavaArgument = arg1; break; } } if (foundJavaArgument != null) { args.remove(foundJavaArgument); } args.add(arg); } return args; } /** * Filters the provided list of java arguments depending on the showing * options (basically whether the 'Show All Command-lines' is selected or * not). * @param args the list of java arguments. * @return a list of filtered java arguments (the ones that must be displayed * in the table). */ private Set<JavaArgumentsDescriptor> filterJavaArguments( Set<JavaArgumentsDescriptor> args) { if (showAll.isSelected()) { return args; } else { Set<JavaArgumentsDescriptor> filteredArgs = new HashSet<>(); for (String relevantName : getRelevantCommandLineNames()) { for (JavaArgumentsDescriptor arg : args) { if (arg.getCommandName().equals(relevantName)) { filteredArgs.add(arg); break; } } } return filteredArgs; } } /** Inits the contents of the table in the background. */ private void initContents() { disableComponents(); BackgroundTask<Void> worker = new BackgroundTask<Void>() { @Override public Void processBackgroundTask() throws Throwable { String propertiesFile = getPropertiesFile(); Properties properties = new Properties(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(propertiesFile)); JavaPropertiesTool.updateProperties(reader, properties); } catch (Throwable t) { } finally { StaticUtils.close(reader); } String v = properties.getProperty("overwrite-env-java-home"); readUseOpenDSJavaHome = v == null || "false".equalsIgnoreCase(v.trim()); v = properties.getProperty("overwrite-env-java-args"); readUseOpenDSJavaArgs = v == null || "false".equalsIgnoreCase(v.trim()); readJavaHome = properties.getProperty("default.java-home"); if (readJavaHome == null) { for (String script : getAllCommandLineNames()) { readJavaHome = properties.getProperty(script+".java-home"); if (readJavaHome != null) { break; } } } readJavaArguments.clear(); for (String script : getAllCommandLineNames()) { v = properties.getProperty(script+".java-args"); if (v != null) { readJavaArguments.add(new JavaArgumentsDescriptor(script, v)); } else { readJavaArguments.add(new JavaArgumentsDescriptor(script, "")); } } return null; } @Override public void backgroundTaskCompleted(Void returnValue, Throwable t) { if (t == null) { updateContentsOfPanelWithReadValues(); Utilities.updateTableSizes(argumentsTable, 7); } else { String arg; if (t instanceof OpenDsException) { arg = ((OpenDsException)t).getMessageObject().toString(); } else { arg = t.toString(); } LocalizableMessage title = ERR_CTRL_PANEL_ERR_READING_JAVA_SETTINGS_SUMMARY.get(); LocalizableMessage details = ERR_CTRL_PANEL_READING_JAVA_SETTINGS_DETAILS.get(arg); updateErrorPane(errorPane, title, ColorAndFontConstants.errorTitleFont, details, errorPane.getFont()); packParentDialog(); errorPane.setVisible(true); } enableComponents(); } }; worker.startBackgroundTask(); } /** * Disables all the components. This is used when we are reading the * java settings in the background. */ private void disableComponents() { setEnabledOK(false); lInitContents.setVisible(true); argumentsScroll.setVisible(false); for (JComponent comp : comps) { comp.setEnabled(false); } } /** * Enables all the components. This is used when we are reading the * java settings in the background. */ private void enableComponents() { for (JComponent comp : comps) { comp.setEnabled(true); } lInitContents.setVisible(false); argumentsScroll.setVisible(true); setEnabledOK(true); } @Override public void cancelClicked() public void configurationChanged(final ConfigurationChangeEvent ev) { updateContentsOfPanelWithReadValues(); super.cancelClicked(); } @Override public void okClicked() { editor.stopCellEditing(); final ArrayList<LocalizableMessage> javaHomeErrors = new ArrayList<>(); String f = javaHome.getText().trim(); if (f.length() > 0) { File file = new File(f); if (!file.exists()) { javaHomeErrors.add(ERR_CTRL_PANEL_JAVA_PATH_DOES_NOT_EXIST.get(f)); } else if (!file.isDirectory()) { javaHomeErrors.add(ERR_CTRL_PANEL_JAVA_PATH_NOT_A_DIRECTORY.get(f)); } else { File javaFile = getJavaFile(file); if (!javaFile.exists()) { javaHomeErrors.add(ERR_CTRL_PANEL_JAVA_BINARY_NOT_FOUND.get(javaFile)); } } } if (javaHomeErrors.isEmpty()) { final Set<String> providedArguments = new HashSet<>(); for (JavaArgumentsDescriptor cmd : getCurrentJavaArguments()) { String args = cmd.getJavaArguments().trim(); if (args.length() > 0) { providedArguments.add(args); } } disableComponents(); lInitContents.setText( INFO_CTRL_PANEL_CHECKING_JAVA_OPTIONS_SUMMARY.get().toString()); BackgroundTask<List<LocalizableMessage>> worker = new BackgroundTask<List<LocalizableMessage>>() { private boolean isConfirmation = false; @Override public List<LocalizableMessage> processBackgroundTask() throws Throwable { String[] jvms; String userJVM = javaHome.getText(); ArrayList<LocalizableMessage> errorMessages = new ArrayList<>(); ArrayList<LocalizableMessage> confirmationMessages = new ArrayList<>(); String defaultJVM = System.getenv(SetupUtils.OPENDJ_JAVA_HOME); if (defaultJVM == null) { defaultJVM = System.getProperty("java.home"); } if (useSpecifiedJavaHome.isSelected()) { jvms = new String[]{userJVM}; } else if (userJVM != null && userJVM.trim().length() > 0) { jvms = new String[]{defaultJVM, userJVM}; } else { jvms = new String[]{defaultJVM}; } for (String jvm : jvms) { Set<String> notWorkingArgs = new HashSet<>(); String installPath = getInfo().getServerDescriptor(). getInstallPath(); if (!Utils.supportsOption("", jvm, installPath)) { if (jvm == userJVM && !useSpecifiedJavaHome.isSelected()) { errorMessages.add( ERR_CTRL_PANEL_NOT_WORKING_FALLBACK_JVM_DETAILS.get(jvm)); } else { errorMessages.add( ERR_CTRL_PANEL_NOT_WORKING_JVM_DETAILS.get(jvm)); } } else { for (String arg : providedArguments) { if (!Utils.supportsOption(arg, jvm, installPath)) { notWorkingArgs.add(arg); } } } if (!notWorkingArgs.isEmpty()) { File javaFile = getJavaFile(new File(jvm)); LocalizableMessage confirmationMessage; if (useSpecifiedJavaArgs.isSelected()) { confirmationMessage = INFO_CTRL_PANEL_CONFIRM_NOT_WORKING_ARGUMENTS_DETAILS.get( javaFile, Utilities.getStringFromCollection(notWorkingArgs, "<br>-")); } else { confirmationMessage = INFO_CTRL_PANEL_CONFIRM_NOT_WORKING_FALLBACK_ARGUMENTS_DETAILS.get( javaFile, Utilities.getStringFromCollection(notWorkingArgs, "<br>-")); } confirmationMessages.add(confirmationMessage); } } isConfirmation = errorMessages.isEmpty(); if (!errorMessages.isEmpty()) { return errorMessages; } else { return confirmationMessages; } } @Override public void backgroundTaskCompleted(List<LocalizableMessage> returnValue, Throwable t) { if (t == null) { boolean confirm = false; if (isConfirmation && !returnValue.isEmpty()) { confirm = displayConfirmationDialog( INFO_CTRL_PANEL_CONFIRMATION_REQUIRED_SUMMARY.get(), returnValue.iterator().next()); } else if (!isConfirmation && !returnValue.isEmpty()) { displayErrorDialog(returnValue); } else { confirm = true; } if (confirm) { launchTask(); } } else { String arg; if (t instanceof OpenDsException) { arg = ((OpenDsException)t).getMessageObject().toString(); } else { arg = t.toString(); } LocalizableMessage title = ERR_CTRL_PANEL_ERROR_CHECKING_JAVA_SETTINGS_SUMMARY.get(); LocalizableMessage details = ERR_CTRL_PANEL_ERROR_CHECKING_JAVA_SETTINGS_DETAILS.get(arg); updateErrorPane(errorPane, title, ColorAndFontConstants.errorTitleFont, details, errorPane.getFont()); packParentDialog(); errorPane.setVisible(true); } enableComponents(); lInitContents.setText(READING_JAVA_SETTINGS.toString()); } }; worker.startBackgroundTask(); return; } else { if (useSpecifiedJavaHome.isSelected()) { displayErrorDialog(javaHomeErrors); } else { ArrayList<String> s = new ArrayList<>(); for (LocalizableMessage msg : javaHomeErrors) { s.add(msg.toString()); } ArrayList<LocalizableMessage> msgs = new ArrayList<>(); LocalizableMessage msg = ERR_CTRL_PANEL_GENERIC_ERROR_FALLBACK_JAVAHOME.get( f, Utilities.getStringFromCollection(s, "<br>-")); msgs.add(msg); displayErrorDialog(msgs); } } } /** * Returns the java binary (the executable) for a given java home. * @param javaHome the java home. * @return the java binary (the executable) for the provided java home. */ private File getJavaFile(File javaHome) { File javaFile = new File(javaHome, "bin"); if (isWindows()) { javaFile = new File(javaFile, "java.exe"); } else { javaFile = new File(javaFile, "java"); } return javaFile; } private void launchTask() { ArrayList<LocalizableMessage> errors = new ArrayList<>(); ProgressDialog dlg = new ProgressDialog( Utilities.createFrame(), Utilities.getParentDialog(this), INFO_CTRL_PANEL_JAVA_PROPERTIES_TITLE.get(), getInfo()); JavaPropertiesTask newTask = new JavaPropertiesTask(getInfo(), dlg); for (Task task : getInfo().getTasks()) { task.canLaunch(newTask, errors); } if (errors.isEmpty()) { launchOperation(newTask, INFO_CTRL_PANEL_UPDATING_JAVA_SETTINGS_SUMMARY.get(), INFO_CTRL_PANEL_UPDATING_JAVA_SETTINGS_COMPLETE.get(), INFO_CTRL_PANEL_UPDATING_JAVA_SETTINGS_SUCCESSFUL.get(), ERR_CTRL_PANEL_UPDATING_JAVA_SETTINGS_ERROR_SUMMARY.get(), ERR_CTRL_PANEL_UPDATING_JAVA_SETTINGS_ERROR_DETAILS.get(), ERR_CTRL_PANEL_UPDATING_JAVA_SETTINGS_ERROR_CODE, dlg); dlg.setVisible(true); Utilities.getParentDialog(this).setVisible(false); readJavaHome = javaHome.getText(); readUseOpenDSJavaHome = useOpenDSJavaHome.isSelected(); readUseOpenDSJavaArgs = useOpenDSJavaArgs.isSelected(); readJavaArguments = getCurrentJavaArguments(); } else { displayErrorDialog(errors); } } /** * Returns the file containing the java properties. * @return the file containing the java properties. */ private String getPropertiesFile() { String installPath = getInfo().getServerDescriptor().getInstancePath(); return Utils.getPath( Utilities.getInstanceRootDirectory(installPath).getAbsolutePath(), Installation.RELATIVE_JAVA_PROPERTIES_FILE); } private void updateContentsOfPanelWithReadValues() { if (readJavaHome != null) { javaHome.setText(readJavaHome); } else { javaHome.setText(""); } useOpenDSJavaHome.setSelected(readUseOpenDSJavaHome); useSpecifiedJavaHome.setSelected(!readUseOpenDSJavaHome); useOpenDSJavaArgs.setSelected(readUseOpenDSJavaArgs); useSpecifiedJavaArgs.setSelected(!readUseOpenDSJavaArgs); currentJavaArguments.clear(); currentJavaArguments.addAll(readJavaArguments); argumentsTableModel.setData( filterJavaArguments(currentJavaArguments)); } /** Class containing the command-name and the associated java arguments. */ private class JavaArgumentsDescriptor { private String commandName; private String javaArguments; private int hashCode; private String toString; /** * Constructor of the arguments descriptor. * @param commandName the command-line name. * @param javaArguments the java arguments. */ public JavaArgumentsDescriptor(String commandName, String javaArguments) { this.commandName = commandName; this.javaArguments = javaArguments; hashCode = commandName.hashCode() + javaArguments.hashCode(); toString = commandName+ ": " +javaArguments; } /** * Returns the command-line name. * @return the command-line name. */ public String getCommandName() { return commandName; } /** * Returns the java arguments associated with the command-line. * @return the java arguments associated with the command-line. */ public String getJavaArguments() { return javaArguments; } @Override public int hashCode() { return hashCode; } @Override public String toString() { return toString; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof JavaArgumentsDescriptor)) { return false; } JavaArgumentsDescriptor desc = (JavaArgumentsDescriptor)o; return commandName.equals(desc.getCommandName()) && javaArguments.equals(desc.getJavaArguments()); } } /** The table model used to display the java arguments. */ private class JavaArgumentsTableModel extends SortableTableModel implements Comparator<JavaArgumentsDescriptor> { private static final long serialVersionUID = 8288418995255677560L; private final Set<JavaArgumentsDescriptor> data = new HashSet<>(); private final ArrayList<String[]> dataArray = new ArrayList<>(); private final ArrayList<JavaArgumentsDescriptor> argsArray = new ArrayList<>(); private final String[] COLUMN_NAMES = new String[] { getHeader(INFO_CTRL_PANEL_COMMAND_LINE_NAME_COLUMN.get(), 40), getHeader(INFO_CTRL_PANEL_JAVA_ARGUMENTS_COLUMN.get(), 40)}; private int sortColumn; private boolean sortAscending = true; /** * Sets the data for this table model. * @param newData the data for this table model. */ public void setData(Set<JavaArgumentsDescriptor> newData) { if (!newData.equals(data)) { data.clear(); data.addAll(newData); updateDataArray(); fireTableDataChanged(); } } /** * Compares two java argument descriptors. * @param desc1 the first java argument descriptor. * @param desc2 the second java argument descriptor. * @return 1 if in terms of comparison the first element goes higher than * the second one. Returns 0 if both elements are equal in terms of * comparison. Returns -1 if the second element goes higher than the first * one. */ @Override public int compare(JavaArgumentsDescriptor desc1, JavaArgumentsDescriptor desc2) { int result; int[] possibleResults = { desc1.getCommandName().compareTo(desc2.getCommandName()), desc1.getJavaArguments().compareTo(desc2.getJavaArguments())}; result = possibleResults[sortColumn]; if (result == 0) { for (int i : possibleResults) { if (i != 0) { result = i; break; } } } if (!sortAscending) { result = -result; } return result; } /** * Updates the table model contents and sorts its contents depending on the * sort options set by the user. */ @Override public void forceResort() { updateDataArray(); fireTableDataChanged(); } @Override public int getColumnCount() { return COLUMN_NAMES.length; } @Override public int getRowCount() { return dataArray.size(); } @Override public Object getValueAt(int row, int col) { return dataArray.get(row)[col]; } @Override public String getColumnName(int col) { return COLUMN_NAMES[col]; } /** * Returns the java argument descriptor in the provided row. * @param row the row number. * @return the java argument descriptor in the provided row. */ private JavaArgumentsDescriptor getJavaArguments(int row) { return argsArray.get(row); } /** * Returns whether the sort is ascending or descending. * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> * otherwise. */ @Override public boolean isSortAscending() { return sortAscending; } /** * Sets whether to sort ascending of descending. * @param sortAscending whether to sort ascending or descending. */ @Override public void setSortAscending(boolean sortAscending) { this.sortAscending = sortAscending; } /** * Returns the column index used to sort. * @return the column index used to sort. */ @Override public int getSortColumn() { return sortColumn; } /** * Sets the column index used to sort. * @param sortColumn column index used to sort.. */ @Override public void setSortColumn(int sortColumn) { this.sortColumn = sortColumn; } @Override public boolean isCellEditable(int row, int col) { return col != 0; } @Override public void setValueAt(Object value, int row, int col) { dataArray.get(row)[col] = (String)value; JavaArgumentsDescriptor currentArg = argsArray.get(row); JavaArgumentsDescriptor newArg = new JavaArgumentsDescriptor(currentArg.getCommandName(), (String)value); argsArray.set(row, newArg); data.remove(currentArg); data.add(newArg); fireTableCellUpdated(row, col); } private void updateDataArray() { TreeSet<JavaArgumentsDescriptor> sortedSet = new TreeSet<>(this); sortedSet.addAll(data); dataArray.clear(); argsArray.clear(); for (JavaArgumentsDescriptor arg : sortedSet) { String[] s = getLine(arg); dataArray.add(s); argsArray.add(arg); } } /** * Returns an array of String with the String representation of the cells * in the table. * @param desc the java argument descriptor for which we want to get the * cells. * @return an array of String with the String representation of the cells * in the table. */ private String[] getLine(JavaArgumentsDescriptor desc) { String cmd = desc.getCommandName(); if (cmd.equalsIgnoreCase("start-ds")) { cmd = INFO_CTRL_PANEL_SERVER_RUNTIME_CELL.get( desc.getCommandName()).toString(); } else if (cmd.endsWith(".online")) { int index = cmd.lastIndexOf(".online"); cmd = INFO_CTRL_PANEL_ONLINE_COMMAND_LINE_CELL.get( cmd.substring(0, index)).toString(); } else if (desc.getCommandName().endsWith(".offline")) { int index = cmd.lastIndexOf(".offline"); cmd = INFO_CTRL_PANEL_OFFLINE_COMMAND_LINE_CELL.get( cmd.substring(0, index)).toString(); } return new String[] {cmd, desc.getJavaArguments()}; } } /** The task in charge of updating the java properties. */ private class JavaPropertiesTask extends Task { private final Set<String> backendSet; private String defaultJavaHome; private final boolean overwriteOpenDSJavaHome; private final boolean overwriteOpenDSJavaArgs; private final Set<JavaArgumentsDescriptor> arguments; /** * The constructor of the task. * @param info the control panel info. * @param dlg the progress dialog that shows the progress of the task. */ private JavaPropertiesTask(ControlPanelInfo info, ProgressDialog dlg) { super(info, dlg); backendSet = new HashSet<>(); defaultJavaHome = javaHome.getText().trim(); overwriteOpenDSJavaHome = useSpecifiedJavaHome.isSelected(); overwriteOpenDSJavaArgs = useSpecifiedJavaArgs.isSelected(); arguments = getCurrentJavaArguments(); } @Override public Type getType() { return Type.JAVA_SETTINGS_UPDATE; } @Override public Set<String> getBackends() { return backendSet; } @Override public LocalizableMessage getTaskDescription() { return INFO_CTRL_PANEL_UPDATE_JAVA_SETTINGS_TASK_DESCRIPTION.get(); } @Override public boolean canLaunch(Task taskToBeLaunched, Collection<LocalizableMessage> incompatibilityReasons) { if (!isServerRunning() && state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) { // All the operations are incompatible if they apply to this // backend for safety. This is a short operation so the limitation // has not a lot of impact. Set<String> backends = new TreeSet<>(taskToBeLaunched.getBackends()); backends.retainAll(getBackends()); if (!backends.isEmpty()) { incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched)); return false; } } return true; } @Override protected String getCommandLinePath() { return null; } @Override protected ArrayList<String> getCommandLineArguments() { return new ArrayList<>(); } @Override public void runTask() { state = State.RUNNING; lastException = null; try { returnCode = updateJavaSettings(); if (returnCode == 0) { state = State.FINISHED_SUCCESSFULLY; } else { state = State.FINISHED_WITH_ERROR; } } catch (Throwable t) { lastException = t; state = State.FINISHED_WITH_ERROR; } } private int updateJavaSettings() throws IOException { final String propertiesFile = getPropertiesFile(); ArrayList<String> commentLines = new ArrayList<>(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(propertiesFile)); String line; while ((line = reader.readLine()) != null) { String trimmedLine = line.trim(); if (trimmedLine.startsWith("#") || trimmedLine.length() == 0) { commentLines.add(line); } else { break; } } } catch (IOException ioe) { // Not critical. } finally { StaticUtils.close(reader); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(propertiesFile, false)); for (String comment : commentLines) { writer.write(comment); writer.newLine(); } writer.newLine(); writer.write("overwrite-env-java-home="+overwriteOpenDSJavaHome); writer.newLine(); writer.write("overwrite-env-java-args="+overwriteOpenDSJavaArgs); writer.newLine(); writer.newLine(); if (defaultJavaHome != null && defaultJavaHome.length() > 0) { writer.write("default.java-home="+defaultJavaHome); writer.newLine(); writer.newLine(); } for (JavaArgumentsDescriptor desc : arguments) { String args = desc.getJavaArguments(); if (args.trim().length() > 0) { writer.newLine(); writer.write(desc.getCommandName()+".java-args="+args); } } } finally { StaticUtils.close(writer); } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { getProgressDialog().appendProgressHtml(Utilities.applyFont( INFO_CTRL_PANEL_EQUIVALENT_ACTION_TO_UPDATE_JAVA_PROPERTIES.get( propertiesFile, getCommandLinePath("dsjavaproperties")). toString(), ColorAndFontConstants.progressFont)); } }); // Launch the script String[] args = { "--quiet" }; return JavaPropertiesTool.mainCLI(args); } // Nothing to do } } opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -1500,6 +1500,7 @@ } argList.add("-F"); argList.add("-Q"); argList.add("--offline"); argList.add("--noPropertiesFile"); final String[] args = new String[argList.size()]; @@ -1587,6 +1588,7 @@ } List<String> argList = new ArrayList<>(); argList.add("--offline"); argList.add("-n"); argList.add(ROOT_BACKEND_NAME); for (String ldifPath : ldifPaths) @@ -1711,6 +1713,7 @@ setNotifyListeners(false); } final List<String> argList = new ArrayList<>(); argList.add("--offline"); argList.add("-n"); argList.add(ROOT_BACKEND_NAME); argList.add("-A"); opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
@@ -79,7 +79,6 @@ import org.opends.server.core.DirectoryServer; import org.opends.server.tools.ConfigureDS; import org.opends.server.tools.ConfigureWindowsService; import org.opends.server.tools.JavaPropertiesTool; import org.opends.server.types.HostPort; import org.opends.server.types.LDIFExportConfig; import org.opends.server.types.OpenDsException; @@ -987,15 +986,6 @@ } final String destinationFile = Utils.getPath(libDir, isWindows() ? SET_JAVA_PROPERTIES_FILE_WINDOWS : SET_JAVA_PROPERTIES_FILE_UNIX); // Launch the script int returnValue = JavaPropertiesTool.mainCLI( "--propertiesFile", propertiesFile, "--destinationFile", destinationFile, "--quiet"); if (JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL.getReturnCode() != returnValue && JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode() != returnValue) { logger.warn(LocalizableMessage.raw("Error creating java home scripts, error code: " + returnValue)); throw new IOException(ERR_ERROR_CREATING_JAVA_HOME_SCRIPTS.get(returnValue).toString()); } } /** opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
@@ -292,8 +292,7 @@ // Encryption or signing requires the ADS backend be available for // CryptoManager access to secret key entries. If no connection arguments // are present, infer an offline backup. if ((encrypt.isPresent() || signHash.isPresent()) && ! argParser.connectionArgumentsPresent()) { if ((encrypt.isPresent() || signHash.isPresent()) && runOffline()) { argParser.displayMessageAndUsageReference(err, ERR_BACKUPDB_ENCRYPT_OR_SIGN_REQUIRES_ONLINE.get( encrypt.getLongIdentifier(), signHash.getLongIdentifier())); return 1; opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -217,7 +217,7 @@ // Count rejects option requires the ability to return result codes // which are potentially greater than 1. This is not supported by // the task framework. if (countRejects.isPresent() && argParser.connectionArgumentsPresent()) if (countRejects.isPresent() && !runOffline()) { argParser.displayMessageAndUsageReference(err, ERR_LDIFIMPORT_COUNT_REJECTS_REQUIRES_OFFLINE.get( countRejects.getLongIdentifier())); opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java
File was deleted opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
File was deleted opendj-server-legacy/src/main/java/org/opends/server/tools/RestoreDB.java
@@ -219,7 +219,7 @@ } if (listBackups.isPresent() && argParser.connectionArgumentsPresent()) { if (listBackups.isPresent() && !runOffline()) { printWrappedText(err, ERR_LDAP_CONN_INCOMPATIBLE_ARGS.get(listBackups.getLongIdentifier())); return 1; } opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskTool.java
@@ -87,10 +87,8 @@ private TaskScheduleArgs taskScheduleArgs; /** * Argument used to know whether we must test if we must run in off-line mode. */ private BooleanArgument testIfOfflineArg; /** Argument used to know if the tool should be run in offline mode. */ private BooleanArgument runOfflineArg; /** This CLI is always using the administration connector with SSL. */ private static final boolean alwaysSSL = true; @@ -158,11 +156,9 @@ argParser.addArgument(arg, taskGroup); } testIfOfflineArg = BooleanArgument.builder("testIfOffline") .description(INFO_DESCRIPTION_TEST_IF_OFFLINE.get()) .hidden() .buildAndAddToParser(argParser); runOfflineArg = BooleanArgument.builder("offline") .description(INFO_DESCRIPTION_RUN_OFFLINE.get()) .buildAndAddToParser(argParser); } catch (ArgumentException e) { // should never happen } @@ -181,7 +177,7 @@ */ protected void validateTaskArgs() throws ArgumentException, ClientException { if (isRemoteTask()) if (!runOffline()) { taskScheduleArgs.validateArgs(); } @@ -243,19 +239,7 @@ protected int process(LDAPConnectionArgumentParser argParser, boolean initializeServer, PrintStream out, PrintStream err) { if (testIfOffline()) { if (!isRemoteTask()) { return RUN_OFFLINE; } else { return RUN_ONLINE; } } if (!isRemoteTask()) if (runOffline()) { try { @@ -372,10 +356,6 @@ } } private boolean isRemoteTask() { return argParser.connectionArgumentsPresent(); } /** * Returns {@code true} if the provided exception was caused by trying to * connect to the wrong port and {@code false} otherwise. @@ -410,14 +390,9 @@ * @return <CODE>true</CODE> if we must return if the command must be run in * off-line mode and <CODE>false</CODE> otherwise. */ public boolean testIfOffline() public boolean runOffline() { boolean returnValue = false; if (testIfOfflineArg != null) { returnValue = testIfOfflineArg.isPresent(); } return returnValue; return runOfflineArg.isPresent(); } /** opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java
@@ -133,10 +133,6 @@ "ds-cfg-java-class: org.opends.server.extensions.PKCS5S2PasswordStorageScheme", "ds-cfg-enabled: true")); /* See OPENDJ-1322 and OPENDJ-1067 */ register("2.8.0", rerunJavaPropertiesTool(INFO_UPGRADE_TASK_9206_SUMMARY.get())); register("2.8.0", modifyConfigEntry(INFO_UPGRADE_TASK_10214_SUMMARY.get(), "(ds-cfg-java-class=org.opends.server.loggers.debug.TextDebugLogPublisher)", @@ -611,9 +607,7 @@ "objectClass: ds-cfg-local-backend") ); register("4.0.0", moveSubordinateBaseDnToGlobalConfiguration()); register("4.0.0", removeTools("ldif-diff", "make-ldif") ); register("4.0.0", removeTools("ldif-diff", "make-ldif", "dsjavaproperties")); /* All upgrades will refresh the server configuration schema and generate a new upgrade folder. */ registerLast( opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -66,7 +66,6 @@ import org.forgerock.opendj.ldif.EntryReader; import org.forgerock.opendj.ldif.LDIFEntryReader; import org.opends.server.backends.pluggable.spi.TreeName; import org.opends.server.tools.JavaPropertiesTool; import org.opends.server.tools.RebuildIndex; import org.opends.server.util.BuildVersion; import org.opends.server.util.ChangeOperationType; @@ -407,42 +406,6 @@ } /** * Re-run the dsjavaproperties tool to rewrite the set-java-home script/batch file. * * @param summary * The summary of the task. * @return An upgrade task which runs dsjavaproperties. */ static UpgradeTask rerunJavaPropertiesTool(final LocalizableMessage summary) { return new AbstractUpgradeTask() { @Override public void perform(UpgradeContext context) throws ClientException { logger.debug(summary); final ProgressNotificationCallback pnc = new ProgressNotificationCallback(INFORMATION, summary, 50); context.notifyProgress(pnc); int returnValue = JavaPropertiesTool.mainCLI("--quiet"); context.notifyProgress(pnc.setProgress(100)); if (JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL.getReturnCode() != returnValue && JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode() != returnValue) { throw new ClientException(ReturnCode.ERROR_UNEXPECTED, ERR_UPGRADE_DSJAVAPROPERTIES_FAILED.get()); } } @Override public String toString() { return String.valueOf(summary); } }; } /** * Creates a group of tasks which will only be invoked if the current version * is more recent than the provided version. This may be useful in cases where * a regression was introduced in version X and resolved in a later version Y. opendj-server-legacy/src/main/java/org/opends/server/util/cli/LDAPConnectionArgumentParser.java
@@ -84,18 +84,6 @@ } /** * Indicates whether the user has indicated that they would like to * perform a remote operation based on the arguments. * * @return true if the user wants to perform a remote operation; false * otherwise */ public boolean connectionArgumentsPresent() { return args != null && args.argumentsPresent(); } /** * Creates a new LDAPConnection and invokes a connect operation using * information provided in the parsed set of arguments that were provided by * the user. opendj-server-legacy/src/messages/org/opends/messages/admin_tool.properties
@@ -2927,3 +2927,5 @@ ERROR_RESET_CHANGE_NUMBER_SERVERS_BASEDNS_DIFFER=Cannot reset change-log change number because replicated baseDNs \ on server %s and server %s differ. Since the change number is computed across all the replicated baseDNs, \ the change-log change number can only be reset between two replication servers replicating the exact same baseDNs. INFO_CTRL_PANEL_EDIT_JAVA_PROPERTIES_FILE=To edit default java home and JVM runtime arguments please edit \ content of the [INSTANCE_ROOT]/config/java.properties file opendj-server-legacy/src/messages/org/opends/messages/tool.properties
@@ -1977,8 +1977,7 @@ INFO_JAVAPROPERTIES_SUCCESSFUL_1495=The operation was successful. The server \ commands will use the java arguments and java home specified in the \ properties file located in %s INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=When this is set test if the command \ must be run in offline or online mode, returning the appropriate error code INFO_DESCRIPTION_RUN_OFFLINE_1496=Indicates that the command must be run in offline mode ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=The backend ID '%s' has been \ specified several times ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=ERROR: The empty LDAP DN is not \ opendj-server-legacy/src/messages/org/opends/messages/tool_de.properties
@@ -956,7 +956,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=Die Zieldatei "%s" kann nicht geschrieben werden. Stellen Sie sicher, dass Sie die Leserechte hierf\u00fcr besitzen INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=Die Skriptdatei %s wurde erfolgreich erstellt. Um in den Befehlzeilen die in %s festgelegten Java-Eigenschaften verwenden zu k\u00f6nnen, m\u00fcssen Sie die erstellte Skriptdatei nach %s kopieren INFO_JAVAPROPERTIES_SUCCESSFUL_1495=Der Vorgang war erfolgreich. Die Server-Befehle verwenden die Java-Argumente und Java-Home, die in der Eigenschaftendatei in %s festgelegt sind INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=Wenn dies gesetzt ist, pr\u00fcfen Sie, ob der Befehl im Offline- oder Online-Modus ausgef\u00fchrt werden muss und den dazugeh\u00f6rigen Fehlercode zur\u00fcckgibt ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=Die Backend-ID '%s' wurde mehrmals angegeben ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=FEHLER: Ein leerer LDAP-Wert ist kein g\u00fcltiger Wert opendj-server-legacy/src/messages/org/opends/messages/tool_es.properties
@@ -956,7 +956,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=El archivo de destino "%s" no puede escribirse. Compruebe si tiene derechos de lectura para esto INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=El archivo de secuencia de comandos %s se ha creado correctamente. Para que las l\u00edneas de comandos utilicen las propiedades Java especificadas en %s debe copiar el archivo de secuencia de comandos en %s INFO_JAVAPROPERTIES_SUCCESSFUL_1495=La operaci\u00f3n se ha realizado correctamente. Los comandos del servidor utilizar\u00e1n los argumentos Java e inicio de Java especificados en el archivo de propiedades ubicado en %s INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=Cuando se establezca compruebe si el comando se debe ejecutar en modo con conexi\u00f3n o sin conexi\u00f3n, devolviendo el c\u00f3digo de error adecuado ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=El Id. de backend '%s' se ha especificado varias veces ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=ERROR: El ND de LDAP vac\u00edo no es un valor v\u00e1lido opendj-server-legacy/src/messages/org/opends/messages/tool_fr.properties
@@ -956,7 +956,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=Impossible d'\u00e9crire le fichier de destination "%s". V\u00e9rifiez que vous disposez de droits de lecture le concernant INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=Le fichier script %s a \u00e9t\u00e9 cr\u00e9\u00e9 avec succ\u00e8s. Pour que les lignes de commandes utilisent les propri\u00e9t\u00e9s Java sp\u00e9cifi\u00e9s dans %s, vous devez copier le fichier script cr\u00e9\u00e9 dans %s INFO_JAVAPROPERTIES_SUCCESSFUL_1495=L'op\u00e9ration a r\u00e9ussi. Les commandes du serveur vont utiliser les arguments et le r\u00e9pertoire d'installation de Java sp\u00e9cifi\u00e9s dans le fichier de propri\u00e9t\u00e9s situ\u00e9 dans %s INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=Une fois d\u00e9fini, testez si la commande doit s'ex\u00e9cuter en mode hors ligne ou en ligne, selon le code d'erreur appropri\u00e9 renvoy\u00e9 ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=L'ID de backend '%s' a \u00e9t\u00e9 sp\u00e9cifi\u00e9 plusieurs fois ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=ERREUR\u00a0: Le DN de LDAP vide n'est pas une valeur valide opendj-server-legacy/src/messages/org/opends/messages/tool_ja.properties
@@ -956,7 +956,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=\u30bf\u30fc\u30b2\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb "%s" \u306b\u66f8\u304d\u8fbc\u3081\u307e\u305b\u3093\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u3059\u308b\u8aad\u307f\u53d6\u308a\u6a29\u9650\u304c\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044 INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb %s \u306e\u4f5c\u6210\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002 %s \u3067\u6307\u5b9a\u3055\u308c\u305f java \u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u3092\u30b3\u30de\u30f3\u30c9\u884c\u3067\u4f7f\u7528\u3059\u308b\u306b\u306f\u3001\u4f5c\u6210\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3092 %s \u306b\u30b3\u30d4\u30fc\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059 INFO_JAVAPROPERTIES_SUCCESSFUL_1495=\u64cd\u4f5c\u304c\u6210\u529f\u3057\u307e\u3057\u305f\u3002 \u30b5\u30fc\u30d0\u30fc\u30b3\u30de\u30f3\u30c9\u306f\u3001%s \u306b\u3042\u308b\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u30d5\u30a1\u30a4\u30eb\u3067\u6307\u5b9a\u3055\u308c\u305f java \u5f15\u6570\u304a\u3088\u3073 java \u30db\u30fc\u30e0\u3092\u4f7f\u7528\u3057\u307e\u3059 INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=\u3053\u308c\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u30b3\u30de\u30f3\u30c9\u3092\u30aa\u30d5\u30e9\u30a4\u30f3\u30e2\u30fc\u30c9\u3068\u30aa\u30f3\u30e9\u30a4\u30f3\u30e2\u30fc\u30c9\u306e\u3069\u3061\u3089\u3067\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3092\u30c6\u30b9\u30c8\u3057\u3066\u9069\u5207\u306a\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u8fd4\u3057\u307e\u3059 ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 ID '%s' \u306f\u8907\u6570\u56de\u6307\u5b9a\u3055\u308c\u307e\u3057\u305f ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=\u30a8\u30e9\u30fc: \u7a7a\u306e LDAP DN \u306f\u6709\u52b9\u306a\u5024\u3067\u306f\u3042\u308a\u307e\u305b\u3093 opendj-server-legacy/src/messages/org/opends/messages/tool_ko.properties
@@ -954,7 +954,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=\ub300\uc0c1 \ud30c\uc77c \"%s\"\uc5d0 \uc4f8 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774 \ud30c\uc77c\uc744 \uc77d\uc744 \uc218 \uc788\ub294 \uad8c\ud55c\uc774 \uc788\ub294\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624. INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=\uc2a4\ud06c\ub9bd\ud2b8 \ud30c\uc77c %s\uc744(\ub97c) \ub9cc\ub4e4\uc5c8\uc2b5\ub2c8\ub2e4. \uba85\ub839\uc904\uc5d0\uc11c %s\uc5d0 \uc9c0\uc815\ub41c java \ub4f1\ub85d \uc815\ubcf4\ub97c \uc0ac\uc6a9\ud558\ub824\uba74 \ub9cc\ub4e0 \uc2a4\ud06c\ub9bd\ud2b8 \ud30c\uc77c\uc744 %s\uc5d0 \ubcf5\uc0ac\ud574\uc57c \ud569\ub2c8\ub2e4. INFO_JAVAPROPERTIES_SUCCESSFUL_1495=\uc791\uc5c5\uc774 \uc131\uacf5\ud588\uc2b5\ub2c8\ub2e4. The server commands will use the java arguments and java home specified in the properties file located in %s INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=\uc774 \uac12\uc744 \uc124\uc815\ud560 \ub54c \uc801\uc808\ud55c \uc624\ub958 \ucf54\ub4dc\ub97c \ubc18\ud658\ud558\uc5ec \uba85\ub839\uc774 \uc624\ud504\ub77c\uc778 \ub610\ub294 \uc628\ub77c\uc778 \ubaa8\ub4dc\ub85c \uc2e4\ud589\ub418\ub294\uc9c0 \ud14c\uc2a4\ud2b8\ud569\ub2c8\ub2e4. ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=\ubc31\uc5d4\ub4dc \uc544\uc774\ub514 '%s'\uc744(\ub97c) \uc5ec\ub7ec \ubc88 \uc9c0\uc815\ud588\uc2b5\ub2c8\ub2e4. ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=\uc624\ub958: \ube48 LDAP DN\uc740 \uc720\ud6a8\ud55c \uac12\uc774 \uc544\ub2d9\ub2c8\ub2e4. opendj-server-legacy/src/messages/org/opends/messages/tool_zh_CN.properties
@@ -956,7 +956,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=\u65e0\u6cd5\u5199\u5165\u76ee\u6807\u6587\u4ef6 "%s"\u3002\u68c0\u67e5\u60a8\u662f\u5426\u6709\u6743\u9650\u8bfb\u53d6\u8be5\u6587\u4ef6 INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=\u5df2\u6210\u529f\u521b\u5efa\u811a\u672c\u6587\u4ef6 %s\u3002\u8981\u4f7f\u547d\u4ee4\u884c\u4f7f\u7528 %s \u4e2d\u6307\u5b9a\u7684 Java \u5c5e\u6027\uff0c\u5fc5\u987b\u5c06\u521b\u5efa\u7684\u811a\u672c\u6587\u4ef6\u590d\u5236\u5230 %s INFO_JAVAPROPERTIES_SUCCESSFUL_1495=\u64cd\u4f5c\u6210\u529f\u3002\u670d\u52a1\u5668\u547d\u4ee4\u5c06\u4f7f\u7528\u4f4d\u4e8e %s \u7684\u5c5e\u6027\u6587\u4ef6\u4e2d\u6307\u5b9a\u7684 Java \u53c2\u6570\u548c Java \u4e3b\u76ee\u5f55 INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=\u5982\u679c\u8bbe\u7f6e\u6b64\u9009\u9879\uff0c\u5219\u4f1a\u6d4b\u8bd5\u662f\u5fc5\u987b\u5728\u8131\u673a\u6a21\u5f0f\u8fd8\u662f\u5728\u8054\u673a\u6a21\u5f0f\u4e0b\u8fd0\u884c\u547d\u4ee4\uff0c\u4ee5\u8fd4\u56de\u76f8\u5e94\u7684\u9519\u8bef\u4ee3\u7801 ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=\u540e\u7aef ID '%s' \u5df2\u591a\u6b21\u6307\u5b9a ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=ERROR\uff1a\u7a7a LDAP DN \u4e0d\u662f\u6709\u6548\u503c opendj-server-legacy/src/messages/org/opends/messages/tool_zh_TW.properties
@@ -954,7 +954,6 @@ ERR_JAVAPROPERTIES_WRITING_DESTINATION_FILE_1493=\u7121\u6cd5\u5beb\u5165\u76ee\u6a19\u6a94\u6848\u300c%s\u300d\u3002\u8acb\u6aa2\u67e5\u60a8\u662f\u5426\u6709\u6b0a\u52a0\u4ee5\u8b80\u53d6 INFO_JAVAPROPERTIES_SUCCESSFUL_NON_DEFAULT_1494=\u5df2\u6210\u529f\u5efa\u7acb\u7a0b\u5e8f\u6a94\u6a94\u6848 %s\u3002\u82e5\u8981\u8b93\u6307\u4ee4\u884c\u4f7f\u7528 %s \u4e0a\u6240\u6307\u5b9a\u7684 java \u7279\u6027\uff0c\u60a8\u5fc5\u9808\u5c07\u5df2\u5efa\u7acb\u7684\u7a0b\u5e8f\u6a94\u6a94\u6848\u8907\u88fd\u5230 %s INFO_JAVAPROPERTIES_SUCCESSFUL_1495=\u4f5c\u696d\u5df2\u6210\u529f\u3002The server commands will use the java arguments and java home specified in the properties file located in %s INFO_DESCRIPTION_TEST_IF_OFFLINE_1496=\u8a2d\u5b9a\u5b8c\u6210\u5f8c\uff0c\u8acb\u6e2c\u8a66\u5fc5\u9808\u4ee5\u96e2\u7dda\u9084\u662f\u7dda\u4e0a\u6a21\u5f0f\u57f7\u884c\u6307\u4ee4\uff0c\u4ee5\u50b3\u56de\u9069\u7576\u7684\u932f\u8aa4\u78bc ERR_BACKUPDB_REPEATED_BACKEND_ID_1497=\u5f8c\u7aef ID\u300c%s\u300d\u5df2\u6307\u5b9a\u591a\u6b21 ERR_INSTALLDS_EMPTY_DN_RESPONSE_1498=\u932f\u8aa4\uff1a\u7a7a\u7684 LDAP DN \u4e0d\u662f\u6709\u6548\u503c opendj-server-legacy/src/test/java/org/opends/server/tools/ArgumentParserToolsTestCase.java
@@ -100,12 +100,6 @@ } @Test(dataProvider = "invalidArgs") public void testDSJavaProperties(final String[] args) { assertToolFailsWithUsage(JavaPropertiesTool.mainCLI(args, outStream, errStream, null)); } @Test(dataProvider = "invalidArgs") public void testDSReplication(final String[] args) { assertToolFailsWithUsage(ReplicationCliMain.mainCLI(args, false, outStream, errStream), ERRORS_ON_STDOUT); opendj-server-legacy/src/test/java/org/opends/server/tools/ImportLDIFTestCase.java
@@ -118,7 +118,8 @@ "-n", beID, "-i", "+" "+", "--offline" }; assertEquals(importLDIF(args), 0); // Expecting a non-empty reject file. @@ -149,7 +150,8 @@ "-n", beID, "-i", "*" "*", "--offline" }; assertEquals(importLDIF(args), 0); // Expecting an empty reject file. @@ -185,7 +187,8 @@ "-n", beID, "-R", rejectFilePath rejectFilePath, "--offline" }; assertEquals(importLDIF(args), 0); // Reject file should be empty. @@ -222,7 +225,8 @@ "-b", baseDN, "-R", rejectFilePath rejectFilePath, "--offline" }; assertEquals(importLDIF(args), 0); // Reject file should be empty. @@ -262,7 +266,8 @@ "-i", "*", "-e", "description" "description", "--offline" }; assertEquals(importLDIF(args), 0); @@ -294,7 +299,8 @@ "-R", rejectFilePath, "-e", "*" "*", "--offline" }; assertEquals(importLDIF(args), 0); @@ -326,7 +332,8 @@ "-R", rejectFilePath, "-e", "+" "+", "--offline" }; assertEquals(importLDIF(args), 0); assertRejectedFile(reject, true); @@ -359,7 +366,8 @@ "-i", "*", "-i", "creatorsname" "creatorsname", "--offline" }; assertEquals(importLDIF(args), 0); assertRejectedFile(reject, true); @@ -398,7 +406,8 @@ "-i", "sn", "-i", "creatorsname" "creatorsname", "--offline" }; assertEquals(importLDIF(args), 0); assertRejectedFile(reject, true); @@ -435,7 +444,8 @@ "-e", "givenName", "-e", "creatorsname" "creatorsname", "--offline" }; assertEquals(importLDIF(args), 0); assertRejectedFile(reject, true); opendj-server-legacy/src/test/java/org/opends/server/tools/RebuildIndexTestCase.java
@@ -81,7 +81,8 @@ final String[] args = { "-f",configFilePath, "-b", baseDN, "-i", "description" "-i", "description", "--offline" }; assertEquals(RebuildIndex.mainRebuildIndex(args, false, null, null), 1); } @@ -95,7 +96,8 @@ final String[] args = { "-f", configFilePath, "-b", baseDN, "-i", "ds-sync-hist" "-i", "ds-sync-hist", "--offline" }; assertEquals(RebuildIndex.mainRebuildIndex(args, false, null, null), 0); } @@ -106,7 +108,8 @@ final String[] args = { "-f", configFilePath, "-b", baseDN, "--rebuildDegraded" "--rebuildDegraded", "--offline" }; assertEquals(RebuildIndex.mainRebuildIndex(args, false, null, null), 0); }