if (DStatus.NOT_A_PROXY == status.getDiscoveryStatus().getStatus()) {
payload.setDiscovery(null);
}
else {
final DiscoveryStatus dstatus = status.getDiscoveryStatus();
final RoutingDiscoveryStatusMessage discoveryPayload = new RoutingDiscoveryStatusMessage();
payload.setDiscovery(discoveryPayload);
if (DStatus.DISABLED == status.getDiscoveryStatus().getStatus()) {
discoveryPayload.setDiscoveryEnabled(false);
discoveryPayload.setDiscoveryLastStrategy("");
discoveryPayload.setDiscoveryLastMessage("");
}
else {
final MavenProxyRepository mavenProxyRepository =
getMavenRepository(request, MavenProxyRepository.class);
final DiscoveryConfig config = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
discoveryPayload.setDiscoveryEnabled(true);
discoveryPayload.setDiscoveryIntervalHours(
Ints.saturatedCast(TimeUnit.MILLISECONDS.toHours(config.getDiscoveryInterval())));
discoveryPayload.setDiscoveryLastStatus(0);
discoveryPayload.setDiscoveryLastStrategy("");
discoveryPayload.setDiscoveryLastMessage("");
// if we have it run at all
if (DStatus.ENABLED_IN_PROGRESS.ordinal() < status.getDiscoveryStatus().getStatus().ordinal()) {
if (DStatus.SUCCESSFUL == status.getDiscoveryStatus().getStatus()) {
discoveryPayload.setDiscoveryLastStatus(1);
}
else {
discoveryPayload.setDiscoveryLastStatus(-1);
}
// last- messages
discoveryPayload.setDiscoveryLastStrategy(Strings.nullToEmpty(dstatus.getLastDiscoveryStrategy()));
discoveryPayload.setDiscoveryLastMessage(Strings.nullToEmpty(dstatus.getLastDiscoveryMessage()));
discoveryPayload.setDiscoveryLastRunTimestamp(dstatus.getLastDiscoveryTimestamp());
}
}
}
final RoutingStatusMessageWrapper responseNessage = new RoutingStatusMessageWrapper();