@echo off

REM
REM Copyright 2003 Sun Microsystems, Inc. All rights reserved.
REM SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
REM

REM
REM @(#)run.bat	1.1 03/10/17
REM

rem Should have the following variables set:
rem
rem  set JAVA_HOME=<path to J2SDK installation root>
rem  set TOMCAT_HOME=<path to jwsdp-1.2 installation root> 

set PATH=%TOMCAT_HOME%/bin;%TOMCAT_HOME%/jaxrpc/bin;%JAVA_HOME%/bin;%PATH%

rem check variables correctness
if ""%TOMCAT_HOME%""=="""" goto no_tomcat
if not exist %TOMCAT_HOME%\jaxrpc\bin\wscompile.bat goto no_tomcat2
if ""%JAVA_HOME%""=="""" goto no_java
if not exist %JAVA_HOME%/bin/javac.exe goto no_java2

if not exist serverscript.war goto build

echo Coping serverscript.war to webapps
copy serverscript.war %TOMCAT_HOME%\webapps
echo Stopping Tomcat
call %TOMCAT_HOME%/bin/catalina.bat stop
echo Starting Tomcat
call %TOMCAT_HOME%/bin/catalina.bat start



goto exit

:build
 echo You should run build.bat before
 goto exit

:no_tomcat
 echo TOMCAT_HOME variable is not set
:no_tomcat2
 echo TOMCAT_HOME should point to JWSDP-1.2 installation
 echo You can download it from:
 echo http://java.sun.com/webservices/downloads/webservicespack.html
 goto error

:no_java
 echo JAVA_HOME variable is not set
:no_java2
 echo JAVA_HOME should point to J2SDK installation
:error
:exit
 pause
