org.jboss.as.clustering.controller.Operations.createWriteAttributeOperation()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(13.2k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.jboss.as.clustering.controller.Operations.createWriteAttributeOperation()方法的一些代码示例,展示了Operations.createWriteAttributeOperation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.createWriteAttributeOperation()方法的具体详情如下:
包路径:org.jboss.as.clustering.controller.Operations
类名称:Operations
方法名:createWriteAttributeOperation

Operations.createWriteAttributeOperation介绍

[英]Creates a write-attribute operation using the specified address, name and value.
[中]使用指定的地址、名称和值创建写入属性操作。

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
  public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) {
    PathAddress parentAddress = address.getParent();
    ModelNode value = operation.get(Attribute.FACTOR.getName());
    ModelNode transformedOperation = Operations.createWriteAttributeOperation(parentAddress, ProxyConfigurationResourceDefinition.DeprecatedAttribute.SIMPLE_LOAD_PROVIDER, value);
    return new TransformedOperation(transformedOperation, OperationResultTransformer.ORIGINAL_RESULT);
  }
});

代码示例来源:origin: wildfly/wildfly

@Override
  public ModelNode transformOperation(ModelNode operation) {
    PathAddress storeAddress = Operations.getPathAddress(operation).getParent();
    ModelNode value = new ModelNode();
    for (Class<? extends org.jboss.as.clustering.controller.Attribute> attributeClass : Arrays.asList(Attribute.class, TableResourceDefinition.Attribute.class, TableResourceDefinition.ColumnAttribute.class)) {
      for (org.jboss.as.clustering.controller.Attribute attribute : attributeClass.getEnumConstants()) {
        String name = attribute.getName();
        if (operation.hasDefined(name)) {
          value.get(name).set(operation.get(name));
        }
      }
    }
    return value.isDefined() ? Operations.createWriteAttributeOperation(storeAddress, StringKeyedJDBCStoreResourceDefinition.DeprecatedAttribute.TABLE, value) : Operations.createUndefineAttributeOperation(storeAddress, StringKeyedJDBCStoreResourceDefinition.DeprecatedAttribute.TABLE);
  }
};

代码示例来源:origin: wildfly/wildfly

@Override
  public ModelNode transformOperation(ModelNode operation) {
    PathAddress storeAddress = Operations.getPathAddress(operation).getParent();
    ModelNode value = new ModelNode();
    for (Class<? extends org.jboss.as.clustering.controller.Attribute> attributeClass : Arrays.asList(Attribute.class, TableResourceDefinition.Attribute.class, TableResourceDefinition.ColumnAttribute.class)) {
      for (org.jboss.as.clustering.controller.Attribute attribute : attributeClass.getEnumConstants()) {
        String name = attribute.getName();
        if (operation.hasDefined(name)) {
          value.get(name).set(operation.get(name));
        }
      }
    }
    return value.isDefined() ? Operations.createWriteAttributeOperation(storeAddress, BinaryKeyedJDBCStoreResourceDefinition.DeprecatedAttribute.TABLE, value) : Operations.createUndefineAttributeOperation(storeAddress, BinaryKeyedJDBCStoreResourceDefinition.DeprecatedAttribute.TABLE);
  }
};

代码示例来源:origin: wildfly/wildfly

/**
 * Creates operations such as /subsystem=jgroups/stack=tcp/transport=TCP/:write-attribute(name=properties,value={a=b,c=d})".
 *
 * @return resulting :write-attribute operation
 */
protected static ModelNode getTransportSetPropertiesOperation(String stackName, String type, ModelNode values) {
  return Operations.createWriteAttributeOperation(getTransportAddress(stackName, type), AbstractProtocolResourceDefinition.Attribute.PROPERTIES, values);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Creates operations such as /subsystem=jgroups/stack=tcp/protocol=MPING/:write-attribute(name=properties,value={a=b,c=d})".
 */
protected static ModelNode getProtocolSetPropertiesOperation(String stackName, String protocolName, ModelNode values) {
  return Operations.createWriteAttributeOperation(getProtocolAddress(stackName, protocolName), AbstractProtocolResourceDefinition.Attribute.PROPERTIES, values);
}

代码示例来源:origin: wildfly/wildfly

protected static ModelNode getTransportWriteOperation(String stackName, String type, Attribute attribute, String value) {
  return Operations.createWriteAttributeOperation(getTransportAddress(stackName, type), attribute, new ModelNode(value));
}

代码示例来源:origin: wildfly/wildfly

protected static ModelNode getProtocolWriteOperation(String stackName, String protocolName, Attribute attribute, String value) {
  return Operations.createWriteAttributeOperation(getProtocolAddress(stackName, protocolName), attribute, new ModelNode(value));
}

代码示例来源:origin: wildfly/wildfly

protected static ModelNode getSubsystemWriteOperation(Attribute attribute, String value) {
  return Operations.createWriteAttributeOperation(getSubsystemAddress(), attribute, new ModelNode(value));
}

代码示例来源:origin: wildfly/wildfly

@Override
  public ModelNode transformOperation(ModelNode operation) {
    ModelNode mode = Operations.getAttributeValue(operation);
    boolean batching = (mode.isDefined() && (mode.getType() == ModelType.STRING)) ? (TransactionMode.valueOf(mode.asString()) == TransactionMode.BATCH) : false;
    if (batching) {
      mode.set(TransactionMode.NONE.name());
    }
    PathAddress address = Operations.getPathAddress(operation);
    return Operations.createCompositeOperation(operation, Operations.createWriteAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING, new ModelNode(batching)));
  }
};

代码示例来源:origin: wildfly/wildfly

@Override
  public ModelNode transformOperation(ModelNode operation) {
    if (operation.hasDefined(Attribute.MODE.getName())) {
      ModelNode mode = operation.get(Attribute.MODE.getName());
      if ((mode.getType() == ModelType.STRING) && (TransactionMode.valueOf(mode.asString()) == TransactionMode.BATCH)) {
        mode.set(TransactionMode.NONE.name());
        PathAddress address = Operations.getPathAddress(operation);
        return Operations.createCompositeOperation(operation, Operations.createWriteAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING, new ModelNode(true)));
      }
    }
    return operation;
  }
};

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
protected static ModelNode getTransportPropertyWriteOperation(String stackName, String type, String propertyName, String propertyValue) {
  return Operations.createWriteAttributeOperation(getTransportPropertyAddress(stackName, type, propertyName), new SimpleAttribute(PropertyResourceDefinition.VALUE), new ModelNode(propertyValue));
}

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
protected static ModelNode getProtocolPropertyWriteOperation(String stackName, String protocolName, String propertyName, String propertyValue) {
  return Operations.createWriteAttributeOperation(getProtocolPropertyAddress(stackName, protocolName, propertyName), new SimpleAttribute(PropertyResourceDefinition.VALUE), new ModelNode(propertyValue));
}

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
  @Override
  public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress().append(BinaryTableResourceDefinition.PATH);
    ModelNode table = Operations.getAttributeValue(operation);
    for (Class<? extends org.jboss.as.clustering.controller.Attribute> attributeClass : Arrays.asList(BinaryTableResourceDefinition.Attribute.class, TableResourceDefinition.Attribute.class, TableResourceDefinition.DeprecatedAttribute.class)) {
      for (org.jboss.as.clustering.controller.Attribute attribute : attributeClass.getEnumConstants()) {
        ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(address, attribute, table.get(attribute.getName()));
        context.addStep(writeAttributeOperation, context.getResourceRegistration().getAttributeAccess(PathAddress.pathAddress(BinaryTableResourceDefinition.PATH), attribute.getName()).getWriteHandler(), context.getCurrentStage());
      }
    }
  }
};

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
  @Override
  public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress().append(StringTableResourceDefinition.PATH);
    ModelNode table = Operations.getAttributeValue(operation);
    for (Class<? extends org.jboss.as.clustering.controller.Attribute> attributeClass : Arrays.asList(StringTableResourceDefinition.Attribute.class, TableResourceDefinition.Attribute.class, TableResourceDefinition.DeprecatedAttribute.class)) {
      for (org.jboss.as.clustering.controller.Attribute attribute : attributeClass.getEnumConstants()) {
        ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(address, attribute, table.get(attribute.getName()));
        context.addStep(writeAttributeOperation, context.getResourceRegistration().getAttributeAccess(PathAddress.pathAddress(StringTableResourceDefinition.PATH), attribute.getName()).getWriteHandler(), context.getCurrentStage());
      }
    }
  }
};

代码示例来源:origin: wildfly/wildfly

@Override
  public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    ModelNode value = context.resolveExpressions(Operations.getAttributeValue(operation));
    ModelNode targetValue = this.translation.getWriteTranslator().translate(context, value);
    Attribute targetAttribute = this.translation.getTargetAttribute();
    PathAddress currentAddress = context.getCurrentAddress();
    PathAddress targetAddress = this.translation.getPathAddressTransformation().apply(currentAddress);
    ModelNode targetOperation = Operations.createWriteAttributeOperation(targetAddress, targetAttribute, targetValue);
    ImmutableManagementResourceRegistration targetRegistration = this.translation.getResourceRegistrationTransformation().apply(context.getResourceRegistration());
    OperationStepHandler writeAttributeHandler = targetRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, targetAttribute.getName()).getWriteHandler();
    if (targetAddress == currentAddress) {
      writeAttributeHandler.execute(context, targetOperation);
    } else {
      context.addStep(targetOperation, writeAttributeHandler, context.getCurrentStage());
    }
  }
}

代码示例来源:origin: wildfly/wildfly

ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(targetAddress, targetAttribute, targetValue);
ImmutableManagementResourceRegistration targetRegistration = translation.getResourceRegistrationTransformation().apply(context.getResourceRegistration());
OperationStepHandler writeAttributeHandler = targetRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, targetAttribute.getName()).getWriteHandler();

代码示例来源:origin: org.jboss.eap/wildfly-mod_cluster-extension

@Override
  public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) {
    PathAddress parentAddress = address.getParent();
    ModelNode value = operation.get(Attribute.FACTOR.getName());
    ModelNode transformedOperation = Operations.createWriteAttributeOperation(parentAddress, ProxyConfigurationResourceDefinition.DeprecatedAttribute.SIMPLE_LOAD_PROVIDER, value);
    return new TransformedOperation(transformedOperation, OperationResultTransformer.ORIGINAL_RESULT);
  }
});

代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension

@Override
  public ModelNode transformOperation(ModelNode operation) {
    ModelNode mode = Operations.getAttributeValue(operation);
    boolean batching = (mode.isDefined() && (mode.getType() == ModelType.STRING)) ? (TransactionMode.valueOf(mode.asString()) == TransactionMode.BATCH) : false;
    if (batching) {
      mode.set(TransactionMode.NONE.name());
    }
    PathAddress address = Operations.getPathAddress(operation);
    return Operations.createCompositeOperation(operation, Operations.createWriteAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING, new ModelNode(batching)));
  }
};

代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension

@SuppressWarnings("deprecation")
  @Override
  public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress().append(BinaryTableResourceDefinition.PATH);
    ModelNode table = Operations.getAttributeValue(operation);
    for (Class<? extends org.jboss.as.clustering.controller.Attribute> attributeClass : Arrays.asList(BinaryTableResourceDefinition.Attribute.class, TableResourceDefinition.Attribute.class, TableResourceDefinition.DeprecatedAttribute.class)) {
      for (org.jboss.as.clustering.controller.Attribute attribute : attributeClass.getEnumConstants()) {
        ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(address, attribute, table.get(attribute.getName()));
        context.addStep(writeAttributeOperation, context.getResourceRegistration().getAttributeAccess(PathAddress.pathAddress(BinaryTableResourceDefinition.PATH), attribute.getName()).getWriteHandler(), context.getCurrentStage());
      }
    }
  }
};

代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension

@SuppressWarnings("deprecation")
  @Override
  public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress().append(StringTableResourceDefinition.PATH);
    ModelNode table = Operations.getAttributeValue(operation);
    for (Class<? extends org.jboss.as.clustering.controller.Attribute> attributeClass : Arrays.asList(StringTableResourceDefinition.Attribute.class, TableResourceDefinition.Attribute.class, TableResourceDefinition.DeprecatedAttribute.class)) {
      for (org.jboss.as.clustering.controller.Attribute attribute : attributeClass.getEnumConstants()) {
        ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(address, attribute, table.get(attribute.getName()));
        context.addStep(writeAttributeOperation, context.getResourceRegistration().getAttributeAccess(PathAddress.pathAddress(StringTableResourceDefinition.PATH), attribute.getName()).getWriteHandler(), context.getCurrentStage());
      }
    }
  }
};

相关文章