예제 #1
0
  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();
          }
        });
  }
예제 #2
0
  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();
          }
        });
  }
예제 #3
0
  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);
            }
          }
        });
  }
예제 #4
0
  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();
          }
        });
  }
예제 #5
0
  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);
            }
          }
        });
  }
예제 #6
0
  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();
          }
        });
  }
예제 #7
0
  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();
          }
        });
  }
예제 #8
0
  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();
          }
        });
  }
예제 #9
0
  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);
          }
        });
  }
예제 #10
0
  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);
            }
          }
        });
  }
예제 #11
0
  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);
            }
          }
        });
  }
예제 #12
0
  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();
  }
예제 #13
0
  @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();
  }