本文整理了Java中org.jboss.as.clustering.controller.Operations
类的一些代码示例,展示了Operations
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations
类的具体详情如下:
包路径:org.jboss.as.clustering.controller.Operations
类名称:Operations
[英]Utility methods for creating/manipulating management operations.
[中]用于创建/操作管理操作的实用工具方法。
代码示例来源:origin: wildfly/wildfly
@Override
public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException {
String name = Operations.getName(operation);
OperationTransformer transformer = this.transformers.get(name);
return (transformer != null) ? transformer.transformOperation(context, address, operation) : new TransformedOperation(operation, OperationResultTransformer.ORIGINAL_RESULT);
}
}
代码示例来源: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) {
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) {
PathAddress address = Operations.getPathAddress(operation);
return Operations.createCompositeOperation(operation, Operations.createUndefineAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING));
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public ModelNode transformOperation(ModelNode operation) {
PathAddress address = Operations.getPathAddress(operation);
return Operations.createCompositeOperation(Operations.createReadAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING), operation);
}
};
代码示例来源:origin: wildfly/wildfly
@Override
public ModelNode transformOperation(ModelNode operation) {
PathAddress storeAddress = Operations.getPathAddress(operation).getParent();
return Operations.createUndefineAttributeOperation(storeAddress, BinaryKeyedJDBCStoreResourceDefinition.DeprecatedAttribute.TABLE);
}
};
代码示例来源: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
String originalName = Operations.getName(originalOperation);
PathAddress originalAddress = Operations.getPathAddress(originalOperation);
Deque<ModelNode> preSteps = new LinkedList<>();
Deque<ModelNode> postSteps = new LinkedList<>();
while (steps.hasNext()) {
ModelNode step = steps.next();
String operationName = Operations.getName(step);
PathAddress operationAddress = Operations.getPathAddress(step);
if (operationName.equals(originalName) && operationAddress.equals(originalAddress)) {
operation = step;
while (steps.hasPrevious()) {
ModelNode step = steps.previous();
String operationName = Operations.getName(step);
PathAddress operationAddress = Operations.getPathAddress(step);
if (operationName.equals(originalName) && operationAddress.equals(originalAddress)) {
break;
steps.add(operation);
steps.addAll(postSteps);
operation = Operations.createCompositeOperation(steps);
代码示例来源: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
@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 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
ModelNode initialValue = attachment.getInitialValue(resolvedAddress, Operations.getAttributeName(operation));
ModelNode newValue = context.readResourceFromRoot(resolvedAddress).getModel().get(PROPERTIES).clone();
final PathAddress legacyAddress = Operations.getPathAddress(operation);
return new TransformedOperation(Operations.createCompositeOperation(operations), OperationResultTransformer.ORIGINAL_RESULT);
代码示例来源:origin: wildfly/wildfly
@Override
public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) {
if (operation != null && !(operation.hasDefined(OPERATION_HEADERS) && operation.get(OPERATION_HEADERS, "push-to-servers").asBoolean(false)) ){
String originalAttribute = Operations.getAttributeName(operation);
if (renames.containsKey(originalAttribute)){
operation = operation.clone();
operation.get(NAME).set(renames.get(originalAttribute));
}
}
return new TransformedOperation(operation, OperationResultTransformer.ORIGINAL_RESULT);
}
代码示例来源:origin: wildfly/wildfly
@Override
public void execute(OperationContext context, ModelNode operation) {
PathAddress address = context.getCurrentAddress();
JGroupsLogger.ROOT_LOGGER.legacyProtocol(address.getLastElement().getValue(), this.targetName);
PathAddress targetAddress = address.getParent().append(pathElement(this.targetName));
Operations.setPathAddress(operation, targetAddress);
PathAddress targetRegistrationAddress = address.getParent().append(ProtocolResourceDefinition.WILDCARD_PATH);
String operationName = Operations.getName(operation);
context.addStep(operation, context.getRootResourceRegistration().getOperationHandler(targetRegistrationAddress, operationName), OperationContext.Stage.MODEL, true);
}
}
代码示例来源: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
@Override
public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) {
ModelNode legacyOperation = operation.clone();
Operations.setPathAddress(legacyOperation, this.addressTransformer.transform(address));
InitialAttributeValueOperationContextAttachment attachment = context.getAttachment(InitialAttributeValueOperationContextAttachment.INITIAL_VALUES_ATTACHMENT);
if (attachment != null) {
ModelNode value = attachment.getInitialValue(address, Operations.getAttributeName(operation));
if (value != null) {
attachment.putIfAbsentInitialValue(this.addressTransformer.transform(address), Operations.getAttributeName(operation), value);
}
}
return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public ModelNode transformOperation(ModelNode operation) {
if (operation.get(NAME).asString().equals(PROPERTIES)) {
String key = operation.get("key").asString();
PathAddress address = Operations.getPathAddress(operation);
ModelNode transformedOperation = Util.createOperation(READ_ATTRIBUTE_OPERATION, address.append(PathElement.pathElement(PROPERTY, key)));
transformedOperation.get(NAME).set(VALUE);
return transformedOperation;
}
return operation;
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Creates a composite operation using the specified operation steps.
* @param operations steps
* @return a composite operation
*/
public static ModelNode createCompositeOperation(ModelNode... operations) {
return createCompositeOperation(Arrays.asList(operations));
}
代码示例来源:origin: wildfly/wildfly
Operations.setPathAddress(operation, address);
Operations.setPathAddress(binaryTableOperation, address.append(BinaryTableResourceDefinition.PATH));
Operations.setPathAddress(operation, address);
Operations.setPathAddress(stringTableOperation, address.append(StringTableResourceDefinition.PATH));
内容来源于网络,如有侵权,请联系作者删除!