@echo off

rem get command line arguments
rem --------------------------

set DEBUG=NO
IF "%1"=="debug" set DEBUG=YES


rem Set the environment
rem -------------------

set JAVA_HOME=K:\prod\Wnt\java\jdk1.6.0
set PATH=%JAVA_HOME%\bin;%PATH%

IF not "%DEBUG%"=="YES" GOTO NOTDEBUG
   set APPLHOME=h:\workspace
   set JDOMHOME=%APPLHOME%\RMI\lib
   set JGRAPHTHOME=%APPLHOME%\FuelConsumption\lib
   set MATLABHOME=%APPLHOME%\FuelConsumption\lib
   set ECLIPSEHOME=d:\eclipse\plugins
  
   set RMICP=%APPLHOME%\RMI\bin;%JDOMHOME%\jdom.jar;%JDOMHOME%\jaxen-1.1.1.jar
   set FCCP=%APPLHOME%\FuelConsumption\bin;%JGRAPHTHOME%\jgrapht-jdk1.6.jar;%MATLABHOME%\matlabcontrol-4.0.0.jar
   set AEECP=%APPLHOME%\Aee\bin;%ECLIPSEHOME%\org.eclipse.swt.win32.win32.x86_3.3.3.v3349.jar

   set PROPHOME=%APPLHOME%\RMI
   set REPOSHOME=h:\Darpa\Repository
   set DATADIR=h:\Darpa
GOTO SETCP

:NOTDEBUG
   set DEPLOYDIR=@DEPLOYDIR

   set RMICP=%DEPLOYDIR%\lib\rmi.jar;%DEPLOYDIR%\lib\jdom.jar;%DEPLOYDIR%\lib\jaxen-1.1.1.jar
   set FCCP=%DEPLOYDIR%\lib\fc.jar;%DEPLOYDIR%\lib\jgrapht-jdk1.6.jar;%DEPLOYDIR%\lib\matlabcontrol-4.0.0.jar
   set AEECP=%DEPLOYDIR%\lib\aee.jar;%DEPLOYDIR%\lib\plugins\org.eclipse.swt.win32.win32.x86_3.3.3.v3349.jar

   set PROPHOME=%DEPLOYDIR%\data
   set REPOSHOME=%DEPLOYDIR%\Repository
   set DATADIR=%DEPLOYDIR%\data

:SETCP
set classpath=%RMICP%;%FCCP%;%AEECP%





rem Launch the server
rem -----------------

set JAVA_ARGS=-cp %classpath% -DREPOSITORY_DIR=%REPOSHOME%  ^
-Dservices.properties=%PROPHOME%\services.properties ^
-Daee.properties=%PROPHOME%\aee.properties ^
-Dtsfc.properties=%PROPHOME%\tsfc.properties ^
-Dfuelconsumption.properties=%PROPHOME%\fuelconsumption.properties ^
-Ddatadir=%DATADIR% ^
-DAMPL_HOME=D:\meta\ampl
IF %DEBUG%==YES set JAVA_ARGS=%JAVA_ARGS% -Xdebug -Xrunjdwp:transport=dt_socket,address=7111,server=y,suspend=y
set JAVA_MAIN=meta.rmi.server.Server

echo Executing java %JAVA_ARGS% %JAVA_MAIN%
java %JAVA_ARGS% %JAVA_MAIN%