final ImmutableManagementResourceRegistration registry = context.getResourceRegistration();
AliasEntry aliasEntry = registry.getAliasEntry();
final ImmutableManagementResourceRegistration realRegistry = aliasEntry == null ? registry : context.getRootResourceRegistration().getSubModel(aliasEntry.convertToTargetAddress(PathAddress.pathAddress(opAddr)));
final DescriptionProvider descriptionProvider = realRegistry.getModelDescription(PathAddress.EMPTY_ADDRESS);
final Locale locale = GlobalOperationHandlers.getLocale(context, operation);
final ModelNode nodeDescription = descriptionProvider.getModelDescription(locale);
final Map<String, ModelNode> operations = new HashMap<String, ModelNode>();
final Map<PathElement, ModelNode> childResources = recursive ? new HashMap<PathElement, ModelNode>() : Collections.<PathElement, ModelNode>emptyMap();
// We're going to add a bunch of steps that should immediately follow this one. We are going to add them
// in reverse order of how they should execute, as that is the way adding a Stage.IMMEDIATE step works
// Last to execute is the handler that assembles the overall response from the pieces created by all the other steps
final ReadResourceDescriptionAssemblyHandler assemblyHandler = new ReadResourceDescriptionAssemblyHandler(nodeDescription, operations, childResources);
context.addStep(assemblyHandler, OperationContext.Stage.IMMEDIATE);
if (ops) {
for (final Map.Entry<String, OperationEntry> entry : realRegistry.getOperationDescriptions(PathAddress.EMPTY_ADDRESS, inheritedOps).entrySet()) {
if (entry.getValue().getType() == OperationEntry.EntryType.PUBLIC) {
if (context.getProcessType() != ProcessType.DOMAIN_SERVER || entry.getValue().getFlags().contains(OperationEntry.Flag.RUNTIME_ONLY)) {
final DescriptionProvider provider = entry.getValue().getDescriptionProvider();
operations.put(entry.getKey(), provider.getModelDescription(locale));
}
}
}
}
if (nodeDescription.hasDefined(ATTRIBUTES)) {