:: This script loads all data into the database based on the given scale factor.
:: Pass the orders_injection_rate as an argument. If not given, defaults to 1

:: directory /tmp is necessary in root directory of drive

@echo off

set SCALE=1
if .%1.==".." GOTO ENV

set SCALE=%1
GOTO :ENV

:ENV
::This shouldn't need to be modified
set LOAD_PKG=org.spec.jappserver.load


set WL_HOME=C:\russellr\bea81sp4\weblogic81
set JAVA_HOME=C:\russellr\bea81sp4\jdk142_05
set JAS_HOME=C:\russellr\spec02
set CONFIG_DIR=%JAS_HOME%\config
set APPSSERVER=wls_81
set ENVFILE=%CONFIG_DIR%\%APPSSERVER%.env

IF .%APPSSERVER%.==".." Goto  setENV
echo SPECjAppServer Home is %JAS_HOME%
echo Appsserver is %APPSSERVER%
echo ENVFILE is %ENVFILE%
echo SCALE is %SCALE%

set JDBC_CLASSPATH=%WL_HOME%\server\lib\weblogic.jar

set CLASSPATH=%JDBC_CLASSPATH%;%JAS_HOME%\jars\load.jar

echo Loading Corp Database...
%JAVA_HOME%\jre\bin\java -Dspecjappserver.home=%JAS_HOME% %LOAD_PKG%.LoadCorp %SCALE% 

echo Loading Orders Database...
%JAVA_HOME%\jre\bin\java -Dspecjappserver.home=%JAS_HOME% %LOAD_PKG%.LoadOrds %SCALE%

echo Loading Manufacturing Database...
%JAVA_HOME%\jre\bin\java -Dspecjappserver.home=%JAS_HOME% %LOAD_PKG%.LoadMfg %SCALE%

echo Loading Supplier Database...
%JAVA_HOME%\jre\bin\java -Dspecjappserver.home=%JAS_HOME% %LOAD_PKG%.LoadSupp %SCALE%

echo Loading Discount Rules...
%JAVA_HOME%\jre\bin\java -Dspecjappserver.home=%JAS_HOME% %LOAD_PKG%.LoadRules discount %JAS_HOME%\schema\discount.rules
Goto Done

:setEnv
echo Please update and run setEnv.bat in the bin directory before running this command

:Done
