Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'build-kernel/bin')
-rw-r--r--build-kernel/bin/checkJava.bat17
-rwxr-xr-xbuild-kernel/bin/checkJava.sh12
-rwxr-xr-xbuild-kernel/bin/dmk.bat239
-rwxr-xr-xbuild-kernel/bin/dmk.sh228
-rw-r--r--build-kernel/bin/jconsole.bat54
-rwxr-xr-xbuild-kernel/bin/jconsole.sh53
-rw-r--r--build-kernel/bin/jmxPermissions.vbs70
-rw-r--r--build-kernel/bin/setupClasspath.bat20
-rwxr-xr-xbuild-kernel/bin/setupClasspath.sh19
-rw-r--r--build-kernel/bin/setupVars.bat31
-rw-r--r--build-kernel/bin/shutdown.bat8
-rwxr-xr-xbuild-kernel/bin/shutdown.sh20
-rw-r--r--build-kernel/bin/startup.bat8
-rwxr-xr-xbuild-kernel/bin/startup.sh20
14 files changed, 799 insertions, 0 deletions
diff --git a/build-kernel/bin/checkJava.bat b/build-kernel/bin/checkJava.bat
new file mode 100644
index 00000000..316486be
--- /dev/null
+++ b/build-kernel/bin/checkJava.bat
@@ -0,0 +1,17 @@
+@echo off
+rem Script for checking we have the right version of Java.
+
+if "%JAVA_HOME%" == "" (
+ echo The JAVA_HOME environment variable is not defined.
+ exit /B 1
+)
+if "%CLASSPATH%" == "" (
+ echo The CLASSPATH environment variable is not defined.
+ exit /B 1
+)
+
+rem Run java version check with the discovered java jvm.
+"%JAVA_HOME%\bin\java" -classpath "%CLASSPATH%" org.eclipse.virgo.osgi.launcher.JavaVersionChecker
+
+rem If non-zero exit then either we cannot find the checker or the Java version is incorrect.
+if not "%ERRORLEVEL%"=="0" exit /B %ERRORLEVEL%
diff --git a/build-kernel/bin/checkJava.sh b/build-kernel/bin/checkJava.sh
new file mode 100755
index 00000000..3dace27e
--- /dev/null
+++ b/build-kernel/bin/checkJava.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Run java version check with the discovered java jvm.
+$JAVA_HOME/bin/java \
+ -classpath $CLASSPATH \
+ org.eclipse.virgo.osgi.launcher.JavaVersionChecker
+
+# If non-zero exit then either we cannot find the check or the java version is incorrect.
+if [ $? != 0 ]
+then
+ exit 1
+fi
diff --git a/build-kernel/bin/dmk.bat b/build-kernel/bin/dmk.bat
new file mode 100755
index 00000000..7d1e9aa7
--- /dev/null
+++ b/build-kernel/bin/dmk.bat
@@ -0,0 +1,239 @@
+@echo off
+rem Script for starting and stopping the kernel
+
+if "%OS%" == "Windows_NT" setlocal
+
+rem Derive full path for script (includes trailing backslash)
+ set SCRIPT_DIR=%~dp0
+
+if exist "%SCRIPT_DIR%setupVars.bat" (
+ call "%SCRIPT_DIR%setupVars.bat"
+ if not "%ERRORLEVEL%"=="0" (
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B %ERRORLEVEL%
+ )
+) else (
+ echo Cannot set up environment. "setupVars.bat" file missing.
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B 1
+)
+
+rem Select command we are to run
+
+ rem First parm is command
+ set COMMAND=%~1
+ rem Rest are parameters - shift done in subroutines
+
+ rem Switch on COMMAND in {"start","stop"}
+
+ if "%COMMAND%" == "start" (
+ call :doStartCommand %*
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B 0
+ )
+
+ if "%COMMAND%" == "stop" (
+ call :doStopCommand %*
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B 0
+ )
+
+ echo Unknown command: %COMMAND%
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B 1
+
+rem ------------------ Subroutines
+rem ------------------------------
+:doStartCommand
+
+ shift
+ rem The shift must be here :()
+
+ rem Check further file that needs to exist
+ for %%I in ("%KERNEL_HOME%\bin\jmxPermissions.vbs") do if not exist "%%~I" (
+ echo File "%%~I" does not exist but is required to continue.
+ exit /B 1
+ )
+
+ rem Set defaults
+ set CONFIG_DIR=%KERNEL_HOME%\config
+ set CLEAN_FLAG=
+ set DEBUG_FLAG=
+ set DEBUG_PORT=8000
+ set SUSPEND=n
+ if not defined JMX_PORT set JMX_PORT=9875
+ if not defined KEYSTORE_PASSWORD set KEYSTORE_PASSWORD=changeit
+ set ADDITIONAL_ARGS=
+
+ rem Loop through options
+
+ :startOptionLoop
+ if "%~1"=="" goto endStartOptionLoop
+ if "%~1"=="-debug" goto debug
+ if "%~1"=="-clean" goto clean
+ if "%~1"=="-configDir" goto configDir
+ if "%~1"=="-jmxport" goto jmxport
+ if "%~1"=="-keystore" goto keystore
+ if "%~1"=="-keystorePassword" goto keystorePassword
+ if "%~1"=="-suspend" goto suspend
+ if "%~1"=="-shell" goto shell
+
+ set ADDITIONAL_ARGS=%ADDITIONAL_ARGS% "%~1"
+
+ :continueStartOptionLoop
+ shift
+ goto startOptionLoop
+
+ :debug
+ set DEBUG_FLAG=1
+ set PORT_CANDIDATE=%~2
+ if not "%PORT_CANDIDATE:~0,1%"=="-" (
+ set DEBUG_PORT=%PORT_CANDIDATE%
+ shift
+ )
+ goto continueStartOptionLoop
+ :clean
+ set CLEAN_FLAG=1
+ goto continueStartOptionLoop
+ :configDir
+ set CONFIG_DIR=%~2
+ rem check it is absolute, relative to the kernel home
+ if not "%CONFIG_DIR:~1,2%"==":\" set CONFIG_DIR=%KERNEL_HOME%\%CONFIG_DIR%
+ if "%CONFIG_DIR:-1%"=="\" set CONFIG_DIR=%CONFIG_DIR:~-1%
+ shift
+ goto continueStartOptionLoop
+ :jmxport
+ set JMX_PORT=%~2
+ shift
+ goto continueStartOptionLoop
+ :keystore
+ set KEYSTORE_PATH=%~2
+ shift
+ goto continueStartOptionLoop
+ :keystorePassword
+ set KEYSTORE_PASSWORD=%~2
+ shift
+ goto continueStartOptionLoop
+ :suspend
+ set SUSPEND=y
+ goto continueStartOptionLoop
+ :shell
+ set SHELL_FLAG=1
+ goto continueStartOptionLoop
+
+ :endStartOptionLoop
+
+
+ rem Adjust permissions if necessary
+ cscript //NoLogo "%KERNEL_HOME%\bin\jmxPermissions.vbs" "%CONFIG_DIR%\"
+
+ rem Adjust options now all are known
+ if "%KEYSTORE_PATH%"=="" set KEYSTORE_PATH=%CONFIG_DIR%\keystore
+ if not "%DEBUG_FLAG%"=="" set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=%DEBUG_PORT%,server=y,suspend=%SUSPEND%
+
+ rem do Clean work:
+ if not "%CLEAN_FLAG%"=="" (
+ rmdir /Q /S "%KERNEL_HOME%\serviceability"
+ rmdir /Q /S "%KERNEL_HOME%\work"
+ set LAUNCH_OPTS=%LAUNCH_OPTS% -Fosgi.clean=true
+ )
+
+ rem ensure that the tmp directory exists:
+ set TMP_DIR="%KERNEL_HOME%\work\tmp"
+ if not exist "%TMP_DIR%" mkdir "%TMP_DIR%"
+
+ rem do Shell work:
+ if not "%SHELL_FLAG%"=="" (
+ set LAUNCH_OPTS=%LAUNCH_OPTS% -Forg.eclipse.virgo.kernel.shell.local=true
+ )
+
+ rem Set JMX options
+ set JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.port=%JMX_PORT%
+ set JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.authenticate=true
+ set JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.login.config=virgo-kernel
+ set JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.access.file="%CONFIG_DIR%\org.eclipse.virgo.kernel.jmxremote.access.properties"
+ set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.keyStore="%KEYSTORE_PATH%"
+ set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.keyStorePassword=%KEYSTORE_PASSWORD%
+ set JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.ssl=true
+ set JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.ssl.need.client.auth=false
+
+ rem Run the server
+
+ rem Marshall parameters
+ set KERNEL_JAVA_PARMS=%JAVA_OPTS% %DEBUG_OPTS% %JMX_OPTS%
+
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -XX:+HeapDumpOnOutOfMemoryError
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -XX:ErrorFile="%KERNEL_HOME%\serviceability\error.log"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -XX:HeapDumpPath="%KERNEL_HOME%\serviceability\heap_dump.hprof"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Djava.security.auth.login.config="%CONFIG_DIR%\org.eclipse.virgo.kernel.authentication.config"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.virgo.kernel.authentication.file="%CONFIG_DIR%\org.eclipse.virgo.kernel.users.properties"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Djava.io.tmpdir="%TMP_DIR%"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.virgo.kernel.home="%KERNEL_HOME%"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -classpath "%CLASSPATH%"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% org.eclipse.virgo.osgi.launcher.Launcher
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -config "%KERNEL_HOME%\lib\org.eclipse.virgo.kernel.launch.properties"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Forg.eclipse.virgo.kernel.home="%KERNEL_HOME%"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Forg.eclipse.virgo.kernel.config="%CONFIG_DIR%"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Fosgi.configuration.area="%KERNEL_HOME%\work\osgi\configuration"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Fosgi.java.profile="file:%KERNEL_HOME%\lib\java6-server.profile"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% %LAUNCH_OPTS%
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% %ADDITIONAL_ARGS%
+
+ rem Now run it
+ PUSHD %KERNEL_HOME%
+ "%JAVA_HOME%\bin\java" %KERNEL_JAVA_PARMS%
+ POPD
+
+goto :eof
+
+rem ------------------------------
+:doStopCommand
+
+ shift
+ rem The shift must be here :()
+
+ rem Set defaults
+ if not defined TRUSTSTORE_PATH set TRUSTSTORE_PATH=%KERNEL_HOME%\config\keystore
+ if not defined TRUSTSTORE_PASSWORD set TRUSTSTORE_PASSWORD=changeit
+ set OTHER_ARGS=
+
+ rem Loop through options
+
+ :stopOptionLoop
+ if "%~1"=="" goto endStopOptionLoop
+
+ if "%~1"=="-truststore" (
+ set TRUSTSTORE_PATH=%~2
+ shift
+ ) else (
+ if "%~1"=="-truststorePassword" (
+ set TRUSTSTORE_PASSWORD=%~2
+ shift
+ ) else (
+ set OTHER_ARGS=%OTHER_ARGS% "%~1"
+ )
+ )
+
+ shift
+ goto stopOptionLoop
+ :endStopOptionLoop
+
+ rem Call shutdown client
+
+ rem Extend JMX options
+ set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.trustStore="%TRUSTSTORE_PATH%"
+ set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.trustStorePassword=%TRUSTSTORE_PASSWORD%
+
+ rem Marshall parameters
+ set SHUTDOWN_PARMS= %JAVA_OPTS% %JMX_OPTS%
+ set SHUTDOWN_PARMS=%SHUTDOWN_PARMS% -classpath "%CLASSPATH%"
+ set SHUTDOWN_PARMS=%SHUTDOWN_PARMS% -Dorg.eclipse.virgo.kernel.home="%KERNEL_HOME%"
+ set SHUTDOWN_PARMS=%SHUTDOWN_PARMS% org.eclipse.virgo.kernel.shutdown.ShutdownClient
+ set SHUTDOWN_PARMS=%SHUTDOWN_PARMS% %OTHER_ARGS%
+
+ rem Run Java program
+ PUSHD %KERNEL_HOME%
+ "%JAVA_HOME%\bin\java" %SHUTDOWN_PARMS%
+ POPD
+
+goto :eof
diff --git a/build-kernel/bin/dmk.sh b/build-kernel/bin/dmk.sh
new file mode 100755
index 00000000..bd9dd368
--- /dev/null
+++ b/build-kernel/bin/dmk.sh
@@ -0,0 +1,228 @@
+#!/bin/bash
+
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+# determine kernel home
+KERNEL_HOME=`dirname "$SCRIPT"`/..
+
+# make KERNEL_HOME absolute
+KERNEL_HOME=`cd $KERNEL_HOME; pwd`
+
+# setup classpath and java environment
+. $KERNEL_HOME/bin/setupClasspath.sh
+
+# execute user setenv script if needed
+if [ -r $KERNEL_HOME/bin/setenv.sh ]
+then
+ . $KERNEL_HOME/bin/setenv.sh
+fi
+
+
+# Run java version check with the discovered java jvm.
+. $KERNEL_HOME/bin/checkJava.sh
+
+shopt -s extglob
+
+# parse the command we executing
+COMMAND=$1
+shift;
+
+if [ "$COMMAND" = "start" ]
+then
+
+ # parse the standard arguments
+ CONFIG_DIR=$KERNEL_HOME/config
+ CLEAN_FLAG=
+
+ SHELL_FLAG=
+
+ DEBUG_FLAG=
+ DEBUG_PORT=8000
+ SUSPEND=n
+ if [ -z "$JMX_PORT" ]
+ then
+ JMX_PORT=9875
+ fi
+
+ if [ -z "$KEYSTORE_PASSWORD" ]
+ then
+ KEYSTORE_PASSWORD=changeit
+ fi
+
+ ADDITIONAL_ARGS=
+
+ while (($# > 0))
+ do
+ case $1 in
+ -debug)
+ DEBUG_FLAG=1
+ if [[ "$2" == +([0-9]) ]]
+ then
+ DEBUG_PORT=$2
+ shift;
+ fi
+ ;;
+ -clean)
+ CLEAN_FLAG=1
+ ;;
+ -configDir)
+ CONFIG_DIR=$2
+ shift;
+ ;;
+ -jmxport)
+ JMX_PORT=$2
+ shift;
+ ;;
+ -keystore)
+ KEYSTORE_PATH=$2
+ shift;
+ ;;
+ -keystorePassword)
+ KEYSTORE_PASSWORD=$2
+ shift;
+ ;;
+ -suspend)
+ SUSPEND=y
+ ;;
+ -shell)
+ SHELL_FLAG=1
+ ;;
+ *)
+ ADDITIONAL_ARGS="$ADDITIONAL_ARGS $1"
+ ;;
+ esac
+ shift
+ done
+
+ # start the kernel
+ if [[ "$CONFIG_DIR" != /* ]]
+ then
+ CONFIG_DIR=$KERNEL_HOME/$CONFIG_DIR
+ fi
+
+ if [ -z "$KEYSTORE_PATH" ]
+ then
+ KEYSTORE_PATH=$CONFIG_DIR/keystore
+ fi
+
+ if [ "$DEBUG_FLAG" ]
+ then
+ DEBUG_OPTS=" \
+ -Xdebug \
+ -Xrunjdwp:transport=dt_socket,address=$DEBUG_PORT,server=y,suspend=$SUSPEND"
+ fi
+
+ if [ "$CLEAN_FLAG" ]
+ then
+ rm -rf $KERNEL_HOME/work
+ rm -rf $KERNEL_HOME/serviceability
+
+ LAUNCH_OPTS="$LAUNCH_OPTS -Fosgi.clean=true"
+ fi
+
+ if [ "$SHELL_FLAG" ]
+ then
+ LAUNCH_OPTS="$LAUNCH_OPTS -Forg.eclipse.virgo.kernel.shell.local=true"
+ fi
+
+ # Set the required permissions on the JMX configuration files
+ chmod 600 $CONFIG_DIR/org.eclipse.virgo.kernel.jmxremote.access.properties
+
+ JMX_OPTS=" \
+ $JMX_OPTS \
+ -Dcom.sun.management.jmxremote.port=$JMX_PORT \
+ -Dcom.sun.management.jmxremote.authenticate=true \
+ -Dcom.sun.management.jmxremote.login.config=virgo-kernel \
+ -Dcom.sun.management.jmxremote.access.file=$CONFIG_DIR/org.eclipse.virgo.kernel.jmxremote.access.properties \
+ -Djavax.net.ssl.keyStore=$KEYSTORE_PATH \
+ -Djavax.net.ssl.keyStorePassword=$KEYSTORE_PASSWORD \
+ -Dcom.sun.management.jmxremote.ssl=true \
+ -Dcom.sun.management.jmxremote.ssl.need.client.auth=false"
+
+ # If we get here we have the correct Java version.
+
+ TMP_DIR=$KERNEL_HOME/work/tmp
+
+ # Ensure that the tmp directory exists
+ mkdir -p $TMP_DIR
+
+ cd $KERNEL_HOME; $JAVA_HOME/bin/java \
+ $JAVA_OPTS \
+ $DEBUG_OPTS \
+ $JMX_OPTS \
+ -XX:+HeapDumpOnOutOfMemoryError \
+ -XX:ErrorFile=$KERNEL_HOME/serviceability/error.log \
+ -XX:HeapDumpPath=$KERNEL_HOME/serviceability/heap_dump.hprof \
+ -Djava.security.auth.login.config=$CONFIG_DIR/org.eclipse.virgo.kernel.authentication.config \
+ -Dorg.eclipse.virgo.kernel.authentication.file=$CONFIG_DIR/org.eclipse.virgo.kernel.users.properties \
+ -Djava.io.tmpdir=$TMP_DIR \
+ -Dorg.eclipse.virgo.kernel.home=$KERNEL_HOME \
+ -classpath $CLASSPATH \
+ org.eclipse.virgo.osgi.launcher.Launcher \
+ -config $KERNEL_HOME/lib/org.eclipse.virgo.kernel.launch.properties \
+ -Forg.eclipse.virgo.kernel.home=$KERNEL_HOME \
+ -Forg.eclipse.virgo.kernel.config=$CONFIG_DIR \
+ -Fosgi.configuration.area=$KERNEL_HOME/work/osgi/configuration \
+ -Fosgi.java.profile="file:$KERNEL_HOME/lib/java6-server.profile" \
+ $LAUNCH_OPTS \
+ $ADDITIONAL_ARGS
+elif [ "$COMMAND" = "stop" ]
+then
+
+ #parse args for the script
+ if [ -z "$TRUSTSTORE_PATH" ]
+ then
+ TRUSTSTORE_PATH=$KERNEL_HOME/config/keystore
+ fi
+
+ if [ -z "$TRUSTSTORE_PASSWORD" ]
+ then
+ TRUSTSTORE_PASSWORD=changeit
+ fi
+
+ shopt -s extglob
+
+ while (($# > 0))
+ do
+ case $1 in
+ -truststore)
+ TRUSTSTORE_PATH=$2
+ shift;
+ ;;
+ -truststorePassword)
+ TRUSTSTORE_PASSWORD=$2
+ shift;
+ ;;
+ *)
+ OTHER_ARGS+=" $1"
+ ;;
+ esac
+ shift
+ done
+
+ JMX_OPTS=" \
+ $JMX_OPTS \
+ -Djavax.net.ssl.trustStore=${TRUSTSTORE_PATH} \
+ -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}"
+
+ $JAVA_HOME/bin/java $JAVA_OPTS $JMX_OPTS \
+ -classpath $CLASSPATH \
+ -Dorg.eclipse.virgo.kernel.home=$KERNEL_HOME \
+ org.eclipse.virgo.kernel.shutdown.ShutdownClient $OTHER_ARGS
+
+else
+ echo "Unknown command: ${COMMAND}"
+fi
+
diff --git a/build-kernel/bin/jconsole.bat b/build-kernel/bin/jconsole.bat
new file mode 100644
index 00000000..27fd0219
--- /dev/null
+++ b/build-kernel/bin/jconsole.bat
@@ -0,0 +1,54 @@
+@echo off
+rem Script for starting jconsole
+
+if "%OS%" == "Windows_NT" setlocal
+
+rem Find root drive and path for current bat file directory (includes trailing backslash)
+ set SCRIPT_DIR=%~dp0
+
+if exist "%SCRIPT_DIR%setupVars.bat" (
+ call "%SCRIPT_DIR%setupVars.bat"
+ if not "%ERRORLEVEL%"=="0" (
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B %ERRORLEVEL%
+ )
+) else (
+ echo Cannot set up environment. "setupVars.bat" file missing.
+ if "%OS%" == "Windows_NT" endlocal
+ exit /B 1
+)
+
+rem Set defaults
+ set TRUSTSTORE_PATH=%KERNEL_HOME%\config\keystore
+ set TRUSTSTORE_PASSWORD=changeit
+ set OTHER_ARGS=
+
+:Loop
+ if "%~1"=="" goto EndLoop
+
+ if "%~1"=="-truststore" (
+ set TRUSTSTORE_PATH=%~2
+ shift
+ shift
+ goto Loop
+ )
+ if "%~1"=="-truststorePassword" (
+ set TRUSTSTORE_PASSWORD=%~2
+ shift
+ shift
+ goto Loop
+ )
+ rem Accumulate extra parameters.
+ set OTHER_ARGS=%OTHER_ARGS% "%~1"
+ shift
+ goto Loop
+:EndLoop
+
+set JMX_OPTS=%JMX_OPTS% -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=category,type
+set JMX_OPTS=%JMX_OPTS% -J-Djavax.net.ssl.trustStore="%TRUSTSTORE_PATH%"
+set JMX_OPTS=%JMX_OPTS% -J-Djavax.net.ssl.trustStorePassword=%TRUSTSTORE_PASSWORD%
+
+"%JAVA_HOME%\bin\jconsole" %JMX_OPTS% %OTHER_ARGS%
+
+if "%OS%" == "Windows_NT" endlocal
+goto :eof
diff --git a/build-kernel/bin/jconsole.sh b/build-kernel/bin/jconsole.sh
new file mode 100755
index 00000000..34f864b7
--- /dev/null
+++ b/build-kernel/bin/jconsole.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+if [ -z "$JAVA_HOME" ]
+then
+ echo The JAVA_HOME environment variable is not defined
+ exit 1
+fi
+
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+KERNEL_HOME=`dirname "$SCRIPT"`/..
+KERNEL_HOME=`cd $KERNEL_HOME; pwd`
+
+#parse args for the script
+TRUSTSTORE_PATH=$KERNEL_HOME/config/keystore
+TRUSTSTORE_PASSWORD=changeit
+
+shopt -s extglob
+
+while (($# > 0))
+ do
+ case $1 in
+ -truststore)
+ TRUSTSTORE_PATH=$2
+ shift;
+ ;;
+ -truststorePassword)
+ TRUSTSTORE_PASSWORD=$2
+ shift;
+ ;;
+ esac
+ shift
+done
+
+JMX_OPTS=" \
+ $JMX_OPTS \
+ -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=category,type \
+ -J-Djavax.net.ssl.trustStore=$TRUSTSTORE_PATH \
+ -J-Djavax.net.ssl.trustStorePassword=$TRUSTSTORE_PASSWORD"
+
+$JAVA_HOME/bin/jconsole $JMX_OPTS
diff --git a/build-kernel/bin/jmxPermissions.vbs b/build-kernel/bin/jmxPermissions.vbs
new file mode 100644
index 00000000..c50031b1
--- /dev/null
+++ b/build-kernel/bin/jmxPermissions.vbs
@@ -0,0 +1,70 @@
+configFolder = Wscript.Arguments.Item(0)
+
+'WScript.Echo "Fixing permissions on " & configFolder
+
+Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") 'Load up WMI with the right dll
+
+Dim files(0)
+files(0) = "org.eclipse.virgo.kernel.jmxremote.access.properties"
+
+For Each file In files
+ updateInheritance(configFolder & file)
+ updateOwnership(configFolder & file)
+ updatePermissions(configFolder & file)
+Next
+
+Sub updateInheritance(file)
+ 'WScript.Echo "Updating inheritance of " & file
+
+ Const SE_DACL_PRESENT = 4
+ Const SE_DACL_PROTECTED = 4096
+ Const SE_SELF_RELATIVE = 32768
+
+ Set objFileSecSetting = objWMIService.Get("Win32_LogicalFileSecuritySetting.Path='" & file & "'")
+ objFileSecSetting.GetSecurityDescriptor objSecurityDescriptor
+
+ objSecurityDescriptor.ControlFlags = SE_DACL_PRESENT + SE_DACL_PROTECTED + SE_SELF_RELATIVE
+
+ Set objMethod = objFileSecSetting.Methods_("SetSecurityDescriptor")
+ Set objInParam = objMethod.inParameters.SpawnInstance_()
+ objInParam.Properties_.item("Descriptor") = objSecurityDescriptor
+ objFileSecSetting.ExecMethod_ "SetSecurityDescriptor", objInParam
+
+ 'WScript.Echo "Updated inheritance of " & file
+End Sub
+
+Sub updateOwnership(file)
+ 'WScript.Echo "Updating ownership of " & file
+ Set objDataFile = objWMIService.Get("CIM_DataFile.Name='" & file & "'")
+
+ Set objMethod = objDataFile.Methods_("TakeOwnerShipEx")
+ Set objInParam = objMethod.inParameters.SpawnInstance_()
+
+ objDataFile.ExecMethod_ "TakeOwnerShipEx", objInParam
+
+ 'WScript.Echo "Updated ownership of " & file
+End Sub
+
+Sub updatePermissions(file)
+ 'WScript.Echo "Updating permissions of " & file
+
+ Set objFileSecSetting = objWMIService.Get("Win32_LogicalFileSecuritySetting.Path='" & file & "'")
+ objFileSecSetting.GetSecurityDescriptor objSecurityDescriptor
+
+ Set WshNetwork = WScript.CreateObject("WScript.Network")
+ Dim specificAce(0)
+ For Each ace in objSecurityDescriptor.DACL
+ If ace.Trustee.Name = WshNetwork.UserName Then
+ Set specificAce(0) = ace
+ End If
+ Next
+
+ objSecurityDescriptor.DACL = specificAce
+
+ Set objMethod = objFileSecSetting.Methods_("SetSecurityDescriptor")
+ Set objInParam = objMethod.inParameters.SpawnInstance_()
+ objInParam.Properties_.item("Descriptor") = objSecurityDescriptor
+ objFileSecSetting.ExecMethod_ "SetSecurityDescriptor", objInParam
+
+ 'WScript.Echo "Updated permissions of " & file
+End Sub
diff --git a/build-kernel/bin/setupClasspath.bat b/build-kernel/bin/setupClasspath.bat
new file mode 100644
index 00000000..96b7ac97
--- /dev/null
+++ b/build-kernel/bin/setupClasspath.bat
@@ -0,0 +1,20 @@
+@echo off
+rem Construct the CLASSPATH list from the Kernel lib directory.
+
+if "%JAVA_HOME%" == "" (
+ echo The JAVA_HOME environment variable is not defined.
+ exit /B 1
+)
+if "%KERNEL_HOME%" == "" (
+ echo The KERNEL_HOME environment variable is not defined.
+ exit /B 1
+)
+
+for %%G in ("%KERNEL_HOME%\lib\*.jar") do call :AppendToClasspath "%%G"
+rem Remove leading semi-colon if present
+if "%CLASSPATH:~0,1%"==";" set CLASSPATH=%CLASSPATH:~1%
+exit /B 0
+
+:AppendToClasspath
+ set CLASSPATH=%CLASSPATH%;%~1
+ goto :eof
diff --git a/build-kernel/bin/setupClasspath.sh b/build-kernel/bin/setupClasspath.sh
new file mode 100755
index 00000000..75410b38
--- /dev/null
+++ b/build-kernel/bin/setupClasspath.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# make sure we have JAVA_HOME set
+if [ -z "$JAVA_HOME" ]
+then
+ echo The JAVA_HOME environment variable is not defined
+ exit 1
+fi
+
+CLASSPATH=
+
+# Create the classpath for bootstrapping the Server from all the JARs in lib
+for file in $KERNEL_HOME/lib/*
+do
+ if [[ $file == *.jar ]]
+ then
+ CLASSPATH=$CLASSPATH:$KERNEL_HOME/lib/${file##*/}
+ fi
+done
diff --git a/build-kernel/bin/setupVars.bat b/build-kernel/bin/setupVars.bat
new file mode 100644
index 00000000..55ff31dc
--- /dev/null
+++ b/build-kernel/bin/setupVars.bat
@@ -0,0 +1,31 @@
+@echo off
+rem Set up env vars needed for dmk.bat and jconsole.bat (with user-pluggable mods if present)
+
+if "%SCRIPT_DIR%"=="" (
+ echo Called setupVars.bat out of context.
+ exit /B 1
+)
+
+rem Derive KERNEL_HOME full path from script's parent (no backslash)
+ for %%I in ("%SCRIPT_DIR%..") do set KERNEL_HOME=%%~dpfsI
+
+rem Check files exist (exit if not)
+ set ChkLst="%KERNEL_HOME%\bin\setupClasspath.bat","%KERNEL_HOME%\bin\checkJava.bat"
+
+ for %%I in (%ChkLst%) do if not exist "%%~I" (
+ echo File "%%~I" does not exist but is required.
+ exit /B 1
+ )
+
+rem set up the classpath (check result)
+ call "%KERNEL_HOME%\bin\setupClasspath.bat"
+ if not "%ERRORLEVEL%" == "0" exit /B %ERRORLEVEL%
+
+rem Run Java Version check (uses JAVA_HOME) (check result)
+ call "%KERNEL_HOME%\bin\checkJava.bat"
+ if not "%ERRORLEVEL%" == "0" exit /B %ERRORLEVEL%
+
+rem Execute user setenv script if needed (ignore result)
+ if exist "%KERNEL_HOME%\bin\setenv.bat" call "%KERNEL_HOME%\bin\setenv.bat"
+
+goto :eof
diff --git a/build-kernel/bin/shutdown.bat b/build-kernel/bin/shutdown.bat
new file mode 100644
index 00000000..a2a1ff47
--- /dev/null
+++ b/build-kernel/bin/shutdown.bat
@@ -0,0 +1,8 @@
+@ECHO OFF
+IF "%OS%" == "Windows_NT" SETLOCAL
+
+SET SCRIPT_DIR=%~dp0%
+SET EXECUTABLE=dmk.bat
+
+call "%SCRIPT_DIR%%EXECUTABLE%" stop %*
+if not "%ERRORLEVEL%"=="0" exit /B %ERRORLEVEL%
diff --git a/build-kernel/bin/shutdown.sh b/build-kernel/bin/shutdown.sh
new file mode 100755
index 00000000..aac5ff46
--- /dev/null
+++ b/build-kernel/bin/shutdown.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+SCRIPT_DIR=`dirname $SCRIPT`
+EXECUTABLE="dmk.sh"
+
+exec "$SCRIPT_DIR"/"$EXECUTABLE" stop "$@"
diff --git a/build-kernel/bin/startup.bat b/build-kernel/bin/startup.bat
new file mode 100644
index 00000000..76e1618f
--- /dev/null
+++ b/build-kernel/bin/startup.bat
@@ -0,0 +1,8 @@
+@ECHO OFF
+IF "%OS%" == "Windows_NT" SETLOCAL
+
+SET SCRIPT_DIR=%~dp0%
+SET EXECUTABLE=dmk.bat
+
+call "%SCRIPT_DIR%%EXECUTABLE%" start %*
+if not "%ERRORLEVEL%"=="0" exit /B %ERRORLEVEL%
diff --git a/build-kernel/bin/startup.sh b/build-kernel/bin/startup.sh
new file mode 100755
index 00000000..20f721e5
--- /dev/null
+++ b/build-kernel/bin/startup.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+SCRIPT_DIR=`dirname $SCRIPT`
+EXECUTABLE="dmk.sh"
+
+exec "$SCRIPT_DIR"/"$EXECUTABLE" start "$@"

Back to the top