use of org.jboss.hal.core.deployment.ServerGroupDeployment in project console by hal.
the class ContentColumn method undeploy.
private void undeploy(Content content) {
if (!content.getServerGroupDeployments().isEmpty()) {
Set<String> serverGroupsWithContent = content.getServerGroupDeployments().stream().map(ServerGroupDeployment::getServerGroup).collect(toSet());
new DeployContentDialog1(content, serverGroupsWithContent, resources, (cnt, serverGroups) -> {
List<Operation> operations = serverGroups.stream().map(serverGroup -> {
ResourceAddress resourceAddress = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, content.getName());
return new Operation.Builder(resourceAddress, REMOVE).build();
}).collect(toList());
dispatcher.execute(new Composite(operations), (CompositeResult cr) -> {
refresh(RESTORE_SELECTION);
MessageEvent.fire(eventBus, Message.success(resources.messages().contentUndeployed(content.getName())));
});
}).show();
} else {
MessageEvent.fire(eventBus, Message.warning(resources.messages().undeployedContent(content.getName())));
}
}
use of org.jboss.hal.core.deployment.ServerGroupDeployment in project console by hal.
the class ContentColumn method deploy.
void deploy(Content content) {
Operation operation = new Operation.Builder(ResourceAddress.root(), READ_CHILDREN_NAMES_OPERATION).param(CHILD_TYPE, SERVER_GROUP).build();
dispatcher.execute(operation, result -> {
Set<String> serverGroupsWithoutContent = result.asList().stream().map(ModelNode::asString).collect(toSet());
Set<String> serverGroupsWithContent = content.getServerGroupDeployments().stream().map(ServerGroupDeployment::getServerGroup).collect(toSet());
serverGroupsWithoutContent.removeAll(serverGroupsWithContent);
if (serverGroupsWithoutContent.isEmpty()) {
MessageEvent.fire(eventBus, Message.warning(resources.messages().contentAlreadyDeployedToAllServerGroups(content.getName())));
} else {
new DeployContentDialog1(content, serverGroupsWithoutContent, resources, (cnt, serverGroups, enable) -> {
List<Operation> operations = serverGroups.stream().map(serverGroup -> {
ResourceAddress resourceAddress = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, content.getName());
return new Operation.Builder(resourceAddress, ADD).param(RUNTIME_NAME, content.getRuntimeName()).param(ENABLED, enable).build();
}).collect(toList());
if (enable) {
ItemMonitor.startProgress(Ids.content(cnt.getName()));
}
dispatcher.execute(new Composite(operations), (CompositeResult cr) -> {
if (enable) {
ItemMonitor.stopProgress(Ids.content(cnt.getName()));
}
refresh(RESTORE_SELECTION);
MessageEvent.fire(eventBus, Message.success(resources.messages().contentDeployed1(content.getName())));
});
}).show();
}
});
}
use of org.jboss.hal.core.deployment.ServerGroupDeployment in project console by hal.
the class ServerGroupDeploymentPresenter method reload.
@Override
protected void reload() {
List<Task<FlowContext>> tasks = new ArrayList<>();
tasks.add(new ReadServerGroupDeployments(environment, dispatcher, serverGroup, deployment));
tasks.addAll(runningServers(environment, dispatcher, properties(SERVER_GROUP, serverGroup)));
tasks.add(new LoadDeploymentsFromRunningServer(environment, dispatcher));
series(new FlowContext(progress.get()), tasks).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
MessageEvent.fire(getEventBus(), Message.error(resources.messages().deploymentReadError(deployment)));
}
@Override
public void onSuccess(FlowContext context) {
List<ServerGroupDeployment> serverGroupDeployments = context.get(DeploymentTasks.SERVER_GROUP_DEPLOYMENTS);
if (!serverGroupDeployments.isEmpty()) {
ServerGroupDeployment serverGroupDeployment = serverGroupDeployments.get(0);
getView().update(serverGroup, serverGroupDeployment);
} else {
MessageEvent.fire(getEventBus(), Message.error(resources.messages().deploymentReadError(deployment)));
}
}
});
}
Aggregations