@echo off

@REM ==============================
@REM  Check environment properties
@REM ==============================

set WLS_HOME=wlserver_10.0

if not defined BEA_HOME goto nobeahome
if not exist %BEA_HOME%\. ( echo Error : BEA_HOME [%BEA_HOME%] does not point to a valid directory. ) & ( goto end ) 

if not defined JAVA_HOME goto nojavahome
if not exist %JAVA_HOME%\. ( echo Error : JAVA_HOME [%JAVA_HOME%] does not point to a valid directory. ) & ( goto end ) 

if not defined WLI_UTIL_HOME goto nowliutilhome
if not exist %WLI_UTIL_HOME%\. ( echo Error : WLI_UTIL_HOME [%WLI_UTIL_HOME%] does not point to a valid directory. ) & ( goto end ) 

if not defined JYTHON_HOME ( set JYTHON_HOME=%BEA_HOME%\%WLS_HOME%\common\lib) & ( @echo JYTHON_HOME was set to the default location %JYTHON_HOME% )
if not exist %JYTHON_HOME%\. ( echo Error : JYTHON_HOME [%JYTHON_HOME%] does not point to a valid directory. ) & ( goto end ) 

if not defined DOMAIN_HOME ( set DOMAIN_HOME=%BEA_HOME%\user_projects) & ( @echo DOMAIN_HOME was set to the default location %DOMAIN_HOME% )
if not exist %DOMAIN_HOME%\. ( echo Error : DOMAIN_HOME [%DOMAIN_HOME%] does not point to a valid directory. ) & ( goto end ) 

@REM ==========================
@REM   Add ant to PATH
@REM ==========================

set PATH=%BEA_HOME%\%WLS_HOME%\server\bin;%BEA_HOME%\%WLS_HOME%\common\bin;%PATH%

@REM ==========================
@REM    Create env.properties
@REM ==========================

if exist env.properties DEL env.properties

echo.>env.properties
echo tools.dir=%WLI_UTIL_HOME:\=\\%>>env.properties
echo bea.home=%BEA_HOME:\=\\%>>env.properties
echo jython.home=%JYTHON_HOME:\=\\%>>env.properties
echo jdk.home=%JAVA_HOME:\=\\%>>env.properties
echo domain.base=%DOMAIN_HOME:\=\\%>>env.properties
echo weblogic.name=%WLS_HOME:\=\\%>>env.properties
echo wli.home=%WLI_HOME:\=\\%>>env.properties
echo Environment Set.

goto end


@REM ==========================
@REM   Error Messages
@REM ==========================

:nobeahome
@echo ---------- 
@echo Error : BEA_HOME was not set. Please set this variable to the root directory of the BEA Platform installation.
goto end

:nowliutilhome
@echo ---------- 
@echo Please download and unzip the WLI common utilities. Then set this variable to the root directory (wli_util).
goto end

:nojavahome
@echo ---------- 
@echo Error : JAVA_HOME was not set. Please set this variable to the root directory of a JDK installation.
goto end


:end
set classpath=
