From 3aea921de15933628ff1ac9f9b234a16b55ead35 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 27 Oct 2006 17:06:48 +0000
Subject: [PATCH] Make a number of changes to administrative batch files for Windows systems:

---
 opends/resource/bin/export-ldif.bat        |   29 --
 opends/resource/bin/stop-ds.bat            |   30 --
 opends/resource/bin/encode-password.bat    |   28 --
 opends/resource/bin/ldifsearch.bat         |   26 --
 opends/resource/bin/ldappasswordmodify.bat |   26 --
 opends/resource/bin/_server-script.bat     |   68 ++++++
 opends/resource/bin/restore.bat            |   29 --
 opends/resource/bin/ldapcompare.bat        |   26 --
 opends/resource/bin/_client-script.bat     |   68 ++++++
 opends/resource/bin/configure-ds.bat       |   28 --
 opends/resource/setup.bat                  |    4 
 opends/resource/bin/backup.bat             |   29 --
 opends/resource/bin/makeldif.bat           |   29 --
 opends/resource/bin/verify-index.bat       |   29 --
 opends/resource/bin/ldapdelete.bat         |   26 --
 opends/resource/bin/ldifmodify.bat         |   26 --
 opends/resource/bin/import-ldif.bat        |   29 --
 opends/resource/bin/ldapsearch.bat         |   26 --
 opends/resource/bin/ldapmodify.bat         |   26 --
 opends/resource/bin/ldif-diff.bat          |   26 --
 opends/resource/bin/start-ds.bat           |    9 
 21 files changed, 178 insertions(+), 439 deletions(-)

diff --git a/opends/resource/bin/_client-script.bat b/opends/resource/bin/_client-script.bat
new file mode 100644
index 0000000..5aa0f37
--- /dev/null
+++ b/opends/resource/bin/_client-script.bat
@@ -0,0 +1,68 @@
+
+@echo off
+rem CDDL HEADER START
+rem
+rem The contents of this file are subject to the terms of the
+rem Common Development and Distribution License, Version 1.0 only
+rem (the "License").  You may not use this file except in compliance
+rem with the License.
+rem
+rem You can obtain a copy of the license at
+rem trunk/opends/resource/legal-notices/OpenDS.LICENSE
+rem or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+rem See the License for the specific language governing permissions
+rem and limitations under the License.
+rem
+rem When distributing Covered Code, include this CDDL HEADER in each
+rem file and include the License file at
+rem trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+rem add the following below this CDDL HEADER, with the fields enclosed
+rem by brackets "[]" replaced with your own identifying * information:
+rem      Portions Copyright [yyyy] [name of copyright owner]
+rem
+rem CDDL HEADER END
+rem
+rem
+rem      Portions Copyright 2006 Sun Microsystems, Inc.
+
+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 INSTANCE_ROOT=%DIR_HOME%
+
+if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
+goto checkJavaBin
+
+:noInvokeClass
+echo Error:  OPENDS_INVOKE_CLASS environment variable is not set.
+goto end
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto noJavaBin
+goto setClassPath
+
+:noJavaBin
+if "%JAVA_HOME%" == "" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
+goto setClassPath
+
+:noJavaHome
+echo Error: JAVA_HOME environment variable is not set.
+echo        Please set it to a valid Java 5 installation.
+goto end
+
+
+:setClassPath
+FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
+
+set PATH=%SystemRoot%
+
+%JAVA_BIN% %JAVA_ARGS% %OPENDS_INVOKE_CLASS% %*
+
+
+:end
+
diff --git a/opends/resource/bin/_server-script.bat b/opends/resource/bin/_server-script.bat
new file mode 100644
index 0000000..e595ba9
--- /dev/null
+++ b/opends/resource/bin/_server-script.bat
@@ -0,0 +1,68 @@
+
+@echo off
+rem CDDL HEADER START
+rem
+rem The contents of this file are subject to the terms of the
+rem Common Development and Distribution License, Version 1.0 only
+rem (the "License").  You may not use this file except in compliance
+rem with the License.
+rem
+rem You can obtain a copy of the license at
+rem trunk/opends/resource/legal-notices/OpenDS.LICENSE
+rem or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+rem See the License for the specific language governing permissions
+rem and limitations under the License.
+rem
+rem When distributing Covered Code, include this CDDL HEADER in each
+rem file and include the License file at
+rem trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+rem add the following below this CDDL HEADER, with the fields enclosed
+rem by brackets "[]" replaced with your own identifying * information:
+rem      Portions Copyright [yyyy] [name of copyright owner]
+rem
+rem CDDL HEADER END
+rem
+rem
+rem      Portions Copyright 2006 Sun Microsystems, Inc.
+
+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 INSTANCE_ROOT=%DIR_HOME%
+
+if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
+goto checkJavaBin
+
+:noInvokeClass
+echo Error:  OPENDS_INVOKE_CLASS environment variable is not set.
+goto end
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto noJavaBin
+goto setClassPath
+
+:noJavaBin
+if "%JAVA_HOME%" == "" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
+goto setClassPath
+
+:noJavaHome
+echo Error: JAVA_HOME environment variable is not set.
+echo        Please set it to a valid Java 5 installation.
+goto end
+
+
+:setClassPath
+FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
+
+set PATH=%SystemRoot%
+
+%JAVA_BIN% %JAVA_ARGS% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+
+
+:end
+
diff --git a/opends/resource/bin/backup.bat b/opends/resource/bin/backup.bat
index b01fbbb..227d585 100644
--- a/opends/resource/bin/backup.bat
+++ b/opends/resource/bin/backup.bat
@@ -27,31 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.BackUpDB --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.BackUpDB"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/configure-ds.bat b/opends/resource/bin/configure-ds.bat
index b26808c..2612296 100755
--- a/opends/resource/bin/configure-ds.bat
+++ b/opends/resource/bin/configure-ds.bat
@@ -27,30 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.ConfigureDS --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.ConfigureDS"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/encode-password.bat b/opends/resource/bin/encode-password.bat
index 2fecaea..d95f0bf 100755
--- a/opends/resource/bin/encode-password.bat
+++ b/opends/resource/bin/encode-password.bat
@@ -27,30 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.EncodePassword --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.EncodePassword"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/export-ldif.bat b/opends/resource/bin/export-ldif.bat
index 9b8f924..229c0ea 100755
--- a/opends/resource/bin/export-ldif.bat
+++ b/opends/resource/bin/export-ldif.bat
@@ -27,31 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.ExportLDIF --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.ExportLDIF"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/import-ldif.bat b/opends/resource/bin/import-ldif.bat
index 648b6bb..cb05b2a 100755
--- a/opends/resource/bin/import-ldif.bat
+++ b/opends/resource/bin/import-ldif.bat
@@ -27,31 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.ImportLDIF --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.ImportLDIF"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/ldapcompare.bat b/opends/resource/bin/ldapcompare.bat
index db184c1..158145f 100755
--- a/opends/resource/bin/ldapcompare.bat
+++ b/opends/resource/bin/ldapcompare.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDAPCompare %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPCompare"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/ldapdelete.bat b/opends/resource/bin/ldapdelete.bat
index dcfd074..e1b946b 100755
--- a/opends/resource/bin/ldapdelete.bat
+++ b/opends/resource/bin/ldapdelete.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDAPDelete %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPDelete"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/ldapmodify.bat b/opends/resource/bin/ldapmodify.bat
index cd33ac0..a145f32 100755
--- a/opends/resource/bin/ldapmodify.bat
+++ b/opends/resource/bin/ldapmodify.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDAPModify %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPModify"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/ldappasswordmodify.bat b/opends/resource/bin/ldappasswordmodify.bat
index 985b251..94d43c7 100755
--- a/opends/resource/bin/ldappasswordmodify.bat
+++ b/opends/resource/bin/ldappasswordmodify.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDAPPasswordModify %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPPasswordModify"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/ldapsearch.bat b/opends/resource/bin/ldapsearch.bat
index 2f0aeef..aa4ad90 100755
--- a/opends/resource/bin/ldapsearch.bat
+++ b/opends/resource/bin/ldapsearch.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDAPSearch %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPSearch"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/ldif-diff.bat b/opends/resource/bin/ldif-diff.bat
index 3c120cf..3d80c69 100755
--- a/opends/resource/bin/ldif-diff.bat
+++ b/opends/resource/bin/ldif-diff.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDIFDiff %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDIFDiff"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/ldifmodify.bat b/opends/resource/bin/ldifmodify.bat
index cb6701b..e948fb8 100755
--- a/opends/resource/bin/ldifmodify.bat
+++ b/opends/resource/bin/ldifmodify.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDIFModify -c "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDIFModify"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/ldifsearch.bat b/opends/resource/bin/ldifsearch.bat
index bc41595..7622191 100755
--- a/opends/resource/bin/ldifsearch.bat
+++ b/opends/resource/bin/ldifsearch.bat
@@ -27,28 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.LDIFSearch %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDIFSearch"
+call %~dP0\_client-script.bat %*
 
diff --git a/opends/resource/bin/makeldif.bat b/opends/resource/bin/makeldif.bat
index 73054df..47e9123 100755
--- a/opends/resource/bin/makeldif.bat
+++ b/opends/resource/bin/makeldif.bat
@@ -27,31 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.makeldif.MakeLDIF --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --resourcePath "%DIR_HOME%\config\MakeLDIF" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.makeldif.MakeLDIF"
+call %~dP0\_server-script.bat --resourcePath "%~dP0..\config\MakeLDIF" %*
 
diff --git a/opends/resource/bin/restore.bat b/opends/resource/bin/restore.bat
index 738db37..85bc088 100644
--- a/opends/resource/bin/restore.bat
+++ b/opends/resource/bin/restore.bat
@@ -27,31 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.RestoreDB --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.RestoreDB"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/bin/start-ds.bat b/opends/resource/bin/start-ds.bat
index 95808d5..a103bc6 100755
--- a/opends/resource/bin/start-ds.bat
+++ b/opends/resource/bin/start-ds.bat
@@ -36,7 +36,7 @@
 :noJavaBin
 if "%JAVA_HOME%" == "" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
+set JAVA_BIN=%JAVA_HOME%\bin\java.exe
 goto setClassPath
 
 :noJavaHome
@@ -48,9 +48,12 @@
 :setClassPath
 FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
 
-cd %DIR_HOME%
+set PATH=%SystemRoot%
 
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+if not exist "%DIR_HOME%\logs\server.out" echo. > "%DIR_HOME%\logs\server.out"
+if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
+start "OpenDS %DIR_HOME%" /B "%JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
 
 
 :end
diff --git a/opends/resource/bin/stop-ds.bat b/opends/resource/bin/stop-ds.bat
index 09a66e0..a3afbb1 100755
--- a/opends/resource/bin/stop-ds.bat
+++ b/opends/resource/bin/stop-ds.bat
@@ -27,31 +27,5 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.StopDS %*
-
-
-:end
-
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.StopDS"
+call %~dP0\_client-script.bat %*
diff --git a/opends/resource/bin/verify-index.bat b/opends/resource/bin/verify-index.bat
index ea25a23..51f74a8 100644
--- a/opends/resource/bin/verify-index.bat
+++ b/opends/resource/bin/verify-index.bat
@@ -27,31 +27,6 @@
 
 setlocal
 
-set DIR_HOME=%~dP0..
-set INSTANCE_ROOT=%DIR_HOME%
-
-if "%JAVA_BIN%" == "" goto noJavaBin
-goto setClassPath
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN="%JAVA_HOME%\bin\java.exe"
-goto setClassPath
-
-:noJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo        Please set it to a valid Java 5 installation.
-goto end
-
-
-:setClassPath
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
-
-cd %DIR_HOME%
-
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.VerifyIndex --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-
-
-:end
+set OPENDS_INVOKE_CLASS="org.opends.server.tools.VerifyIndex"
+call %~dP0\_server-script.bat %*
 
diff --git a/opends/resource/setup.bat b/opends/resource/setup.bat
index 710f470..59bd8a0 100644
--- a/opends/resource/setup.bat
+++ b/opends/resource/setup.bat
@@ -47,9 +47,9 @@
 :setClassPath
 FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
 
-cd %DIR_HOME%
+set PATH=%SystemRoot%
 
-%JAVA_BIN% %JAVA_ARGS% -classpath "%CLASSPATH%" org.opends.server.tools.InstallDS --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" -P setup.bat %*
+%JAVA_BIN% %JAVA_ARGS% org.opends.server.tools.InstallDS --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" -P setup.bat %*
 
 
 :end

--
Gitblit v1.10.0