예제 #1
0
  public void getSessions(final String vdbName, final int version) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("list-sessions");
    operation.get(ADDRESS).set(address);
    operation.get("vdb-name").set(new ModelNode().set(vdbName));
    operation.get("vdb-version").set(new ModelNode().set(version));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            if (response.get(RESULT).isDefined()) {
              List<Session> sessions = sessionAdaptor.fromDMRList(response.get(RESULT).asList());
              getView().setVDBSessions(vdbName, version, sessions);
            } else {
              getView().setVDBRequests(null);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to get current sessions for vdb = " + vdbName + "." + version,
                caught.getMessage());
          }
        });
  }
예제 #2
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));
          }
        });
  }
예제 #3
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();
          }
        });
  }
예제 #4
0
  @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));
          }
        });
  }
예제 #5
0
  @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));
          }
        });
  }
예제 #6
0
  @Process(actionType = RefreshBufferPools.class)
  public void refresh(final Dispatcher.Channel channel) {
    final ResourceAddress op =
        new ResourceAddress("{selected.profile}/subsystem=io/", statementContext);
    op.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
    op.get(CHILD_TYPE).set("buffer-pool");
    op.get(INCLUDE_RUNTIME).set(true);

    dispatcher.execute(
        new DMRAction(op),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(Throwable caught) {
            channel.nack(caught);
          }

          @Override
          public void onSuccess(DMRResponse dmrResponse) {
            ModelNode response = dmrResponse.get();
            if (response.isFailure()) {
              channel.nack(
                  new RuntimeException(
                      "Failed to read buffer pools using "
                          + op
                          + ": "
                          + response.getFailureDescription()));
            } else {
              bufferPools.clear();
              bufferPools.addAll(response.get(RESULT).asPropertyList());
              channel.ack();
            }
          }
        });
  }
예제 #7
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));
          }
        });
  }
예제 #8
0
  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());
          }
        });
  }
예제 #9
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);
            }
          }
        });
  }
예제 #10
0
  public void getCacheStatistics() {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("cache-statistics");
    operation.get(ADDRESS).set(address);
    operation.get("cache-type").set(new ModelNode().set("QUERY_SERVICE_RESULT_SET_CACHE"));

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

          @Override
          public void onFailure(Throwable caught) {
            Console.error("Failed to get cache statistics", caught.getMessage());
          }
        });
  }
예제 #11
0
  public void getSourceRequests(final Request selection) {
    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("list-requests-per-session");
    operation.get(ADDRESS).set(address);
    operation.get("session").set(new ModelNode().set(selection.getSessionId()));
    operation.get("include-source").set(new ModelNode().set(true));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            if (response.get(RESULT).isDefined()) {
              List<Request> requests = requestAdaptor.fromDMRList(response.get(RESULT).asList());
              getView().setSourceRequests(selection, requests);
            } else {
              getView().setSourceRequests(selection, null);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to get data source requests for session = " + selection.getSessionId(),
                caught.getMessage());
          }
        });
  }
예제 #12
0
  public void reloadVDB(final String vdbName, final int version) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("restart-vdb");
    operation.get(ADDRESS).set(address);
    operation.get("vdb-name").set(new ModelNode().set(vdbName));
    operation.get("vdb-version").set(new ModelNode().set(version));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            Console.info("VDB " + vdbName + "." + version + " has been submitted for reload");
            getView().vdbReloaded(vdbName, version);
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to reload the VDB = " + vdbName + "." + version, caught.getMessage());
          }
        });
  }
예제 #13
0
  public void clearCache(final String vdbName, final int version, final String cacheType) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("clear-cache");
    operation.get(ADDRESS).set(address);
    operation.get("cache-type").set(new ModelNode().set(cacheType));
    operation.get("vdb-name").set(new ModelNode().set(vdbName));
    operation.get("vdb-version").set(new ModelNode().set(version));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            Console.info(
                "Cache "
                    + cacheType
                    + " on VDB = "
                    + vdbName
                    + "."
                    + version
                    + " has been cleared");
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to clear Cache " + cacheType + " on VDB = " + vdbName + "." + version,
                caught.getMessage());
          }
        });
  }
예제 #14
0
  public void terminateSession(final Session session) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("terminate-session");
    operation.get(ADDRESS).set(address);
    operation.get("session").set(new ModelNode().set(session.getSessionId()));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            if (response.get(RESULT).isDefined()) {
              getView().terminateSessionSubmitted(session);
              Console.info("Terminate Session Submitted. Session Id:" + session.getSessionId());
            } else {
              getView().terminateSessionSubmitted(null);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error("Failed to terminate seession '" + session, caught.getMessage());
          }
        });
  }
예제 #15
0
  public void removeContent(final Content content, boolean unmanaged) {
    Operation operation =
        new Operation.Builder(REMOVE, new ResourceAddress().add("deployment", content.getName()))
            .build();

    dispatcher.execute(
        new DMRAction(operation),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            Console.error("Unable to remove deployment.", caught.getMessage());
          }

          @Override
          public void onSuccess(final DMRResponse response) {
            ModelNode result = response.get();
            if (result.isFailure()) {
              Console.error("Unable to remove deployment.", result.getFailureDescription());
            } else {
              Console.info(content.getName() + " successfully removed.");
              if (unmanaged) {
                loadUnassignedContent();
              } else {
                loadContentRepository();
              }
            }
          }
        });
  }
예제 #16
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);
            }
          }
        });
  }
예제 #17
0
  public void modifyAssignment(
      final Assignment assignment, final String operation, final String successMessage) {
    String serverGroup = assignment.getServerGroup();
    ResourceAddress address =
        new ResourceAddress()
            .add("server-group", serverGroup)
            .add("deployment", assignment.getName());
    Operation op = new Operation.Builder(operation, address).build();

    // wrap the operation in a single flow to show the progress indicator in the footer
    new Async<FunctionContext>(Footer.PROGRESS_ELEMENT)
        .single(
            new FunctionContext(),
            control -> dispatcher.execute(new DMRAction(op), new FunctionCallback(control)),
            new Outcome<FunctionContext>() {
              @Override
              public void onFailure(final FunctionContext context) {
                Console.error("Unable to modify deployment.", context.getErrorMessage());
              }

              @Override
              public void onSuccess(final FunctionContext context) {
                Console.info(successMessage);
                loadAssignments(serverGroup);
              }
            });
  }
  @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));
            }
          }
        });
  }
예제 #19
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);
            }
          }
        });
  }
예제 #20
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();
          }
        });
  }
예제 #21
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 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());
          }
        });
  }
예제 #23
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());
          }
        });
  }
  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);
            }
          }
        });
  }
예제 #25
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);
          }
        });
  }
  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();
            }
          }
        });
  }
예제 #27
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);
            }
          }
        });
  }
예제 #28
0
  public void unassignContent(final Content content, Set<String> serverGroups) {
    List<Operation> operations = new ArrayList<>();
    for (String serverGroup : serverGroups) {
      ResourceAddress address =
          new ResourceAddress()
              .add("server-group", serverGroup)
              .add("deployment", content.getName());
      Operation operation = new Operation.Builder(REMOVE, address).build();
      operations.add(operation);
    }
    dispatcher.execute(
        new DMRAction(new Composite(operations)),
        new AsyncCallback<DMRResponse>() {
          @Override
          public void onFailure(final Throwable caught) {
            Console.error("Unable to unassign " + content.getName() + ".", caught.getMessage());
          }

          @Override
          public void onSuccess(final DMRResponse response) {
            ModelNode result = response.get();
            if (result.isFailure()) {
              Console.error(
                  "Unable to unassign " + content.getName() + ".", result.getFailureDescription());
            } else {
              Console.info(
                  content.getName() + " successfully unassigned from selected server groups.");
              loadContentRepository();
            }
          }
        });
  }
예제 #29
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);
            }
          }
        });
  }
예제 #30
0
  public void getQueryPlan(Request request) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("get-query-plan");
    operation.get(ADDRESS).set(address);
    operation.get("session").set(new ModelNode().set(request.getSessionId()));
    operation.get("execution-id").set(new ModelNode().set(request.getExecutionId()));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            String plan = null;
            if (response.get(RESULT).isDefined()) {
              plan = response.get(RESULT).asString();
            }
            if (plan != null && !plan.trim().isEmpty()) {
              getView().setQueryPlan(plan);
            } else {
              getView()
                  .setQueryPlan(
                      "<node name=\"query\"><property name=\"noplan\">No Plan found, query might have finished executing!</property></node>");
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error("Failed to get query plan", caught.getMessage());
          }
        });
  }