@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) { 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; } };
@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))); } };
/** * {@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); } }
@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()); } } } };
@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()); } };
@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()); } };
@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()); } } } };
@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()); } } }
@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) { 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; } };
@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 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()); } };
/** * {@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 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()); } };
@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()); } } } };
@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()); } } } };
@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()); } } }