|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -81,7 +81,7 @@ abstract class HealthEndpointSupport<C, T> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Object contributor = getContributor(path, pathOffset);
|
|
|
|
Object contributor = getContributor(path, pathOffset);
|
|
|
|
T health = getContribution(apiVersion, group, contributor, showComponents, showDetails,
|
|
|
|
T health = getContribution(apiVersion, group, contributor, showComponents, showDetails,
|
|
|
|
isSystemHealth ? this.groups.getNames() : null);
|
|
|
|
isSystemHealth ? this.groups.getNames() : null, false);
|
|
|
|
return (health != null) ? new HealthResult<>(health, group) : null;
|
|
|
|
return (health != null) ? new HealthResult<>(health, group) : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -100,23 +100,24 @@ abstract class HealthEndpointSupport<C, T> {
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
private T getContribution(ApiVersion apiVersion, HealthEndpointGroup group, Object contributor,
|
|
|
|
private T getContribution(ApiVersion apiVersion, HealthEndpointGroup group, Object contributor,
|
|
|
|
boolean showComponents, boolean showDetails, Set<String> groupNames) {
|
|
|
|
boolean showComponents, boolean showDetails, Set<String> groupNames, boolean isNested) {
|
|
|
|
if (contributor instanceof NamedContributors) {
|
|
|
|
if (contributor instanceof NamedContributors) {
|
|
|
|
return getAggregateHealth(apiVersion, group, (NamedContributors<C>) contributor, showComponents,
|
|
|
|
return getAggregateHealth(apiVersion, group, (NamedContributors<C>) contributor, showComponents,
|
|
|
|
showDetails, groupNames);
|
|
|
|
showDetails, groupNames, isNested);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (contributor != null) ? getHealth((C) contributor, showDetails) : null;
|
|
|
|
return (contributor != null) ? getHealth((C) contributor, showDetails) : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private T getAggregateHealth(ApiVersion apiVersion, HealthEndpointGroup group,
|
|
|
|
private T getAggregateHealth(ApiVersion apiVersion, HealthEndpointGroup group,
|
|
|
|
NamedContributors<C> namedContributors, boolean showComponents, boolean showDetails,
|
|
|
|
NamedContributors<C> namedContributors, boolean showComponents, boolean showDetails, Set<String> groupNames,
|
|
|
|
Set<String> groupNames) {
|
|
|
|
boolean isNested) {
|
|
|
|
Map<String, T> contributions = new LinkedHashMap<>();
|
|
|
|
Map<String, T> contributions = new LinkedHashMap<>();
|
|
|
|
for (NamedContributor<C> namedContributor : namedContributors) {
|
|
|
|
for (NamedContributor<C> namedContributor : namedContributors) {
|
|
|
|
String name = namedContributor.getName();
|
|
|
|
String name = namedContributor.getName();
|
|
|
|
C contributor = namedContributor.getContributor();
|
|
|
|
C contributor = namedContributor.getContributor();
|
|
|
|
if (group.isMember(name)) {
|
|
|
|
if (group.isMember(name) || isNested) {
|
|
|
|
T contribution = getContribution(apiVersion, group, contributor, showComponents, showDetails, null);
|
|
|
|
T contribution = getContribution(apiVersion, group, contributor, showComponents, showDetails, null,
|
|
|
|
|
|
|
|
true);
|
|
|
|
if (contribution != null) {
|
|
|
|
if (contribution != null) {
|
|
|
|
contributions.put(name, contribution);
|
|
|
|
contributions.put(name, contribution);
|
|
|
|
}
|
|
|
|
}
|
|
|
|