static final LoggingDescribeHandler INSTANCE = new LoggingDescribeHandler();
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final ModelNode model = context.readModel(PathAddress.EMPTY_ADDRESS);
PathAddress rootAddress = PathAddress.pathAddress(PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement());
final ModelNode result = context.getResult();
result.add(LoggingExtension.NewLoggingSubsystemAdd.createOperation(rootAddress.toModelNode()));
if (model.hasDefined(ROOT_LOGGER)) {
ModelNode add = Util.getEmptyOperation(RootLoggerAdd.OPERATION_NAME, rootAddress.toModelNode());
add.get(LEVEL).set(model.get(ROOT_LOGGER, LEVEL));
add.get(HANDLERS).set(model.get(ROOT_LOGGER, HANDLERS));
result.add(add);
}
if (model.hasDefined(LOGGER)) {
for (Property prop : model.get(LOGGER).asPropertyList()) {
ModelNode add = Util.getEmptyOperation(ADD, rootAddress.append(PathElement.pathElement(LOGGER, prop.getName())).toModelNode());
add.get(HANDLERS).set(prop.getValue().get(HANDLERS));
add.get(LEVEL).set(prop.getValue().get(LEVEL));
result.add(add);
}
}