Esempio n. 1
0
  @Override
  public void requestSuggestions(
      final SuggestOracle.Request request, final SuggestOracle.Callback callback) {

    LoadSocketBindingsCmd cmd = new LoadSocketBindingsCmd(dispatcher, factory, metaData);
    cmd.execute(
        "full-ha-sockets",
        new SimpleCallback<List<SocketBinding>>() {
          @Override
          public void onSuccess(List<SocketBinding> result) {

            List<SimpleSuggestion> suggestions = new ArrayList<SimpleSuggestion>();
            for (SocketBinding binding : result) {
              if (binding.getName().startsWith(request.getQuery())) {
                SimpleSuggestion suggestion =
                    new SimpleSuggestion(binding.getName(), binding.getName());
                suggestions.add(suggestion);
              }
            }

            SuggestOracle.Response response = new SuggestOracle.Response();
            response.setSuggestions(suggestions);
            response.setMoreSuggestionsCount(suggestions.size());
            callback.onSuggestionsReady(request, response);
          }
        });
  }
  public void loadPorts(final Server server) {

    if (server.getSocketBinding() != null && !server.getSocketBinding().equals("")) {

      loadSocketCmd.execute(
          server.getSocketBinding(),
          new SimpleCallback<List<SocketBinding>>() {
            @Override
            public void onSuccess(List<SocketBinding> result) {

              getView().setPorts(server.getSocketBinding(), server, result);
            }
          });
    }
  }