Beispiel #1
0
  @Override
  public void deleteDataSource(final DataSource dataSource, final AsyncCallback<Boolean> callback) {

    AddressBinding address = dsMetaData.getAddress();
    ModelNode addressModel = address.asResource(baseadress.getAdress(), dataSource.getName());

    ModelNode operation = dataSourceAdapter.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);
          }
        });
  }
Beispiel #2
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));
          }
        });
  }
Beispiel #3
0
  @Override
  public void enableDataSource(
      DataSource dataSource,
      boolean doEnable,
      final AsyncCallback<ResponseWrapper<Boolean>> callback) {

    final String opName = doEnable ? "enable" : "disable";

    AddressBinding address = dsMetaData.getAddress();
    ModelNode addressModel = address.asResource(baseadress.getAdress(), dataSource.getName());

    ModelNode operation = dataSourceAdapter.fromEntity(dataSource);
    operation.get(OP).set(opName);
    operation.get(ADDRESS).set(addressModel.get(ADDRESS));

    if (!doEnable) operation.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true);

    // System.out.println(operation);

    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();
            ResponseWrapper<Boolean> response =
                new ResponseWrapper<Boolean>(
                    modelNode.get(OUTCOME).asString().equals(SUCCESS), modelNode);

            callback.onSuccess(response);
          }
        });
  }