@Override public ModelNode transformOperation(ModelNode operation) { PathAddress address = Operations.getPathAddress(operation); return Operations.createCompositeOperation(Operations.createReadAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING), operation); } };
protected static ModelNode getProtocolReadOperation(String stackName, String protocolName, Attribute attribute) { return Operations.createReadAttributeOperation(getProtocolAddress(stackName, protocolName), attribute); }
protected static ModelNode getSubsystemReadOperation(Attribute attribute) { return Operations.createReadAttributeOperation(getSubsystemAddress(), attribute); }
protected static ModelNode getTransportReadOperation(String stackName, String type, Attribute attribute) { return Operations.createReadAttributeOperation(getTransportAddress(stackName, type), attribute); }
@SuppressWarnings("deprecation") protected static ModelNode getTransportPropertyReadOperation(String stackName, String type, String propertyName) { return Operations.createReadAttributeOperation(getTransportPropertyAddress(stackName, type, propertyName), new SimpleAttribute(PropertyResourceDefinition.VALUE)); }
@SuppressWarnings("deprecation") protected static ModelNode getProtocolPropertyReadOperation(String stackName, String protocolName, String propertyName) { return Operations.createReadAttributeOperation(getProtocolPropertyAddress(stackName, protocolName, propertyName), new SimpleAttribute(PropertyResourceDefinition.VALUE)); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress currentAddress = context.getCurrentAddress(); PathAddress targetAddress = this.translation.getPathAddressTransformation().apply(currentAddress); Attribute targetAttribute = this.translation.getTargetAttribute(); ModelNode targetOperation = Operations.createReadAttributeOperation(targetAddress, targetAttribute); ImmutableManagementResourceRegistration targetRegistration = this.translation.getResourceRegistrationTransformation().apply(context.getResourceRegistration()); OperationStepHandler readAttributeHandler = targetRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, targetAttribute.getName()).getReadHandler(); OperationStepHandler readTranslatedAttributeHandler = new ReadTranslatedAttributeStepHandler(readAttributeHandler, targetAttribute, this.translation.getReadTranslator()); // If targetOperation applies to the current resource, we can execute in the current step if (targetAddress == currentAddress) { readTranslatedAttributeHandler.execute(context, targetOperation); } else { context.addStep(targetOperation, readTranslatedAttributeHandler, context.getCurrentStage(), true); } }
@Override public ModelNode transformOperation(ModelNode operation) { PathAddress address = Operations.getPathAddress(operation); return Operations.createCompositeOperation(Operations.createReadAttributeOperation(cacheAddress(address), CacheResourceDefinition.DeprecatedAttribute.BATCHING), operation); } };
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress currentAddress = context.getCurrentAddress(); PathAddress targetAddress = this.translation.getPathAddressTransformation().apply(currentAddress); Attribute targetAttribute = this.translation.getTargetAttribute(); ModelNode targetOperation = Operations.createReadAttributeOperation(targetAddress, targetAttribute); ImmutableManagementResourceRegistration targetRegistration = this.translation.getResourceRegistrationTransformation().apply(context.getResourceRegistration()); OperationStepHandler readAttributeHandler = targetRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, targetAttribute.getName()).getReadHandler(); OperationStepHandler readTranslatedAttributeHandler = new ReadTranslatedAttributeStepHandler(readAttributeHandler, targetAttribute, this.translation.getReadTranslator()); // If targetOperation applies to the current resource, we can execute in the current step if (targetAddress == currentAddress) { readTranslatedAttributeHandler.execute(context, targetOperation); } else { context.addStep(targetOperation, readTranslatedAttributeHandler, context.getCurrentStage(), true); } }