@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); } }
@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))); } };
@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; } };
@Override public ModelNode transformOperation(ModelNode operation) { PathAddress address = Operations.getPathAddress(operation); return Operations.createCompositeOperation(operation, Operations.createUndefineAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING)); } };
@Override public ModelNode transformOperation(ModelNode operation) { PathAddress address = Operations.getPathAddress(operation); return Operations.createCompositeOperation(Operations.createReadAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING), operation); } };
@Override public ModelNode transformOperation(ModelNode operation) { PathAddress storeAddress = Operations.getPathAddress(operation).getParent(); return Operations.createUndefineAttributeOperation(storeAddress, BinaryKeyedJDBCStoreResourceDefinition.DeprecatedAttribute.TABLE); } };
@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()); } } } };
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);
@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; } };
@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); } });
@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); } };
@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()); } };
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);
@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); }
@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); } }
/** * {@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); } }
@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); } }
@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; } }
/** * 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)); }
Operations.setPathAddress(operation, address); Operations.setPathAddress(binaryTableOperation, address.append(BinaryTableResourceDefinition.PATH)); Operations.setPathAddress(operation, address); Operations.setPathAddress(stringTableOperation, address.append(StringTableResourceDefinition.PATH));