final Variant variant)
throws ResourceException
{
final MavenRepository mavenRepository = getMavenRepository(request, MavenRepository.class);
final RoutingStatus status = getManager().getStatusFor(mavenRepository);
final RoutingStatusMessage payload = new RoutingStatusMessage();
switch (status.getPublishingStatus().getStatus()) {
case PUBLISHED:
payload.setPublishedStatus(1);
break;
case NOT_PUBLISHED:
payload.setPublishedStatus(-1);
break;
default:
payload.setPublishedStatus(0);
break;
}
payload.setPublishedMessage(status.getPublishingStatus().getLastPublishedMessage());
final PublishingStatus pstatus = status.getPublishingStatus();
if (PStatus.PUBLISHED == pstatus.getStatus()) {
payload.setPublishedTimestamp(pstatus.getLastPublishedTimestamp());
if (mavenRepository.isExposed() && pstatus.getLastPublishedFilePath() != null) {
final String repositoryUrl = repositoryURLBuilder.getExposedRepositoryContentUrl(mavenRepository);
if (repositoryUrl != null) {
payload.setPublishedUrl(repositoryUrl + pstatus.getLastPublishedFilePath());
}
}
}
else {
payload.setPublishedTimestamp(-1);
payload.setPublishedUrl(null);
}
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("");
}