本文整理了Java中org.jboss.as.clustering.controller.Operations.getAttributeValue()
方法的一些代码示例,展示了Operations.getAttributeValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.getAttributeValue()
方法的具体详情如下:
包路径:org.jboss.as.clustering.controller.Operations
类名称:Operations
方法名:getAttributeValue
[英]Returns the attribute value of the specified operation
[中]返回指定操作的属性值
代码示例来源:origin: wildfly/wildfly
@Override
public ModelNode transformOperation(ModelNode operation) {
String attributeName = Operations.getAttributeName(operation);
if (Attribute.ALIASES.getName().equals(attributeName)) {
ModelNode value = Operations.getAttributeValue(operation);
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(ALIAS_ADD, address);
transformedOperation.get(ALIAS.getName()).set(value);
return transformedOperation;
}
return operation;
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public ModelNode transformOperation(ModelNode operation) {
String attributeName = Operations.getAttributeName(operation);
if (Attribute.ALIASES.getName().equals(attributeName)) {
ModelNode value = Operations.getAttributeValue(operation);
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(ALIAS_REMOVE, address);
transformedOperation.get(ALIAS.getName()).set(value);
return transformedOperation;
}
return operation;
}
};
代码示例来源: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
/**
* {@inheritDoc}
*/
@Override
public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) {
String name = Operations.getAttributeName(operation);
ModelNode value = Operations.getAttributeValue(operation);
ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createWriteAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name, value);
return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT);
}
}
代码示例来源: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
@Override
public void execute(OperationContext context, ModelNode operation) {
operationDeprecated(context, operation);
PathAddress protocolAddress = context.getCurrentAddress().getParent();
String key = context.getCurrentAddressValue();
String value = Operations.getAttributeValue(operation).asString();
ModelNode putOperation = Operations.createMapPutOperation(protocolAddress, AbstractProtocolResourceDefinition.Attribute.PROPERTIES, key, value);
context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public void execute(OperationContext context, ModelNode operation) {
operationDeprecated(context, operation);
PathAddress storeAddress = context.getCurrentAddress().getParent();
String key = context.getCurrentAddressValue();
String value = Operations.getAttributeValue(operation).asString();
ModelNode putOperation = Operations.createMapPutOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, key, value);
context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, 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: org.wildfly/wildfly-clustering-infinispan-extension
@Override
public ModelNode transformOperation(ModelNode operation) {
String attributeName = Operations.getAttributeName(operation);
if (Attribute.ALIASES.getName().equals(attributeName)) {
ModelNode value = Operations.getAttributeValue(operation);
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(ALIAS_ADD, address);
transformedOperation.get(ALIAS.getName()).set(value);
return transformedOperation;
}
return operation;
}
};
代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension
@Override
public ModelNode transformOperation(ModelNode operation) {
String attributeName = Operations.getAttributeName(operation);
if (Attribute.ALIASES.getName().equals(attributeName)) {
ModelNode value = Operations.getAttributeValue(operation);
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(ALIAS_REMOVE, address);
transformedOperation.get(ALIAS.getName()).set(value);
return transformedOperation;
}
return operation;
}
};
代码示例来源: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.jboss.eap/wildfly-clustering-jgroups-extension
@Override
public void execute(OperationContext context, ModelNode operation) {
operationDeprecated(context, operation);
PathAddress protocolAddress = context.getCurrentAddress().getParent();
String key = context.getCurrentAddressValue();
String value = Operations.getAttributeValue(operation).asString();
ModelNode putOperation = Operations.createMapPutOperation(protocolAddress, AbstractProtocolResourceDefinition.Attribute.PROPERTIES, key, value);
context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
}
};
代码示例来源:origin: org.jboss.eap/wildfly-clustering-common
/**
* {@inheritDoc}
*/
@Override
public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) {
String name = Operations.getAttributeName(operation);
ModelNode value = Operations.getAttributeValue(operation);
ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createWriteAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name, value);
return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT);
}
}
代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension
@Override
public void execute(OperationContext context, ModelNode operation) {
operationDeprecated(context, operation);
PathAddress storeAddress = context.getCurrentAddress().getParent();
String key = context.getCurrentAddressValue();
String value = Operations.getAttributeValue(operation).asString();
ModelNode putOperation = Operations.createMapPutOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, key, value);
context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, 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());
}
}
}
};
代码示例来源: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.jboss.eap/wildfly-clustering-common
@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());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!