@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));
            }
          }
        });
  }
Example #2
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof DeleteAction)) return false;

    DeleteAction that = (DeleteAction) o;
    return addressTemplate.equals(that.addressTemplate) && instanceName.equals(that.instanceName);
  }
  private void readServiceProvider() {
    if (federation != null && serviceProvider != null) {
      Operation spOp =
          new Operation.Builder(
                  READ_RESOURCE_OPERATION,
                  SERVICE_PROVIDER_TEMPLATE.resolve(statementContext, federation, serviceProvider))
              .param(RECURSIVE, true)
              .build();
      Operation sdOp =
          new Operation.Builder(
                  READ_CHILDREN_NAMES_OPERATION,
                  AddressTemplate.of("{selected.profile}/subsystem=security")
                      .resolve(statementContext))
              .param(CHILD_TYPE, "security-domain")
              .build();
      dispatcher.execute(
          new DMRAction(new Composite(spOp, sdOp)),
          new SimpleCallback<DMRResponse>() {
            @Override
            public void onSuccess(final DMRResponse dmrResponse) {
              ModelNode response = dmrResponse.get();

              if (response.isFailure()) {
                Log.error(
                    "Failed to read service provider "
                        + serviceProvider
                        + " from federation "
                        + federation,
                    response.getFailureDescription());
              } else {
                ModelNode serviceProvider = response.get(RESULT).get("step-1").get(RESULT);
                List<ModelNode> sdNodes = response.get(RESULT).get("step-2").get(RESULT).asList();

                getView()
                    .update(
                        serviceProvider,
                        Ordering.natural()
                            .immutableSortedCopy(
                                FluentIterable.from(sdNodes).transform(ModelNode::asString)));
              }
            }
          });
    }
  }
  @Override
  public void execute(final Control<FunctionContext> control) {
    ModelNode op = new ModelNode();
    op.get(ADDRESS).set(singletonAddress.resolve(statementContext, connectorName));
    op.get(OP).set(READ_RESOURCE_OPERATION);
    dispatcher.execute(
        new DMRAction(op),
        new FunctionCallback(control) {
          @Override
          protected void proceed() {
            // security singleton already exists, signal next step to skip creation
            context.push(200);
            control.proceed();
          }

          @Override
          protected void abort() {
            // security singleton does not exist, create in next step
            context.push(404);
            proceed();
          }
        });
  }
Example #5
0
 @Override
 public int hashCode() {
   int result = addressTemplate.hashCode();
   result = 31 * result + instanceName.hashCode();
   return result;
 }