@echo off
::
::                   Petals ESB bootstrap script
::
:: Environment variables:
::
::     JAVA_HOME   Home directory of the JVM to be used
::
::     JAVA_OPTS   Options for the JVM. Try "java -h" to get informations
::                 about the available options for your environment
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: Set the path to the java executable
if "x%JAVA_HOME%"=="x" (
   set JAVA=java
) else (
   set JAVA="%JAVA_HOME%\bin\java.exe"
)

if "x%PETALS_HOME%"=="x" (
   set PETALS_HOME="%CD%\.."
)
if not exist %PETALS_HOME% (
   echo "PETALS_HOME is not valid: %PETALS_HOME%"
   goto :EOF
)

set PETALS_JAR="%CD%\petals-launcher.jar"
if not exist %PETALS_JAR% (
   echo "ERROR: petals-launcher.jar: jar archive not found"
   goto :EOF
)

if "x%JAVA_OPTS%"=="x" (
   set JAVA_OPTS=-Djava.net.preferIPv4Stack=true -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl -Xmx1024m -XX:MaxPermSize=256m
)

start "OW2 PEtALS Enterprise Service Bus" %JAVA% %JAVA_OPTS% -Dpetals.home=%PETALS_HOME% -jar %PETALS_JAR%

