Example #1
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);
            }
          }
        });
  }
  public void getEngineStatistics() {
    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid"); // $NON-NLS-1$  //$NON-NLS-2$
    ModelNode operation = new ModelNode();
    operation.get(OP).set("engine-statistics"); // $NON-NLS-1$
    operation.get(ADDRESS).set(address);

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            if (response.get(RESULT).isDefined()) {
              EngineStatistics stats = runtimeAdaptor.fromDMR(response.get(RESULT));
              getView().setEngineStatistics(stats);
            } else {
              getView().setEngineStatistics(null);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to retrieve query engine statistics for Teiid", caught.getMessage());
          }
        });
  }
Example #3
0
  public void rollback(
      final PatchInfo patchInfo,
      final boolean resetConfiguration,
      final boolean overrideAll,
      final AsyncCallback<Void> callback) {
    ModelNode rollbackOp = baseAddress();
    rollbackOp.get(OP).set("rollback");
    rollbackOp.get("patch-id").set(patchInfo.getId());
    rollbackOp.get("reset-configuration").set(resetConfiguration);
    rollbackOp.get("override-all").set(overrideAll);

    dispatcher.execute(
        new DMRAction(rollbackOp),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            callback.onFailure(caught);
          }

          @Override
          public void onSuccess(final DMRResponse response) {
            ModelNode result = response.get();
            if (!result.hasDefined(OUTCOME) || result.isFailure()) {
              callback.onFailure(new RuntimeException(result.getFailureDescription()));
            } else {
              callback.onSuccess(null);
            }
          }
        });
  }
Example #4
0
  public void getPatchInfo(final PatchInfo patch, final AsyncCallback<PatchInfo> callback) {
    ModelNode patchInfoOp = baseAddress();
    patchInfoOp.get(OP).set("patch-info");
    patchInfoOp.get("patch-id").set(patch.getId());

    dispatcher.execute(
        new DMRAction(patchInfoOp),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            callback.onFailure(caught);
          }

          @Override
          public void onSuccess(final DMRResponse response) {
            ModelNode result = response.get();
            if (!result.hasDefined(OUTCOME) || result.isFailure()) {
              callback.onFailure(new RuntimeException(result.getFailureDescription()));
            } else {
              ModelNode payload = result.get(RESULT);
              patch.setIdentityName(payload.get("identity-name").asString());
              patch.setIdentityVersion(payload.get("identity-version").asString());
              patch.setDescription(payload.get("description").asString());
              if (payload.get("link").isDefined()) {
                patch.setLink(payload.get("link").asString());
              } else {
                patch.setLink("");
              }
              callback.onSuccess(patch);
            }
          }
        });
  }
Example #5
0
  public void restart() {
    ModelNode restartNode = new ModelNode();
    if (!bootstrapContext.isStandalone()) {
      restartNode.get(ADDRESS).add("host", domainManager.getSelectedHost());
    }
    restartNode.get(OP).set(SHUTDOWN);
    restartNode.get("restart").set(true);

    final RestartModal restartModal = new RestartModal();
    restartModal.center();

    RestartOp restartOp = new RestartOp(dispatcher);
    restartOp.start(
        dispatcher,
        restartNode,
        new TimeoutOperation.Callback() {
          @Override
          public void onSuccess() {
            // TODO Doesn't need a full reload if a non-dc host was patched
            Window.Location.reload();
          }

          @Override
          public void onTimeout() {
            // TODO Is there another way out?
            restartModal.timeout();
          }

          @Override
          public void onError(final Throwable caught) {
            // TODO Is there another way out?
            restartModal.error();
          }
        });
  }
Example #6
0
  @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);
          }
        });
  }
Example #7
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();
          }
        });
  }
Example #8
0
  public HostControllerOpV3(
      final LifecycleOperation op,
      final LifecycleCallback callback,
      final DispatchAsync dispatcher,
      final HostInformationStore hostInformationStore,
      final String host,
      final List<Server> server) {

    super(op, callback);

    this.dispatcher = dispatcher;
    this.hostInformationStore = hostInformationStore;
    this.host = host;

    this.node = new ModelNode();
    this.node.get(ADDRESS).setEmptyList();
    this.node.get(OP).set(COMPOSITE);
    List<ModelNode> steps = new LinkedList<ModelNode>();

    for (Server serverRef : server) {
      ModelNode serverStateOp = new ModelNode();
      serverStateOp.get(OP).set(READ_ATTRIBUTE_OPERATION);
      serverStateOp.get(ADDRESS).add("host", host);
      serverStateOp.get(ADDRESS).add("server-config", serverRef.getName());
      serverStateOp.get(NAME).set("status");
      steps.add(serverStateOp);
    }

    this.node.get(STEPS).set(steps);
  }
Example #9
0
  @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);
            }
          }
        });
  }
Example #10
0
  @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);
          }
        });
  }
  public void tryDelete(final Server server) {

    // check if instance exist
    ModelNode operation = new ModelNode();
    operation.get(ADDRESS).add("host", hostSelection.getName());
    operation.get(ADDRESS).add("server", server.getName());
    operation.get(OP).set(READ_RESOURCE_OPERATION);

    dispatcher.execute(
        new DMRAction(operation),
        new AsyncCallback<DMRResponse>() {

          @Override
          public void onFailure(Throwable throwable) {
            performDeleteOperation(server);
          }

          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            String outcome = response.get(OUTCOME).asString();

            Boolean serverIsRunning = outcome.equals(SUCCESS) ? Boolean.TRUE : Boolean.FALSE;
            if (!serverIsRunning) performDeleteOperation(server);
            else
              Console.error(
                  "Failed to delete server configuration",
                  "The server instance is still running: " + server.getName());
          }
        });
  }
Example #12
0
  @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);
            }
          }
        });
  }
Example #13
0
  @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));
          }
        });
  }
  private void loadServer() {

    final ModelNode operation = new ModelNode();
    operation.get(OP).set(READ_RESOURCE_OPERATION);
    operation.get(INCLUDE_RUNTIME).set(true);
    operation.get(ADDRESS).setEmptyList();

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {

          @Override
          public void onSuccess(DMRResponse result) {

            ModelNode response = result.get();

            if (response.isFailure()) {
              Console.error(response.getFailureDescription());
            } else {
              // TODO: only works when this response changes the reload state
              ModelNode model = response.get(RESULT);

              boolean isRunning = model.get("server-state").asString().equalsIgnoreCase("RUNNING");
              StandaloneServer server =
                  new StandaloneServer(
                      !isRunning, SuspendState.valueOf(model.get("suspend-state").asString()));

              getView().updateServer(server);
            }
          }
        });
  }
  public void onSuspendServer(Long value) {

    closeDialoge();

    final ModelNode operation = new ModelNode();
    operation.get(OP).set("suspend");
    operation.get(ADDRESS).setEmptyList();
    operation.get("timeout").set(value);

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {

          @Override
          public void onSuccess(DMRResponse result) {

            ModelNode response = result.get();

            if (response.isFailure()) {
              Console.error(response.getFailureDescription());
            } else {
              Console.info("Successfully suspended server");
              loadServer();
            }
          }
        });
  }
Example #16
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);
            }
          }
        });
  }
  public void onReloadServerConfig() {
    final ModelNode operation = new ModelNode();
    operation.get(OP).set("reload");
    operation.get(ADDRESS).setEmptyList();

    dispatcher.execute(
        new DMRAction(operation),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();

            if (response.isFailure()) {
              Console.error(
                  Console.MESSAGES.failed("Reload Server"), response.getFailureDescription());
            } else {
              pollState();
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(Console.MESSAGES.failed("Reload Server"), caught.getMessage());
          }
        });
  }
Example #18
0
  @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());
          }
        });
  }
Example #19
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();
          }
        });
  }
Example #20
0
  @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));
          }
        });
  }
  @Override
  public void onRemove(final Property property) {
    ResourceAddress address = addressTemplate.resolve(statementContext);
    ModelNode op = new ModelNode();
    op.get(ADDRESS).set(address);
    op.get(OP).set("map-remove");
    op.get(NAME).set(attribute);
    op.get("key").set(property.getName());
    dispatcher.execute(
        new DMRAction(op),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            onRemoveFailed(property, caught);
          }

          @Override
          public void onSuccess(final DMRResponse result) {
            ModelNode response = result.get();
            if (response.isFailure()) {
              onRemoveFailed(property, new RuntimeException(response.getFailureDescription()));
            } else {
              onRemoveSuccess(property);
              Console.getEventBus()
                  .fireEvent(new PropertyRemovedEvent(addressTemplate, attribute, property));
            }
          }
        });
  }
Example #22
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();
          }
        });
  }
Example #23
0
  public void getAttributeDescriptions(
      ModelNode resourceAddress, final FormAdapter form, final AsyncCallback<HTML> callback) {

    final ModelNode operation = new ModelNode();
    operation.get(OP).set(READ_RESOURCE_DESCRIPTION_OPERATION);
    operation.get(ADDRESS).set(resourceAddress);
    operation.get(RECURSIVE).set(true);
    operation.get(LOCALE).set(getLocale());

    // build field name list

    List<String> formItemNames = form.getFormItemNames();
    BeanMetaData beanMetaData = propertyMetaData.getBeanMetaData(form.getConversionType());
    List<PropertyBinding> bindings = beanMetaData.getProperties();
    final List<String> fieldNames = new ArrayList<String>();

    for (PropertyBinding binding : bindings) {
      if (!binding.isKey() && formItemNames.contains(binding.getJavaName())) {
        String[] splitDetypedNames = binding.getDetypedName().split("/");
        // last one in the path is the attribute name
        fieldNames.add(splitDetypedNames[splitDetypedNames.length - 1]);
      }
    }

    dispatcher.execute(
        new DMRAction(operation),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();

            if (response.isFailure()) {
              Log.debug(response.toString());
              onFailure(new Exception(response.getFailureDescription()));
            } else {

              final SafeHtmlBuilder html = new SafeHtmlBuilder();
              html.appendHtmlConstant("<table class='help-attribute-descriptions'>");

              ModelNode payload = response.get(RESULT);

              ModelNode descriptionModel = null;
              if (ModelType.LIST.equals(payload.getType()))
                descriptionModel = payload.asList().get(0);
              else descriptionModel = payload;

              matchSubElements(descriptionModel, fieldNames, html);

              html.appendHtmlConstant("</table>");
              callback.onSuccess(new HTML(html.toSafeHtml()));
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            callback.onFailure(caught);
          }
        });
  }
Example #24
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();
          }
        });
  }
Example #25
0
  public ModelNode getAdress() {
    ModelNode baseAddress = new ModelNode();
    baseAddress.setEmptyList();

    if (profileSelection.getName() != null) baseAddress.add("profile", profileSelection.getName());

    return baseAddress;
  }
Example #26
0
 ModelNode baseAddress(String host) {
   ModelNode node = new ModelNode();
   if (!host.equals(STANDALONE_HOST)) {
     node.get(ADDRESS).add("host", host);
   }
   node.get(ADDRESS).add("core-service", "patching");
   return node;
 }
Example #27
0
 private ModelNode getRunningServersOp(final String host) {
   ModelNode operation = new ModelNode();
   operation.get(ADDRESS).add("host", host);
   operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
   operation.get(CHILD_TYPE).set("server");
   operation.get(INCLUDE_RUNTIME).set(true);
   return operation;
 }
Example #28
0
 private void decomposeAndLog(ModelNode operation) {
   if (operation.get(OP).asString().equals(COMPOSITE)) {
     List<ModelNode> steps = operation.get(STEPS).asList();
     for (ModelNode step : steps) logAtomicOperation(step);
   } else {
     logAtomicOperation(operation);
   }
 }
Example #29
0
 private boolean isRequired(ModelNode attributeDescription) {
   boolean required =
       attributeDescription.hasDefined("nillable")
           && !attributeDescription.get("nillable").asBoolean();
   if (attributeDescription.hasDefined("alternatives")
       && !attributeDescription.get("alternatives").asList().isEmpty()) {
     required = false;
   }
   return required;
 }
Example #30
0
  private ModelNode runAsRole(final ModelNode operation, final Map<String, String> properties) {

    String role = properties.get("run_as");
    if (role != null
        && !operation.get(OP).asString().equals("whoami")) // otherwise we get the replacement role
    {
      operation.get("operation-headers").get("roles").set(role);
    }
    return operation;
  }