use of org.jboss.hal.dmr.Operation in project console by hal.
the class ServerGroupActions method start.
public void start(ServerGroup serverGroup) {
List<Server> downServers = serverGroup.getServers(server -> server.isStopped() || server.isFailed());
if (!downServers.isEmpty()) {
prepare(serverGroup, downServers, Action.START);
Operation operation = new Operation.Builder(serverGroup.getAddress(), START_SERVERS).param(BLOCKING, false).build();
dispatcher.execute(operation, result -> repeatCompositeUntil(dispatcher, serverGroupTimeout(serverGroup, Action.START), readServerConfigStatus(downServers), checkServerConfigStatus(downServers.size(), STARTED)).subscribe(new ServerGroupTimeoutCallback(serverGroup, downServers, resources.messages().startServerGroupSuccess(serverGroup.getName()))), new ServerGroupFailedCallback(serverGroup, downServers, resources.messages().startServerGroupError(serverGroup.getName())), new ServerGroupExceptionCallback(serverGroup, downServers, resources.messages().startServerGroupError(serverGroup.getName())));
} else {
MessageEvent.fire(eventBus, Message.warning(resources.messages().serverGroupNoStoppedServers(serverGroup.getName())));
}
}
use of org.jboss.hal.dmr.Operation in project console by hal.
the class HostActions method restart.
public void restart(Host host, SafeHtml question) {
DialogFactory.showConfirmation(resources.messages().restart(host.getName()), question, () -> {
// execute the restart with a little delay to ensure the confirmation dialog is closed
// before the next dialog is opened (only one modal can be open at a time!)
setTimeout((o) -> {
prepare(host, host.getServers(), Action.RESTART);
Operation operation = new Operation.Builder(host.getAddress(), SHUTDOWN).param(RESTART, true).build();
if (host.isDomainController()) {
domainControllerOperation(host, operation, hostTimeout(host, Action.RESTART), host.getServers(), resources.messages().restart(host.getName()), resources.messages().restartDomainControllerPending(host.getName()), resources.messages().restartHostSuccess(host.getName()), resources.messages().restartHostError(host.getName()), resources.messages().domainControllerTimeout(host.getName()));
} else {
hostControllerOperation(host, operation, hostTimeout(host, Action.RESTART), host.getServers(), resources.messages().restartHostSuccess(host.getName()), resources.messages().restartHostError(host.getName()), resources.messages().hostControllerTimeout(host.getName()));
}
}, SHORT_TIMEOUT);
});
}
use of org.jboss.hal.dmr.Operation in project console by hal.
the class HostActions method ping.
private Operation ping(Host host) {
ResourceAddress address = new ResourceAddress().add(HOST, // do not use host.getAddressName() here!
host.getName());
Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).build();
if (host.hasServers(Server::isStarted)) {
Operation[] operations = host.getServers(Server::isStarted).stream().map(server -> {
ResourceAddress serverAddress = host.getAddress().add(SERVER, server.getName());
return new Operation.Builder(serverAddress, READ_RESOURCE_OPERATION).build();
}).toArray(Operation[]::new);
operation = new Composite(operation, operations);
} else {
operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).build();
}
return operation;
}
use of org.jboss.hal.dmr.Operation in project console by hal.
the class ServerGroupDeploymentPresenter method enable.
void enable(String deployment) {
ResourceAddress address = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, deployment);
progress.get().reset();
progress.get().tick();
Operation operation = new Operation.Builder(address, DEPLOY).build();
dispatcher.execute(operation, result -> {
progress.get().finish();
reload();
MessageEvent.fire(getEventBus(), Message.success(resources.messages().deploymentEnabledSuccess(deployment)));
});
}
use of org.jboss.hal.dmr.Operation in project console by hal.
the class StandaloneDeploymentColumn method explode.
private void explode(Deployment deployment) {
ResourceAddress address = new ResourceAddress().add(DEPLOYMENT, deployment.getName());
Operation operation = new Operation.Builder(address, EXPLODE).build();
dispatcher.execute(operation, result -> {
refresh(RESTORE_SELECTION);
MessageEvent.fire(eventBus, Message.success(resources.messages().deploymentExploded(deployment.getName())));
});
}
Aggregations