From d42b15e420478dc45785fff6e00b863cc1f8a0f9 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Thu, 18 Sep 2008 10:14:53 +0000
Subject: [PATCH] These changes are separating the current delivery into  an "Install Layout" (the binaries) and an "Instance Layout" (the user data).

---
 opends/src/server/org/opends/server/admin/ClassLoaderProvider.java                                                                   |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java                                        |    2 
 opends/resource/bin/stop-ds.bat                                                                                                      |   30 
 opends/resource/bin/_mixed-script.sh                                                                                                 |   22 
 opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java                                                |    9 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java                     |   16 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java                       |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/backends/LDIFBackendTestCase.java                                        |    2 
 opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java                                               |    9 
 opends/src/server/org/opends/server/tools/ImportLDIF.java                                                                            |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java                                            |    6 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java        |   24 
 opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java                                                           |    3 
 opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java                                                                       |    3 
 opends/src/server/org/opends/server/util/args/ArgumentParser.java                                                                    |    2 
 opends/src/server/org/opends/server/tasks/RestoreTask.java                                                                           |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java                                              |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/util/CertificateManagerTestCase.java                                     |    9 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPSearchTestCase.java                                            |   20 
 opends/resource/bin/_script-util.bat                                                                                                 |   31 
 opends/resource/bin/start-ds.bat                                                                                                     |   80 +-
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java                      |    4 
 opends/resource/bin/stop-ds                                                                                                          |   19 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java                                    |    3 
 opends/resource/bin/_script-util.sh                                                                                                  |   21 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java |   24 
 opends/src/quicksetup/org/opends/quicksetup/Installation.java                                                                        |  120 +++
 opends/src/server/org/opends/server/tools/CreateRCScript.java                                                                        |   12 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPCompareTestCase.java                                           |   20 
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java                                                       |  192 +++--
 opends/resource/setup.bat                                                                                                            |   15 
 opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java                                                            |  133 +++
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/StartTLSExtendedOperationTestCase.java                        |   10 
 opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java                                                      |    6 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ListBackendsTestCase.java                                          |    2 
 opends/resource/upgrade                                                                                                              |   29 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java                                                                   |   69 +
 opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java                                                          |   50 +
 opends/resource/uninstall.bat                                                                                                        |   15 
 opends/resource/bin/start-ds                                                                                                         |   15 
 opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java                                                                 |   42 +
 opends/src/server/org/opends/server/config/ConfigConstants.java                                                                      |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java                                                |    9 
 opends/src/quicksetup/org/opends/quicksetup/Application.java                                                                         |   17 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java                    |    4 
 opends/src/server/org/opends/server/core/DefaultCompressedSchema.java                                                                |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestImportAndExport.java                                           |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java                                        |    2 
 opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java                                                  |   10 
 opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java                                                   |    8 
 opends/resource/bin/_server-script.bat                                                                                               |   16 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java                                                             |   16 
 opends/resource/bin/status-panel.bat                                                                                                 |   18 
 opends/src/server/org/opends/server/protocols/LDIFConnectionHandler.java                                                             |    4 
 opends/resource/bin/_client-script.sh                                                                                                |   17 
 opends/resource/uninstall                                                                                                            |   15 
 opends/resource/bin/_mixed-script.bat                                                                                                |   22 
 opends/resource/bin/_client-script.bat                                                                                               |   14 
 opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java                                                                 |   15 
 opends/src/server/org/opends/server/util/ServerConstants.java                                                                        |    6 
 opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java                                                               |    3 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/makeldif/MakeLDIFTestCase.java                                     |    2 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java                                   |    3 
 opends/src/server/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java                                             |    2 
 opends/resource/upgrade.bat                                                                                                          |   27 
 opends/src/server/org/opends/server/util/StaticUtils.java                                                                            |    3 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ConfigFileHandlerTestCase.java                                |    2 
 opends/src/server/org/opends/server/tasks/BackupTask.java                                                                            |    2 
 opends/resource/bin/_server-script.sh                                                                                                |   15 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java                             |   20 
 opends/src/quicksetup/org/opends/quicksetup/Configuration.java                                                                       |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java                     |   18 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java                                            |   20 
 opends/src/server/org/opends/server/core/DirectoryServer.java                                                                        |   58 +
 opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java                                |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java                                          |    6 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java                                                           |   15 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java                                                                      |   39 +
 opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java                                                          |   72 ++
 opends/src/server/org/opends/server/api/ConfigHandler.java                                                                           |   12 
 opends/build.xml                                                                                                                     |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java                                    |    4 
 opends/src/quicksetup/org/opends/quicksetup/util/Utils.java                                                                          |   86 ++
 opends/src/server/org/opends/server/extensions/ConfigFileHandler.java                                                                |   35 
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java                            |    4 
 opends/resource/setup                                                                                                                |   15 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java                                                                   |  247 ++++++
 87 files changed, 1,584 insertions(+), 422 deletions(-)

diff --git a/opends/build.xml b/opends/build.xml
index 867945e..3792b76 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -913,6 +913,10 @@
     <copy todir="${pdir}/lib">
       <fileset file="${lib.dir}/*.exe" />
     </copy>
+    
+    <copy todir="${pdir}">
+      <fileset file="${resource.dir}/instance.loc" />
+    </copy>
 
     <antcall target="example-plugin" />
 
diff --git a/opends/resource/bin/_client-script.bat b/opends/resource/bin/_client-script.bat
index e728618..40e17fd 100644
--- a/opends/resource/bin/_client-script.bat
+++ b/opends/resource/bin/_client-script.bat
@@ -30,7 +30,17 @@
 
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
 goto launchCommand
@@ -42,7 +52,7 @@
 
 :launchCommand
 set SCRIPT_UTIL_CMD=set-full-environment
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
 "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% %*
diff --git a/opends/resource/bin/_client-script.sh b/opends/resource/bin/_client-script.sh
index b4c27fe..6c519d2 100755
--- a/opends/resource/bin/_client-script.sh
+++ b/opends/resource/bin/_client-script.sh
@@ -36,7 +36,7 @@
 
 
 # Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
+# Then capture the location of this script and the Directory Server install
 # root so that we can use them to create appropriate paths.
 WORKING_DIR=`pwd`
 
@@ -44,8 +44,17 @@
 SCRIPT_DIR=`pwd`
 
 cd ..
-INSTANCE_ROOT=`pwd`
-export INSTANCE_ROOT
+INSTALL_ROOT=`pwd`
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 cd "${WORKING_DIR}"
 
@@ -53,7 +62,7 @@
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
diff --git a/opends/resource/bin/_mixed-script.bat b/opends/resource/bin/_mixed-script.bat
index f4334d3..0edb52a 100644
--- a/opends/resource/bin/_mixed-script.bat
+++ b/opends/resource/bin/_mixed-script.bat
@@ -30,7 +30,17 @@
 
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
 
@@ -43,13 +53,13 @@
 set ORIGINAL_JAVA_BIN=%OPENDS_JAVA_BIN%
 
 set SCRIPT_UTIL_CMD=set-full-environment
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+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
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --testIfOffline %*  
+"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" --testIfOffline %*  
 if %errorlevel% == 51 goto launchoffline
 if %errorlevel% == 52 goto launchonline
 exit /B %errorlevel%
@@ -61,7 +71,7 @@
 
 :launchonline
 
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
 
 goto end
 
@@ -76,11 +86,11 @@
 set OPENDS_JAVA_BIN=%ORIGINAL_JAVA_BIN%
 
 set SCRIPT_UTIL_CMD=set-full-environment
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+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%"
 
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
 
 goto end
 
diff --git a/opends/resource/bin/_mixed-script.sh b/opends/resource/bin/_mixed-script.sh
index 91e866c..302ee0f 100644
--- a/opends/resource/bin/_mixed-script.sh
+++ b/opends/resource/bin/_mixed-script.sh
@@ -37,16 +37,26 @@
 
 
 # Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
-# root so that we can use them to create appropriate paths.
+# Then capture the location of this script and the Directory Server install
+# and instance  root so that we can use them to create appropriate paths.
 WORKING_DIR=`pwd`
 
 cd "`dirname "${0}"`"
 SCRIPT_DIR=`pwd`
 
 cd ..
-INSTANCE_ROOT=`pwd`
-export INSTANCE_ROOT
+INSTALL_ROOT=`pwd`
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
+
 
 cd "${WORKING_DIR}"
 
@@ -63,7 +73,7 @@
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
@@ -92,7 +102,7 @@
   # Set the environment to use the offline properties
   SCRIPT_NAME=${OLD_SCRIPT_NAME}.offline
   export SCRIPT_NAME
-  .  "${INSTANCE_ROOT}/lib/_script-util.sh"
+  .  "${INSTALL_ROOT}/lib/_script-util.sh"
   RETURN_CODE=$?
   if test ${RETURN_CODE} -ne 0
   then
diff --git a/opends/resource/bin/_script-util.bat b/opends/resource/bin/_script-util.bat
index 97d66d2..a772b18 100644
--- a/opends/resource/bin/_script-util.bat
+++ b/opends/resource/bin/_script-util.bat
@@ -1,4 +1,3 @@
-
 @echo off
 rem CDDL HEADER START
 rem
@@ -29,7 +28,7 @@
 set SET_ENVIRONMENT_VARS_DONE=false
 set SET_CLASSPATH_DONE=false
 
-if "%INSTANCE_ROOT%" == "" goto setInstanceRoot
+if "%INSTALL_ROOT%" == "" goto setInstanceRoot
 
 :scriptBegin
 if "%SCRIPT_UTIL_CMD%" == "set-full-environment-and-test-java" goto setFullEnvironmentAndTestJava
@@ -43,14 +42,26 @@
 :setInstanceRoot
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 goto scriptBegin
 
 
 :setClassPath
 if "%SET_CLASSPATH_DONE%" == "true" goto end
-FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\lib\setcp.bat" %%x
-set CLASSPATH=%DIR_HOME%\classes;%CLASSPATH%
+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
+set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH%
+:setClassPathDone
 set SET_CLASSPATH_DONE=true
 goto scriptBegin
 
@@ -69,8 +80,8 @@
 
 :setJavaHomeAndArgs
 if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto end
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkEnvJavaArgs
-call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto checkEnvJavaArgs
+call "%INSTANCE_ROOT%\lib\set-java-home.bat"
 if "%OPENDS_JAVA_BIN%" == "" goto checkEnvJavaArgs
 :endJavaHomeAndArgs
 set SET_JAVA_HOME_AND_ARGS_DONE=true
@@ -111,7 +122,7 @@
 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 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat
 pause
 exit /B 1
 
@@ -144,7 +155,7 @@
 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 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat
 pause
 exit /B 1
 
@@ -170,7 +181,7 @@
 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 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat
 pause
 exit /B 1
 
diff --git a/opends/resource/bin/_script-util.sh b/opends/resource/bin/_script-util.sh
index 7a70f6b..9830484 100644
--- a/opends/resource/bin/_script-util.sh
+++ b/opends/resource/bin/_script-util.sh
@@ -146,14 +146,21 @@
 # Configure the appropriate CLASSPATH.
 set_classpath() {
   CLASSPATH=${INSTANCE_ROOT}/classes
-  for JAR in "${INSTANCE_ROOT}"/lib/*.jar
+  for JAR in ${INSTALL_ROOT}/lib/*.jar
   do
     CLASSPATH=${CLASSPATH}:${JAR}
   done
+  if [ "${INSTANCE_ROOT}" != "${INSTANCE_ROOT}" ]
+  then
+    for JAR in ${INSTANCE_ROOT}/lib/*.jar
+    do
+      CLASSPATH=${CLASSPATH}:${JAR}
+    done
+  fi
   export CLASSPATH
 }
 
-if test "${INSTANCE_ROOT}" = ""
+if test "${INSTALL_ROOT}" = ""
 then
   # Capture the current working directory so that we can change to it later.
   # Then capture the location of this script and the Directory Server instance
@@ -162,7 +169,15 @@
 
   cd "`dirname "${0}"`"
   cd ..
-  INSTANCE_ROOT=`pwd`
+  INSTALL_ROOT=`pwd`
+  if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+  then
+    INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+    export INSTANCE_ROOT
+  else
+    INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+    export INSTANCE_ROOT
+  fi
   cd "${WORKING_DIR}"
 fi
 
diff --git a/opends/resource/bin/_server-script.bat b/opends/resource/bin/_server-script.bat
index 6baea9f..178894b 100644
--- a/opends/resource/bin/_server-script.bat
+++ b/opends/resource/bin/_server-script.bat
@@ -30,7 +30,17 @@
 
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
 goto launchCommand
@@ -42,10 +52,10 @@
 
 :launchCommand
 set SCRIPT_UTIL_CMD=set-full-environment
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
 
 :end
 
diff --git a/opends/resource/bin/_server-script.sh b/opends/resource/bin/_server-script.sh
index aa88673..6adb9fa 100755
--- a/opends/resource/bin/_server-script.sh
+++ b/opends/resource/bin/_server-script.sh
@@ -44,15 +44,24 @@
 SCRIPT_DIR=`pwd`
 
 cd ..
-INSTANCE_ROOT=`pwd`
-export INSTANCE_ROOT
+INSTALL_ROOT=`pwd`
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+ INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 cd "${WORKING_DIR}"
 
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
diff --git a/opends/resource/bin/start-ds b/opends/resource/bin/start-ds
index b379650..075dcca 100755
--- a/opends/resource/bin/start-ds
+++ b/opends/resource/bin/start-ds
@@ -35,8 +35,17 @@
 SCRIPT_DIR=`pwd`
 
 cd ..
-INSTANCE_ROOT=`pwd`
-export INSTANCE_ROOT
+INSTALL_ROOT=`pwd`
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 cd "${WORKING_DIR}"
 
@@ -55,7 +64,7 @@
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment-and-test-java
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
diff --git a/opends/resource/bin/start-ds.bat b/opends/resource/bin/start-ds.bat
index 3db3a49..39e7414 100644
--- a/opends/resource/bin/start-ds.bat
+++ b/opends/resource/bin/start-ds.bat
@@ -27,9 +27,17 @@
 
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
+set INSTALL_ROOT=%DIR_HOME%
 
-
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%DIR_HOME%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 set LOG="%INSTANCE_ROOT%\logs\native-windows.out"
 set SCRIPT=start-ds.bat
@@ -40,7 +48,7 @@
 
 rem Set environment variables
 set SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 
 set ERROR_CODE=%errorlevel%
 if NOT %ERROR_CODE% == 0 goto exitErrorCode
@@ -51,7 +59,7 @@
 
 echo %SCRIPT%: PATH=%PATH% >> %LOG%
 
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability %*
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" --checkStartability %*
 
 if %errorlevel% == 98 goto serverAlreadyStarted
 if %errorlevel% == 99 goto runDetach
@@ -70,64 +78,68 @@
 
 :runNoDetach
 echo %SCRIPT%: Run no detach  >> %LOG%
-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"
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+if not exist "%INSTANCE_ROOT%\logs\server.out" echo. > "%INSTANCE_ROOT%\logs\server.out"
+if not exist "%INSTANCE_ROOT%\logs\server.starting" echo. > "%INSTANCE_ROOT%\logs\server.starting"
+if exist "%INSTANCE_ROOT%\lib\set-java-args.bat %SCRIPT%" DO call "%INSTANCE_ROOT%\lib\set-java-args.bat"
+"%OPENDS_JAVA_BIN%" %OPENDS_SERVER_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
 set ERROR_CODE=%errorlevel%
 goto exitErrorCode
 
 :runNoDetachQuiet
 echo %SCRIPT%: Run no detach  >> %LOG%
-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"
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %* >> %LOG%
+if not exist "%INSTANCE_ROOT%\logs\server.out" echo. > "%INSTANCE_ROOT%\logs\server.out"
+if not exist "%INSTANCE_ROOT%\logs\server.starting" echo. > "%INSTANCE_ROOT%\logs\server.starting"
+if exist "%INSTANCE_ROOT%\lib\set-java-args.bat %SCRIPT%" DO call "%INSTANCE_ROOT%\lib\set-java-args.bat"
+"%OPENDS_JAVA_BIN%" %OPENDS_SERVER_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %* >> %LOG%
 set ERROR_CODE=%errorlevel%
 goto exitErrorCode
 
 :runDetach
 echo %SCRIPT%: Run detach  >> %LOG%
-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"
-"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS%  %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
+if not exist "%INSTANCE_ROOT%\logs\server.out" echo. > "%INSTANCE_ROOT%\logs\server.out"
+if not exist "%INSTANCE_ROOT%\logs\server.starting" echo. > "%INSTANCE_ROOT%\logs\server.starting"
+if exist "%INSTANCE_ROOT%\lib\set-java-args.bat" DO call "%INSTANCE_ROOT%\lib\set-java-args.bat"
+"%INSTALL_ROOT%\lib\winlauncher.exe" start "%INSTANCE_ROOT%" "%OPENDS_JAVA_BIN%" %OPENDS_SERVER_JAVA_ARGS%  %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
+echo %SCRIPT%: Waiting for "%INSTANCE_ROOT%\logs\server.out" to be deleted >> %LOG%
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.starting" --logFile "%INSTANCE_ROOT%\logs\server.out"
 goto checkStarted
 
 :runDetachQuiet
 echo %SCRIPT%: Run detach  >> %LOG%
-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"
-"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS%  %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" >> %LOG%
+if not exist "%INSTANCE_ROOT%\logs\server.out" echo. > "%INSTANCE_ROOT%\logs\server.out"
+if not exist "%INSTANCE_ROOT%\logs\server.starting" echo. > "%INSTANCE_ROOT%\logs\server.starting"
+if exist "%INSTANCE_ROOT%\lib\set-java-args.bat" DO call "%INSTANCE_ROOT%\lib\set-java-args.bat"
+"%INSTALL_ROOT%\lib\winlauncher.exe" start "%INSTANCE_ROOT%" "%OPENDS_JAVA_BIN%" %OPENDS_SERVER_JAVA_ARGS%  %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
+echo %SCRIPT%: Waiting for "%INSTANCE_ROOT%\logs\server.out" to be deleted >> %LOG%
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.starting" --logFile "%INSTANCE_ROOT%\logs\server.out" >> %LOG%
 goto checkStarted
 
 :runDetachCalledByWinService
 rem We write the output of the start command to the winservice.out file.
 echo %SCRIPT%: Run detach called by windows service  >> %LOG%
-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"
-echo. > "%DIR_HOME%\logs\server.startingservice"
-echo. > "%DIR_HOME%\logs\winservice.out"
-if exist "%DIR_HOME%\lib\set-java-args.bat" DO call "%DIR_HOME%\lib\set-java-args.bat"
-"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" -Xrs %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
-echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" --outputFile "%DIR_HOME%\logs\winservice.out"
-erase "%DIR_HOME%\logs\server.startingservice"
+if not exist "%INSTANCE_ROOT%\logs\server.out" echo. > "%INSTANCE_ROOT%\logs\server.out"
+if not exist "%INSTANCE_ROOT%\logs\server.starting" echo. > "%INSTANCE_ROOT%\logs\server.starting"
+echo. > "%INSTANCE_ROOT%\logs\server.startingservice"
+echo. > "%INSTANCE_ROOT%\logs\winservice.out"
+if exist "%INSTANCE_ROOT%\lib\set-java-args.bat" DO call "%INSTANCE_ROOT%\lib\set-java-args.bat"
+"%INSTALL_ROOT%\lib\winlauncher.exe" start "%INSTANCE_ROOT%" "%OPENDS_JAVA_BIN%" -Xrs %OPENDS_SERVER_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" %*
+echo %SCRIPT%: Waiting for "%INSTANCE_ROOT%\logs\server.out" to be deleted >> %LOG%
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.starting" --logFile "%INSTANCE_ROOT%\logs\server.out" --outputFile "%INSTANCE_ROOT%\logs\winservice.out"
+erase "%INSTANCE_ROOT%\logs\server.startingservice"
 goto checkStarted
 
 :runAsService
 echo %SCRIPT%: Run as service >> %LOG%
 "%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
-echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.startingservice" to be deleted >> %LOG%
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
+echo %SCRIPT%: Waiting for "%INSTANCE_ROOT%\logs\server.startingservice" to be deleted >> %LOG%
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.startingservice"
 rem Type the contents the winwervice.out file and delete it.
-if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
-if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
+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
 
 :checkStarted
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability > NUL 2>&1
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%INSTANCE_ROOT%\config\config.ldif" --checkStartability > NUL 2>&1
 if %errorlevel% == 98 goto serverStarted
 goto serverNotStarted
 
diff --git a/opends/resource/bin/status-panel.bat b/opends/resource/bin/status-panel.bat
index a3d3f10..3e88ad8 100644
--- a/opends/resource/bin/status-panel.bat
+++ b/opends/resource/bin/status-panel.bat
@@ -27,24 +27,36 @@
 
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
+set INSTALL_ROOT=%DIR_HOME%
 
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%DIR_HOME%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
+
 
 set SCRIPT_NAME=status-panel
 
 rem Set environment variables
 set SCRIPT_UTIL_CMD=set-full-environment
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
 if "%~1" == "" goto callLaunch
 goto callJava
 
 :callLaunch
-"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.statuspanel.StatusPanelLauncher
+if exist "%INSTALL_ROOT%\lib\set-java-args.bat" DO call "%INSTALL_ROOT%\lib\set-java-args.bat"
+"%INSTALL_ROOT%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.statuspanel.StatusPanelLauncher
 goto end
 
 :callJava
+if exist "%INSTALL_ROOT%\lib\set-java-args.bat" DO call "%INSTALL_ROOT%\lib\set-java-args.bat"
 "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.statuspanel.StatusPanelLauncher %*
 
 rem return part
diff --git a/opends/resource/bin/stop-ds b/opends/resource/bin/stop-ds
index f432632..71e46a2 100755
--- a/opends/resource/bin/stop-ds
+++ b/opends/resource/bin/stop-ds
@@ -44,8 +44,17 @@
 SCRIPT_DIR=`pwd`
 
 cd ..
-INSTANCE_ROOT=`pwd`
-export INSTANCE_ROOT
+INSTALL_ROOT=`pwd`
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 cd "${WORKING_DIR}"
 
@@ -62,7 +71,7 @@
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment-and-test-java
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
@@ -175,11 +184,11 @@
     OPENDS_JAVA_BIN=${ORIGINAL_JAVA_BIN}
     if test ${QUIET_MODE} -eq 0
     then
-      "${INSTANCE_ROOT}/bin/start-ds" --quiet
+      "${INSTALL_ROOT}/bin/start-ds" --quiet
       EXIT_CODE=${?}
       exit ${EXIT_CODE}
     else
-      "${INSTANCE_ROOT}/bin/start-ds"
+      "${INSTALL_ROOT}/bin/start-ds"
       EXIT_CODE=${?}
       exit ${EXIT_CODE}
     fi
diff --git a/opends/resource/bin/stop-ds.bat b/opends/resource/bin/stop-ds.bat
index 12a26e7..6cba248 100644
--- a/opends/resource/bin/stop-ds.bat
+++ b/opends/resource/bin/stop-ds.bat
@@ -38,7 +38,17 @@
 set ORIGINAL_JAVA_HOME=%OPENDS_JAVA_HOME%
 set ORIGINAL_JAVA_BIN=%OPENDS_JAVA_BIN%
 
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 set LOG="%INSTANCE_ROOT%\logs\native-windows.out"
 set SCRIPT=stop-ds.bat
@@ -49,7 +59,7 @@
 
 rem Set environment variables
 set SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
 echo %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG%
@@ -68,7 +78,7 @@
 
 :serverAlreadyStopped
 echo %SCRIPT%: server already stopped >> %LOG%
-if exist "%DIR_HOME%\logs\server.pid" erase "%DIR_HOME%\logs\server.pid"
+if exist "%INSTANCE_ROOT%\logs\server.pid" erase "%INSTANCE_ROOT%\logs\server.pid"
 goto end
 
 :startUsingSystemCall
@@ -79,23 +89,23 @@
 set OPENDS_JAVA_ARGS=%ORIGINAL_JAVA_ARGS%
 set OPENDS_JAVA_HOME=%ORIGINAL_JAVA_HOME%
 set OPENDS_JAVA_BIN=%ORIGINAL_JAVA_BIN%
-"%DIR_HOME%\bat\start-ds.bat"
+"%INSTALL_ROOT%\bat\start-ds.bat"
 goto end
 
 :stopUsingSystemCall
 echo %SCRIPT%: stop using system call >> %LOG%
-"%DIR_HOME%\lib\winlauncher.exe" stop "%DIR_HOME%"
+"%INSTALL_ROOT%\lib\winlauncher.exe" stop "%INSTANCE_ROOT%"
 goto end
 
 :restartUsingSystemCall
 echo %SCRIPT%: restart using system call >> %LOG%
-"%DIR_HOME%\lib\winlauncher.exe" stop "%DIR_HOME%"
+"%INSTALL_ROOT%\lib\winlauncher.exe" stop "%INSTANCE_ROOT%"
 if not %errorlevel% == 0 goto end
 goto startUsingSystemCall
 
 :stopUsingProtocol
 echo %SCRIPT%: stop using protocol >> %LOG%
-call "%DIR_HOME%\lib\_client-script.bat" %*
+call "%INSTALL_ROOT%\lib\_client-script.bat" %*
 goto end
 
 :stopAsWindowsService
@@ -109,10 +119,10 @@
 if not %errorlevel% == 0 goto end
 echo %SCRIPT%: restart as windows service, starting >> %LOG%
 "%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
-"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%INSTANCE_ROOT%\logs\server.startingservice"
 rem Type the contents the winwervice.out file and delete it.
-if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
-if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
+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
 
 :end
diff --git a/opends/resource/setup b/opends/resource/setup
index bb7eb12..f9ceae1 100755
--- a/opends/resource/setup
+++ b/opends/resource/setup
@@ -34,8 +34,17 @@
 cd "`dirname "${0}"`"
 SCRIPT_DIR=`pwd`
 
-INSTANCE_ROOT=${SCRIPT_DIR}
-export INSTANCE_ROOT
+INSTALL_ROOT=${SCRIPT_DIR}
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 SCRIPT_NAME=setup
 export SCRIPT_NAME
@@ -45,7 +54,7 @@
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment-and-test-java
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
diff --git a/opends/resource/setup.bat b/opends/resource/setup.bat
index acbed50..81b7f8d 100644
--- a/opends/resource/setup.bat
+++ b/opends/resource/setup.bat
@@ -37,13 +37,22 @@
 
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
 
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 set SCRIPT_NAME=setup
 
 rem Set environment variables and test java
 set SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
 if "%~1" == "" goto callLaunch
@@ -56,7 +65,7 @@
 goto end
 
 :callLaunch
-"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.quicksetup.installer.SetupLauncher
+"%INSTALL_ROOT%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.quicksetup.installer.SetupLauncher
 goto end
 
 :callJava
diff --git a/opends/resource/uninstall b/opends/resource/uninstall
index e50905d..f1e6ad5 100644
--- a/opends/resource/uninstall
+++ b/opends/resource/uninstall
@@ -39,15 +39,24 @@
 SCRIPT_NAME=uninstall
 export SCRIPT_NAME
 
-INSTANCE_ROOT=${SCRIPT_DIR}
-export INSTANCE_ROOT
+INSTALL_ROOT=${SCRIPT_DIR}
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 cd "${WORKING_DIR}"
 
 # Set environment variables
 SCRIPT_UTIL_CMD=set-full-environment-and-test-java
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
diff --git a/opends/resource/uninstall.bat b/opends/resource/uninstall.bat
index 677efca..1e4a6ce 100644
--- a/opends/resource/uninstall.bat
+++ b/opends/resource/uninstall.bat
@@ -28,20 +28,29 @@
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
 
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 set SCRIPT_NAME=uninstall
 
 rem Set environment variables
 set SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
 if "%~1" == "" goto callLaunch
 goto callJava
 
 :callLaunch
-"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.uninstaller.UninstallLauncher
+"%INSTALL_ROOT%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.uninstaller.UninstallLauncher
 goto end
 
 :callJava
diff --git a/opends/resource/upgrade b/opends/resource/upgrade
index 59ea211..291439a 100644
--- a/opends/resource/upgrade
+++ b/opends/resource/upgrade
@@ -33,8 +33,17 @@
 cd "`dirname "${0}"`"
 SCRIPT_DIR=`pwd`
 
-INSTANCE_ROOT=${SCRIPT_DIR}
-export INSTANCE_ROOT
+INSTALL_ROOT=${SCRIPT_DIR}
+export INSTALL_ROOT
+
+if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
+then
+  INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+else
+  INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
+  export INSTANCE_ROOT
+fi
 
 SCRIPT_NAME=upgrade
 export SCRIPT_NAME
@@ -44,7 +53,7 @@
 # Set java home
 SCRIPT_UTIL_CMD=set-java-home-and-args
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
@@ -54,7 +63,7 @@
 # Set environment variables
 SCRIPT_UTIL_CMD=set-environment-vars
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
@@ -67,7 +76,7 @@
   CLASSPATH=${CLASSPATH}:${JAR}
 done
 CLASSPATH=${CLASSPATH}:${INSTANCE_ROOT}/classes
-for JAR in ${INSTANCE_ROOT}/lib/*.jar
+for JAR in ${INSTALL_ROOT}/lib/*.jar
 do
   CLASSPATH=${CLASSPATH}:${JAR}
 done
@@ -76,7 +85,7 @@
 # Test the java installation
 SCRIPT_UTIL_CMD=test-java
 export SCRIPT_UTIL_CMD
-.  "${INSTANCE_ROOT}/lib/_script-util.sh"
+.  "${INSTALL_ROOT}/lib/_script-util.sh"
 RETURN_CODE=$?
 if test ${RETURN_CODE} -ne 0
 then
@@ -93,7 +102,7 @@
 # BuildExtractor uses the existing install's
 # jars
 CLASSPATH=${INSTANCE_ROOT}/classes
-for JAR in ${INSTANCE_ROOT}/lib/*.jar
+for JAR in ${INSTALL_ROOT}/lib/*.jar
 do
   CLASSPATH=${CLASSPATH}:${JAR}
 done
@@ -118,13 +127,13 @@
     CLASSPATH=${JAR}:${CLASSPATH}
   done
   # Launch the upgrade process.
-  "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
+  "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
 elif test ${RETURN_CODE} -eq 98
 then
   # Copy jars to a temporary place from which to run the reverter
   # in order to avoid potential file lock issues.
   mkdir -p ${INSTANCE_ROOT}/tmp/revert
-  cp -R ${INSTANCE_ROOT}/lib ${INSTANCE_ROOT}/tmp/revert
+  cp -R ${INSTALL_ROOT}/lib ${INSTANCE_ROOT}/tmp/revert
   if test ${?} -ne 0
   then
     echo "ERROR:  Failed to initialize reversion."
@@ -136,7 +145,7 @@
       CLASSPATH=${JAR}:${CLASSPATH}
     done
     # Launch the upgrade process.
-    "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
+    "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
   fi
 elif test ${RETURN_CODE} -eq 50
 then
diff --git a/opends/resource/upgrade.bat b/opends/resource/upgrade.bat
index df0b639..5a52041 100644
--- a/opends/resource/upgrade.bat
+++ b/opends/resource/upgrade.bat
@@ -28,7 +28,16 @@
 setlocal
 for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
 
-set INSTANCE_ROOT=%DIR_HOME%
+set INSTALL_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+for /f "delims=" %%a in (%INSTALL_ROOT%\instance.loc) do (
+  set INSTANCE_DIR=%%a
+)
+set CUR_DIR=%~dp0
+cd %INSTALL_ROOT%
+cd %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd %CUR_DIR%
 
 :checkNewVersion
 if exist "upgrade.bat.NEW" goto newVersion
@@ -37,14 +46,14 @@
 
 rem Set environment variables and test java
 set SCRIPT_UTIL_CMD=set-full-environment-and-test-java
-call "%INSTANCE_ROOT%\lib\_script-util.bat"
+call "%INSTALL_ROOT%\lib\_script-util.bat"
 if NOT %errorlevel% == 0 exit /B %errorlevel%
 
 :callExtractor
 if EXIST "%INSTANCE_ROOT%\tmp\upgrade" rd "%INSTANCE_ROOT%\tmp\upgrade" /s /q
 set CLASSPATH=""
-FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
-set CLASSPATH=%DIR_HOME%\classes;%CLASSPATH%
+FOR %%x in ("%INSTALL_ROOT%\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
+set CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH%
 "%OPENDS_JAVA_BIN%" %SCRIPT_NAME_ARG% org.opends.quicksetup.upgrader.BuildExtractor %*
 if %errorlevel% == 99 goto upgrader
 if %errorlevel% == 98 goto reverter
@@ -60,16 +69,16 @@
 
 :upgrader
 set CLASSPATH=""
-FOR %%x in ("%INSTANCE_ROOT%\tmp\upgrade\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG%  org.opends.quicksetup.upgrader.UpgradeLauncher %*
+FOR %%x in ("%INSTANCE_ROOT%\tmp\upgrade\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
+"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% -DINSTALL_ROOT=%INSTALL_ROOT% org.opends.quicksetup.upgrader.UpgradeLauncher %*
 goto end
 
 :reverter
 if EXIST "%INSTANCE_ROOT%\tmp\revert" rd "%INSTANCE_ROOT%\tmp\revert" /s /q
-xcopy "%INSTANCE_ROOT%\lib\*.*" "%INSTANCE_ROOT%\tmp\revert\lib\" /E /Q /Y
+xcopy "%INSTALL_ROOT%\lib\*.*" "%INSTANCE_ROOT%\tmp\revert\lib\" /E /Q /Y
 set CLASSPATH=""
-FOR %%x in ("%INSTANCE_ROOT%\tmp\revert\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
-"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG%  org.opends.quicksetup.upgrader.ReversionLauncher %*
+FOR %%x in ("%INSTANCE_ROOT%\tmp\revert\lib\*.jar") DO call "%INSTALL_ROOT%\lib\setcp.bat" %%x
+"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% -DINSTALL_ROOT=%INSTALL_ROOT% org.opends.quicksetup.upgrader.ReversionLauncher %*
 goto end
 
 :version
diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index 66a9241..17bb40a 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -68,6 +68,9 @@
 import java.util.Collections;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.net.URI;
 
@@ -981,6 +984,53 @@
       /**
        * {@inheritDoc}
        */
+      public String getInstancePath()
+      {
+        String installPath =  getInstallationPath();
+
+        // look for <installPath>/lib/resource.loc
+        String instancePathFileName = installPath + File.separator + "lib"
+        + File.separator + "resource.loc";
+        File f = new File(instancePathFileName);
+
+        if (! f.exists())
+        {
+          return installPath;
+        }
+
+        BufferedReader reader;
+        try
+        {
+          reader = new BufferedReader(new FileReader(instancePathFileName));
+        }
+        catch (Exception e)
+        {
+          return installPath;
+        }
+
+
+        // Read the first line and close the file.
+        String line;
+        try
+        {
+          line = reader.readLine();
+          return new File(line).getAbsolutePath();
+        }
+        catch (Exception e)
+        {
+          return installPath;
+        }
+        finally
+        {
+          try
+          {
+            reader.close();
+          } catch (Exception e) {}
+        }
+      }
+      /**
+       * {@inheritDoc}
+       */
       public ProgressStep getCurrentProgressStep()
       {
         return UninstallProgressStep.NOT_STARTED;
diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index d1064e7..ef3b45d 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -50,6 +50,7 @@
 import org.opends.quicksetup.util.BackgroundTask;
 import org.opends.quicksetup.util.ServerController;
 import org.opends.quicksetup.util.UIKeyStore;
+import org.opends.quicksetup.util.Utils;
 import org.opends.server.admin.AttributeTypePropertyDefinition;
 import org.opends.server.admin.ClassLoaderProvider;
 import org.opends.server.admin.ClassPropertyDefinition;
@@ -586,6 +587,13 @@
   }
 
   /**
+   * {@inheritDoc}
+   */
+  public String getInstancePath() {
+    return getInstancePathFromClasspath(getInstallPathFromClasspath());
+  }
+
+  /**
    * Returns the ApplicationException that might occur during installation or
    * <CODE>null</CODE> if no exception occurred.
    *
@@ -1104,10 +1112,39 @@
       notifyListeners(getFormattedWithPoints(
           INFO_PROGRESS_DELETING_INSTALLATION_FILES_NON_VERBOSE.get()));
     }
-    File f = new File(getInstallPathFromClasspath());
+    String installPath = getInstallPathFromClasspath();
+    File installFile = new File(installPath);
+
+    String instancePath =
+      Utils.getInstancePathFromClasspath(installFile.getAbsolutePath());
+    File instanceFile = new File(instancePath);
+
     InstallationFilesToDeleteFilter filter =
             new InstallationFilesToDeleteFilter();
-    File[] rootFiles = f.listFiles();
+
+    File[] installFiles  = installFile.listFiles();
+    File[] instanceFiles = new File(instancePath).listFiles();
+
+    File[] rootFiles = null;
+
+    if (installFiles == null)
+    {
+      rootFiles = new File(instancePath).listFiles();
+    }
+    else
+    if (instanceFiles == null)
+    {
+      rootFiles = installFiles;
+    }
+    else
+    {
+      // both installFiles and instanceFiles are not null
+      rootFiles = new File[installFiles.length + instanceFiles.length];
+      System.arraycopy(installFiles,  0, rootFiles, 0, installFiles.length);
+      System.arraycopy(instanceFiles, 0, rootFiles, installFiles.length,
+          instanceFiles.length);
+    }
+
     if (rootFiles != null) {
       /* The following is done to have a moving progress bar when we delete
        * the installation files.
@@ -1161,6 +1198,7 @@
                 beforeRatio);
         deleteRecursively(rootFiles[i], filter);
       }
+      deleteRecursively(instanceFile);
       hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio);
     }
     if (!isVerbose())
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opends/src/quicksetup/org/opends/quicksetup/Application.java
index 6373cf6..61e5963 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -180,8 +180,16 @@
   public Installation getInstallation() {
     if (installation == null) {
       String installPath = getInstallationPath();
+      String instancePath = getInstancePath();
       if (installPath != null) {
-        installation = new Installation(installPath);
+        if (instancePath == null)
+        {
+          installation = new Installation(installPath, installPath);
+        }
+        else
+        {
+          installation = new Installation(installPath, instancePath);
+        }
       }
     }
     return installation;
@@ -538,6 +546,13 @@
   public abstract String getInstallationPath();
 
   /**
+   * Returns the instance path.
+   * @return the instance path.
+   */
+  public abstract String getInstancePath();
+
+
+  /**
    * Gets the current step.
    * @return ProgressStep representing the current step
    */
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Configuration.java b/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
index ff7c6de..18de8db 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
@@ -240,10 +240,10 @@
       if (pathFile.isAbsolute()) {
         fullDbPath = pathFile;
       } else {
-        fullDbPath = new File(install.getRootDirectory(), path);
+        fullDbPath = new File(install.getInstanceDirectory(), path);
       }
 
-      if (!Utils.isDescendant(fullDbPath, install.getRootDirectory())) {
+      if (!Utils.isDescendant(fullDbPath, install.getInstanceDirectory())) {
         outsidePaths.add(Utils.getPath(fullDbPath));
       }
     }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Installation.java b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
index a002478..0adbbbf 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -143,6 +143,11 @@
     CONFIG_PATH_RELATIVE+File.separator+"tools.properties";
 
   /**
+   * The relative path to the instance.loc file.
+   */
+  public static final String INSTANCE_LOCATION_PATH_RELATIVE =
+    "instance.loc";
+  /**
    * The UNIX setup script file name.
    */
   public static final String UNIX_SETUP_FILE_NAME = "setup";
@@ -240,6 +245,20 @@
 
   /**
    * The name of the directory in an upgrade backup directory (child
+   * of the 'history' directory) that contains the install files from a
+   * previous version.
+   */
+  public static final String HISTORY_BACKUP_FILES_DIR_INSTALL = "install";
+
+  /**
+   * The name of the directory in an upgrade backup directory (child
+   * of the 'history' directory) that contains the instance files from a
+   * previous version.
+   */
+
+  public static final String HISTORY_BACKUP_FILES_DIR_INSTANCE = "instance";
+  /**
+   * The name of the directory in an upgrade backup directory (child
    * of the 'history' directory) that contains the files from a
    * previous version.
    */
@@ -353,11 +372,16 @@
       // This allows testing of configuration components when the OpenDS.jar
       // in the classpath does not necessarily point to the server's
       String installRoot = System.getProperty("org.opends.quicksetup.Root");
+      String instanceRoot = System
+          .getProperty("org.opends.quicksetup.instance");
 
       if (installRoot == null) {
         installRoot = Utils.getInstallPathFromClasspath();
       }
-      local = new Installation(installRoot);
+      if (instanceRoot == null) {
+        instanceRoot = Utils.getInstancePathFromClasspath(installRoot);
+      }
+      local = new Installation(installRoot, instanceRoot);
     }
     return local;
   }
@@ -367,6 +391,8 @@
 
   private File rootDirectory;
 
+  private File instanceDirectory;
+
   private Status status;
 
   private Configuration configuration;
@@ -376,21 +402,49 @@
   private BuildInformation buildInformation;
 
   /**
+   * Indicates if the install and instance are in the same directory.
+   * @return true if the install and instance are in the same directory.
+   */
+  public boolean instanceAndInstallInSameDir;
+
+  /**
    * Creates a new instance from a root directory specified as a string.
    *
    * @param rootDirectory of this installation
+   * @param instanceRootDirectory The instance root directory
    */
-  public Installation(String rootDirectory) {
-    this(new File(rootDirectory));
+  public Installation(String rootDirectory, String instanceRootDirectory) {
+    this(new File(rootDirectory),new File(instanceRootDirectory));
   }
 
   /**
    * Creates a new instance from a root directory specified as a File.
    *
    * @param rootDirectory of this installation
+   *
+   * @param instanceDirectory of the instance
    */
-  public Installation(File rootDirectory) {
+  public Installation(File rootDirectory, File instanceDirectory) {
     setRootDirectory(rootDirectory);
+    setInstancetDirectory(instanceDirectory);
+    if (rootDirectory.getAbsolutePath().
+        equals(instanceDirectory.getAbsolutePath()))
+    {
+      instanceAndInstallInSameDir = true ;
+    }
+    else
+    {
+      instanceAndInstallInSameDir = false;
+    }
+  }
+
+  /**
+   * Indicates if the install and instance are in the same directory.
+   * @return true if the install and instance are in the same directory.
+   */
+  public boolean instanceAndInstallInSameDir()
+  {
+    return instanceAndInstallInSameDir;
   }
 
   /**
@@ -404,6 +458,16 @@
   }
 
   /**
+   * Gets the top level directory of an OpenDS instance.
+   *
+   * @return File object representing the top level directory of
+   *         and OpenDS installation
+   */
+  public File getInstanceDirectory() {
+    return this.instanceDirectory;
+  }
+
+  /**
    * Sets the root directory of this installation.
    *
    * @param rootDirectory File of this installation
@@ -412,12 +476,12 @@
 
     // Hold off on doing validation of rootDirectory since
     // some applications (like the Installer) create an Installation
-    // before the actual bits have been laid down on the filesyste.
+    // before the actual bits have been laid down on the file system.
     this.rootDirectory = rootDirectory;
 
     // Obtaining build information is a fairly time consuming operation.
     // Try to get a head start if possible.
-    if (isValid()) {
+    if (isValid(rootDirectory)) {
       try {
         BuildInformation bi = getBuildInformation();
         LOG.log(Level.INFO, "build info for " + rootDirectory.getName() +
@@ -429,15 +493,41 @@
   }
 
   /**
+   * Sets the root directory of this instance.
+   *
+   * @param instanceDirectory File of this instance
+   */
+  public void setInstancetDirectory(File instanceDirectory) {
+
+    // Hold off on doing validation of rootDirectory since
+    // some applications (like the Installer) create an Installation
+    // before the actual bits have been laid down on the filesyste.
+    this.instanceDirectory = instanceDirectory;
+
+    // Obtaining build information is a fairly time consuming operation.
+    // Try to get a head start if possible.
+    if (isValid(instanceDirectory)) {
+      try {
+        BuildInformation bi = getBuildInformation();
+        LOG.log(Level.INFO, "build info for " + instanceDirectory.getName() +
+                ": " + bi);
+      } catch (ApplicationException e) {
+        LOG.log(Level.INFO, "error determining build information", e);
+      }
+    }
+  }
+
+  /**
    * Indicates whether or not this installation appears to be an actual
    * OpenDS installation.
+   * @param file The root directory
    * @return boolean where true indicates that this does indeed appear to be
    * a valid OpenDS installation; false otherwise
    */
-  public boolean isValid() {
+  public boolean isValid(File file) {
     boolean valid = true;
     try {
-      validateRootDirectory(rootDirectory);
+      validateRootDirectory(file);
     } catch (IllegalArgumentException e) {
       valid = false;
     }
@@ -624,7 +714,7 @@
    * @return the path to the database files under the install path.
    */
   public File getDatabasesDirectory() {
-    return new File(getRootDirectory(), DATABASES_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), DATABASES_PATH_RELATIVE);
   }
 
   /**
@@ -633,7 +723,7 @@
    * @return the path to the backup files under the install path.
    */
   public File getBackupDirectory() {
-    return new File(getRootDirectory(), BACKUPS_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), BACKUPS_PATH_RELATIVE);
   }
 
   /**
@@ -642,7 +732,7 @@
    * @return the path to the config files under the install path.
    */
   public File getConfigurationDirectory() {
-    return new File(getRootDirectory(), CONFIG_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), CONFIG_PATH_RELATIVE);
   }
 
   /**
@@ -651,7 +741,7 @@
    * @return the path to the log files under the install path.
    */
   public File getLogsDirectory() {
-    return new File(getRootDirectory(), LOGS_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), LOGS_PATH_RELATIVE);
   }
 
   /**
@@ -660,7 +750,7 @@
    * @return the path to the lock files.
    */
   public File getLocksDirectory() {
-    return new File(getRootDirectory(), LOCKS_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), LOCKS_PATH_RELATIVE);
   }
 
   /**
@@ -668,7 +758,7 @@
    * @return File temporary directory
    */
   public File getTemporaryDirectory() {
-    return new File(getRootDirectory(), TMP_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), TMP_PATH_RELATIVE);
   }
 
   /**
@@ -677,7 +767,7 @@
    * @return the path to the lock files.
    */
   public File getHistoryDirectory() {
-    return new File(getRootDirectory(), HISTORY_PATH_RELATIVE);
+    return new File(getInstanceDirectory(), HISTORY_PATH_RELATIVE);
   }
 
   /**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
index 5d14717..89967fe 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
@@ -499,6 +499,15 @@
     return getDelegateApplication().getInstallationPath();
   }
 
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getInstancePath()
+  {
+    return getDelegateApplication().getInstancePath();
+  }
+
   /**
    * {@inheritDoc}
    */
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 9481c96..f61e948 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -816,7 +816,8 @@
 
     if (Utils.isWebStart())
     {
-      setInstallation(new Installation(getUserData().getServerLocation()));
+      String installDir = getUserData().getServerLocation();
+      setInstallation(new Installation(installDir, installDir));
     }
 
     checkAbort();
@@ -1892,7 +1893,7 @@
             getFormattedSuccess(
                     INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY.get(
                             formatter.getFormattedText(
-                                    Message.raw(getInstallationPath())),
+                                    Message.raw(getInstancePath())),
                             INFO_GENERAL_SERVER_STOPPED.get(),
                             cmd)));
     hmSummary.put(InstallProgressStep.FINISHED_CANCELED,
@@ -1926,7 +1927,7 @@
             getFormattedSuccess(
                     INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY.get(
                             formatter.getFormattedText(
-                                    Message.raw(getInstallationPath())),
+                                    Message.raw(getInstancePath())),
                             status,
                             cmd)));
     hmSummary.put(InstallProgressStep.FINISHED_WITH_ERROR,
@@ -3967,7 +3968,7 @@
    */
   protected String getSelfSignedKeystorePath()
   {
-    String parentFile = getPath(getInstallationPath(),
+    String parentFile = getPath(getInstancePath(),
         Installation.CONFIG_PATH_RELATIVE);
     return (getPath(parentFile, "keystore"));
   }
@@ -3980,7 +3981,7 @@
    */
   private String getTrustManagerPath()
   {
-    String parentFile = getPath(getInstallationPath(),
+    String parentFile = getPath(getInstancePath(),
         Installation.CONFIG_PATH_RELATIVE);
     return (getPath(parentFile, "truststore"));
   }
@@ -3992,7 +3993,7 @@
    */
   private String getTemporaryCertificatePath()
   {
-    String parentFile = getPath(getInstallationPath(),
+    String parentFile = getPath(getInstancePath(),
         Installation.CONFIG_PATH_RELATIVE);
     return (getPath(parentFile, "server-cert.txt"));
   }
@@ -4003,7 +4004,7 @@
    */
   private String getKeystorePinPath()
   {
-    String parentFile = getPath(getInstallationPath(),
+    String parentFile = getPath(getInstancePath(),
         Installation.CONFIG_PATH_RELATIVE);
     return (getPath(parentFile, "keystore.pin"));
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index 3127f22..a055d8a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -678,7 +678,8 @@
       javaHome = System.getenv(SetupUtils.OPENDS_JAVA_HOME);
     }
 
-    String configDir = Utils.getPath(installPath,
+    String configDir = Utils.getPath(Utils
+        .getInstancePathFromClasspath(installPath),
         Installation.CONFIG_PATH_RELATIVE);
     String propertiesFile = Utils.getPath(
         configDir, Installation.DEFAULT_JAVA_PROPERTIES_FILE);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index cf7622a..2437a05 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -30,6 +30,7 @@
 import org.opends.messages.Message;
 import static org.opends.messages.QuickSetupMessages.*;
 
+
 import java.io.PrintStream;
 import java.io.File;
 import java.util.ArrayList;
@@ -542,6 +543,15 @@
   /**
    * {@inheritDoc}
    */
+  public String getInstancePath()
+  {
+    String installPath =  Utils.getInstallPathFromClasspath();
+    return Utils.getInstancePathFromClasspath(installPath);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   protected String getOpenDSClassPath()
   {
     return System.getProperty("java.class.path");
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index 0971a89..adf2ed6 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -656,4 +656,13 @@
   {
     return getUserData().getServerLocation();
   }
+
+  /**
+   * {@inheritDoc}
+   */
+  public String getInstancePath()
+  {
+    // TODO
+    return null;
+  }
 }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
index 5532770..fe54ad0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -380,8 +380,9 @@
         {
           Installation installation;
           if (isWebStart()) {
+            String installDir = application.getUserData().getServerLocation();
             installation =
-              new Installation(application.getUserData().getServerLocation());
+              new Installation(installDir, installDir);
           } else {
             installation = Installation.getLocal();
           }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
index 0411d22..282d8a7 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -126,8 +126,9 @@
           ZipExtractor extractor = new ZipExtractor(buildFile);
           extractor.extract(stageDirectory);
           LOG.log(Level.INFO, "Extraction finished");
-          Installation installation = new Installation(stageDirectory);
-          if (!installation.isValid()) {
+          Installation installation = new Installation(stageDirectory,
+              stageDirectory);
+          if (!installation.isValid(stageDirectory)) {
             LOG.log(Level.INFO, "Extraction produed an invalid OpenDS" +
                     "installation: " + installation.getInvalidityReason());
             Message invalidMsg = INFO_BUILD_EXTRACTOR_FILE_INVALID.get(
@@ -162,7 +163,8 @@
 
   private File initStageDirectory() throws ApplicationException {
     File stageDir;
-    Installation installation = new Installation(getInstallationPath());
+    Installation installation = new Installation(getInstallationPath(),
+        getInstancePath());
     stageDir = installation.getTemporaryUpgradeDirectory();
     if (stageDir.exists()) {
       FileManager fm = new FileManager();
@@ -193,6 +195,14 @@
 
   /**
    * {@inheritDoc}
+   */
+  public String getInstancePath() {
+    return Utils.getInstancePathFromClasspath(getInstallationPath());
+  }
+
+
+  /**
+   * {@inheritDoc}
    * @param launcher
    */
   public UserData createUserData(Launcher launcher)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java
index e5dc169..f419c94 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RevertFileFilter.java
@@ -49,5 +49,20 @@
       filesToIgnore.add(new File(root, rootFileNamesToIgnore));
     }
   }
+
+  /**
+   * Creates a filter for ignoring in an OpenDS installation at
+   * <code>root</code>certain OpenDS files below root.
+   * @param root the root of the installation
+   * @param forInstallDir true if the filter is for the install directory.
+   */
+  public RevertFileFilter(File root,boolean forInstallDir ) {
+    super(root, forInstallDir);
+    this.filesToIgnore = new HashSet<File>();
+    for (String rootFileNamesToIgnore :
+            Upgrader.ROOT_FILES_TO_IGNORE_DURING_BACKUP) {
+      filesToIgnore.add(new File(root, rootFileNamesToIgnore));
+    }
+  }
 }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
index fb7332f..770882a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
@@ -163,8 +163,9 @@
                 Message buildInfo = INFO_UPGRADE_BUILD_ID_UNKNOWN.get();
                 Message date = INFO_GENERAL_UNKNOWN.get();
                 try {
+                  File f = appendFilesDirIfNeccessary(raDir);
                   Installation i =
-                          new Installation(appendFilesDirIfNeccessary(raDir));
+                          new Installation(f,f);
                   BuildInformation bi = i.getBuildInformation();
                   buildInfo = Message.raw(bi.toString());
                 } catch (Exception e) {
@@ -369,7 +370,7 @@
    */
   public String getInstallationPath() {
     String installationPath = null;
-    String path = Utils.getInstallPathFromClasspath();
+    String path =  System.getProperty("INSTALL_ROOT");
     if (path != null) {
       File f = new File(path);
       if (f.getParentFile() != null &&
@@ -387,6 +388,14 @@
   /**
    * {@inheritDoc}
    */
+  public String getInstancePath() {
+    String installPath = getInstallationPath() ;
+    return Utils.getInstancePathFromClasspath(installPath);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   public ProgressStep getCurrentProgressStep() {
     return this.currentProgressStep;
   }
@@ -481,8 +490,16 @@
   public Installation getInstallation() {
     if (installation == null) {
       String installPath = getInstallationPath();
+      String instancePath = getInstancePath();
       if (installPath != null) {
-        installation = new Installation(installPath);
+        if (instancePath != null)
+        {
+          installation = new Installation(installPath, instancePath);
+        }
+        else
+        {
+          installation = new Installation(installPath, installPath);
+        }
       }
     }
     return installation;
@@ -690,8 +707,23 @@
     try {
       Stage stage = getStage();
       Installation installation = getInstallation();
-      File root = installation.getRootDirectory();
-      stage.move(root, new RevertFileFilter(getReversionFilesDirectory()));
+      if (installation.instanceAndInstallInSameDir())
+      {
+        File root = installation.getRootDirectory();
+        stage.move(root, new RevertFileFilter(getReversionFilesDirectory()));
+      }
+      else
+      {
+        File root = installation.getRootDirectory();
+        File revFileRoot = new File(getReversionFilesDirectory(),
+            Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
+        stage.move(root, new RevertFileFilter(revFileRoot,true),true);
+
+        root = installation.getInstanceDirectory();
+        revFileRoot = new File(getReversionFilesDirectory(),
+            Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
+        stage.move(root, new RevertFileFilter(revFileRoot,false),false);
+      }
 
       // The bits should now be of the new version.  Have
       // the installation update the build information so
@@ -734,8 +766,18 @@
       Set<String> cs = new HashSet<String>(Arrays.asList(children));
 
       // TODO:  more testing of file dir
+      String installPath = System.getProperty("INSTALL_ROOT");
+      String instancePath = System.getProperty("INSTANCE_ROOT");
+      if (installPath.equals(instancePath))
+      {
       isFilesDir = cs.contains(CONFIG_PATH_RELATIVE) &&
               cs.contains(LIBRARIES_PATH_RELATIVE);
+      }
+      else
+      {
+        isFilesDir = cs.contains(Installation.HISTORY_BACKUP_FILES_DIR_INSTALL)
+        && cs.contains( Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
+      }
     }
     return isFilesDir;
   }
@@ -1089,7 +1131,22 @@
   {
     if (archiveInstallation == null) {
       File revFiles = getReversionFilesDirectory();
-      archiveInstallation = new Installation(revFiles);
+      String[] children = revFiles.list();
+      Set<String> cs = new HashSet<String>(Arrays.asList(children));
+      if ((cs.contains(Installation.HISTORY_BACKUP_FILES_DIR_INSTALL)) &&
+          (cs.contains(Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE)))
+      {
+        File installRevFiles =
+          new File (revFiles,Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
+        File instanceRevFiles =
+          new File (revFiles,Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
+        archiveInstallation =
+          new Installation(installRevFiles,instanceRevFiles);
+      }
+      else
+      {
+        archiveInstallation = new Installation(revFiles,revFiles);
+      }
     }
     return archiveInstallation;
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java
index 64ae24f..0be6085 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Stage.java
@@ -31,6 +31,7 @@
 import static org.opends.messages.QuickSetupMessages.*;
 import org.opends.messages.Message;
 import org.opends.quicksetup.ApplicationException;
+import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.util.Utils;
 import org.opends.quicksetup.util.FileManager;
 
@@ -79,7 +80,39 @@
   throws ApplicationException {
     for (String fileName : root.list()) {
       File dest = new File(destination, fileName);
-      File src = getSourceForCopy(fileName, dest);
+      File srctmp = new File(root, fileName);
+      File src = getSourceForCopy(srctmp, fileName, dest);
+      //fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
+      fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
+    }
+  }
+
+  /**
+   * Moves the files in the staging area to a destination directory.
+   *
+   * @param destination for the staged files
+   * @param fileFilter the file filter to be used
+   * @param forInstallDir true if the filter is for the install directory.
+   * @throws ApplicationException if something goes wrong
+   */
+  public void move(File destination, FileFilter fileFilter,
+      boolean forInstallDir)
+  throws ApplicationException {
+    File actualRoot = root ;
+    if (forInstallDir)
+    {
+      actualRoot =
+        new File(root, Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
+    }
+    else
+    {
+      actualRoot =
+        new File(root, Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
+    }
+    for (String fileName : actualRoot.list()) {
+      File dest = new File(destination, fileName);
+      File srctmp = new File(actualRoot, fileName);
+      File src = getSourceForCopy(srctmp, fileName, dest);
       //fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
       fm.copyRecursively(src, destination, fileFilter, /*overwrite=*/true);
     }
@@ -95,9 +128,7 @@
     return Collections.unmodifiableList(messages);
   }
 
-  private File getSourceForCopy(String fileName, File dest) {
-
-    File src = new File(root, fileName);
+  private File getSourceForCopy(File src, String fileName, File dest) {
 
     // If this is the running script on Windows, see if it is actually
     // different than the new version.  If not don't do anything but if
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java
index 38981ec..d12678f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeFileFilter.java
@@ -28,18 +28,28 @@
 package org.opends.quicksetup.upgrader;
 
 import org.opends.quicksetup.util.Utils;
+import org.opends.quicksetup.util.Utils.Dir;
 
 import java.io.FileFilter;
 import java.io.File;
 import java.util.Set;
 import java.util.HashSet;
 
+
 /**
    * Filter defining files we want to manage in the upgrade
  * process.
  */
 class UpgradeFileFilter implements FileFilter {
 
+  /**
+   * Private variable that store the filter scope.
+   */
+  private Dir dir ;
+
+
+  private Set<File>  installDirFileList;
+
   Set<File> filesToIgnore;
 
   /**
@@ -57,6 +67,33 @@
       Upgrader.FILES_TO_IGNORE_DURING_BACKUP) {
       filesToIgnore.add(new File(root, rootFileNamesToIgnore));
     }
+
+    dir = Dir.ALL ;
+    installDirFileList = null ;
+  }
+
+  /**
+   * Creates a filter for ignoring in an OpenDS installation at
+   * <code>root</code>certain OpenDS files below root.
+   * @param root the root of the installation
+   * @param forInstallDir true if the filter is for the install directory.
+   */
+  public UpgradeFileFilter(File root, boolean forInstallDir) {
+    this(root);
+    if (forInstallDir)
+    {
+      dir = Dir.INSTALL;
+    }
+    else
+    {
+      dir = Dir.INSTANCE;
+    }
+
+    installDirFileList = new HashSet<File>();
+    for (String rootInstallDirFile :
+            Upgrader.ROOT_FILE_FOR_INSTALL_DIR) {
+      installDirFileList.add(new File(root, rootInstallDirFile));
+    }
   }
 
   /**
@@ -71,6 +108,41 @@
         break;
       }
     }
+
+    if ((!accept) || (dir.compareTo(Dir.ALL) == 0))
+    {
+      return accept ;
+    }
+
+    // If we are here, accept is still set to "true".
+    if(dir.compareTo(Dir.INSTALL) == 0)
+    {
+      accept = false ;
+      for (File installDirFile : installDirFileList) {
+        if (installDirFile.equals(file) ||
+                Utils.isParentOf(installDirFile, file)) {
+          accept = true ;
+          break;
+        }
+      }
+    }
+    else
+    if (dir.compareTo(Dir.INSTANCE) == 0)
+    {
+      for (File installDirFile : installDirFileList) {
+        if (installDirFile.equals(file) ||
+                Utils.isParentOf(installDirFile, file)) {
+          accept = false ;
+          break;
+        }
+      }
+    }
+    else
+    {
+      // Should never occurs
+      accept = false ;
+    }
+
     return accept;
   }
 }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 1ccee21..0c7e279 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -72,8 +72,10 @@
 import org.opends.server.tools.JavaPropertiesTool;
 
 import java.awt.event.WindowEvent;
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileFilter;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.InetSocketAddress;
@@ -105,6 +107,13 @@
           "org.opends.quicksetup.upgrader.Root";
 
   /**
+   * Passed in from the shell script if the root is known at the time
+   * of invocation.
+   */
+  static private final String SYS_PROP_INSTANCE_ROOT =
+          "org.opends.quicksetup.upgrader.Instance";
+
+  /**
    * If set to true, an error is introduced during the
    * upgrade process for testing.
    */
@@ -134,7 +143,28 @@
           LOGS_PATH_RELATIVE, // logs
           LOCKS_PATH_RELATIVE, // locks
           HISTORY_PATH_RELATIVE, // history
-          TMP_PATH_RELATIVE // tmp
+          TMP_PATH_RELATIVE, // tmp
+          INSTANCE_LOCATION_PATH_RELATIVE //instance.loc
+  };
+
+  // Files that should be located into the install directory
+  static final String[] ROOT_FILE_FOR_INSTALL_DIR= {
+    "bin",
+    "lib",
+    "bat",
+    "setup",
+    "setup.bat",
+    "uninstall",
+    "uninstall.bat",
+    "install.html",
+    "install.txt",
+    "legal-notices",
+    "opends_logo.png",
+    "README",
+    "upgrade",
+    "upgrade.bat",
+    "QuickSetup.app",
+    "Uninstall.app"
   };
 
   // Files that will be ignored during backup
@@ -218,10 +248,21 @@
       initLoader();
     }
 
-    final String instanceRootFromSystem =
+    final String installRootFromSystem =
             System.getProperty(SYS_PROP_INSTALL_ROOT);
-    if (instanceRootFromSystem != null) {
-      setInstallation(new Installation(instanceRootFromSystem));
+    final String instanceRootFromSystem =
+      System.getProperty(SYS_PROP_INSTANCE_ROOT);
+    if (installRootFromSystem != null)
+    {
+      if (instanceRootFromSystem != null)
+      {
+        setInstallation(new Installation(installRootFromSystem,
+            instanceRootFromSystem));
+      } else
+      {
+        setInstallation(new Installation(installRootFromSystem,
+            installRootFromSystem));
+      }
     }
 
   }
@@ -311,25 +352,67 @@
    */
   public String getInstallationPath() {
     // The upgrader runs from the bits extracted by BuildExtractor
-    // in the staging directory.  So 'stagePath' below will point
-    // to the staging directory [installroot]/tmp/upgrade.  However
+    // in the staging directory.  However
     // we still want the Installation to point at the build being
     // upgraded so the install path reported in [installroot].
+    return System.getProperty("INSTALL_ROOT");
+  }
 
-    String installationPath = null;
-    String path = Utils.getInstallPathFromClasspath();
-    if (path != null) {
-      File f = new File(path);
-      if (f.getParentFile() != null &&
-              f.getParentFile().getParentFile() != null &&
-              new File(f.getParentFile().getParentFile(),
-                      Installation.LOCKS_PATH_RELATIVE).exists()) {
-        installationPath = Utils.getPath(f.getParentFile().getParentFile());
-      } else {
-        installationPath = path;
+  /**
+   * {@inheritDoc}
+   */
+  public String getInstancePath()
+  {
+    String installPath = getInstallationPath();
+    if (installPath == null)
+    {
+      return null;
+    }
+
+    String instancePathFileName = installPath + File.separator + "instance.loc";
+
+    // look for <installPath>/instance.loc
+    File f = new File(instancePathFileName);
+    if (!f.exists())
+    {
+      return installPath;
+    }
+
+    BufferedReader reader;
+    try
+    {
+      reader = new BufferedReader(new FileReader(instancePathFileName));
+    } catch (Exception e)
+    {
+      return installPath;
+    }
+
+    // Read the first line and close the file.
+    String line;
+    try
+    {
+      line = reader.readLine();
+      File instanceLoc = new File(line);
+      if (instanceLoc.isAbsolute())
+      {
+        return instanceLoc.getAbsolutePath();
+      } else
+      {
+        return new File(installPath + File.separator
+            + line).getAbsolutePath();
+      }
+    } catch (Exception e)
+    {
+      return installPath;
+    } finally
+    {
+      try
+      {
+        reader.close();
+      } catch (Exception e)
+      {
       }
     }
-    return installationPath;
   }
 
   /**
@@ -588,7 +671,8 @@
                               "'null'" :
                               currentInstallation.getRootDirectory()) +
                       " to " + serverLocation);
-              Installation installation = new Installation(serverLocation);
+              Installation installation = new Installation(serverLocation,
+                  serverLocation);
               setInstallation(installation);
             }
 
@@ -1351,7 +1435,7 @@
       File root = getInstallation().getRootDirectory();
       File backupDirectory;
       try {
-        backupDirectory = getFilesBackupDirectory();
+        backupDirectory = getFilesInstallBackupDirectory();
         FileManager fm = new FileManager();
         boolean restoreError = false;
         for (String fileName : backupDirectory.list()) {
@@ -1372,6 +1456,30 @@
           fm.deleteRecursively(backupDirectory);
         }
 
+        if (! instanceAndInstallInSameDir())
+        {
+          root = getInstallation().getInstanceDirectory();
+          backupDirectory = getFilesInstanceBackupDirectory();
+          fm = new FileManager();
+          for (String fileName : backupDirectory.list()) {
+            File f = new File(backupDirectory, fileName);
+
+            // Do our best to restore the filesystem like
+            // we found it.  Just report potential problems
+            // to the user.
+            try {
+              fm.move(f, root, null);
+            } catch (Throwable t) {
+              restoreError = true;
+              notifyListeners(INFO_ERROR_RESTORING_FILE.get(Utils.getPath(f),
+                      Utils.getPath(root)));
+            }
+          }
+          if (!restoreError) {
+            fm.deleteRecursively(backupDirectory);
+          }
+        }
+
         // Restart the server after putting the files
         // back like we found them.
         ServerController sc = new ServerController(getInstallation());
@@ -1398,7 +1506,18 @@
       Stage stage = getStage();
       Installation installation = getInstallation();
       File root = installation.getRootDirectory();
-      stage.move(root, new UpgradeFileFilter(getStageDirectory()));
+
+      if (instanceAndInstallInSameDir())
+      {
+        stage.move(root, new UpgradeFileFilter(getStageDirectory()));
+      }
+      else
+      {
+        stage.move(root, new UpgradeFileFilter(getStageDirectory(),true));
+
+        root = installation.getInstanceDirectory();
+        stage.move(root, new UpgradeFileFilter(getStageDirectory(),false));
+      }
 
       // The bits should now be of the new version.  Have
       // the installation update the build information so
@@ -1418,7 +1537,7 @@
     // The config directory may contain files that are needed
     // by the new installation (e.g. SSL config files and tasks)
     File oldConfigDir =
-            new File(getFilesBackupDirectory(),
+            new File(getFilesInstanceBackupDirectory(),
                      Installation.CONFIG_PATH_RELATIVE);
     File newConfigDir =
             getInstallation().getConfigurationDirectory();
@@ -1440,7 +1559,9 @@
 
   private void backupFilesystem() throws ApplicationException {
     try {
-      File filesBackupDirectory = getFilesBackupDirectory();
+      // Backup first install (potentially everything if install and instance
+      //  are in the same dir
+      File filesBackupDirectory = getFilesInstallBackupDirectory();
       FileManager fm = new FileManager();
       File root = getInstallation().getRootDirectory();
       FileFilter filter = new UpgradeFileFilter(root);
@@ -1458,6 +1579,27 @@
 
         fm.move(f, filesBackupDirectory, filter);
       }
+      if (!instanceAndInstallInSameDir())
+      {
+        filesBackupDirectory = getFilesInstanceBackupDirectory();
+        root = getInstallation().getInstanceDirectory();
+        filter = new UpgradeFileFilter(root);
+        for (String fileName : root.list())
+        {
+          File f = new File(root, fileName);
+
+          // Replacing a Windows bat file while it is running with a different
+          // version leads to unpredictable behavior so we make a special case
+          // here and during the upgrade components step. This file will only
+          // be backed up at the end of the process if everything went fine.
+          if (Utils.isWindows()
+              && fileName.equals(Installation.WINDOWS_UPGRADE_FILE_NAME))
+          {
+            continue;
+          }
+          fm.move(f, filesBackupDirectory, filter);
+        }
+      }
     } catch (ApplicationException ae) {
       throw ae;
     } catch (Exception e) {
@@ -1480,7 +1622,7 @@
     {
       if (Utils.isWindows())
       {
-        File filesBackupDirectory = getFilesBackupDirectory();
+        File filesBackupDirectory = getFilesInstallBackupDirectory();
         FileManager fm = new FileManager();
         File root = getInstallation().getRootDirectory();
         File f = new File(root, Installation.WINDOWS_UPGRADE_FILE_NAME);
@@ -1620,7 +1762,8 @@
       File stageDir = getStageDirectory();
       try {
         Installation.validateRootDirectory(stageDir);
-        stagedInstallation = new Installation(getStageDirectory());
+        stagedInstallation = new Installation(getStageDirectory(),
+            getStageDirectory());
       } catch (IllegalArgumentException e) {
         Message msg = INFO_ERROR_BAD_STAGE_DIRECTORY.get(
                 Utils.getPath(getStageDirectory()));
@@ -1746,6 +1889,37 @@
     return (UpgradeUserData) getUserData();
   }
 
+  private boolean instanceAndInstallInSameDir()
+  {
+    File installDir  = new File(getInstallationPath()) ;
+    File instanceDir = new File(getInstancePath()) ;
+    return installDir.getAbsolutePath().equals(instanceDir.getAbsolutePath());
+  }
+
+  private File getFilesInstanceBackupDirectory() throws IOException
+  {
+    if (instanceAndInstallInSameDir())
+    {
+      return getFilesBackupDirectory();
+    } else
+    {
+      return new File(getFilesBackupDirectory(),
+          Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
+    }
+  }
+
+  private File getFilesInstallBackupDirectory() throws IOException
+  {
+    if (instanceAndInstallInSameDir())
+    {
+      return getFilesBackupDirectory();
+    } else
+    {
+      return new File(getFilesBackupDirectory(),
+          Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
+    }
+  }
+
   private File getFilesBackupDirectory() throws IOException {
     File files = new File(getUpgradeBackupDirectory(),
             Installation.HISTORY_BACKUP_FILES_DIR_NAME);
@@ -1754,6 +1928,29 @@
         throw new IOException("error creating files backup directory");
       }
     }
+
+    // Check if instance and instance are in the same dir
+    if ( ! instanceAndInstallInSameDir())
+    {
+      File install = new File(files,
+          Installation.HISTORY_BACKUP_FILES_DIR_INSTALL);
+      if (!install.exists())
+      {
+        if (!install.mkdirs())
+        {
+          throw new IOException("error creating files backup directory");
+        }
+      }
+      File instance = new File(files,
+          Installation.HISTORY_BACKUP_FILES_DIR_INSTANCE);
+      if (!instance.exists())
+      {
+        if (!instance.mkdirs())
+        {
+          throw new IOException("error creating files backup directory");
+        }
+      }
+    }
     return files;
   }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index b2f49d4..8f007fc 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -34,6 +34,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
@@ -82,6 +83,27 @@
   }
 
   /**
+   * Enumeration that specify if the operation applies to the install directory
+   * only, to the instance directory only, or both.
+   */
+  public static enum  Dir {
+    /**
+     * all directories.
+     */
+    ALL,
+
+    /**
+     * The install directory.
+     */
+    INSTALL,
+
+    /***
+     * The instance directory.
+     */
+    INSTANCE;
+  }
+
+  /**
    * Returns <CODE>true</CODE> if the provided port is free and we can use it,
    * <CODE>false</CODE> otherwise.
    * @param port the port we are analyzing.
@@ -1093,6 +1115,7 @@
     return ConnectionUtils.getDefaultLDAPTimeout();
   }
 
+
   /**
    * Returns the path of the installation of the directory server.  Note that
    * this method assumes that this code is being run locally.
@@ -1100,7 +1123,11 @@
    */
   public static String getInstallPathFromClasspath()
   {
-    String installPath = null;
+    String installPath = System.getProperty("org.opends.quicksetup.Root");
+    if (installPath != null)
+    {
+      return installPath;
+    }
 
     /* Get the install path from the Class Path */
     String sep = System.getProperty("path.separator");
@@ -1140,6 +1167,63 @@
   }
 
   /**
+   * Returns the path of the installation of the directory server.  Note that
+   * this method assumes that this code is being run locally.
+   * @param installPath The installation path
+   * @return the path of the installation of the directory server.
+   */
+  public static String getInstancePathFromClasspath(String installPath)
+  {
+    String instancePathFileName = installPath + File.separator + "instance.loc";
+
+    // look for <installPath>/instance.loc
+    File f = new File(instancePathFileName);
+    if (! f.exists())
+    {
+      return installPath;
+    }
+
+    BufferedReader reader;
+    try
+    {
+      reader = new BufferedReader(new FileReader(instancePathFileName));
+    }
+    catch (Exception e)
+    {
+      return installPath;
+    }
+
+
+    // Read the first line and close the file.
+    String line;
+    try
+    {
+      line = reader.readLine();
+      File instanceLoc =  new File (line);
+      if (instanceLoc.isAbsolute())
+      {
+        return instanceLoc.getAbsolutePath();
+      }
+      else
+      {
+        return new File(installPath + File.separator + instanceLoc.getPath())
+            .getAbsolutePath();
+      }
+    }
+    catch (Exception e)
+    {
+      return installPath;
+    }
+    finally
+    {
+      try
+      {
+        reader.close();
+      } catch (Exception e) {}
+    }
+  }
+
+  /**
 
    * Returns the max size in character of a line to be displayed in the command
    * line.
diff --git a/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java b/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
index a441b68..078ed0c 100644
--- a/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
+++ b/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
@@ -207,7 +207,7 @@
           "Class loader provider is disabled.");
     }
 
-    File libPath = new File(DirectoryServer.getServerRoot(), LIB_DIR);
+    File libPath = new File(DirectoryServer.getInstanceRoot(), LIB_DIR);
     File extensionsPath = new File(libPath, EXTENSIONS_DIR);
 
     ArrayList<File> files = new ArrayList<File>(extensions.length);
@@ -396,7 +396,7 @@
    */
   private void initializeAllExtensions()
       throws InitializationException {
-    File libPath = new File(DirectoryServer.getServerRoot(), LIB_DIR);
+    File libPath = new File(DirectoryServer.getInstanceRoot(), LIB_DIR);
     File extensionsPath = new File(libPath, EXTENSIONS_DIR);
 
     try {
diff --git a/opends/src/server/org/opends/server/api/ConfigHandler.java b/opends/src/server/org/opends/server/api/ConfigHandler.java
index a2c1279..f19e9d3 100644
--- a/opends/src/server/org/opends/server/api/ConfigHandler.java
+++ b/opends/src/server/org/opends/server/api/ConfigHandler.java
@@ -113,13 +113,21 @@
 
 
   /**
+   * Retrieves the absolute path of the Directory Server install
+   * root.
+   *
+   * @return  The absolute path of the Directory Server install root.
+   */
+  public abstract String getServerRoot();
+
+
+  /**
    * Retrieves the absolute path of the Directory Server instance
    * root.
    *
    * @return  The absolute path of the Directory Server instance root.
    */
-  public abstract String getServerRoot();
-
+  public abstract String getInstanceRoot();
 
 
   /**
diff --git a/opends/src/server/org/opends/server/config/ConfigConstants.java b/opends/src/server/org/opends/server/config/ConfigConstants.java
index e5fc391..96b52ee 100644
--- a/opends/src/server/org/opends/server/config/ConfigConstants.java
+++ b/opends/src/server/org/opends/server/config/ConfigConstants.java
@@ -3111,7 +3111,7 @@
    * The name of the environment variable that the Directory Server may check to
    * determine the installation root.
    */
-  public static final String ENV_VAR_INSTANCE_ROOT = "INSTANCE_ROOT";
+  public static final String ENV_VAR_INSTALL_ROOT = "INSTALL_ROOT";
 
 
 
diff --git a/opends/src/server/org/opends/server/core/DefaultCompressedSchema.java b/opends/src/server/org/opends/server/core/DefaultCompressedSchema.java
index 8a4dbb7..fbf7e5a 100644
--- a/opends/src/server/org/opends/server/core/DefaultCompressedSchema.java
+++ b/opends/src/server/org/opends/server/core/DefaultCompressedSchema.java
@@ -135,7 +135,7 @@
       // Determine the location of the compressed schema data file.  It should
       // be in the config directory with a name of "schematokens.dat".  If that
       // file doesn't exist, then don't do anything.
-      String path = DirectoryServer.getServerRoot() + File.separator +
+      String path = DirectoryServer.getInstanceRoot() + File.separator +
                     CONFIG_DIR_NAME + File.separator +
                     COMPRESSED_SCHEMA_FILE_NAME;
       if (! new File(path).exists())
@@ -274,7 +274,7 @@
       // Determine the location of the "live" compressed schema data file, and
       // then append ".tmp" to get the name of the temporary file that we will
       // use.
-      String path = DirectoryServer.getServerRoot() + File.separator +
+      String path = DirectoryServer.getInstanceRoot() + File.separator +
                     CONFIG_DIR_NAME + File.separator +
                     COMPRESSED_SCHEMA_FILE_NAME;
       String tempPath = path + ".tmp";
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 4d108ef..2db04b8 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -75,7 +75,7 @@
 import org.opends.server.api.plugin.PluginResult;
 import org.opends.server.backends.RootDSEBackend;
 import static org.opends.server.config.ConfigConstants.DN_MONITOR_ROOT;
-import static org.opends.server.config.ConfigConstants.ENV_VAR_INSTANCE_ROOT;
+import static org.opends.server.config.ConfigConstants.ENV_VAR_INSTALL_ROOT;
 import org.opends.server.config.ConfigEntry;
 import org.opends.server.config.ConfigException;
 import org.opends.server.config.JMXMBean;
@@ -1482,7 +1482,7 @@
 
       // If a server.starting file exists, then remove it.
       File serverStartingFile =
-                new File(configHandler.getServerRoot() + File.separator +
+                new File(configHandler.getInstanceRoot() + File.separator +
                          "logs" + File.separator + "server.starting");
       if (serverStartingFile.exists())
       {
@@ -3239,6 +3239,39 @@
   }
 
   /**
+   * Retrieves the path to the instance directory for this instance of the
+   * Directory Server.
+   *
+   * @return The path to the instance directory for this instance of
+   * the Directory Server.
+   */
+  public static String getInstanceRoot()
+  {
+    if (directoryServer.configHandler == null)
+    {
+      File serverRoot = directoryServer.environmentConfig.getServerRoot();
+      if (serverRoot != null)
+      {
+        File instanceRoot =
+          directoryServer.environmentConfig.getInstanceRootFromServerRoot(
+              serverRoot);
+        if (instanceRoot != null)
+        {
+          return instanceRoot.getAbsolutePath();
+        }
+      }
+
+      // We don't know where the server root is, so we'll have to assume it's
+      // the current working directory.
+      return System.getProperty("user.dir");
+    }
+    else
+    {
+      return directoryServer.configHandler.getInstanceRoot();
+    }
+  }
+
+  /**
    * Retrieves the time that the Directory Server was started, in milliseconds
    * since the epoch.
    *
@@ -9458,18 +9491,20 @@
     {
       String pidFilePath;
       String startingFilePath;
-      String serverRoot = System.getenv(ENV_VAR_INSTANCE_ROOT);
-      if (serverRoot == null)
+      String serverRoot = System.getenv(ENV_VAR_INSTALL_ROOT);
+      File instanceRoot = DirectoryEnvironmentConfig
+          .getInstanceRootFromServerRoot(new File(serverRoot));
+      if (instanceRoot == null)
       {
         pidFilePath      = "logs/server.pid";
         startingFilePath = "logs/server.starting";
       }
       else
       {
-        pidFilePath      = serverRoot + File.separator + "logs" +
-                           File.separator + "server.pid";
-        startingFilePath = serverRoot + File.separator + "logs" +
-                           File.separator + "server.starting";
+        pidFilePath = instanceRoot.getAbsolutePath() + File.separator + "logs"
+            + File.separator + "server.pid";
+        startingFilePath = instanceRoot.getAbsolutePath() + File.separator
+            + "logs" + File.separator + "server.starting";
       }
 
       File pidFile = new File(pidFilePath);
@@ -9498,7 +9533,7 @@
       // We need to figure out where to put the file.  See if the server root
       // is available as an environment variable and if so then use it.
       // Otherwise, try to figure it out from the location of the config file.
-      String serverRoot = System.getenv(ENV_VAR_INSTANCE_ROOT);
+      String serverRoot = System.getenv(ENV_VAR_INSTALL_ROOT);
       if (serverRoot == null)
       {
         serverRoot = new File(configFile.getValue()).getParentFile().
@@ -9513,7 +9548,10 @@
       }
       else
       {
-        File logDir = new File(serverRoot + File.separator + "logs");
+        File instanceRoot = DirectoryEnvironmentConfig
+            .getInstanceRootFromServerRoot(new File(serverRoot));
+        File logDir = new File(instanceRoot.getAbsolutePath() + File.separator
+            + "logs");
         if (logDir.exists())
         {
           FileOutputStream fos =
diff --git a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index 01020ba..6a14302 100644
--- a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -174,9 +174,12 @@
   // The path to the configuration file.
   private String configFile;
 
-  // The instance root directory for the Directory Server.
+  // The install root directory for the Directory Server.
   private String serverRoot;
 
+  // The instance root directory for the Directory Server.
+  private String instanceRoot;
+
 
 
   /**
@@ -694,7 +697,7 @@
         if (serverRoot == null)
         {
           Message message = ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(
-              ENV_VAR_INSTANCE_ROOT);
+              ENV_VAR_INSTALL_ROOT);
           throw new InitializationException(message);
         }
       }
@@ -715,7 +718,7 @@
         }
 
         Message message =
-            ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(ENV_VAR_INSTANCE_ROOT);
+            ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(ENV_VAR_INSTALL_ROOT);
         throw new InitializationException(message);
       }
     }
@@ -724,6 +727,23 @@
       serverRoot = rootFile.getAbsolutePath();
     }
 
+    // Determine the appropriate server root.  If it's not defined in the
+    // environment config, then try to figure it out from the location of the
+    // configuration file.
+    File instanceFile = envConfig.getInstanceRootFromServerRoot(new File(
+        serverRoot));
+    if (instanceFile == null)
+    {
+      Message message =
+        ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(ENV_VAR_INSTALL_ROOT);
+        throw new InitializationException(message);
+    }
+    else
+    {
+      instanceRoot = instanceFile.getAbsolutePath();
+    }
+
+
 
     // Register with the Directory Server as an alert generator.
     DirectoryServer.registerAlertGenerator(this);
@@ -1083,6 +1103,15 @@
     return serverRoot;
   }
 
+  /**
+   * {@inheritDoc}
+   */
+  @Override()
+  public String getInstanceRoot()
+  {
+    return instanceRoot;
+  }
+
 
 
   /**
diff --git a/opends/src/server/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java b/opends/src/server/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
index 00957f6..ae2a17b 100644
--- a/opends/src/server/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
+++ b/opends/src/server/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -279,7 +279,7 @@
       File f = new File(path);
       if (! f.isAbsolute() )
       {
-        f = new File(DirectoryServer.getServerRoot() + File.separator +
+        f = new File(DirectoryServer.getInstanceRoot() + File.separator +
             path);
       }
       if (! f.exists())
diff --git a/opends/src/server/org/opends/server/protocols/LDIFConnectionHandler.java b/opends/src/server/org/opends/server/protocols/LDIFConnectionHandler.java
index 841ee28..8af3200 100644
--- a/opends/src/server/org/opends/server/protocols/LDIFConnectionHandler.java
+++ b/opends/src/server/org/opends/server/protocols/LDIFConnectionHandler.java
@@ -143,8 +143,8 @@
 
     // If we have a relative path to the instance, get the absolute one.
     if ( ! ldifDirectory.isAbsolute() ) {
-      ldifDirectory = new File(DirectoryServer.getServerRoot() + File.separator
-          + ldifDirectoryPath);
+      ldifDirectory = new File(DirectoryServer.getInstanceRoot()
+          + File.separator + ldifDirectoryPath);
     }
 
     if (ldifDirectory.exists())
diff --git a/opends/src/server/org/opends/server/tasks/BackupTask.java b/opends/src/server/org/opends/server/tasks/BackupTask.java
index 20280a4..f323f7e 100644
--- a/opends/src/server/org/opends/server/tasks/BackupTask.java
+++ b/opends/src/server/org/opends/server/tasks/BackupTask.java
@@ -246,7 +246,7 @@
     if (! backupDirectory.isAbsolute())
     {
       backupDirectory =
-           new File(DirectoryServer.getServerRoot(), backupDirectoryPath);
+           new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath);
     }
 
     attrList = taskEntry.getAttribute(typeIncrementalBaseID);
diff --git a/opends/src/server/org/opends/server/tasks/RestoreTask.java b/opends/src/server/org/opends/server/tasks/RestoreTask.java
index 8111b24..3143e6f 100644
--- a/opends/src/server/org/opends/server/tasks/RestoreTask.java
+++ b/opends/src/server/org/opends/server/tasks/RestoreTask.java
@@ -156,7 +156,7 @@
     if (! backupDirectory.isAbsolute())
     {
       backupDirectory =
-           new File(DirectoryServer.getServerRoot(), backupDirectoryPath);
+           new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath);
     }
 
     attrList = taskEntry.getAttribute(typebackupID);
diff --git a/opends/src/server/org/opends/server/tools/CreateRCScript.java b/opends/src/server/org/opends/server/tools/CreateRCScript.java
index 7221a70..5b0a11b 100644
--- a/opends/src/server/org/opends/server/tools/CreateRCScript.java
+++ b/opends/src/server/org/opends/server/tools/CreateRCScript.java
@@ -129,7 +129,7 @@
     if (serverRoot == null)
     {
       err.println(ERR_CREATERC_UNABLE_TO_DETERMINE_SERVER_ROOT.get(
-                       PROPERTY_SERVER_ROOT, ENV_VAR_INSTANCE_ROOT).toString());
+                       PROPERTY_SERVER_ROOT, ENV_VAR_INSTALL_ROOT).toString());
       return 1;
     }
 
@@ -246,8 +246,8 @@
       w.println();
 
       w.println("# Set the path to the OpenDS instance to manage");
-      w.println("INSTANCE_ROOT=\"" + serverRoot.getAbsolutePath() + "\"");
-      w.println("export INSTANCE_ROOT");
+      w.println("INSTALL_ROOT=\"" + serverRoot.getAbsolutePath() + "\"");
+      w.println("export INSTALL_ROOT");
       w.println();
 
       if (javaHomeDir != null)
@@ -269,15 +269,15 @@
       w.println("# Determine what action should be performed on the server");
       w.println("case \"${1}\" in");
       w.println("start)");
-      w.println("  " + suString + "\"${INSTANCE_ROOT}/bin/start-ds\" --quiet");
+      w.println("  " + suString + "\"${INSTALL_ROOT}/bin/start-ds\" --quiet");
       w.println("  exit ${?}");
       w.println("  ;;");
       w.println("stop)");
-      w.println("  " + suString + "\"${INSTANCE_ROOT}/bin/stop-ds\" --quiet");
+      w.println("  " + suString + "\"${INSTALL_ROOT}/bin/stop-ds\" --quiet");
       w.println("  exit ${?}");
       w.println("  ;;");
       w.println("restart)");
-      w.println("  " + suString + "\"${INSTANCE_ROOT}/bin/stop-ds\" " +
+      w.println("  " + suString + "\"${INSTALL_ROOT}/bin/stop-ds\" " +
                 "--restart --quiet");
       w.println("  exit ${?}");
       w.println("  ;;");
diff --git a/opends/src/server/org/opends/server/tools/ImportLDIF.java b/opends/src/server/org/opends/server/tools/ImportLDIF.java
index a6ebe3f..4a7e3a8 100644
--- a/opends/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -1229,7 +1229,7 @@
         random = new Random();
       }
 
-      String resourcePath = DirectoryServer.getServerRoot() + File.separator +
+      String resourcePath = DirectoryServer.getInstanceRoot() + File.separator +
                             PATH_MAKELDIF_RESOURCE_DIR;
       TemplateFile tf = new TemplateFile(resourcePath, random);
 
diff --git a/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java b/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
index 0257368..ae388a0 100644
--- a/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
+++ b/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
@@ -716,7 +716,8 @@
   {
     // Use this instead of Installation.getLocal() because making that call
     // starts a new JVM and the command-line becomes less responsive.
-    String root = Utils.getInstallPathFromClasspath();
+    String a = Utils.getInstallPathFromClasspath();
+    String root = Utils.getInstancePathFromClasspath(a);
     String configDir = Utils.getPath(root, Installation.CONFIG_PATH_RELATIVE);
     return Utils.getPath(configDir, Installation.CURRENT_CONFIG_FILE_NAME);
   }
diff --git a/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java b/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
index 7910087..8afc9a5 100644
--- a/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
+++ b/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
@@ -163,7 +163,8 @@
     String value;
     // Use this instead of Installation.getLocal() because making that call
     // starts a new JVM and the command-line becomes less responsive.
-    String root = Utils.getInstallPathFromClasspath();
+    String installPath = Utils.getInstallPathFromClasspath();
+    String root = Utils.getInstancePathFromClasspath(installPath);
     if (root != null)
     {
       String libDir = Utils.getPath(root, Installation.LIBRARIES_PATH_RELATIVE);
@@ -206,7 +207,8 @@
     String defaultPropertiesValue;
     // Use this instead of Installation.getLocal() because making that call
     // starts a new JVM and the command-line becomes less responsive.
-    String root = Utils.getInstallPathFromClasspath();
+    String installPath = Utils.getInstallPathFromClasspath();
+    String root = Utils.getInstancePathFromClasspath(installPath);
     if (root != null)
     {
       String configDir = Utils.getPath(root, Installation.CONFIG_PATH_RELATIVE);
diff --git a/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java b/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java
index dabd2d4..8f00dcc 100644
--- a/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java
+++ b/opends/src/server/org/opends/server/types/DirectoryEnvironmentConfig.java
@@ -28,7 +28,9 @@
 
 
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
@@ -196,7 +198,7 @@
     String serverRootPath = getProperty(PROPERTY_SERVER_ROOT);
     if (serverRootPath == null)
     {
-      serverRootPath = System.getenv(ENV_VAR_INSTANCE_ROOT);
+      serverRootPath = System.getenv(ENV_VAR_INSTALL_ROOT);
     }
 
     if (serverRootPath == null)
@@ -209,6 +211,72 @@
     }
   }
 
+  /**
+   * Retrieves the directory that should be considered the instance
+   * root.  The determination will first be based on the properties
+   * defined in this config object.  If no value is found there, then
+   * the JVM system properties will be checked, followed by an
+   * environment variable.
+   *
+   * @param serverRoot the server Root
+   *
+   * @return  The directory that should be considered the instance
+   *          root, or {@code null} if it is not defined.
+   */
+  public static File getInstanceRootFromServerRoot(File serverRoot)
+  {
+    String instancePathFileName = serverRoot.getAbsolutePath() +
+      File.separator + "instance.loc";
+
+    // look for <installPath>/instance.loc
+    File f = new File(instancePathFileName);
+
+    if (! f.exists())
+    {
+      return serverRoot;
+    }
+
+    BufferedReader reader;
+    try
+    {
+      reader = new BufferedReader(
+          new FileReader(instancePathFileName));
+    }
+    catch (Exception e)
+    {
+      return null;
+    }
+
+
+    // Read the first line and close the file.
+    String line;
+    try
+    {
+      line = reader.readLine();
+      File instanceLoc = new File(line);
+      if (instanceLoc.isAbsolute())
+      {
+        return instanceLoc;
+      }
+      else
+      {
+        return new File(serverRoot.getAbsolutePath()  + File.separator
+            + instanceLoc.getPath());
+      }
+    }
+    catch (Exception e)
+    {
+      return null;
+    }
+    finally
+    {
+      try
+      {
+        reader.close();
+      } catch (Exception e) {}
+    }
+  }
+
 
 
   /**
@@ -265,6 +333,60 @@
     }
   }
 
+  /**
+   * Specifies the directory that should be considered the instance
+   * root.  Any relative path used in the server should be considered
+   * relative to the instance root.
+   *
+   * @param  instanceRoot  The directory that should be considered the
+   *                     instanceRoot root.
+   *
+   * @return  The previous server root, or {@code null} if there was
+   *          none.
+   *
+   * @throws  InitializationException  If the Directory Server is
+   *                                   already running or there is a
+   *                                   problem with the provided
+   *                                   server root.
+   */
+  public File setInstanceRoot(File instanceRoot)
+         throws InitializationException
+  {
+    if (DirectoryServer.isRunning())
+    {
+      throw new InitializationException(
+              ERR_DIRCFG_SERVER_ALREADY_RUNNING.get());
+    }
+
+    if ((! instanceRoot.exists()) || (! instanceRoot.isDirectory()))
+    {
+      throw new InitializationException(
+              ERR_DIRCFG_INVALID_SERVER_ROOT.get(
+                  instanceRoot.getAbsolutePath()));
+    }
+
+    String instanceRootPath;
+    try
+    {
+      instanceRootPath = instanceRoot.getCanonicalPath();
+    }
+    catch (Exception e)
+    {
+      instanceRootPath = instanceRoot.getAbsolutePath();
+    }
+
+    String oldInstancePath = setProperty(PROPERTY_INSTANCE_ROOT,
+        instanceRootPath);
+    if (oldInstancePath == null)
+    {
+      return null;
+    }
+    else
+    {
+      return new File(oldInstancePath);
+    }
+  }
+
 
   /**
    * Retrieves the configuration file that should be used to
@@ -284,7 +406,8 @@
       File serverRoot = getServerRoot();
       if (serverRoot != null)
       {
-        File configDir = new File(serverRoot, CONFIG_DIR_NAME);
+        File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
+        File configDir = new File(instanceRoot, CONFIG_DIR_NAME);
         File configFile = new File(configDir, CONFIG_FILE_NAME);
         if (configFile.exists())
         {
@@ -695,7 +818,8 @@
       File serverRoot = getServerRoot();
       if (serverRoot != null)
       {
-        File schemaDir = new File(serverRoot.getAbsolutePath() +
+        File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
+        File schemaDir = new File(instanceRoot.getAbsolutePath() +
                                   File.separator + PATH_SCHEMA_DIR);
         if (schemaDir.exists() && schemaDir.isDirectory())
         {
@@ -789,7 +913,8 @@
       }
       else
       {
-        return new File(serverRoot, LOCKS_DIRECTORY);
+        File instanceRoot = getInstanceRootFromServerRoot(serverRoot);
+        return new File(instanceRoot, LOCKS_DIRECTORY);
       }
     }
     else
diff --git a/opends/src/server/org/opends/server/util/ServerConstants.java b/opends/src/server/org/opends/server/util/ServerConstants.java
index ddd69ad..abb6e4b 100644
--- a/opends/src/server/org/opends/server/util/ServerConstants.java
+++ b/opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2740,6 +2740,12 @@
   public static final String PROPERTY_SERVER_ROOT =
        "org.opends.server.ServerRoot";
 
+  /**
+   * The name of the system property that can be used to specify the path to the
+   * instance root.
+   */
+  public static final String PROPERTY_INSTANCE_ROOT =
+       "org.opends.server.InstanceRoot";
 
 
   /**
diff --git a/opends/src/server/org/opends/server/util/StaticUtils.java b/opends/src/server/org/opends/server/util/StaticUtils.java
index 4ff81da..ea01ec5 100644
--- a/opends/src/server/org/opends/server/util/StaticUtils.java
+++ b/opends/src/server/org/opends/server/util/StaticUtils.java
@@ -3578,7 +3578,8 @@
     }
     else
     {
-      return new File(DirectoryServer.getServerRoot() + File.separator + path);
+      return new File(DirectoryServer.getInstanceRoot() + File.separator +
+          path);
     }
   }
 
diff --git a/opends/src/server/org/opends/server/util/args/ArgumentParser.java b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
index dbd90a2..d39c52c 100644
--- a/opends/src/server/org/opends/server/util/args/ArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -1290,7 +1290,7 @@
       if (propertiesFilePath == null)
       {
         // check "Opends instance"/config directory
-        String instanceDir = DirectoryServer.getServerRoot();
+        String instanceDir = DirectoryServer.getInstanceRoot();
         propertiesFilePath = findPropertiesFile(instanceDir+ File.separator
             + "config");
       }
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
index 41ec2cc..b58165b 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
@@ -76,7 +76,8 @@
    */
   @Test(enabled = false)
   public void testIsValid() {
-    assertTrue(installation.isValid());
+    assertTrue(installation.isValid(installation.getRootDirectory()));
+    assertTrue(installation.isValid(installation.getInstanceDirectory()));
   }
 
   /**
@@ -85,13 +86,15 @@
    */
   @Test(enabled = false)
   public void testIsValid2() {
-    assertTrue(installation.isValid());
+    assertTrue(installation.isValid(installation.getRootDirectory()));
+    assertTrue(installation.isValid(installation.getInstanceDirectory()));
     File x = new File(installation.getRootDirectory(), "x");
     for (String reqDirName : Installation.REQUIRED_DIRECTORIES) {
       File reqDir = new File(installation.getRootDirectory(), reqDirName);
       try {
         assertTrue(reqDir.renameTo(x));
-        assertFalse(installation.isValid());
+        assertFalse(installation.isValid(installation.getRootDirectory()));
+        assertFalse(installation.isValid(installation.getInstanceDirectory()));
         assertNotNull(installation.getInvalidityReason());
       } finally {
         x.renameTo(reqDir);
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
index ac0acbb..4c78b84 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
@@ -33,9 +33,14 @@
 import org.opends.server.TestCaseUtils;
 import org.opends.server.types.OperatingSystem;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
 import java.net.ServerSocket;
 import java.util.List;
 import java.util.ArrayList;
@@ -75,7 +80,7 @@
   }
 
   static public Installation getInstallation() {
-    return new Installation(getQuickSetupTestServerRootDir());
+    return new Installation(getQuickSetupTestServerRootDir(),getQuickSetupTestServerRootDir());
   }
 
   static private void setupServer() throws IOException, InterruptedException {
@@ -106,6 +111,7 @@
     args.add("-O");
 
     ProcessBuilder pb = new ProcessBuilder(args);
+    
     Process p = pb.start();
     if (p.waitFor() != 0) {
       throw new IllegalStateException("setup server failed");
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index 5be714b..9240a02 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -113,6 +113,20 @@
   public static final String PROPERTY_BUILD_ROOT =
        "org.opends.server.BuildRoot";
 
+   /**
+   * The name of the system property that specifies an existing OpenDS
+   * installation root (inside or outside of the source tree).
+   */
+  public static final String PROPERTY_INSTALLED_ROOT =
+      "org.opends.server.InstalledRoot";
+
+  /**
+   * The name of the system property that specifies an LDIF file
+   * with changes compare to the default config.ldif.
+   */
+  public static final String PROPERTY_CONFIG_CHANGE_FILE =
+      "org.opends.server.ConfigChangeFile";
+  
   /**
    * The name of the system property that specifies the ldap port.
    * Set this prtoperty when running the server if you want to use a given
@@ -225,27 +239,44 @@
       String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT);
       File   buildDir  = new File(buildRoot, "build");
       File   unitRoot  = new File(buildDir, "unit-tests");
-      File   testRoot  = new File(unitRoot, "package");
+      File   testInstallRoot  =  new File(unitRoot, "package-install");
+      File   testInstanceRoot  = new File(unitRoot, "package-instance");
       File   testSrcRoot = new File(buildRoot + File.separator + "tests" +
                                     File.separator + "unit-tests-testng");
 
-      if (testRoot.exists())
+      if (testInstallRoot.exists())
       {
-        deleteDirectory(testRoot);
+        deleteDirectory(testInstallRoot);
       }
-      testRoot.mkdirs();
+      if (testInstanceRoot.exists())
+      {
+        deleteDirectory(testInstanceRoot);
+      }
+      testInstallRoot.mkdirs();
+      testInstanceRoot.mkdirs();
+
+      // Retrieves the location of a typical installation directory to use as a
+      // source to build our test instance.
+      String installedRoot = System.getProperty(PROPERTY_INSTALLED_ROOT);
+ 
+      
       //db_verify is second jeb backend used by the jeb verify test cases
       //db_rebuild is the third jeb backend used by the jeb rebuild test cases
       //db_unindexed is the forth backend used by the unindexed search privilege
       //test cases
-      String[] subDirectories = { "bak", "bin", "changelogDb", "classes",
-                                  "config", "db", "import-tmp", "db_verify",
-                                  "ldif", "lib", "locks", "logs", "db_rebuild",
-                                  "db_unindexed", "db_index_test",
-                                  "db_import_test"};
-      for (String s : subDirectories)
+      String[] installSubDirectories = { "bin", "lib", "bat"};
+      String[] instanceSubDirectories = { "bak", "changelogDb", "classes",
+          "config", "db", "import-tmp", "db_verify",
+          "ldif", "locks", "logs", "db_rebuild",
+          "db_unindexed", "db_index_test",
+          "db_import_test"};
+      for (String s : installSubDirectories)
       {
-        new File(testRoot, s).mkdir();
+        new File(testInstallRoot, s).mkdir();
+      }
+      for (String s : instanceSubDirectories)
+      {
+        new File(testInstanceRoot, s).mkdir();
       }
 
       // Copy the configuration, schema, and MakeLDIF resources into the
@@ -255,10 +286,10 @@
       File libDir           = new File(buildRoot, "lib");
       File resourceDir      = new File(buildRoot, "resource");
       File testResourceDir  = new File(testSrcRoot, "resource");
-      File testConfigDir    = new File(testRoot, "config");
-      File testClassesDir   = new File(testRoot, "classes");
-      File testLibDir       = new File(testRoot, "lib");
-      File testBinDir       = new File(testRoot, "bin");
+      File testConfigDir    = new File(testInstanceRoot, "config");
+      File testClassesDir   = new File(testInstanceRoot, "classes");
+      File testLibDir       = new File(testInstallRoot, "lib");
+      File testBinDir       = new File(testInstallRoot, "bin");
       
       // Snmp resource
       String opendmkJarFileLocation = 
@@ -275,64 +306,83 @@
       File testSnmpResourceDir = new File (testConfigDir + File.separator +
                                     "snmp");
       
-      if (Boolean.getBoolean(PROPERTY_COPY_CLASSES_TO_TEST_PKG)) {
+      if (Boolean.getBoolean(PROPERTY_COPY_CLASSES_TO_TEST_PKG))
+      {
         copyDirectory(serverClassesDir, testClassesDir);
         copyDirectory(unitClassesDir, testClassesDir);
       }
-
-      copyDirectory(libDir, testLibDir);
-      copyDirectory(new File(resourceDir, "bin"), testBinDir);
-      copyDirectory(new File(resourceDir, "config"), testConfigDir);
-      copyDirectory(new File(resourceDir, "schema"),
-                    new File(testConfigDir, "schema"));
-      copyDirectory(new File(resourceDir, "MakeLDIF"),
-                    new File(testConfigDir, "MakeLDIF"));
-      copyDirectory(new File(snmpResourceDir, "security"),
-                    new File(testSnmpResourceDir, "security"));
-      copyFile(new File(testResourceDir, "server.keystore"),
-               new File(testConfigDir, "server.keystore"));
-      copyFile(new File(testResourceDir, "server.truststore"),
-               new File(testConfigDir, "server.truststore"));
-      copyFile(new File(testResourceDir, "client.keystore"),
-               new File(testConfigDir, "client.keystore"));
-      copyFile(new File(testResourceDir, "client.truststore"),
-               new File(testConfigDir, "client.truststore"));
-      copyFile(new File(testResourceDir, "server-cert.p12"),
-               new File(testConfigDir, "server-cert.p12"));
-      copyFile(new File(testResourceDir, "client-cert.p12"),
-               new File(testConfigDir, "client-cert.p12"));
       
-      if (opendmkJar.exists()) {
+      if (installedRoot != null)
+      {
+        copyDirectory(new File(installedRoot), testInstallRoot);
+        
+        // Get the instance location
+        
+      }
+      else
+      {
+        copyDirectory(libDir, testLibDir);
+        copyDirectory(new File(resourceDir, "bin"), testBinDir);
+        copyDirectory(new File(resourceDir, "config"), testConfigDir);
+        copyDirectory(new File(resourceDir, "schema"),
+            new File(testConfigDir, "schema"));
+        copyDirectory(new File(resourceDir, "MakeLDIF"),
+            new File(testConfigDir, "MakeLDIF"));
+        copyDirectory(new File(snmpResourceDir, "security"),
+            new File(testSnmpResourceDir, "security"));
+        copyFile(new File(testResourceDir, "server.keystore"),
+            new File(testConfigDir, "server.keystore"));
+        copyFile(new File(testResourceDir, "server.truststore"),
+            new File(testConfigDir, "server.truststore"));
+        copyFile(new File(testResourceDir, "client.keystore"),
+            new File(testConfigDir, "client.keystore"));
+        copyFile(new File(testResourceDir, "client.truststore"),
+            new File(testConfigDir, "client.truststore"));
+        copyFile(new File(testResourceDir, "server-cert.p12"),
+            new File(testConfigDir, "server-cert.p12"));
+        copyFile(new File(testResourceDir, "client-cert.p12"),
+            new File(testConfigDir, "client-cert.p12"));
+
+        // Update the install.loc file
+        File installLoc = new File(testInstallRoot + File.separator
+            + "instance.loc");
+        installLoc.deleteOnExit();
+        FileWriter w = new FileWriter(installLoc);
+        w.write(testInstanceRoot.getAbsolutePath());
+        w.close();
+
+        if (opendmkJar.exists())
+        {
           appendFile(new File(snmpConfigDir, "config.snmp.ldif"),
-               new File(testConfigDir,"config.ldif"));
-      }
+              new File(testConfigDir, "config.ldif"));
+        }
 
-      for (File f : testBinDir.listFiles())
-      {
-        try
+        for (File f : testBinDir.listFiles())
         {
-          FilePermission.setPermissions(f, FilePermission.decodeUNIXMode("755"));
-        } catch (Exception e) {}
-      }
-
-      // Make the shell scripts in the bin directory executable, if possible.
-      OperatingSystem os = DirectoryServer.getOperatingSystem();
-      if ((os != null) && OperatingSystem.isUNIXBased(os) &&
-          FilePermission.canSetPermissions())
-      {
-        try
-        {
-          FilePermission perm = FilePermission.decodeUNIXMode("755");
-          for (File f : testBinDir.listFiles())
+          try
           {
-            if (f.getName().endsWith(".sh"))
-            {
-              FilePermission.setPermissions(f, perm);
-            }
-          }
-        } catch (Exception e) {}
-      }
+            FilePermission.setPermissions(f, FilePermission.decodeUNIXMode("755"));
+          } catch (Exception e) {}
+        }
 
+        // Make the shell scripts in the bin directory executable, if possible.
+        OperatingSystem os = DirectoryServer.getOperatingSystem();
+        if ((os != null) && OperatingSystem.isUNIXBased(os) &&
+            FilePermission.canSetPermissions())
+        {
+          try
+          {
+            FilePermission perm = FilePermission.decodeUNIXMode("755");
+            for (File f : testBinDir.listFiles())
+            {
+              if (f.getName().endsWith(".sh"))
+              {
+                FilePermission.setPermissions(f, perm);
+              }
+            }
+          } catch (Exception e) {}
+        }
+      }
       // Find some free ports for the listeners and write them to the
       // config-chamges.ldif file.
       ServerSocket serverLdapSocket  = null;
@@ -357,10 +407,12 @@
       serverLdapsSocket = bindFreePort();
       serverLdapsPort = serverLdapsSocket.getLocalPort();
 
+      String defaultConfigChangeFile = testResourceDir + File.separator
+          + "config-changes.ldif";
+      String configChangeFile = System.getProperty(
+          PROPERTY_CONFIG_CHANGE_FILE, defaultConfigChangeFile);
       BufferedReader reader = new BufferedReader(new FileReader(
-                                                 new File(testResourceDir,
-                                                          "config-changes.ldif")
-                                                ));
+                                                 new File(configChangeFile)));
       FileOutputStream outFile = new FileOutputStream(
           new File(testConfigDir, "config-changes.ldif"));
       PrintStream writer = new PrintStream(outFile);
@@ -387,7 +439,9 @@
 
       // Create a configuration for the server.
       DirectoryEnvironmentConfig config = new DirectoryEnvironmentConfig();
-      config.setServerRoot(testRoot);
+      config.setServerRoot(testInstallRoot);
+      config.setInstanceRoot(testInstanceRoot);
+      
       config.setForceDaemonThreads(true);
       config.setConfigClass(ConfigFileHandler.class);
       config.setConfigFile(new File(testConfigDir, "config.ldif"));
@@ -517,7 +571,7 @@
     String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT);
     File   buildDir  = new File(buildRoot, "build");
     File   unitRoot  = new File(buildDir, "unit-tests");
-    File   testRoot  = new File(unitRoot, "package");
+    File   testRoot  = new File(unitRoot, "package-instance");
     return new File(testRoot, "config");
   }
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java
index 03091e7..deb16fb 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java
@@ -248,7 +248,7 @@
   @Test()
   public void testListGroupsSSLTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -295,7 +295,7 @@
   @Test()
   public void testListGroupsStartTLSTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/LDIFBackendTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/LDIFBackendTestCase.java
index 06d7ee0..01159bd 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/LDIFBackendTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/LDIFBackendTestCase.java
@@ -106,7 +106,7 @@
 
     // Create a temporary test LDIF file.
     File ldifFile = File.createTempFile("import-test", ".ldif");
-    String resourcePath = DirectoryServer.getServerRoot() + File.separator +
+    String resourcePath = DirectoryServer.getInstanceRoot() + File.separator +
          "config" + File.separator + "MakeLDIF";
     LdifFileWriter.makeLdif(ldifFile.getPath(), resourcePath, templateFilePath);
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ConfigFileHandlerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ConfigFileHandlerTestCase.java
index bc31937..b6d97ce 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ConfigFileHandlerTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ConfigFileHandlerTestCase.java
@@ -64,7 +64,7 @@
 
     String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
     String startOKFile = buildRoot + File.separator + "build" + File.separator +
-                         "unit-tests" + File.separator + "package" +
+                         "unit-tests" + File.separator + "package-instance" +
                          File.separator + "config" + File.separator +
                          "config.ldif.startok";
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
index a845121..531b459 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
@@ -222,9 +222,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -278,7 +278,7 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     String[] args =
@@ -345,7 +345,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     String[] args =
@@ -410,7 +410,7 @@
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     String[] args =
@@ -454,7 +454,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     KeyStore ks = KeyStore.getInstance("JKS");
@@ -535,7 +535,7 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     String[] args =
@@ -572,7 +572,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     KeyStore ks = KeyStore.getInstance("JKS");
@@ -680,7 +680,7 @@
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java
index 7036a1e..b98eaf0 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedKeyManagerProviderTestCase.java
@@ -71,13 +71,13 @@
   {
     TestCaseUtils.startServer();
 
-    FileWriter writer = new FileWriter(DirectoryServer.getServerRoot() +
+    FileWriter writer = new FileWriter(DirectoryServer.getInstanceRoot() +
                                        File.separator + "config" +
                                        File.separator + "server.pin");
     writer.write("password" + EOL);
     writer.close();
 
-    writer = new FileWriter(DirectoryServer.getServerRoot() + File.separator +
+    writer = new FileWriter(DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "empty");
     writer.close();
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java
index 828d023..716d042 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileBasedTrustManagerProviderTestCase.java
@@ -71,13 +71,13 @@
   {
     TestCaseUtils.startServer();
 
-    FileWriter writer = new FileWriter(DirectoryServer.getServerRoot() +
+    FileWriter writer = new FileWriter(DirectoryServer.getInstanceRoot() +
                                        File.separator + "config" +
                                        File.separator + "server.pin");
     writer.write("password" + EOL);
     writer.close();
 
-    writer = new FileWriter(DirectoryServer.getServerRoot() + File.separator +
+    writer = new FileWriter(DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "empty");
     writer.close();
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
index 60387d1..feaded1 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
@@ -218,9 +218,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -280,9 +280,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -339,9 +339,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -412,9 +412,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/StartTLSExtendedOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/StartTLSExtendedOperationTestCase.java
index 2590bd9..4e88aba 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/StartTLSExtendedOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/StartTLSExtendedOperationTestCase.java
@@ -73,7 +73,7 @@
   @Test()
   public void testStartTLSNoAuthTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -125,7 +125,7 @@
   @Test()
   public void testStartTLSSimpleAuthTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -204,9 +204,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -260,7 +260,7 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                           "config" + File.separator + "client.keystore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
index a5d1f60..bb636b2 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
@@ -251,9 +251,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -312,9 +312,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -374,9 +374,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -433,9 +433,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -502,9 +502,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -563,9 +563,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
index fe9acbc..d9cc9f9 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
@@ -191,9 +191,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -253,9 +253,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -316,9 +316,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -375,9 +375,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -447,9 +447,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
@@ -509,9 +509,9 @@
 
 
 
-      String keyStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-      String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+      String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                               "config" + File.separator + "client.truststore";
 
       String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java
index 6caa8d7..da3fa3f 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java
@@ -606,7 +606,7 @@
    * @return
    */
   private String getJmxKeystorePath() {
-    return DirectoryServer.getServerRoot() + File.separator + "config"
+    return DirectoryServer.getInstanceRoot() + File.separator + "config"
         + File.separator + "server.keystore";
   }
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
index e124d70..e5dceaa 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
@@ -397,9 +397,9 @@
       // Initialization :
       // Load the database with a single entry :
       String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
-      String path = buildRoot + File.separator + "build" +
-                    File.separator + "unit-tests" + File.separator +
-                    "package"+ File.separator + "addModDelDependencyTest";
+      String path = buildRoot + File.separator + "build" + File.separator
+        + "unit-tests" + File.separator + "package-instance" + File.separator
+        + "addModDelDependencyTest";
       OutputStream out = new FileOutputStream(new File(path));
       out.write(baseentryldif.getBytes());
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
index a4768c7..3e2e4e8 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
@@ -199,7 +199,7 @@
     String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
     String path = buildRoot + File.separator + "build" +
                   File.separator + "unit-tests" + File.separator +
-                  "package"+ File.separator + "ReSynchTest";
+                  "package-instance"+ File.separator + "ReSynchTest";
 
     task("dn: ds-task-id=" + UUID.randomUUID()
         + ",cn=Scheduled Tasks,cn=Tasks\n"
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
index 6e7dc1c..e164da4 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
@@ -310,7 +310,8 @@
     // open the schema file
     String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
     String path = buildRoot + File.separator + "build" + File.separator +
-                  "unit-tests" + File.separator + "package" + File.separator +
+                  "unit-tests" + File.separator + "package-instance" +
+                  File.separator +
                   "config" + File.separator + "schema" + File.separator +
                   "99-user.ldif";
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
index 5210741..4d9c70d 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
@@ -147,7 +147,8 @@
       String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
       String path = buildRoot + File.separator + "build" +
                     File.separator + "unit-tests" + File.separator +
-                    "package"+ File.separator + "addModDelDependencyTest";
+                    "package-instance" + File.separator +
+                    "addModDelDependencyTest";
       OutputStream out = new FileOutputStream(new File(path));
       out.write(baseentryldif.getBytes());
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
index e80f766..97b2663 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
@@ -1149,7 +1149,7 @@
      String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
      String path = buildRoot + File.separator + "build" +
                    File.separator + "unit-tests" + File.separator +
-                   "package"+ File.separator + "exportLDIF.ldif";
+                   "package-instance"+ File.separator + "exportLDIF.ldif";
      return TestCaseUtils.makeEntry(
      "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks",
      "objectclass: top",
@@ -1168,7 +1168,7 @@
      String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
      String path = buildRoot + File.separator + "build" +
                    File.separator + "unit-tests" + File.separator +
-                   "package"+ File.separator + "exportLDIF" + root +".ldif";
+                   "package-instance"+ File.separator + "exportLDIF" + root +".ldif";
      return TestCaseUtils.makeEntry(
      "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks",
      "objectclass: top",
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestImportAndExport.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestImportAndExport.java
index fd8b791..ea60ed9 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestImportAndExport.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestImportAndExport.java
@@ -111,7 +111,7 @@
 
     // Create a temporary test LDIF file.
     ldifFile = File.createTempFile("import-test", ".ldif");
-    String resourcePath = DirectoryServer.getServerRoot() + File.separator +
+    String resourcePath = DirectoryServer.getInstanceRoot() + File.separator +
          "config" + File.separator + "MakeLDIF";
     LdifFileWriter.makeLdif(ldifFile.getPath(), resourcePath, template);
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java
index 1781483..7fb4497 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java
@@ -72,7 +72,7 @@
   {
     TestCaseUtils.startServer();
 
-    configFilePath = DirectoryServer.getServerRoot() + File.separator +
+    configFilePath = DirectoryServer.getInstanceRoot() + File.separator +
                      "config" + File.separator + "config.ldif";
 
     passwordFilePath = TestCaseUtils.createTempFile("password");
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java
index 5508528..d77c72c 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java
@@ -2463,9 +2463,9 @@
     DirectoryServer.deregisterSASLMechanismHandler("EXTERNAL");
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
 
@@ -2534,9 +2534,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
 
@@ -2603,9 +2603,9 @@
     DirectoryServer.deregisterSASLMechanismHandler("EXTERNAL");
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
 
@@ -2678,9 +2678,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
 
@@ -4201,9 +4201,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPCompareTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPCompareTestCase.java
index 0b5a6cb..d9afd2b 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPCompareTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPCompareTestCase.java
@@ -506,7 +506,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -567,7 +567,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -619,9 +619,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -674,9 +674,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -730,9 +730,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -786,9 +786,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java
index 61aae32..4337663 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java
@@ -419,7 +419,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -478,7 +478,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -509,7 +509,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java
index 993c34b..5ba2057 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java
@@ -436,7 +436,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -495,7 +495,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -546,9 +546,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -600,9 +600,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -655,9 +655,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -710,9 +710,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java
index 07b71d4..cbb7cba 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPPasswordModifyTestCase.java
@@ -735,7 +735,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     addTestUser();
@@ -802,7 +802,7 @@
   {
     TestCaseUtils.initializeTestBackend(true);
 
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     addTestUser();
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPSearchTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPSearchTestCase.java
index be4fcb6..11250af 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPSearchTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPSearchTestCase.java
@@ -672,7 +672,7 @@
   @Test()
   public void testSimpleSearchSSLTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -721,7 +721,7 @@
   @Test()
   public void testSimpleSearchStartTLSTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -771,9 +771,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -826,9 +826,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -882,9 +882,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -938,9 +938,9 @@
     assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
 
 
-    String keyStorePath   = DirectoryServer.getServerRoot() + File.separator +
+    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ListBackendsTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ListBackendsTestCase.java
index bd7dbe6..8b452bd 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ListBackendsTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ListBackendsTestCase.java
@@ -73,7 +73,7 @@
   {
     TestCaseUtils.startServer();
 
-    configFilePath = DirectoryServer.getServerRoot() + File.separator +
+    configFilePath = DirectoryServer.getInstanceRoot() + File.separator +
                      "config" + File.separator + "config.ldif";
   }
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java
index 8b7f923..fd6f201 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java
@@ -238,7 +238,7 @@
   @Test()
   public void testListConnectionHandlersSSLTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
@@ -289,7 +289,7 @@
   @Test()
   public void testListConnectionHandlersStartTLSTrustStore()
   {
-    String trustStorePath = DirectoryServer.getServerRoot() + File.separator +
+    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
                             "config" + File.separator + "client.truststore";
 
     String[] args =
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/makeldif/MakeLDIFTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
index b651122..1ac0bdb 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/makeldif/MakeLDIFTestCase.java
@@ -57,7 +57,7 @@
     // it can provide "getServerRoot()".
     TestCaseUtils.startServer();
 
-    resourcePath = DirectoryServer.getServerRoot() + File.separator +
+    resourcePath = DirectoryServer.getInstanceRoot() + File.separator +
          "config" + File.separator + "MakeLDIF";
   }
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/util/CertificateManagerTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/util/CertificateManagerTestCase.java
index fc59858..c71a573 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/util/CertificateManagerTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/util/CertificateManagerTestCase.java
@@ -63,7 +63,8 @@
    */
   public static final String JKS_KEY_STORE_PATH =
        System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT) + File.separator +
-       "build" + File.separator + "unit-tests" + File.separator + "package" +
+       "build" + File.separator + "unit-tests" + File.separator +
+       "package-instance" +
        File.separator + "config" + File.separator + "server.keystore";
 
 
@@ -73,7 +74,8 @@
    */
   public static final String PKCS12_KEY_STORE_PATH =
        System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT) + File.separator +
-       "build" + File.separator + "unit-tests" + File.separator + "package" +
+       "build" + File.separator + "unit-tests" + File.separator +
+       "package-instance" +
        File.separator + "config" + File.separator + "server-cert.p12";
 
 
@@ -83,7 +85,8 @@
    */
   public static final String TEST_DIR =
        System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT) + File.separator +
-       "build" + File.separator + "unit-tests" + File.separator + "package";
+       "build" + File.separator + "unit-tests" + File.separator +
+       "package-instance";
 
 
 

--
Gitblit v1.10.0