-
Notifications
You must be signed in to change notification settings - Fork 97
/
DomainModelControllerService.java
588 lines (508 loc) · 28.8 KB
/
DomainModelControllerService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.host.controller;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.FAILURE_DESCRIPTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OUTCOME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PROFILE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESULT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RUNNING_SERVER;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUCCESS;
import static org.jboss.as.host.controller.HostControllerLogger.DOMAIN_LOGGER;
import static org.jboss.as.host.controller.HostControllerLogger.ROOT_LOGGER;
import static org.jboss.as.host.controller.HostControllerMessages.MESSAGES;
import java.io.File;
import java.io.IOException;
import java.security.AccessController;
import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import javax.security.auth.callback.CallbackHandler;
import org.jboss.as.controller.AbstractControllerService;
import org.jboss.as.controller.BootContext;
import org.jboss.as.controller.ControlledProcessState;
import org.jboss.as.controller.ModelController;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ProcessType;
import org.jboss.as.controller.ProxyController;
import org.jboss.as.controller.RunningMode;
import org.jboss.as.controller.client.helpers.domain.ServerStatus;
import org.jboss.as.controller.extension.ExtensionRegistry;
import org.jboss.as.controller.operations.common.Util;
import org.jboss.as.controller.persistence.ConfigurationPersistenceException;
import org.jboss.as.controller.persistence.ConfigurationPersister;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.Resource;
import org.jboss.as.domain.controller.DomainController;
import org.jboss.as.domain.controller.DomainModelUtil;
import org.jboss.as.domain.controller.LocalHostControllerInfo;
import org.jboss.as.domain.controller.SlaveRegistrationException;
import org.jboss.as.domain.controller.descriptions.DomainDescriptionProviders;
import org.jboss.as.domain.controller.operations.coordination.PrepareStepHandler;
import org.jboss.as.host.controller.RemoteDomainConnectionService.RemoteFileRepository;
import org.jboss.as.host.controller.ignored.IgnoredDomainResourceRegistry;
import org.jboss.as.host.controller.mgmt.MasterDomainControllerOperationHandlerService;
import org.jboss.as.host.controller.mgmt.ServerToHostOperationHandlerFactoryService;
import org.jboss.as.host.controller.operations.HttpManagementAddHandler;
import org.jboss.as.host.controller.operations.LocalHostControllerInfoImpl;
import org.jboss.as.host.controller.operations.NativeManagementAddHandler;
import org.jboss.as.host.controller.operations.StartServersHandler;
import org.jboss.as.process.CommandLineConstants;
import org.jboss.as.process.ExitCodes;
import org.jboss.as.process.ProcessControllerClient;
import org.jboss.as.process.ProcessInfo;
import org.jboss.as.process.ProcessMessageHandler;
import org.jboss.as.protocol.mgmt.ManagementChannelHandler;
import org.jboss.as.remoting.EndpointService;
import org.jboss.as.remoting.management.ManagementChannelRegistryService;
import org.jboss.as.remoting.management.ManagementRemotingServices;
import org.jboss.as.repository.ContentRepository;
import org.jboss.as.repository.HostFileRepository;
import org.jboss.as.repository.LocalFileRepository;
import org.jboss.as.server.BootstrapListener;
import org.jboss.as.server.RuntimeExpressionResolver;
import org.jboss.as.server.services.security.AbstractVaultReader;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
import org.jboss.threads.JBossThreadFactory;
/**
* Creates the service that acts as the {@link org.jboss.as.controller.ModelController} for a Host Controller process.
*
* @author Brian Stansberry (c) 2011 Red Hat Inc.
*/
public class DomainModelControllerService extends AbstractControllerService implements DomainController {
public static final ServiceName SERVICE_NAME = HostControllerService.HC_SERVICE_NAME.append("model", "controller");
private HostControllerConfigurationPersister hostControllerConfigurationPersister;
private final HostControllerEnvironment environment;
private final HostRunningModeControl runningModeControl;
private final LocalHostControllerInfoImpl hostControllerInfo;
private final HostFileRepository localFileRepository;
private final RemoteFileRepository remoteFileRepository;
private final InjectedValue<ProcessControllerConnectionService> injectedProcessControllerConnection = new InjectedValue<ProcessControllerConnectionService>();
private final Map<String, ProxyController> hostProxies;
private final Map<String, ProxyController> serverProxies;
private final PrepareStepHandler prepareStepHandler;
private final BootstrapListener bootstrapListener;
private ManagementResourceRegistration modelNodeRegistration;
// TODO look into using the controller executor
final ThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup("proxy-threads"), Boolean.FALSE, null, "%G - %t", null, null, AccessController.getContext());
private final ExecutorService proxyExecutor = Executors.newCachedThreadPool(threadFactory);
private final AbstractVaultReader vaultReader;
private final ContentRepository contentRepository;
private final ExtensionRegistry extensionRegistry;
private final ControlledProcessState processState;
private final IgnoredDomainResourceRegistry ignoredRegistry;
private volatile ServerInventory serverInventory;
public static ServiceController<ModelController> addService(final ServiceTarget serviceTarget,
final HostControllerEnvironment environment,
final HostRunningModeControl runningModeControl,
final ControlledProcessState processState,
final BootstrapListener bootstrapListener) {
final Map<String, ProxyController> hostProxies = new ConcurrentHashMap<String, ProxyController>();
final Map<String, ProxyController> serverProxies = new ConcurrentHashMap<String, ProxyController>();
final LocalHostControllerInfoImpl hostControllerInfo = new LocalHostControllerInfoImpl(processState, environment);
final AbstractVaultReader vaultReader = service(AbstractVaultReader.class);
ROOT_LOGGER.debugf("Using VaultReader %s", vaultReader);
final ContentRepository contentRepository = ContentRepository.Factory.create(environment.getDomainContentDir());
IgnoredDomainResourceRegistry ignoredRegistry = new IgnoredDomainResourceRegistry(hostControllerInfo);
final PrepareStepHandler prepareStepHandler = new PrepareStepHandler(hostControllerInfo, contentRepository,
hostProxies, serverProxies, ignoredRegistry);
DomainModelControllerService service = new DomainModelControllerService(environment, runningModeControl, processState,
hostControllerInfo, contentRepository, hostProxies, serverProxies, prepareStepHandler, vaultReader,
ignoredRegistry, bootstrapListener);
return serviceTarget.addService(SERVICE_NAME, service)
.addDependency(HostControllerService.HC_EXECUTOR_SERVICE_NAME, ExecutorService.class, service.getExecutorServiceInjector())
.addDependency(ProcessControllerConnectionService.SERVICE_NAME, ProcessControllerConnectionService.class, service.injectedProcessControllerConnection)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
private DomainModelControllerService(final HostControllerEnvironment environment,
final HostRunningModeControl runningModeControl,
final ControlledProcessState processState,
final LocalHostControllerInfoImpl hostControllerInfo,
final ContentRepository contentRepository,
final Map<String, ProxyController> hostProxies,
final Map<String, ProxyController> serverProxies,
final PrepareStepHandler prepareStepHandler,
final AbstractVaultReader vaultReader,
final IgnoredDomainResourceRegistry ignoredRegistry,
final BootstrapListener bootstrapListener) {
super(ProcessType.HOST_CONTROLLER, runningModeControl, null, processState,
DomainDescriptionProviders.ROOT_PROVIDER, prepareStepHandler, new RuntimeExpressionResolver(vaultReader));
this.environment = environment;
this.runningModeControl = runningModeControl;
this.processState = processState;
this.hostControllerInfo = hostControllerInfo;
this.localFileRepository = new LocalFileRepository(environment.getDomainBaseDir(), environment.getDomainContentDir(), environment.getDomainConfigurationDir());
this.remoteFileRepository = new RemoteFileRepository(localFileRepository);
this.contentRepository = contentRepository;
this.hostProxies = hostProxies;
this.serverProxies = serverProxies;
this.prepareStepHandler = prepareStepHandler;
this.vaultReader = vaultReader;
this.ignoredRegistry = ignoredRegistry;
this.bootstrapListener = bootstrapListener;
this.extensionRegistry = new ExtensionRegistry(ProcessType.HOST_CONTROLLER, runningModeControl);
}
@Override
public LocalHostControllerInfo getLocalHostInfo() {
return hostControllerInfo;
}
@Override
public void registerRemoteHost(ProxyController hostControllerClient) throws SlaveRegistrationException {
if (!hostControllerInfo.isMasterDomainController()) {
throw SlaveRegistrationException.forHostIsNotMaster();
}
if (runningModeControl.getRunningMode() == RunningMode.ADMIN_ONLY) {
throw SlaveRegistrationException.forMasterInAdminOnlyMode(runningModeControl.getRunningMode());
}
PathAddress pa = hostControllerClient.getProxyNodeAddress();
PathElement pe = pa.getElement(0);
ProxyController existingController = modelNodeRegistration.getProxyController(pa);
if (existingController != null || hostControllerInfo.getLocalHostName().equals(pe.getValue())){
throw SlaveRegistrationException.forHostAlreadyExists(pe.getValue());
}
modelNodeRegistration.registerProxyController(pe, hostControllerClient);
hostProxies.put(pe.getValue(), hostControllerClient);
}
@Override
public boolean isHostRegistered(String id) {
return hostControllerInfo.getLocalHostName().equals(id) || hostProxies.containsKey(id);
}
@Override
public void unregisterRemoteHost(String id) {
if (hostProxies.remove(id) != null) {
DOMAIN_LOGGER.unregisteredRemoteSlaveHost(id);
}
modelNodeRegistration.unregisterProxyController(PathElement.pathElement(HOST, id));
}
@Override
public void registerRunningServer(ProxyController serverControllerClient) {
PathAddress pa = serverControllerClient.getProxyNodeAddress();
PathElement pe = pa.getElement(1);
if (modelNodeRegistration.getProxyController(pa) != null) {
throw MESSAGES.serverNameAlreadyRegistered(pe.getValue());
}
ROOT_LOGGER.registeringServer(pe.getValue());
ManagementResourceRegistration hostRegistration = modelNodeRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(HOST)));
hostRegistration.registerProxyController(pe, serverControllerClient);
serverProxies.put(pe.getValue(), serverControllerClient);
}
@Override
public void unregisterRunningServer(String serverName) {
PathAddress pa = PathAddress.pathAddress(PathElement.pathElement(HOST, hostControllerInfo.getLocalHostName()));
PathElement pe = PathElement.pathElement(RUNNING_SERVER, serverName);
ROOT_LOGGER.unregisteringServer(serverName);
ManagementResourceRegistration hostRegistration = modelNodeRegistration.getSubModel(pa);
hostRegistration.unregisterProxyController(pe);
serverProxies.remove(serverName);
}
@Override
public ModelNode getProfileOperations(String profileName) {
ModelNode operation = new ModelNode();
operation.get(OP).set(DESCRIBE);
operation.get(OP_ADDR).set(PathAddress.pathAddress(PathElement.pathElement(PROFILE, profileName)).toModelNode());
ModelNode rsp = getValue().execute(operation, null, null, null);
if (!rsp.hasDefined(OUTCOME) || !SUCCESS.equals(rsp.get(OUTCOME).asString())) {
ModelNode msgNode = rsp.get(FAILURE_DESCRIPTION);
String msg = msgNode.isDefined() ? msgNode.toString() : MESSAGES.failedProfileOperationsRetrieval();
throw new RuntimeException(msg);
}
return rsp.require(RESULT);
}
@Override
public HostFileRepository getLocalFileRepository() {
return localFileRepository;
}
@Override
public HostFileRepository getRemoteFileRepository() {
if (hostControllerInfo.isMasterDomainController()) {
throw MESSAGES.cannotAccessRemoteFileRepository();
}
return remoteFileRepository;
}
@Override
public void start(StartContext context) throws StartException {
final ExecutorService executorService = getExecutorServiceInjector().getValue();
this.hostControllerConfigurationPersister = new HostControllerConfigurationPersister(environment, hostControllerInfo, executorService, extensionRegistry);
setConfigurationPersister(hostControllerConfigurationPersister);
prepareStepHandler.setExecutorService(executorService);
super.start(context);
}
@Override
protected void initModel(Resource rootResource, ManagementResourceRegistration rootRegistration) {
DomainModelUtil.updateCoreModel(rootResource, environment);
HostModelUtil.createHostRegistry(rootRegistration, hostControllerConfigurationPersister, environment, runningModeControl,
localFileRepository, hostControllerInfo, new DelegatingServerInventory(), remoteFileRepository, contentRepository,
this, extensionRegistry,vaultReader, ignoredRegistry, processState);
this.modelNodeRegistration = rootRegistration;
}
// See superclass start. This method is invoked from a separate non-MSC thread after start. So we can do a fair
// bit of stuff
@Override
protected void boot(final BootContext context) throws ConfigurationPersistenceException {
final ServiceTarget serviceTarget = context.getServiceTarget();
boolean ok = false;
boolean reachedServers = false;
try {
// Parse the host.xml and invoke all the ops. The ops should rollback on any Stage.RUNTIME failure
ok = boot(hostControllerConfigurationPersister.load(), true);
final RunningMode currentRunningMode = runningModeControl.getRunningMode();
if (ok) {
// Install the core remoting endpoint and listener
ManagementRemotingServices.installRemotingEndpoint(serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT,
hostControllerInfo.getLocalHostName(), EndpointService.EndpointType.MANAGEMENT, null, null);
// Now we know our management interface configuration. Install the server inventory
ManagementChannelRegistryService.addService(serviceTarget);
Future<ServerInventory> inventoryFuture = ServerInventoryService.install(serviceTarget, this, runningModeControl, environment,
hostControllerInfo.getNativeManagementInterface(), hostControllerInfo.getNativeManagementPort());
if (!hostControllerInfo.isMasterDomainController() && !environment.isUseCachedDc()) {
serverInventory = getFuture(inventoryFuture);
if (hostControllerInfo.getRemoteDomainControllerHost() != null) {
Future<MasterDomainControllerClient> clientFuture = RemoteDomainConnectionService.install(serviceTarget,
getValue(),
hostControllerInfo,
environment.getProductConfig(),
hostControllerInfo.getRemoteDomainControllerSecurityRealm(),
remoteFileRepository);
MasterDomainControllerClient masterDomainControllerClient = getFuture(clientFuture);
//Registers us with the master and gets down the master copy of the domain model to our DC
//TODO make sure that the RDCS checks env.isUseCachedDC, and if true falls through to that
// BES 2012/02/04 Comment ^^^ implies the semantic is to use isUseCachedDC as a fallback to
// a failure to connect as opposed to being an instruction to not connect at all. I believe
// the current impl is the latter. Don't change this without a discussion first, as the
// current semantic is a reasonable one.
try {
masterDomainControllerClient.register();
} catch (Exception e) {
//We could not connect to the host
ROOT_LOGGER.cannotConnectToMaster(e);
System.exit(ExitCodes.HOST_CONTROLLER_ABORT_EXIT_CODE);
}
} else if (currentRunningMode != RunningMode.ADMIN_ONLY) {
//We could not connect to the host
ROOT_LOGGER.noDomainControllerConfigurationProvided(currentRunningMode,
CommandLineConstants.ADMIN_ONLY, RunningMode.ADMIN_ONLY);
System.exit(ExitCodes.HOST_CONTROLLER_ABORT_EXIT_CODE);
}
} else {
if (environment.isUseCachedDc()) {
remoteFileRepository.setRemoteFileRepositoryExecutor(new RemoteDomainConnectionService.RemoteFileRepositoryExecutor() {
@Override
public File getFile(String relativePath, byte repoId, HostFileRepository localFileRepository) {
return localFileRepository.getFile(relativePath);
}
});
}
// parse the domain.xml and load the steps
// TODO look at having LocalDomainControllerAdd do this, using Stage.IMMEDIATE for the steps
ConfigurationPersister domainPersister = hostControllerConfigurationPersister.getDomainPersister();
ok = boot(domainPersister.load(), false);
if (!ok && runningModeControl.getRunningMode().equals(RunningMode.ADMIN_ONLY)) {
ROOT_LOGGER.reportAdminOnlyDomainXmlFailure();
ok = true;
}
if (ok) {
ManagementRemotingServices.installManagementChannelServices(serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT,
new MasterDomainControllerOperationHandlerService(this),
DomainModelControllerService.SERVICE_NAME, ManagementRemotingServices.DOMAIN_CHANNEL, null, null);
serverInventory = getFuture(inventoryFuture);
}
}
}
if (ok) {
// TODO look into adding some of these services in the handlers, but ON-DEMAND.
// Then here just add some simple service that demands them
ServerToHostOperationHandlerFactoryService.install(serviceTarget, ServerInventoryService.SERVICE_NAME, proxyExecutor, localFileRepository);
NativeManagementAddHandler.installNativeManagementServices(serviceTarget, hostControllerInfo, null, null);
if (hostControllerInfo.getHttpManagementInterface() != null) {
HttpManagementAddHandler.installHttpManagementServices(currentRunningMode, serviceTarget, hostControllerInfo, environment, null);
}
reachedServers = true;
if (currentRunningMode == RunningMode.NORMAL) {
startServers();
}
}
} catch (Exception e) {
ROOT_LOGGER.caughtExceptionDuringBoot(e);
if (!reachedServers) {
ok = false;
}
} finally {
if (ok) {
try {
finishBoot();
} finally {
bootstrapListener.tick();
}
} else {
// Die!
ROOT_LOGGER.unsuccessfulBoot();
System.exit(ExitCodes.HOST_CONTROLLER_ABORT_EXIT_CODE);
}
}
}
private <T> T getFuture(Future<T> future) {
try {
return future.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
private void startServers() {
ModelNode addr = new ModelNode();
addr.add(HOST, hostControllerInfo.getLocalHostName());
ModelNode op = Util.getEmptyOperation(StartServersHandler.OPERATION_NAME, addr);
getValue().execute(op, null, null, null);
}
@Override
public void stop(StopContext context) {
serverInventory = null;
extensionRegistry.clear();
super.stop(context);
}
@Override
public void stopLocalHost() {
stopLocalHost(0);
}
@Override
public void stopLocalHost(int exitCode) {
final ProcessControllerClient client = injectedProcessControllerConnection.getValue().getClient();
try {
client.shutdown(exitCode);
} catch (IOException e) {
throw MESSAGES.errorClosingDownHost(e);
}
}
private class DelegatingServerInventory implements ServerInventory {
public void serverCommunicationRegistered(String serverProcessName, ManagementChannelHandler channelHandler) {
serverInventory.serverCommunicationRegistered(serverProcessName, channelHandler);
}
public boolean serverReconnected(String serverProcessName, ManagementChannelHandler channelHandler) {
return serverInventory.serverReconnected(serverProcessName, channelHandler);
}
public void serverProcessAdded(String serverProcessName) {
serverInventory.serverProcessAdded(serverProcessName);
}
public void serverStartFailed(String serverProcessName) {
serverInventory.serverStartFailed(serverProcessName);
}
@Override
public void serverStarted(String serverProcessName) {
serverInventory.serverStarted(serverProcessName);
}
public void serverProcessStopped(String serverProcessName) {
serverInventory.serverProcessStopped(serverProcessName);
}
public String getServerProcessName(String serverName) {
return serverInventory.getServerProcessName(serverName);
}
public String getProcessServerName(String processName) {
return serverInventory.getProcessServerName(processName);
}
public void processInventory(Map<String, ProcessInfo> processInfos) {
serverInventory.processInventory(processInfos);
}
public Map<String, ProcessInfo> determineRunningProcesses() {
return serverInventory.determineRunningProcesses();
}
public Map<String, ProcessInfo> determineRunningProcesses(boolean serversOnly) {
return serverInventory.determineRunningProcesses(serversOnly);
}
public ServerStatus determineServerStatus(String serverName) {
return serverInventory.determineServerStatus(serverName);
}
public ServerStatus startServer(String serverName, ModelNode domainModel) {
return serverInventory.startServer(serverName, domainModel);
}
@Override
public ServerStatus startServer(String serverName, ModelNode domainModel, boolean blocking) {
return serverInventory.startServer(serverName, domainModel, blocking);
}
public void reconnectServer(String serverName, ModelNode domainModel, boolean running) {
serverInventory.reconnectServer(serverName, domainModel, running);
}
public ServerStatus restartServer(String serverName, int gracefulTimeout, ModelNode domainModel) {
return serverInventory.restartServer(serverName, gracefulTimeout, domainModel);
}
@Override
public ServerStatus restartServer(String serverName, int gracefulTimeout, ModelNode domainModel, boolean blocking) {
return serverInventory.restartServer(serverName, gracefulTimeout, domainModel, blocking);
}
public ServerStatus stopServer(String serverName, int gracefulTimeout) {
return serverInventory.stopServer(serverName, gracefulTimeout);
}
@Override
public ServerStatus stopServer(String serverName, int gracefulTimeout, boolean blocking) {
return serverInventory.stopServer(serverName, gracefulTimeout, blocking);
}
public CallbackHandler getServerCallbackHandler() {
return serverInventory.getServerCallbackHandler();
}
@Override
public void stopServers(int gracefulTimeout) {
serverInventory.stopServers(gracefulTimeout);
}
@Override
public void connectionFinished() {
serverInventory.connectionFinished();
}
@Override
public void serverProcessStarted(String processName) {
serverInventory.serverProcessStarted(processName);
}
@Override
public void serverProcessRemoved(String processName) {
serverInventory.serverProcessRemoved(processName);
}
@Override
public void operationFailed(String processName, ProcessMessageHandler.OperationType type) {
serverInventory.operationFailed(processName, type);
}
}
private static <S> S service(final Class<S> service) {
final ServiceLoader<S> serviceLoader = ServiceLoader.load(service);
final Iterator<S> it = serviceLoader.iterator();
if (it.hasNext())
return it.next();
return null;
}
}