use of org.jboss.hal.dmr.dispatch.Dispatcher in project console by hal.
the class RemoteActiveMQPresenter method addHttpConnector.
void addHttpConnector() {
Metadata metadata = metadataRegistry.lookup(HTTP_CONNECTOR_REMOTE_TEMPLATE);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(HTTP_CONNECTOR, Ids.ADD), metadata).unboundFormItem(new NameItem(), 0).fromRequestProperties().requiredOnly().build();
form.getFormItem(SOCKET_BINDING).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, AddressTemplate.of("/socket-binding-group=*/socket-binding=*")));
new AddResourceDialog(Names.HTTP_CONNECTOR, form, (name, model) -> {
crud.add(Names.HTTP_CONNECTOR, name, HTTP_CONNECTOR_REMOTE_TEMPLATE, model, (n, a) -> reload());
}).show();
}
use of org.jboss.hal.dmr.dispatch.Dispatcher in project console by hal.
the class RemoteActiveMQPresenter method addRemoteConnector.
void addRemoteConnector() {
Metadata metadata = metadataRegistry.lookup(REMOTE_CONNECTOR_REMOTE_TEMPLATE);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(REMOTE_CONNECTOR, Ids.ADD), metadata).unboundFormItem(new NameItem(), 0).fromRequestProperties().requiredOnly().build();
form.getFormItem(SOCKET_BINDING).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, AddressTemplate.of("/socket-binding-group=*/socket-binding=*")));
new AddResourceDialog(Names.REMOTE_CONNECTOR, form, (name, model) -> {
crud.add(Names.REMOTE_CONNECTOR, name, REMOTE_CONNECTOR_REMOTE_TEMPLATE, model, (n, a) -> reload());
}).show();
}
use of org.jboss.hal.dmr.dispatch.Dispatcher in project console by hal.
the class RemoteActiveMQPresenter method addConnectionFactory.
void addConnectionFactory(RemoteActiveMQSubResource ssr) {
Metadata metadata = metadataRegistry.lookup(ssr.template);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(ssr.baseId, Ids.ADD), metadata).unboundFormItem(new NameItem(), 0).fromRequestProperties().include(ENTRIES, DISCOVERY_GROUP, CONNECTORS).unsorted().build();
List<AddressTemplate> connectors = asList(CONNECTOR_REMOTE_TEMPLATE, IN_VM_CONNECTOR_REMOTE_TEMPLATE, HTTP_CONNECTOR_REMOTE_TEMPLATE, REMOTE_CONNECTOR_REMOTE_TEMPLATE);
form.getFormItem(CONNECTORS).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, connectors));
form.getFormItem(DISCOVERY_GROUP).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, DISCOVERY_GROUP_REMOTE_TEMPLATE));
new AddResourceDialog(resources.messages().addResourceTitle(ssr.type), form, (name, model) -> {
ResourceAddress address = ssr.template.resolve(statementContext, name);
crud.add(ssr.type, name, address, model, (n, a) -> reload());
}).show();
}
use of org.jboss.hal.dmr.dispatch.Dispatcher in project console by hal.
the class DestinationPresenter method addSecuritySettingRole.
void addSecuritySettingRole() {
Metadata metadata = metadataRegistry.lookup(ROLE_TEMPLATE);
TextBoxItem patternItem = new TextBoxItem(PATTERN, resources.constants().pattern());
patternItem.setRequired(true);
TextBoxItem roleItem = new TextBoxItem(ROLE, resources.constants().role());
roleItem.setRequired(true);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.MESSAGING_SECURITY_SETTING_ROLE_ADD, metadata).unboundFormItem(patternItem, 0).unboundFormItem(roleItem, 1).fromRequestProperties().requiredOnly().build();
new AddResourceDialog(Names.SECURITY_SETTING, form, (name, model) -> {
String pattern = patternItem.getValue();
ResourceAddress securitySettingAddress = SELECTED_SERVER_TEMPLATE.append(SECURITY_SETTING + EQUALS + pattern).resolve(statementContext);
ResourceAddress roleAddress = SELECTED_SERVER_TEMPLATE.append(SECURITY_SETTING + EQUALS + pattern).append(ROLE + EQUALS + roleItem.getValue()).resolve(statementContext);
ResourceCheck check = new ResourceCheck(dispatcher, securitySettingAddress);
Task<FlowContext> add = context -> {
Operation addSecuritySetting = new Operation.Builder(securitySettingAddress, ADD).build();
Operation addRole = new Operation.Builder(roleAddress, ADD).payload(model).build();
int status = context.pop();
if (status == 404) {
return dispatcher.execute(new Composite(addSecuritySetting, addRole)).toCompletable();
} else {
return dispatcher.execute(addRole).toCompletable();
}
};
series(new FlowContext(progress.get()), check, add).subscribe(new SuccessfulOutcome<FlowContext>(getEventBus(), resources) {
@Override
public void onSuccess(FlowContext context) {
MessageEvent.fire(getEventBus(), Message.success(resources.messages().addResourceSuccess(Names.SECURITY_SETTING, pattern + "/" + name)));
reload();
}
});
}).show();
}
Aggregations