@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()); } } } };
@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()); } } }
ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(targetAddress, targetAttribute, targetValue); ImmutableManagementResourceRegistration targetRegistration = translation.getResourceRegistrationTransformation().apply(context.getResourceRegistration()); OperationStepHandler writeAttributeHandler = targetRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, targetAttribute.getName()).getWriteHandler(); context.addStep(writeAttributeOperation, writeAttributeHandler, OperationContext.Stage.MODEL);
private void doExecuteInternal(OperationContext context, ModelNode operation, AttributeAccess attributeAccess) throws OperationFailedException { OperationStepHandler writeHandler = attributeAccess.getWriteHandler(); ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(writeHandler.getClass()); try { writeHandler.execute(context, operation); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } } private void emitAttributeValueWrittenNotification(OperationContext context, PathAddress address, String attributeName, ModelNode oldValue, ModelNode newValue) {
private void doExecuteInternal(OperationContext context, ModelNode operation, AttributeAccess attributeAccess, String attributeName, ModelNode currentValue, boolean useEnhancedSyntax, String attributeExpression) throws OperationFailedException { if (useEnhancedSyntax){ if (attributeAccess.getStorageType() == AttributeAccess.Storage.CONFIGURATION) { operation = getEnhancedSyntaxResolvedOperation(operation, currentValue, attributeName, attributeExpression); } else { assert attributeAccess.getStorageType() == AttributeAccess.Storage.RUNTIME; // Resolution must be postponed to RUNTIME stage for Storage.RUNTIME attributes. final ModelNode originalOperation = operation; // final vars so they can be accessed from lambda final ModelNode resolvedOperation = operation.clone(); operation = resolvedOperation; context.addStep((context1, operation1) -> { ModelNode resolved = getEnhancedSyntaxResolvedOperation(originalOperation, currentValue, attributeName, attributeExpression); resolvedOperation.get(ModelDescriptionConstants.NAME).set(resolved.get(ModelDescriptionConstants.NAME)); resolvedOperation.get(ModelDescriptionConstants.VALUE).set(resolved.get(ModelDescriptionConstants.VALUE)); }, OperationContext.Stage.RUNTIME); } } OperationStepHandler writeHandler = attributeAccess.getWriteHandler(); ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(writeHandler.getClass()); try { writeHandler.execute(context, operation); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } } private void emitAttributeValueWrittenNotification(OperationContext context, PathAddress address, String attributeName, ModelNode oldValue, ModelNode newValue) {
private void doExecuteInternal(OperationContext context, ModelNode operation, AttributeAccess attributeAccess, String attributeName, ModelNode currentValue, boolean useEnhancedSyntax, String attributeExpression) throws OperationFailedException { if (useEnhancedSyntax){ if (attributeAccess.getStorageType() == AttributeAccess.Storage.CONFIGURATION) { operation = getEnhancedSyntaxResolvedOperation(operation, currentValue, attributeName, attributeExpression); } else { assert attributeAccess.getStorageType() == AttributeAccess.Storage.RUNTIME; // Resolution must be postponed to RUNTIME stage for Storage.RUNTIME attributes. final ModelNode originalOperation = operation; // final vars so they can be accessed from lambda final ModelNode resolvedOperation = operation.clone(); operation = resolvedOperation; context.addStep((context1, operation1) -> { ModelNode resolved = getEnhancedSyntaxResolvedOperation(originalOperation, currentValue, attributeName, attributeExpression); resolvedOperation.get(ModelDescriptionConstants.NAME).set(resolved.get(ModelDescriptionConstants.NAME)); resolvedOperation.get(ModelDescriptionConstants.VALUE).set(resolved.get(ModelDescriptionConstants.VALUE)); }, OperationContext.Stage.RUNTIME); } } OperationStepHandler writeHandler = attributeAccess.getWriteHandler(); ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(writeHandler.getClass()); try { writeHandler.execute(context, operation); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } } private void emitAttributeValueWrittenNotification(OperationContext context, PathAddress address, String attributeName, ModelNode oldValue, ModelNode newValue) {
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { nameValidator.validate(operation); final String attributeName = operation.require(GlobalOperationHandlers.NAME.getName()).asString(); final AttributeAccess attributeAccess = context.getResourceRegistration().getAttributeAccess(PathAddress.EMPTY_ADDRESS, attributeName); if (attributeAccess == null) { throw new OperationFailedException(new ModelNode().set(MESSAGES.unknownAttribute(attributeName))); } else if (attributeAccess.getAccessType() != AttributeAccess.AccessType.READ_WRITE) { throw new OperationFailedException(new ModelNode().set(MESSAGES.attributeNotWritable(attributeName))); } else { OperationStepHandler handler = attributeAccess.getWriteHandler(); ClassLoader oldTccl = SecurityActions.setThreadContextClassLoader(handler.getClass()); try { handler.execute(context, operation); } finally { SecurityActions.setThreadContextClassLoader(oldTccl); } } } }
@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()); } } }
OperationStepHandler writeHandler = attributeAccess.getWriteHandler(); ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(writeHandler.getClass()); try {
ModelNode writeAttributeOperation = Operations.createWriteAttributeOperation(targetAddress, targetAttribute, targetValue); ImmutableManagementResourceRegistration targetRegistration = translation.getResourceRegistrationTransformation().apply(context.getResourceRegistration()); OperationStepHandler writeAttributeHandler = targetRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, targetAttribute.getName()).getWriteHandler(); context.addStep(writeAttributeOperation, writeAttributeHandler, OperationContext.Stage.MODEL);