OperationResult handlerResult = null;
final String attributeName = operation.require(NAME).asString();
final AttributeAccess attributeAccess = context.getRegistry().getAttributeAccess(PathAddress.pathAddress(operation.get(OP_ADDR)), attributeName);
if (attributeAccess == null) {
throw new OperationFailedException(new ModelNode().set("No known attribute called " + attributeName)); // TODO i18n
} else if (attributeAccess.getAccessType() != AccessType.READ_WRITE) {
throw new OperationFailedException(new ModelNode().set("Attribute " + attributeName + " is not writeable")); // TODO i18n
} else {
handlerResult = attributeAccess.getWriteHandler().execute(context, operation, resultHandler);
}
return handlerResult;