@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem      https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem  FxcExchange startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and FXC_EXCHANGE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="--add-opens=java.base/jdk.internal.access=ALL-UNNAMED" "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED" "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED" "--add-opens=java.base/sun.util.calendar=ALL-UNNAMED" "--add-opens=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED" "--add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED" "--add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED" "--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED" "--add-opens=java.base/java.io=ALL-UNNAMED" "--add-opens=java.base/java.nio=ALL-UNNAMED" "--add-opens=java.base/java.net=ALL-UNNAMED" "--add-opens=java.base/java.util=ALL-UNNAMED" "--add-opens=java.base/java.util.concurrent=ALL-UNNAMED" "--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED" "--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED" "--add-opens=java.base/java.lang=ALL-UNNAMED" "--add-opens=java.base/java.lang.invoke=ALL-UNNAMED" "--add-opens=java.base/java.math=ALL-UNNAMED" "--add-opens=java.sql/java.sql=ALL-UNNAMED"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\lib\FxcExchange-0.1.0-SNAPSHOT.jar;%APP_HOME%\lib\fxc-common-0.1.0-SNAPSHOT.jar;%APP_HOME%\lib\gridgain-ultimate-8.9.35.jar;%APP_HOME%\lib\gridgain-core-8.9.35.jar;%APP_HOME%\lib\ignite-indexing-8.9.35.jar;%APP_HOME%\lib\quickfixj-core-3.0.1.jar;%APP_HOME%\lib\quickfixj-messages-fix44-3.0.1.jar;%APP_HOME%\lib\mariadb-java-client-3.5.9.jar;%APP_HOME%\lib\HikariCP-7.1.0.jar;%APP_HOME%\lib\slf4j-simple-2.0.16.jar;%APP_HOME%\lib\ignite-h2-8.9.35.jar;%APP_HOME%\lib\quickfixj-base-3.0.1.jar;%APP_HOME%\lib\mina-core-2.2.7.jar;%APP_HOME%\lib\slf4j-api-2.0.17.jar;%APP_HOME%\lib\ofx4j-1.39.jar;%APP_HOME%\lib\ignite-schedule-8.9.35.jar;%APP_HOME%\lib\ignite-core-8.9.35.jar;%APP_HOME%\lib\jackson-annotations-2.16.0.jar;%APP_HOME%\lib\jackson-dataformat-xml-2.16.0.jar;%APP_HOME%\lib\jackson-databind-2.16.0.jar;%APP_HOME%\lib\jackson-core-2.16.0.jar;%APP_HOME%\lib\woodstox-core-6.5.1.jar;%APP_HOME%\lib\stax2-api-4.2.1.jar;%APP_HOME%\lib\bcpkix-jdk18on-1.84.jar;%APP_HOME%\lib\commons-vfs2-2.10.0.jar;%APP_HOME%\lib\jsch-0.1.55.jar;%APP_HOME%\lib\zstd-jni-1.5.0-4.jar;%APP_HOME%\lib\lz4-java-1.10.1.jar;%APP_HOME%\lib\snappy-java-1.1.10.4.jar;%APP_HOME%\lib\commons-io-2.18.0.jar;%APP_HOME%\lib\commons-lang3-3.18.0.jar;%APP_HOME%\lib\commons-codec-1.18.0.jar;%APP_HOME%\lib\commons-logging-1.3.4.jar;%APP_HOME%\lib\nanoxml-2.2.3.jar;%APP_HOME%\lib\reflections-0.9.10.jar;%APP_HOME%\lib\jakarta.xml.bind-api-4.0.0.jar;%APP_HOME%\lib\cache-api-1.0.0.jar;%APP_HOME%\lib\annotations-16.0.3.jar;%APP_HOME%\lib\jna-5.14.0.jar;%APP_HOME%\lib\ignite-shmem-8.7.3.jar;%APP_HOME%\lib\cron4j-2.2.5.jar;%APP_HOME%\lib\bcutil-jdk18on-1.84.jar;%APP_HOME%\lib\javax.servlet-api-3.1.0.jar;%APP_HOME%\lib\jts-core-1.15.0.jar;%APP_HOME%\lib\guava-18.0.jar;%APP_HOME%\lib\javassist-3.18.2-GA.jar;%APP_HOME%\lib\annotations-2.0.1.jar;%APP_HOME%\lib\jakarta.activation-api-2.1.0.jar;%APP_HOME%\lib\bcprov-jdk18on-1.84.jar


@rem Execute FxcExchange
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %FXC_EXCHANGE_OPTS%  -classpath "%CLASSPATH%" com.fxc.exchange.Main %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable FXC_EXCHANGE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%FXC_EXCHANGE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
