1@echo off
2
3@if not "%ECHO%" == ""  echo %ECHO%
4@if "%OS%" == "Windows_NT" setlocal
5
6if "%OS%" == "Windows_NT" (
7  set "DIRNAME=%~dp0%"
8) else (
9  set DIRNAME=.\
10)
11
12setlocal EnableDelayedExpansion
13rem check for the security manager system property
14echo(!SERVER_OPTS! | findstr /r /c:"-Djava.security.manager" > nul
15if not errorlevel == 1 (
16    echo ERROR: The use of -Djava.security.manager has been removed. Please use the -secmgr command line argument or SECMGR=true environment variable.
17    GOTO :EOF
18)
19setlocal DisableDelayedExpansion
20
21rem check for secmgr property
22setlocal EnableDelayedExpansion
23echo(!JAVA_OPTS! | findstr /r /c:"-secmgr" > nul
24if not errorlevel == 1 (
25   set "line=%JAVA_OPTS%"
26   set JAVA_OPTS=!line:-secmgr= !
27   set SECMGR=true
28)
29setlocal DisableDelayedExpansion
30
31pushd "%DIRNAME%.."
32set "RESOLVED_JBOSS_HOME=%CD%"
33popd
34
35if "x%JBOSS_HOME%" == "x" (
36  set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
37)
38
39pushd "%JBOSS_HOME%"
40set "SANITIZED_JBOSS_HOME=%CD%"
41popd
42
43if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
44   echo.
45   echo   WARNING:  JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
46   echo.
47   echo       JBOSS_HOME: "%JBOSS_HOME%"
48   echo.
49)
50
51rem Setup JBoss specific properties
52if "x%JAVA_HOME%" == "x" (
53  set  JAVA=java
54  echo JAVA_HOME is not set. Unexpected results may occur.
55  echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
56) else (
57  set "JAVA=%JAVA_HOME%\bin\java"
58)
59
60rem Find jboss-modules.jar, or we can't continue
61set "JBOSS_RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
62if not exist "%JBOSS_RUNJAR%" (
63  echo Could not locate "%JBOSS_RUNJAR%".
64  echo Please check that you are in the bin directory when running this script.
65  goto END
66)
67
68
69rem Set the module options
70set "MODULE_OPTS="
71if "%SECMGR%" == "true" (
72    set "MODULE_OPTS=-secmgr"
73)
74
75
76rem Set default module root paths
77if "x%JBOSS_MODULEPATH%" == "x" (
78  set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
79)
80
81set "JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=wsprovide.bat"
82
83"%JAVA%" %JAVA_OPTS% ^
84    -jar "%JBOSS_RUNJAR%" ^
85    %MODULE_OPTS% ^
86    -mp "%JBOSS_MODULEPATH%" ^
87    org.jboss.ws.tools.wsprovide ^
88    %*
89
90:END
91