コード例 #1
0
ファイル: AddressUtils.java プロジェクト: hal/core
  public static ModelNode fromFqAddress(ModelNode address) {
    ModelNode wildcardAddress = new ModelNode();
    List<Property> tuples = address.asPropertyList();
    int i = 0;
    for (Property tuple : tuples) {
      String key = tuple.getName();
      String value = tuple.getValue().asString();

      if (i == tuples.size() - 1) wildcardAddress.add(key, "*");
      else wildcardAddress.add(key, value);

      i++;
    }

    return wildcardAddress;
  }
コード例 #2
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());
          }
        });
  }
コード例 #3
0
  public void getRequests(
      final String vdbName, final int version, final boolean includeSourceQueries) {

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

    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().setVDBRequests(requests);
            } else {
              getView().setVDBRequests(null);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to get in process requests for VDB " + vdbName + "." + version,
                caught.getMessage());
          }
        });
  }
コード例 #4
0
  public void addRoleName(
      final String vdbName, final int version, final String dataRole, final String mappedRole) {
    if (!isServerActive()) {
      Console.warning(Console.CONSTANTS.common_err_server_not_active());
      return;
    }

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

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            Console.info(mappedRole + " role added to VDB " + vdbName + "." + version);
          }
        });
  }
コード例 #5
0
  public void cancelRequest(final Request request) {
    if (!isServerActive()) {
      getView().cancelSubmitted(request);
    }
    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("cancel-request");
    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();
            if (response.get(RESULT).isDefined()) {
              getView().cancelSubmitted(request);
              Console.info(
                  "Query Cancel Submitted. Session Id:"
                      + request.getSessionId()
                      + ", Execution Id:"
                      + request.getExecutionId());
            } else {
              getView().cancelSubmitted(null);
            }
          }
        });
  }
コード例 #6
0
  public void getSchema(String vdbName, int version, String modelName) {
    if (!isServerActive()) {
      getView().setModelSchema("No Active Server Found");
    }

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

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            if (response.get(RESULT).isDefined()) {
              getView().setModelSchema(response.get(RESULT).asString());
            } else {
              getView().setModelSchema(null);
            }
          }
        });
  }
コード例 #7
0
  public void getSessions(final String vdbName, final int version) {
    if (!isServerActive()) {
      getView().setVDBRequests(null);
    }

    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);
            }
          }
        });
  }
コード例 #8
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());
          }
        });
  }
コード例 #9
0
  public void addRoleName(
      final String vdbName, final int version, final String dataRole, final String mappedRole) {

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

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            Console.info(mappedRole + " role added to VDB " + vdbName + "." + version);
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error("Failed to add role", caught.getMessage());
          }
        });
  }
コード例 #10
0
  public void getCacheStatistics() {
    if (!isServerActive()) {
      return;
    }

    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);
            }
          }
        });
  }
コード例 #11
0
  public void getRequests(String vdbName, int version, boolean includeSourceQueries) {
    if (!isServerActive()) {
      getView().setVDBRequests(null);
    }

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

    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().setVDBRequests(requests);
            } else {
              getView().setVDBRequests(null);
            }
          }
        });
  }
コード例 #12
0
  public void changeConnectionType(final String vdbName, final int version, final String connType) {
    if (!isServerActive()) {
      return;
    }

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("change-vdb-connection-type");
    operation.get(ADDRESS).set(address);
    operation.get("connection-type").set(new ModelNode().set(connType));
    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) {
            getView().connectionTypeChanged(vdbName, version);
            Console.info(
                "Changing Connection type to "
                    + connType
                    + " on VDB = "
                    + vdbName
                    + "."
                    + version
                    + " has been cleared");
          }
        });
  }
コード例 #13
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());
          }
        });
  }
コード例 #14
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());
          }
        });
  }
コード例 #15
0
  public void getSourceRequests(final Request selection) {
    if (!isServerActive()) {
      getView().setSourceRequests(selection, null);
    }

    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);
            }
          }
        });
  }
コード例 #16
0
  public void terminateSession(final Session session) {
    if (!isServerActive()) {
      getView().terminateSessionSubmitted(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);
            }
          }
        });
  }
コード例 #17
0
  public void getQueryPlan(Request request) {
    if (!isServerActive()) {
      getView().setQueryPlan("No Server Found");
    }

    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>");
            }
          }
        });
  }
コード例 #18
0
  @Override
  public void onDeleteJvm(String reference, Jvm jvm) {

    ModelNode address = new ModelNode();
    address.add("host", hostSelection.getName());
    address.add("server-config", reference);
    address.add(JVM, jvm.getName());

    DeleteJvmCmd cmd = new DeleteJvmCmd(dispatcher, factory, address);
    cmd.execute(
        new SimpleCallback<Boolean>() {
          @Override
          public void onSuccess(Boolean result) {
            loadServerConfigurations();
          }
        });
  }
コード例 #19
0
ファイル: Baseadress.java プロジェクト: ryanemerson/core
  public ModelNode getAdress() {
    ModelNode baseAddress = new ModelNode();
    baseAddress.setEmptyList();

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

    return baseAddress;
  }
コード例 #20
0
  @Override
  public void onDeleteProperty(String reference, final PropertyRecord prop) {

    ModelNode address = new ModelNode();
    address.add("host", hostSelection.getName());
    address.add("server-config", reference);
    address.add("system-property", prop.getKey());

    DeletePropertyCmd cmd = new DeletePropertyCmd(dispatcher, factory, address);
    cmd.execute(
        prop,
        new SimpleCallback<Boolean>() {
          @Override
          public void onSuccess(Boolean result) {
            loadServerConfigurations();
          }
        });
  }
コード例 #21
0
  @Override
  public void onUpdateJvm(String reference, String jvmName, Map<String, Object> changedValues) {

    if (changedValues.size() > 0) {
      ModelNode address = new ModelNode();
      address.add("host", hostSelection.getName());
      address.add("server-config", reference);
      address.add(JVM, jvmName);

      UpdateJvmCmd cmd = new UpdateJvmCmd(dispatcher, factory, propertyMetaData, address);
      cmd.execute(
          changedValues,
          new SimpleCallback<Boolean>() {
            @Override
            public void onSuccess(Boolean result) {
              loadServerConfigurations();
            }
          });
    }
  }
コード例 #22
0
ファイル: AddressUtils.java プロジェクト: hal/core
  public static ModelNode toFqAddress(ModelNode address, String resourceName) {
    ModelNode fqAddress = new ModelNode();
    List<Property> tuples = address.asPropertyList();
    for (Property tuple : tuples) {
      String key = tuple.getName();
      String value = tuple.getValue().asString();

      fqAddress.add(key, value.equals("*") ? resourceName : value);
    }

    return fqAddress;
  }
コード例 #23
0
ファイル: DefaultCFForm.java プロジェクト: ryanemerson/core
  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();
  }
コード例 #24
0
  public void assignDataSource(
      final String vdbName,
      final int version,
      final String modelName,
      final String sourceName,
      final String translatorName,
      final String dataSourceName) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("assign-datasource");
    operation.get(ADDRESS).set(address);
    operation.get("vdb-name").set(new ModelNode().set(vdbName));
    operation.get("vdb-version").set(new ModelNode().set(version));
    operation.get("model-name").set(new ModelNode().set(modelName));
    operation.get("source-name").set(new ModelNode().set(sourceName));
    operation.get("translator-name").set(new ModelNode().set(translatorName));
    operation.get("ds-name").set(new ModelNode().set(dataSourceName));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            Console.info(
                "Changing the JNDI name of the data source on VDB ="
                    + vdbName
                    + "."
                    + version
                    + " on Model="
                    + modelName
                    + " to "
                    + dataSourceName);
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Changing the JNDI name of the data source on VDB ="
                    + vdbName
                    + "."
                    + version
                    + " on Model="
                    + modelName
                    + " to "
                    + dataSourceName,
                caught.getMessage());
          }
        });
  }
コード例 #25
0
ファイル: AddressUtils.java プロジェクト: hal/core
  public static String getDenominatorType(List<Property> addressTuple) {

    int i = 1;

    final ModelNode addressPrefix = new ModelNode();
    Property denominator = null;
    for (Property tuple : addressTuple) {
      if (i == addressTuple.size()) {
        denominator = tuple;
        break;
      } else {
        addressPrefix.add(tuple.getName(), tuple.getValue());
      }

      i++;
    }
    return denominator != null ? denominator.getName() : null;
  }
コード例 #26
0
  public void refresh(final boolean paging) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("list-vdbs");
    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()) {
              List<VDB> vdbs = vdbAdaptor.fromDMRList(response.get(RESULT).asList());
              for (VDB vdb : vdbs) {
                boolean valid = true;
                for (Model m : vdb.getModels()) {
                  if (!m.getValidityErrors().isEmpty()) {
                    for (ValidityError ve : m.getValidityErrors()) {
                      if (ve.getSeverity().equals("ERROR")) {
                        valid = false;
                      }
                    }
                  }
                }
                vdb.setValid(valid);
              }
              getView().setDeployedVDBs(vdbs);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to get list of current VDBs deployed in the system", caught.getMessage());
          }
        });
  }
コード例 #27
0
  public void refresh(final boolean paging) {
    if (!isServerActive()) {
      Console.warning(Console.CONSTANTS.common_err_server_not_active());
      getView().setDeployedVDBs(null);
      return;
    }

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("list-vdbs");
    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()) {
              List<VDB> vdbs = vdbAdaptor.fromDMRList(response.get(RESULT).asList());
              for (VDB vdb : vdbs) {
                boolean valid = true;
                for (Model m : vdb.getModels()) {
                  if (!m.getValidityErrors().isEmpty()) {
                    for (ValidityError ve : m.getValidityErrors()) {
                      if (ve.getSeverity().equals("ERROR")) {
                        valid = false;
                      }
                    }
                  }
                }
                vdb.setValid(valid);
              }
              getView().setDeployedVDBs(vdbs);
            }
          }
        });
  }
コード例 #28
0
  public <T> void executeQuery(
      final String vdbName, final int version, final String sql, final String clazz) {

    ModelNode address = RuntimeBaseAddress.get();
    address.add("subsystem", "teiid");
    ModelNode operation = new ModelNode();
    operation.get(OP).set("execute-query");
    operation.get(ADDRESS).set(address);
    operation.get("vdb-name").set(new ModelNode().set(vdbName));
    operation.get("vdb-version").set(new ModelNode().set(version));
    operation.get("sql-query").set(new ModelNode().set(sql));
    operation.get("timeout-in-milli").set(new ModelNode().set(-1));

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            ModelNode response = result.get();
            if (response.get(RESULT).isDefined()) {
              if (getEntityAdapter(clazz) != null) {
                getView()
                    .setQueryResults(
                        matViewAdaptor.fromDMRList(response.get(RESULT).asList()), clazz);
              } else {
                getView().setQueryResults(null, clazz);
              }
            } else {
              getView().setQueryResults(null, clazz);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            Console.error("Failed to execute query, or timeout occured", caught.getMessage());
          }
        });
  }
コード例 #29
0
  public void reloadVDB(final String vdbName, final int version) {
    if (!isServerActive()) {
      return;
    }

    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);
          }
        });
  }
コード例 #30
0
  public void getSchema(final String vdbName, final int version, final String modelName) {

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

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

          @Override
          public void onFailure(Throwable caught) {
            Console.error(
                "Failed to get schema of the model = "
                    + modelName
                    + " in vdb = "
                    + vdbName
                    + " with version = "
                    + version,
                caught.getMessage());
          }
        });
  }