From b68071a8e646b4a7e2349927c30c5c56a6903b4e Mon Sep 17 00:00:00 2001 From: Jakub Date: Tue, 17 Jun 2014 18:25:17 +0200 Subject: [PATCH] BUG-1200 added functions for help depends on argument (-help arg) Change-Id: Ia2efe44f4eead3f816ec3effc2210ca9bd506c7f Signed-off-by: Jakub --- .../opendaylight/src/main/resources/run.bat | 153 +++++++++++++++--- 1 file changed, 132 insertions(+), 21 deletions(-) diff --git a/opendaylight/distribution/opendaylight/src/main/resources/run.bat b/opendaylight/distribution/opendaylight/src/main/resources/run.bat index 72ccd02707..ce13e33968 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/run.bat +++ b/opendaylight/distribution/opendaylight/src/main/resources/run.bat @@ -14,6 +14,7 @@ SET jvmMaxMemory= SET extraJVMOpts= SET consoleOpts=-console -consoleLog SET PID= +SET JAVA_H=%JAVA_HOME%\bin\jps.exe :LOOP IF "%~1" NEQ "" ( @@ -61,7 +62,7 @@ IF "%~1" NEQ "" ( GOTO :LOOP ) IF "!CARG!"=="-status" ( - for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do ( + for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do ( set PID=%%G ) if "!PID!" NEQ "" ( @@ -72,7 +73,7 @@ IF "%~1" NEQ "" ( GOTO :EOF ) IF "!CARG!"=="-stop" ( - for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do ( + for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do ( set PID=%%G ) if "!PID!" NEQ "" ( @@ -89,18 +90,23 @@ IF "%~1" NEQ "" ( GOTO :LOOP ) IF "!CARG:~0,2!"=="-D" ( - SET extraJVMOpts=%extraJVMOpts% !CARG! + SET extraJVMOpts=!extraJVMOpts! !CARG! SHIFT GOTO :LOOP ) IF "!CARG:~0,2!"=="-X" ( - SET extraJVMOpts=%extraJVMOpts% !CARG! + SET extraJVMOpts=!extraJVMOpts! !CARG! SHIFT GOTO :LOOP ) IF "!CARG!"=="-help" ( - ECHO "Usage: %0 [-jmx] [-jmxport ] [-debug] [-debugsuspend] [-debugport ] [-start] [-consoleport ]] [-stop] [-status] [-console] [-help] []" - ECHO Note: Enclose any JVM or System properties within double quotes. + SHIFT + SET CARG=%2 + IF "!CARG!" NEQ "" ( + CALL:!CARG! + ) ELSE ( + CALL:helper + ) GOTO :EOF ) @@ -110,28 +116,24 @@ IF "%~1" NEQ "" ( IF "%debugEnabled%" NEQ "" ( REM ECHO "DEBUG enabled" - SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport% + SET extraJVMOpts=!extraJVMOpts! -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport% ) + IF "%debugSuspended%" NEQ "" ( REM ECHO "DEBUG enabled suspended" - SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport% + SET extraJVMOpts=!extraJVMOpts! -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport% ) IF "%jvmMaxMemory%"=="" ( SET jvmMaxMemory=-Xmx1G - ECHO ***************************************************************** - ECHO JVM maximum memory was not defined. Setting maximum memory to 1G. - ECHO To define the maximum memory, specify the -Xmx setting on the - ECHO command line. - ECHO e.g. run.bat -Xmx1G - ECHO *****************************************************************" + ECHO Setting maximum memory to 1G. ) -SET extraJVMOpts=%extraJVMOpts% %jvmMaxMemory% +SET extraJVMOpts=!extraJVMOpts! %jvmMaxMemory% IF "%jmxEnabled%" NEQ "" ( REM ECHO "JMX enabled " - SET extraJVMOpts=%extraJVMOpts% -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=%jmxport% -Dcom.sun.management.jmxremote + SET extraJVMOpts=!extraJVMOpts! -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=%jmxport% -Dcom.sun.management.jmxremote ) IF "%startEnabled%" NEQ "" ( REM ECHO "START enabled " @@ -139,7 +141,7 @@ IF "%startEnabled%" NEQ "" ( ) REM Check if controller is already running -for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do ( +for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do ( SET PID=%%G ) if "!PID!" NEQ "" ( @@ -154,16 +156,125 @@ SET cp="%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar;%basedir%lib\or REM Now set framework classpath SET fwcp="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar,file:\%basedir%lib\org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar,file:\%basedir%lib\org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar" -SET RUN_CMD="%JAVA_HOME%\bin\java.exe" -Dopendaylight.controller %extraJVMOpts% -Djava.io.tmpdir="%basedir%work\tmp" -Djava.awt.headless=true -Dosgi.install.area=%basedir% -Dosgi.configuration.area="%basedir%configuration" -Dosgi.frameworkClassPath=%fwcp% -Dosgi.framework="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar" -classpath %cp% org.eclipse.equinox.launcher.Main %consoleOpts% +SET RUN_CMD="%JAVA_HOME%\bin\java.exe" -Dopendaylight.controller !extraJVMOpts! -Djava.io.tmpdir="%basedir%work\tmp" -Djava.awt.headless=true -Dosgi.install.area=%basedir% -Dosgi.configuration.area="%basedir%configuration" -Dosgi.frameworkClassPath=%fwcp% -Dosgi.framework="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar" -classpath %cp% org.eclipse.equinox.launcher.Main %consoleOpts% -ECHO %RUN_CMD% +ECHO !RUN_CMD! if "%startEnabled%" NEQ "" ( - START /B cmd /C CALL %RUN_CMD% > %basedir%\logs\controller.out 2>&1 + START /B cmd /C CALL !RUN_CMD! > %basedir%\logs\controller.out 2>&1 ECHO Running controller in the background. + EXIT /B 1 ) else ( - %RUN_CMD% + !RUN_CMD! EXIT /B %ERRORLEVEL% ) +:helper +echo. For more information on a specific command, type -help command-name. +echo. +echo jmx ^[-jmx^] +echo jmxport ^[-jmxport ^^] - DEFAULT is 1088 +echo debug ^[-debug^] +echo debugsuspend ^[-debugsuspend^] +echo debugport ^[-debugport ^^] - DEFAULT is 8000 +echo start ^[-start ^[^^]^] - DEFAULT port is 2400 +echo stop ^[-stop^] +echo status ^[-status^] +echo console ^[-console^] +echo agentpath ^[-agentpath:^^] +exit/B 1 + +:debugsuspend +ECHO. +ECHO. debugsuspend ^[-debugsuspend^] +ECHO. +ECHO. This command sets suspend on true in runjdwp in extra JVM options. If its true, VMStartEvent has a suspendPolicy of SUSPEND_ALL. If its false, VMStartEvent has a suspendPolicy of SUSPEND_NONE. +ECHO. +EXIT /B 1 + +:debugport +ECHO. +ECHO. debugport ^[-debugport ^^] - DEFAULT is 8000 +ECHO. +ECHO. Set address for settings in runjdwp in extra JVM options. +ECHO. The address is transport address for the connection. +ECHO. The address has to be in the range ^[1024,65535^]. If the option was not call, port will be set to default value. +ECHO. +EXIT /B 1 + +:jmxport +ECHO. +ECHO. jmxport ^[-jmxport ^^] - DEFAULT is 1088 +ECHO. +ECHO. Set jmx port for com.sun.management.jmxremote.port in JMX support. Port has to be in the range ^[1024,65535^]. If this option was not call, port will be set to default value. +ECHO. +EXIT /B 1 + +:debug +ECHO. +ECHO. debug [-debug] +ECHO. +ECHO. Run ODL controller with -Xdebug and -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=^$^{debugport^} +ECHO. +ECHO. -Xdebug enables debugging capabilities in the JVM which are used by the Java Virtual Machine Tools Interface (JVMTI). JVMTI is a low-level debugging interface used by debuggers and profiling tools. +ECHO. +ECHO. -Xrunjdwp option loads the JPDA reference implementation of JDWP. This library resides in the target VM and uses JVMDI and JNI to interact with it. It uses a transport and the JDWP protocol to communicate with a separate debugger application. +ECHO. +ECHO. settings for -Xrunjdwp: +ECHO. transport - name of the transport to use in connecting to debugger application +ECHO. server - if 'y', listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address +ECHO. - if 'y' and no address is specified, choose a transport address at which to listen for a debugger application, and print the address to the standard output stream +ECHO. suspend - if 'y', VMStartEvent has a suspend Policy of SUSPEND_ALL +ECHO. - if 'n', VMStartEvent has a suspend policy of SUSPEND_NONE +ECHO. address - transport address for the connection +ECHO. - if server=n, attempt to attach to debugger application at this address +ECHO. - if server=y, listen for a connection at this address +ECHO. +EXIT /B 1 + +:jmx +ECHO. +ECHO. jmx [-jmx] +ECHO. +ECHO. Add JMX support. With settings for extra JVM options: -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=^$^{jmxport^} -Dcom.sun.management.jmxremote +ECHO. jmxport can by set with option -jmxport ^. Default num for the option is 1088. +ECHO. +EXIT /B 1 + +:stop +ECHO. +ECHO. stop ^[-stop^] +ECHO. +ECHO. If a controller is running, the command stop controller. Pid will be clean. +ECHO. +EXIT /B 1 + +:status +ECHO. +ECHO. status ^[-status^] +ECHO. +ECHO. Find out whether a controller is running and print it. +ECHO. +EXIT /B 1 + +:start +ECHO. +ECHO. start ^[-start ^[^^]^] +ECHO. +ECHO. If controller is not running, the command with argument^(for set port, where controller has start^) will start new controller on a port. The port has to be in the range ^[1024,65535^]. If this option was not call, port will be set to default value. Pid will be create. +EXIT /B 1 + +:console +ECHO. +ECHO. console [-console] +ECHO. Default option. +EXIT /B 1 + +:agentpath +ECHO. +ECHO. agentpath ^[-agentpath:^^] +ECHO. +ECHO. Agentpath option passes path to agent to jvm in order to load native agent library, e.g. yourkit profiler agent. +EXIT /B 1 + -- 2.36.6