use of org.apache.sling.api.resource.runtime.dto.FailureReason in project sling by apache.
the class ResourceProviderTracker method fill.
public void fill(final RuntimeDTO dto) {
final List<ResourceProviderDTO> dtos = new ArrayList<ResourceProviderDTO>();
final List<ResourceProviderFailureDTO> failures = new ArrayList<ResourceProviderFailureDTO>();
synchronized (this.handlers) {
for (final List<ResourceProviderHandler> handlers : this.handlers.values()) {
boolean isFirst = true;
for (final ResourceProviderHandler h : handlers) {
final ResourceProviderDTO d;
if (isFirst) {
d = new ResourceProviderDTO();
dtos.add(d);
isFirst = false;
} else {
d = new ResourceProviderFailureDTO();
((ResourceProviderFailureDTO) d).reason = FailureReason.shadowed;
failures.add((ResourceProviderFailureDTO) d);
}
fill(d, h);
}
}
}
synchronized (this.invalidProviders) {
for (final Map.Entry<ResourceProviderInfo, FailureReason> entry : this.invalidProviders.entrySet()) {
final ResourceProviderFailureDTO d = new ResourceProviderFailureDTO();
fill(d, entry.getKey());
d.reason = entry.getValue();
failures.add(d);
}
}
dto.providers = dtos.toArray(new ResourceProviderDTO[dtos.size()]);
dto.failedProviders = failures.toArray(new ResourceProviderFailureDTO[failures.size()]);
}
Aggregations