public void onSaveSsl(SSLConfig entity, Map<String, Object> changeset) { // TODO: https://issues.jboss.org/browse/AS7-3933 // check transient: requires creation of ssl subresource. otherwise we can simply update it boolean isTransient = false; String state = (String) AutoBeanUtils.getAutoBean(entity).getTag("state"); if (state != null && state.equals("transient")) isTransient = true; ModelNode createOp = null; // the create op, if necessary if (isTransient) { createOp = new ModelNode(); createOp.get(ADDRESS).set(Baseadress.get()); createOp.get(ADDRESS).add("subsystem", "modcluster"); createOp.get(ADDRESS).add("mod-cluster-config", "configuration"); createOp.get(ADDRESS).add("ssl", "configuration"); createOp.get(OP).set(ADD); } // the updated values ModelNode address = new ModelNode(); address.get(ADDRESS).set(Baseadress.get()); address.get(ADDRESS).add("subsystem", "modcluster"); address.get(ADDRESS).add("mod-cluster-config", "configuration"); address.get(ADDRESS).add("ssl", "configuration"); ModelNode updateOp = sslAdapter.fromChangeset(changeset, address); if (createOp != null) { final List<ModelNode> steps = updateOp.get("steps").asList(); LinkedList<ModelNode> orderedSteps = new LinkedList<ModelNode>(); orderedSteps.addAll(steps); orderedSteps.addFirst(createOp); updateOp.get("steps").set(orderedSteps); } // System.out.println(updateOp); dispatcher.execute( new DMRAction(updateOp), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error( Console.MESSAGES.modificationFailed("SSL Config"), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.modified("SSL Config")); } loadModcluster(); } }); }
public void onSave(final JMXSubsystem editedEntity, Map<String, Object> changeset) { List<ModelNode> extraSteps = new ArrayList<ModelNode>(2); if (changeset.containsKey("registryBinding")) { ModelNode registry = new ModelNode(); registry.get(ADDRESS).set(Baseadress.get()); registry.get(ADDRESS).add("subsystem", "jmx"); registry.get(ADDRESS).add("remoting-connector", "jmx"); registry.get(OP).set(WRITE_ATTRIBUTE_OPERATION); registry.get(NAME).set("registry-binding"); registry.get(VALUE).set((String) changeset.get("registryBinding")); changeset.remove("registryBinding"); extraSteps.add(registry); } if (changeset.containsKey("serverBinding")) { ModelNode registry = new ModelNode(); registry.get(ADDRESS).set(Baseadress.get()); registry.get(ADDRESS).add("subsystem", "jmx"); registry.get(ADDRESS).add("remoting-connector", "jmx"); registry.get(OP).set(WRITE_ATTRIBUTE_OPERATION); registry.get(NAME).set("server-binding"); registry.get(VALUE).set((String) changeset.get("serverBinding")); changeset.remove("serverBinding"); extraSteps.add(registry); } ModelNode operation = adapter.fromChangeset( changeset, beanMetaData.getAddress().asResource(Baseadress.get()), extraSteps.toArray(new ModelNode[] {})); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error( Console.MESSAGES.modificationFailed("JMX Subsystem"), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.modified("JMX Subsystem")); } loadSubsystem(); } }); }
public void onClearSslConfig() { ModelNode removeOp = new ModelNode(); removeOp.get(ADDRESS).set(Baseadress.get()); removeOp.get(ADDRESS).add("subsystem", "modcluster"); removeOp.get(ADDRESS).add("mod-cluster-config", "configuration"); removeOp.get(ADDRESS).add("ssl", "configuration"); removeOp.get(OP).set(REMOVE); dispatcher.execute( new DMRAction(removeOp), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error( Console.MESSAGES.deletionFailed("SSL Config"), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.deleted("SSL Config")); } loadModcluster(); } }); }
public void onSave(final Modcluster editedEntity, Map<String, Object> changeset) { ModelNode address = new ModelNode(); address.get(ADDRESS).set(Baseadress.get()); address.get(ADDRESS).add("subsystem", "modcluster"); address.get(ADDRESS).add("mod-cluster-config", "configuration"); ModelNode operation = adapter.fromChangeset(changeset, address); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error( Console.MESSAGES.modificationFailed("Modcluster Subsystem"), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.modified("Modcluster Subsystem")); } loadModcluster(); } }); }
public void onSaveConfig(Map<String, Object> changeset) { ModelNode operation = entityAdapter.fromChangeset( changeset, beanMetaData.getAddress().asResource(Baseadress.get())); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse dmrResponse) { ModelNode response = dmrResponse.get(); boolean success = ModelAdapter.wasSuccess(response); if (success) { Console.info(Console.MESSAGES.modified("Transaction Manager")); } else { Console.error( Console.MESSAGES.modificationFailed("Transaction Manager"), response.getFailureDescription()); } loadModel(); } }); }
@Override public void deleteXADataSource(XADataSource dataSource, final AsyncCallback<Boolean> callback) { AddressBinding address = xadsMetaData.getAddress(); ModelNode addressModel = address.asResource(baseadress.getAdress(), dataSource.getName()); ModelNode operation = xaDataSourceAdapter.fromEntity(dataSource); operation.get(OP).set(REMOVE); operation.get(ADDRESS).set(addressModel.get(ADDRESS)); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { boolean wasSuccessful = responseIndicatesSuccess(result); callback.onSuccess(wasSuccessful); } }); }
private void loadSubsystem() { ModelNode operation = beanMetaData.getAddress().asResource(Baseadress.get()); operation.get(OP).set(READ_RESOURCE_OPERATION); operation.get(RECURSIVE).set(true); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error(Console.MESSAGES.unknown_error(), response.getFailureDescription()); } else { ModelNode payload = response.get(RESULT).asObject(); JMXSubsystem jmxSubsystem = adapter.fromDMR(payload); if (payload.hasDefined("remoting-connector")) { List<Property> connectorList = payload.get("remoting-connector").asPropertyList(); if (!connectorList.isEmpty()) { Property item = connectorList.get(0); ModelNode jmxConnector = item.getValue(); jmxSubsystem.setMgmtEndpoint( jmxConnector.get("use-management-endpoint").asBoolean()); } } getView().updateFrom(jmxSubsystem); } } }); }
@Override public void verifyConnection( final String dataSourceName, boolean isXA, final AsyncCallback<ResponseWrapper<Boolean>> callback) { AddressBinding address = isXA ? xadsMetaData.getAddress() : dsMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), dataSourceName); operation.get(OP).set("test-connection-in-pool"); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable throwable) { callback.onFailure(throwable); } @Override public void onSuccess(DMRResponse response) { ModelNode result = response.get(); ResponseWrapper<Boolean> wrapped = new ResponseWrapper<Boolean>(!result.isFailure(), result); callback.onSuccess(wrapped); } }); }
@Override public void updateXADataSource( String name, Map<String, Object> changedValues, final AsyncCallback<ResponseWrapper<Boolean>> callback) { AddressBinding address = xadsMetaData.getAddress(); ModelNode addressModel = address.asResource(baseadress.getAdress(), name); ModelNode operation = xaDataSourceAdapter.fromChangeset(changedValues, addressModel); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { callback.onSuccess(ModelAdapter.wrapBooleanResponse(result)); } }); }
@Override public void deleteXAConnectionProperty( String reference, PropertyRecord prop, final AsyncCallback<Boolean> callback) { AddressBinding address = xadsMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), reference); operation.get(ADDRESS).add("xa-datasource-properties", prop.getKey()); operation.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true); operation.get(OP).set(REMOVE); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable throwable) { callback.onFailure(throwable); } @Override public void onSuccess(DMRResponse response) { ModelNode result = response.get(); callback.onSuccess(ModelAdapter.wasSuccess(result)); } }); }
public void onSave(JpaSubsystem editedEntity, Map<String, Object> changeset) { ModelNode operation = adapter.fromChangeset(changeset, beanMetaData.getAddress().asResource(Baseadress.get())); if (changeset.containsKey("defaultDataSource") && changeset.get("defaultDataSource").equals("")) { changeset.remove("defaultDataSource"); operation.get("default-datasource").set(ModelType.UNDEFINED); } // TODO: https://issues.jboss.org/browse/AS7-3596 dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error( Console.MESSAGES.modificationFailed("JPA Subsystem"), response.getFailureDescription()); } else { Console.info(Console.MESSAGES.modified("JPA Subsystem")); } loadSubsystem(); } }); }
@Override public void loadDataSources(final AsyncCallback<List<DataSource>> callback) { AddressBinding address = dsMetaData.getAddress(); ModelNode operation = address.asSubresource(baseadress.getAdress()); operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION); // System.out.println(operation); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { callback.onFailure(new RuntimeException(response.getFailureDescription())); } else { List<DataSource> datasources = dataSourceAdapter.fromDMRList(response.get(RESULT).asList()); callback.onSuccess(datasources); } } }); }
@Override public void createDataSource( final DataSource datasource, final AsyncCallback<ResponseWrapper<Boolean>> callback) { AddressBinding address = dsMetaData.getAddress(); ModelNode addressModel = address.asResource(baseadress.getAdress(), datasource.getName()); ModelNode operation = dataSourceAdapter.fromEntity(datasource); operation.get(OP).set(ADD); operation.get(ADDRESS).set(addressModel.get(ADDRESS)); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode modelNode = result.get(); boolean wasSuccessful = modelNode.get(OUTCOME).asString().equals(SUCCESS); callback.onSuccess(new ResponseWrapper<Boolean>(wasSuccessful, modelNode)); } }); }
@Override public void loadDataSource(String name, boolean isXA, final AsyncCallback<DataSource> callback) { AddressBinding address = isXA ? xadsMetaData.getAddress() : dsMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), name); operation.get(OP).set(READ_RESOURCE_OPERATION); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { callback.onFailure(new RuntimeException(response.getFailureDescription())); } else { DataSource datasource = dataSourceAdapter.fromDMR(response.get(RESULT).asObject()); callback.onSuccess(datasource); } } }); }
private void loadSubsystem() { ModelNode operation = beanMetaData.getAddress().asResource(Baseadress.get()); operation.get(OP).set(READ_RESOURCE_OPERATION); operation.get(RECURSIVE).set(true); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error(Console.MESSAGES.unknown_error(), response.getFailureDescription()); } else { ModelNode payload = response.get(RESULT).asObject(); JMXSubsystem jmxSubsystem = adapter.fromDMR(payload); // TODO: https://issues.jboss.org/browse/AS7-3566 if (payload.hasDefined("remoting-connector")) { List<Property> connectorList = payload.get("remoting-connector").asPropertyList(); if (!connectorList.isEmpty()) { Property item = connectorList.get(0); ModelNode jmxConnector = item.getValue(); jmxSubsystem.setRegistryBinding(jmxConnector.get("registry-binding").asString()); jmxSubsystem.setServerBinding(jmxConnector.get("server-binding").asString()); } } getView().updateFrom(jmxSubsystem); } } }); }
@Override public void savePoolConfig( boolean isXA, String name, Map<String, Object> changeset, final AsyncCallback<ResponseWrapper<Boolean>> callback) { String parentAddress = isXA ? "xa-data-source" : "data-source"; AddressBinding address = poolMetaData.getAddress(); ModelNode addressModel = address.asResource(baseadress.getAdress(), parentAddress, name); ModelNode operation = datasourcePoolAdapter.fromChangeset(changeset, addressModel); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { callback.onSuccess(ModelAdapter.wrapBooleanResponse(result)); } }); }
@Override public void doFlush(boolean xa, String name, final AsyncCallback<Boolean> callback) { String parentAddress = xa ? "xa-data-source" : "data-source"; AddressBinding address = poolMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), parentAddress, name); operation.get(OP).set("flush-all-connection-in-pool"); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); callback.onSuccess(!response.isFailure()); } }); }
@Override public void createXADataSource( XADataSource datasource, final AsyncCallback<ResponseWrapper<Boolean>> callback) { ModelNode operation = new ModelNode(); operation.get(OP).set(COMPOSITE); operation.get(ADDRESS).setEmptyList(); List<ModelNode> steps = new ArrayList<ModelNode>(); // create XA datasource AddressBinding address = xadsMetaData.getAddress(); ModelNode addressModel = address.asResource(baseadress.getAdress(), datasource.getName()); ModelNode createResource = xaDataSourceAdapter.fromEntity(datasource); createResource.get(OP).set(ADD); createResource.get(ADDRESS).set(addressModel.get(ADDRESS)); steps.add(createResource); // create xa properties for (PropertyRecord prop : datasource.getProperties()) { ModelNode createProperty = new ModelNode(); createProperty.get(ADDRESS).set(addressModel.get(ADDRESS)); createProperty.get(ADDRESS).add("xa-datasource-properties", prop.getKey()); createProperty.get(OP).set(ADD); createProperty.get(VALUE).set(prop.getValue()); steps.add(createProperty); } operation.get(STEPS).set(steps); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { callback.onSuccess(ModelAdapter.wrapBooleanResponse(result)); } }); }
@Override public void loadXAProperties( final String dataSourceName, final AsyncCallback<List<PropertyRecord>> callback) { AddressBinding address = xadsMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), dataSourceName); operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION); operation.get(CHILD_TYPE).set("xa-datasource-properties"); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable throwable) { callback.onFailure(throwable); } @Override public void onSuccess(DMRResponse response) { ModelNode result = response.get(); if (result.isFailure()) { callback.onFailure( new RuntimeException( "Failed to load XA properties for DS " + dataSourceName + ": " + result.getFailureDescription())); } else { List<Property> properties = result.get(RESULT).asPropertyList(); List<PropertyRecord> records = new ArrayList<PropertyRecord>(properties.size()); for (Property prop : properties) { String name = prop.getName(); String value = prop.getValue().asObject().get("value").asString(); PropertyRecord propertyRecord = factory.property().as(); propertyRecord.setKey(name); propertyRecord.setValue(value); records.add(propertyRecord); } callback.onSuccess(records); } } }); }
private void loadModel() { ModelNode operation = beanMetaData.getAddress().asResource(Baseadress.get()); operation.get(OP).set(READ_RESOURCE_OPERATION); operation.get(INCLUDE_RUNTIME).set(true); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse dmrResponse) { ModelNode response = dmrResponse.get(); TransactionManager transactionManager = entityAdapter.fromDMR(response.get(RESULT)); getView().setTransactionManager(transactionManager); } }); }
private void loadModcluster() { ModelNode operation = new ModelNode(); operation.get(ADDRESS).set(Baseadress.get()); operation.get(ADDRESS).add("subsystem", "modcluster"); operation.get(ADDRESS).add("mod-cluster-config", "configuration"); operation.get(OP).set(READ_RESOURCE_OPERATION); operation.get(RECURSIVE).set(true); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error( Console.MESSAGES.failed("Modcluster Subsystem"), response.getFailureDescription()); } else { ModelNode payload = response.get(RESULT).asObject(); Modcluster modcluster = adapter.fromDMR(payload); if (payload.hasDefined("ssl") && payload.get("ssl").hasDefined("configuration")) { SSLConfig ssl = sslAdapter.fromDMR(payload.get("ssl").get("configuration").asObject()); modcluster.setSSLConfig(ssl); } else { // provide an empty entity AutoBean<SSLConfig> autoBean = factory.SSLConfig(); autoBean.setTag("state", "transient"); modcluster.setSSLConfig(autoBean.as()); } getView().updateFrom(modcluster); } } }); }
private void loadSubsystem() { ModelNode operation = beanMetaData.getAddress().asResource(Baseadress.get()); operation.get(OP).set(READ_RESOURCE_OPERATION); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Console.error(Console.MESSAGES.failed("Loading JPA Subsystem")); } else { JpaSubsystem jpaSubsystem = adapter.fromDMR(response.get(RESULT).asObject()); getView().updateFrom(jpaSubsystem); } } }); }
@Override public void enableDataSource( DataSource dataSource, boolean doEnable, final AsyncCallback<ResponseWrapper<Boolean>> callback) { final String opName = doEnable ? "enable" : "disable"; AddressBinding address = dsMetaData.getAddress(); ModelNode addressModel = address.asResource(baseadress.getAdress(), dataSource.getName()); ModelNode operation = dataSourceAdapter.fromEntity(dataSource); operation.get(OP).set(opName); operation.get(ADDRESS).set(addressModel.get(ADDRESS)); if (!doEnable) operation.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true); // System.out.println(operation); dispatcher.execute( new DMRAction(operation), new SimpleCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode modelNode = result.get(); ResponseWrapper<Boolean> response = new ResponseWrapper<Boolean>( modelNode.get(OUTCOME).asString().equals(SUCCESS), modelNode); callback.onSuccess(response); } }); }
public Widget asWidget() { JndiNameItem jndiName = new JndiNameItem("jndiName", "JNDI Name"); TextBoxItem groupId = new TextBoxItem("groupId", "Group ID", false); TextBoxItem connector = new TextBoxItem("connector", "Connector"); CheckBoxItem failoverInitial = new CheckBoxItem("failoverInitial", "Failover Initial?"); CheckBoxItem globalPools = new CheckBoxItem("useGlobalPools", "Global Pools?"); NumberBoxItem threadPool = new NumberBoxItem("threadPoolMax", "Thread Pool Max"); NumberBoxItem txBatch = new NumberBoxItem("transactionBatchSize", "Transaction Batch Size"); if (isCreate) { TextBoxItem name = new TextBoxItem("name", "Name"); form.setFields(name, jndiName, connector); } else { TextItem name = new TextItem("name", "Name"); form.setFields( name, jndiName, connector, groupId, failoverInitial, threadPool, txBatch, globalPools); } FormHelpPanel helpPanel = new FormHelpPanel( () -> { ModelNode address = Baseadress.get(); address.add("subsystem", "messaging-activemq"); address.add("server", "*"); address.add("connection-factory", "*"); return address; }, form); FormLayout formLayout = new FormLayout().setForm(form).setHelp(helpPanel); if (provideTools) { FormToolStrip<ActivemqConnectionFactory> formTools = new FormToolStrip<ActivemqConnectionFactory>(form, callback); formLayout.setTools(formTools); } return formLayout.build(); }
@Override public void loadPoolConfig( boolean isXA, final String name, final AsyncCallback<ResponseWrapper<PoolConfig>> callback) { String parentAddress = isXA ? "xa-data-source" : "data-source"; AddressBinding address = poolMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), parentAddress, name); operation.get(OP).set(READ_RESOURCE_OPERATION); operation.get(INCLUDE_RUNTIME).set(Boolean.TRUE); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); EntityAdapter<PoolConfig> adapter = new EntityAdapter<PoolConfig>(PoolConfig.class, metaData) .with( new KeyAssignment() { @Override public Object valueForKey(String key) { return name; } }); PoolConfig poolConfig = adapter.fromDMR(response.get(RESULT)); callback.onSuccess(new ResponseWrapper<PoolConfig>(poolConfig, response)); } }); }
@Override public void loadConnectionProperties( String reference, final AsyncCallback<List<PropertyRecord>> callback) { AddressBinding address = dsMetaData.getAddress(); ModelNode operation = address.asResource(baseadress.getAdress(), reference); operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION); operation.get(CHILD_TYPE).set("connection-properties"); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable throwable) { callback.onFailure(throwable); } @Override public void onSuccess(DMRResponse response) { ModelNode result = response.get(); List<Property> properties = result.get(RESULT).asPropertyList(); List<PropertyRecord> records = new ArrayList<PropertyRecord>(properties.size()); for (Property prop : properties) { String name = prop.getName(); String value = prop.getValue().asObject().get("value").asString(); PropertyRecord propertyRecord = factory.property().as(); propertyRecord.setKey(name); propertyRecord.setValue(value); records.add(propertyRecord); } callback.onSuccess(records); } }); }
@SuppressWarnings("unchecked") Widget asWidget() { secTable = new DefaultCellTable<>(8, item -> item.getPattern() + "_" + item.getRole()); secProvider = new ListDataProvider<>(); secProvider.addDataDisplay(secTable); Column<ActivemqSecurityPattern, String> roleColumn = new Column<ActivemqSecurityPattern, String>(new TextCell()) { @Override public String getValue(ActivemqSecurityPattern object) { return object.getRole(); } }; Column<ActivemqSecurityPattern, String> patternColumn = new Column<ActivemqSecurityPattern, String>(new TextCell()) { @Override public String getValue(ActivemqSecurityPattern object) { return object.getPattern(); } }; secTable.addColumn(patternColumn, "Pattern"); secTable.addColumn(roleColumn, "Role"); form = new Form<>(ActivemqSecurityPattern.class); form.setNumColumns(2); form.bind(secTable); CheckBoxItem send = new CheckBoxItem("send", "Send?"); CheckBoxItem consume = new CheckBoxItem("consume", "Consume?"); CheckBoxItem manage = new CheckBoxItem("manage", "Manage?"); CheckBoxItem createDQ = new CheckBoxItem("createDurableQueue", "CreateDurable?"); CheckBoxItem deleteDQ = new CheckBoxItem("deleteDurableQueue", "DeleteDurable?"); CheckBoxItem createNDQ = new CheckBoxItem("createNonDurableQueue", "CreateNonDurable?"); CheckBoxItem deleteNDQ = new CheckBoxItem("deleteNonDurableQueue", "DeleteNonDurable?"); form.setFields(send, consume, manage); form.setFieldsInGroup( Console.CONSTANTS.common_label_advanced(), new DisclosureGroupRenderer(), createDQ, deleteDQ, createNDQ, deleteNDQ); FormHelpPanel helpPanel = new FormHelpPanel( () -> { ModelNode address = Baseadress.get(); address.add("subsystem", "messaging-activemq"); address.add("server", "*"); address.add("security-setting", "*"); address.add("role", "*"); return address; }, form); FormToolStrip<ActivemqSecurityPattern> formTools = new FormToolStrip<>( form, new FormToolStrip.FormCallback<ActivemqSecurityPattern>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveSecDetails(form.getEditedEntity(), changeset); } @Override public void onDelete(ActivemqSecurityPattern entity) {} }); ToolStrip tableTools = new ToolStrip(); ToolButton addBtn = new ToolButton( Console.CONSTANTS.common_label_add(), event -> presenter.launchNewSecDialogue()); addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_securityDetails()); tableTools.addToolButtonRight(addBtn); ToolButton removeBtn = new ToolButton( Console.CONSTANTS.common_label_delete(), event -> Feedback.confirm( Console.MESSAGES.deleteTitle("Security Config"), Console.MESSAGES.deleteConfirm("Security Config"), isConfirmed -> { if (isConfirmed) { presenter.onDeleteSecDetails(form.getEditedEntity()); } })); tableTools.addToolButtonRight(removeBtn); VerticalPanel formPanel = new VerticalPanel(); formPanel.addStyleName("fill-layout-width"); formPanel.add(helpPanel.asWidget()); formPanel.add(formTools.asWidget()); formPanel.add(form.asWidget()); serverName = new ContentHeaderLabel(); MultipleToOneLayout layout = new MultipleToOneLayout() .setPlain(true) .setHeadlineWidget(serverName) .setDescription( "A security setting allows sets of permissions to be defined against queues based on their address.") .setMaster("Available security settings", secTable) .setMasterTools(tableTools.asWidget()) .setDetail("Details", formPanel); return layout.build(); }
public static ModelNode get() { return instance.getAdress(); }