From 42dcc705665a4e788579af8ae03f3338462ddb6b Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Mon, 24 Jun 2024 16:08:12 -0400 Subject: [PATCH 1/2] WFCORE-6865 Add stability attribute to default description provider for add operations. --- .../descriptions/DefaultResourceAddDescriptionProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultResourceAddDescriptionProvider.java b/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultResourceAddDescriptionProvider.java index 5d04555cd44..220ece20493 100644 --- a/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultResourceAddDescriptionProvider.java +++ b/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultResourceAddDescriptionProvider.java @@ -10,6 +10,7 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REPLY_PROPERTIES; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; import java.util.Locale; import java.util.Map; @@ -92,7 +93,8 @@ public ModelNode getModelDescription(Locale locale) { //This is auto-generated so don't add any access constraints result.get(REPLY_PROPERTIES).setEmptyObject(); - + // Use the stability level of the resource + result.get(STABILITY).set(this.registration.getStability().toString()); return result; } From 63e94d450a36e933481c4a807eac2417283ecfd7 Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Mon, 24 Jun 2024 16:09:25 -0400 Subject: [PATCH 2/2] WFCORE-6865 Stability of generated OperationDefinition for add/remove resource operations should match stability of the corresponding resource definition. --- .../java/org/jboss/as/controller/SimpleResourceDefinition.java | 2 ++ .../wildfly/subsystem/resource/ResourceDescriptorRegistrar.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java b/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java index 7eebde58964..08cf60dda59 100644 --- a/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java +++ b/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java @@ -217,6 +217,7 @@ protected void registerAddOperation(final ManagementResourceRegistration registr .setParameters(this.getAddOperationParameters(registration)) .setDescriptionProvider(descriptionProvider) .setEntryType(OperationEntry.EntryType.PUBLIC) + .setStability(registration.getStability()) .withFlags(flags) .build(); registration.registerOperationHandler(definition, handler); @@ -234,6 +235,7 @@ protected void registerRemoveOperation(final ManagementResourceRegistration regi OperationDefinition definition = new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, this.descriptionResolver) .setDescriptionProvider(descriptionProvider) .setEntryType(OperationEntry.EntryType.PUBLIC) + .setStability(registration.getStability()) .withFlags(flags) .build(); registration.registerOperationHandler(definition, handler); diff --git a/subsystem/src/main/java/org/wildfly/subsystem/resource/ResourceDescriptorRegistrar.java b/subsystem/src/main/java/org/wildfly/subsystem/resource/ResourceDescriptorRegistrar.java index a9558efb631..7c5d1489c90 100644 --- a/subsystem/src/main/java/org/wildfly/subsystem/resource/ResourceDescriptorRegistrar.java +++ b/subsystem/src/main/java/org/wildfly/subsystem/resource/ResourceDescriptorRegistrar.java @@ -132,6 +132,7 @@ public void register(ManagementResourceRegistration registration) { OperationDefinition addDefinition = new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.ADD, this.descriptor.getResourceDescriptionResolver()) .setParameters(attributes.toArray(AttributeDefinition[]::new)) .setDescriptionProvider(new DefaultResourceAddDescriptionProvider(registration, this.descriptor.getResourceDescriptionResolver(), ordered)) + .setStability(registration.getStability()) .withFlag(this.descriptor.getAddOperationRestartFlag()) .build(); registration.registerOperationHandler(addDefinition, this.descriptor.getAddOperationTransformation().apply(new AddResourceOperationStepHandler(this.descriptor))); @@ -139,6 +140,7 @@ public void register(ManagementResourceRegistration registration) { // Register remove resource operation handler OperationDefinition removeDefinition = new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, this.descriptor.getResourceDescriptionResolver()) .setDescriptionProvider(new DefaultResourceRemoveDescriptionProvider(this.descriptor.getResourceDescriptionResolver())) + .setStability(registration.getStability()) .withFlag(this.descriptor.getRemoveOperationRestartFlag()) .build(); registration.registerOperationHandler(removeDefinition, this.descriptor.getResourceOperationTransformation().apply(new RemoveResourceOperationStepHandler(this.descriptor)));