Skip to content

Commit

Permalink
[WFCORE-6750] Rework the parser registration to use the stability lev…
Browse files Browse the repository at this point in the history
…el aware variants
  • Loading branch information
kabir committed Apr 15, 2024
1 parent 5dc58f1 commit d26d428
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import org.jboss.as.controller.Feature;
import org.jboss.as.controller.PersistentResourceXMLDescription;
import org.jboss.as.controller.PersistentResourceXMLDescription.PersistentResourceXMLBuilder;
import org.jboss.as.controller.PersistentSubsystemSchema;
import org.jboss.as.controller.SubsystemSchema;
import org.jboss.as.controller.xml.VersionedNamespace;
Expand All @@ -17,8 +16,6 @@
import java.util.EnumSet;
import java.util.Map;

import static org.jboss.as.controller.PersistentResourceXMLDescription.builder;

/**
* Parser and Marshaller for core-management subsystem.
*
Expand Down Expand Up @@ -51,21 +48,24 @@ public VersionedNamespace<IntVersion, CoreManagementSubsystemSchema_1_0> getName

@Override
public PersistentResourceXMLDescription getXMLDescription() {
PersistentResourceXMLBuilder builder = builder(CoreManagementExtension.SUBSYSTEM_PATH, namespace);
builder.addChild(builder(ConfigurationChangeResourceDefinition.PATH).addAttribute(ConfigurationChangeResourceDefinition.MAX_HISTORY));

if (this.getStability().enables(Stability.PREVIEW)) {
builder.addChild(
builder(UnstableApiAnnotationResourceDefinition.PATH)
.addAttribute(UnstableApiAnnotationResourceDefinition.LEVEL));
}
PersistentResourceXMLDescription.Factory factory = PersistentResourceXMLDescription.factory(this);
PersistentResourceXMLDescription.Builder builder = factory.builder(CoreManagementExtension.SUBSYSTEM_PATH);
builder.addChild(
factory.builder(ConfigurationChangeResourceDefinition.PATH)
.addAttribute(ConfigurationChangeResourceDefinition.MAX_HISTORY)
.build());
builder.addChild(
factory.builder(UnstableApiAnnotationResourceDefinition.RESOURCE_REGISTRATION)
.addAttribute(UnstableApiAnnotationResourceDefinition.LEVEL)
.build());
builder.addChild(
factory.builder(CoreManagementExtension.PROCESS_STATE_LISTENER_PATH)

builder.addChild(builder(CoreManagementExtension.PROCESS_STATE_LISTENER_PATH)
.addAttribute(ProcessStateListenerResourceDefinition.LISTENER_CLASS)
.addAttribute(ProcessStateListenerResourceDefinition.LISTENER_MODULE)
.addAttribute(ProcessStateListenerResourceDefinition.PROPERTIES)
.addAttribute(ProcessStateListenerResourceDefinition.TIMEOUT));

.addAttribute(ProcessStateListenerResourceDefinition.TIMEOUT)
.build());
return builder.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ public class UnstableApiAnnotationResourceDefinition extends PersistentResourceD
.setDefaultValue(new ModelNode(UnstableApiAnnotationLevel.LOG.name()))
.build();
public static final PathElement PATH = PathElement.pathElement(SERVICE, UNSTABLE_API_ANNOTATIONS);
static final ResourceRegistration RESOURCE_REGISTRATION = ResourceRegistration.of(PATH, STABILITY);
static final UnstableApiAnnotationResourceDefinition INSTANCE = new UnstableApiAnnotationResourceDefinition();

private UnstableApiAnnotationResourceDefinition() {
super(
new Parameters(
ResourceRegistration.of(PATH, STABILITY),
RESOURCE_REGISTRATION,
CoreManagementExtension.getResourceDescriptionResolver(UNSTABLE_API_ANNOTATIONS))
.setAddHandler(ReloadRequiredAddStepHandler.INSTANCE)
.setRemoveHandler(ReloadRequiredRemoveStepHandler.INSTANCE));
Expand Down

0 comments on commit d26d428

Please sign in to comment.