2 SETLOCAL ENABLEDELAYEDEXPANSION
4 IF NOT EXIST "%JAVA_HOME%" (
5 ECHO JAVA_HOME environment variable is not set
15 SET consoleOpts=-console -consoleLog
17 SET JAVA_H=%JAVA_HOME%\bin\jps.exe
22 IF "!CARG!"=="-debug" (
27 IF "!CARG!"=="-debugsuspend" (
29 SET debugSuspended=true
33 IF "!CARG!"=="-debugport" (
44 IF "!CARG!"=="-jmxport" (
50 IF "!CARG!"=="-start" (
55 IF "!CARG!"=="-consoleport" (
60 IF "!CARG!"=="-console" (
64 IF "!CARG!"=="-status" (
65 for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do (
69 ECHO Controller is running with PID !PID!
71 ECHO Controller is not running.
75 IF "!CARG!"=="-stop" (
76 for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do (
80 ECHO Stopping controller PID !PID!
81 TASKKILL /F /PID !PID!
83 ECHO Controller is not running.
87 IF "!CARG:~0,4!"=="-Xmx" (
88 SET jvmMaxMemory=!CARG!
92 IF "!CARG:~0,2!"=="-D" (
93 SET extraJVMOpts=!extraJVMOpts! !CARG!
97 IF "!CARG:~0,2!"=="-X" (
98 SET extraJVMOpts=!extraJVMOpts! !CARG!
102 IF "!CARG!"=="-help" (
113 ECHO "Unknown option: !CARG!"
117 IF "%debugEnabled%" NEQ "" (
118 REM ECHO "DEBUG enabled"
119 SET extraJVMOpts=!extraJVMOpts! -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport%
122 IF "%debugSuspended%" NEQ "" (
123 REM ECHO "DEBUG enabled suspended"
124 SET extraJVMOpts=!extraJVMOpts! -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport%
127 IF "%jvmMaxMemory%"=="" (
128 SET jvmMaxMemory=-Xmx1G
129 ECHO Setting maximum memory to 1G.
132 SET extraJVMOpts=!extraJVMOpts! %jvmMaxMemory%
134 IF "%jmxEnabled%" NEQ "" (
135 REM ECHO "JMX enabled "
136 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
138 IF "%startEnabled%" NEQ "" (
139 REM ECHO "START enabled "
140 SET consoleOpts=-console %consoleport% -consoleLog
143 REM Check if controller is already running
144 for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do (
148 ECHO Controller is already running with PID !PID!
153 REM Now set the classpath:
154 SET cp="%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar;%basedir%lib\org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar;%basedir%lib\org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar"
156 REM Now set framework classpath
157 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"
159 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%
163 if "%startEnabled%" NEQ "" (
164 START /B cmd /C CALL !RUN_CMD! > %basedir%\logs\controller.out 2>&1
165 ECHO Running controller in the background.
173 echo. For more information on a specific command, type -help command-name.
176 echo jmxport ^[-jmxport ^<num^>^] - DEFAULT is 1088
177 echo debug ^[-debug^]
178 echo debugsuspend ^[-debugsuspend^]
179 echo debugport ^[-debugport ^<num^>^] - DEFAULT is 8000
180 echo start ^[-start ^[^<console port^>^]^] - DEFAULT port is 2400
182 echo status ^[-status^]
183 echo console ^[-console^]
184 echo agentpath ^[-agentpath:^<path to lib^>^]
189 ECHO. debugsuspend ^[-debugsuspend^]
191 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.
197 ECHO. debugport ^[-debugport ^<num^>^] - DEFAULT is 8000
199 ECHO. Set address for settings in runjdwp in extra JVM options.
200 ECHO. The address is transport address for the connection.
201 ECHO. The address has to be in the range ^[1024,65535^]. If the option was not call, port will be set to default value.
207 ECHO. jmxport ^[-jmxport ^<num^>^] - DEFAULT is 1088
209 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.
217 ECHO. Run ODL controller with -Xdebug and -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=^$^{debugport^}
219 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.
221 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.
223 ECHO. settings for -Xrunjdwp:
224 ECHO. transport - name of the transport to use in connecting to debugger application
225 ECHO. server - if 'y', listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address
226 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
227 ECHO. suspend - if 'y', VMStartEvent has a suspend Policy of SUSPEND_ALL
228 ECHO. - if 'n', VMStartEvent has a suspend policy of SUSPEND_NONE
229 ECHO. address - transport address for the connection
230 ECHO. - if server=n, attempt to attach to debugger application at this address
231 ECHO. - if server=y, listen for a connection at this address
239 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
240 ECHO. jmxport can by set with option -jmxport ^<num^>. Default num for the option is 1088.
248 ECHO. If a controller is running, the command stop controller. Pid will be clean.
254 ECHO. status ^[-status^]
256 ECHO. Find out whether a controller is running and print it.
262 ECHO. start ^[-start ^[^<console port^>^]^]
264 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.
269 ECHO. console [-console]
270 ECHO. Default option.
275 ECHO. agentpath ^[-agentpath:^<path to lib^>^]
277 ECHO. Agentpath option passes path to agent to jvm in order to load native agent library, e.g. yourkit profiler agent.