Пример #1
0
 private void putESCfg(ServiceCfgDto dto) {
   ResourceRequestBuilderFactory.newBuilder()
       .forResource("/service/search/cfg") //
       .withResourceBody(ServiceCfgDto.stringify(dto)) //
       .withCallback(
           Response.SC_OK,
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               getView().hideDialog();
               getEventBus().fireEvent(new TableIndicesRefreshEvent());
             }
           }) //
       .withCallback(
           Response.SC_INTERNAL_SERVER_ERROR,
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               getView().hideDialog();
               getEventBus().fireEvent(new TableIndicesRefreshEvent());
               getEventBus()
                   .fireEvent(NotificationEvent.newBuilder().error(response.getText()).build());
             }
           }) //
       .put()
       .send();
 }
 private void putESCfg(ServiceCfgDto dto) {
   ResponseCodeCallback callbackHandler = new CreateOrUpdateMethodCallBack(dto);
   ResourceRequestBuilderFactory.newBuilder()
       .forResource("/service/search/cfg")
       .put() //
       .withResourceBody(ServiceCfgDto.stringify(dto)) //
       .withCallback(callbackHandler, Response.SC_OK, Response.SC_INTERNAL_SERVER_ERROR)
       .send();
 }
  private void updateConfig() {
    ServiceCfgDto dto = ServiceCfgDto.create();

    dto.setName("search");

    ESCfgDto config = ESCfgDto.create();
    config.setEnabled(isEnabled);
    config.setClusterName(getView().getClusterName());
    config.setIndexName(getView().getIndexName());
    config.setDataNode(dataNode);
    config.setShards(getView().getNbShards().intValue());
    config.setReplicas(getView().getNbReplicas().intValue());
    config.setSettings(getView().getSettings());

    dto.setExtension("Opal.ESCfgDto.params", config);

    putESCfg(dto);
  }