@@ -51,6 +51,8 @@ class JBossServer {
51
51
52
52
final String jbossHome
53
53
54
+ private boolean serverManagementAllIP
55
+
54
56
private File redirection = null
55
57
56
58
private long timeout = DEFAULT_TIMEOUT
@@ -165,12 +167,27 @@ class JBossServer {
165
167
* @return itself.
166
168
*/
167
169
JBossServer withStartingTimeout (long timeout ) {
168
- if (this . timeout > 0 ) {
170
+ if (timeout > 0 ) {
169
171
this . timeout = timeout
170
172
}
171
173
return this
172
174
}
173
175
176
+ /**
177
+ * By default, the management console is only available on the machine of the running wildfly
178
+ * at IP 127.0.0.1 and port 9990.
179
+ * This method allows the management console to be accessible from any server IP. This is useful
180
+ * with a client server which does not provide WEB browser (which is generally the case).
181
+ * By default, false (that means default wildfly behavior).
182
+ * This parameter only affects start and debug methods.
183
+ * @param isAllIp true to make the management accessible from any client.
184
+ * @return itself.
185
+ */
186
+ JBossServer setServerManagementAllIP (boolean isAllIp ) {
187
+ this . serverManagementAllIP = isAllIp
188
+ return this
189
+ }
190
+
174
191
/**
175
192
* Gets the name and the version of the JBoss/Wildfly application server referred by the
176
193
* JBOSS_HOME environment variable.
@@ -200,6 +217,7 @@ class JBossServer {
200
217
* </ul>
201
218
*/
202
219
void start (Map params = null ) {
220
+ int managementPort = 9990
203
221
boolean adminOnly = (params != null && params. adminOnly ? params. adminOnly: false )
204
222
if (reloadRequired()) {
205
223
reload()
@@ -209,6 +227,8 @@ class JBossServer {
209
227
ProcessBuilder process
210
228
if (adminOnly) {
211
229
process = new ProcessBuilder (starter, ' -c' , ' standalone-full.xml' , ' --admin-only' )
230
+ } else if (serverManagementAllIP) {
231
+ process = new ProcessBuilder (starter, ' -c' , ' standalone-full.xml' , ' -bmanagement' , ' 0.0.0.0' , ' -b' , ' 0.0.0.0' )
212
232
} else {
213
233
process = new ProcessBuilder (starter, ' -c' , ' standalone-full.xml' , ' -b' , ' 0.0.0.0' )
214
234
}
@@ -222,6 +242,10 @@ class JBossServer {
222
242
}
223
243
process. start()
224
244
waitUntilRunning()
245
+ if (serverManagementAllIP) {
246
+ println ' '
247
+ println " Silverpeas management console is accessible at server IP on port ${ managementPort} "
248
+ }
225
249
} else {
226
250
logger. info ' A JBoss instance is already started'
227
251
}
@@ -239,11 +263,20 @@ class JBossServer {
239
263
stop()
240
264
}
241
265
if (! isStartingOrRunning()) {
266
+ int managementPort = 9990
242
267
String p = (port <= 1000 ? ' 5005' : String . valueOf(port))
243
- ProcessBuilder process =
244
- new ProcessBuilder (starter, ' -c' , ' standalone-full.xml' , ' -b' , ' 0.0.0.0' , ' --debug' , p)
245
- .directory(new File (jbossHome))
246
- .redirectErrorStream(true )
268
+ ProcessBuilder process
269
+ if (serverManagementAllIP) {
270
+ process =
271
+ new ProcessBuilder (starter, ' -c' , ' standalone-full.xml' , ' -bmanagement' , ' 0.0.0.0' , ' -b' , ' 0.0.0.0' , ' --debug' , p)
272
+ .directory(new File (jbossHome))
273
+ .redirectErrorStream(true )
274
+ } else {
275
+ process =
276
+ new ProcessBuilder (starter, ' -c' , ' standalone-full.xml' , ' -b' , ' 0.0.0.0' , ' --debug' , p)
277
+ .directory(new File (jbossHome))
278
+ .redirectErrorStream(true )
279
+ }
247
280
if (redirection != null ) {
248
281
process. redirectOutput(redirection)
249
282
} else {
@@ -252,6 +285,10 @@ class JBossServer {
252
285
}
253
286
process. start()
254
287
waitUntilRunning()
288
+ println ' '
289
+ if (serverManagementAllIP) {
290
+ println " Silverpeas management console is accessible at server IP on port ${ managementPort} "
291
+ }
255
292
println " Silverpeas Debugging Port is ${ p} "
256
293
} else {
257
294
logger. info ' A JBoss instance is already started'
0 commit comments