Package org.sonatype.nexus.rest.model

Examples of org.sonatype.nexus.rest.model.RoutingStatusMessage


                                         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("");
      }
View Full Code Here


  }

  @Override
  public Status getStatus(final String mavenRepositoryId) {
    try {
      final RoutingStatusMessage message =
          getNexusClient().serviceResource(routingPath(mavenRepositoryId)).get(RoutingStatusMessageWrapper.class)
              .getData();

      final DiscoveryStatus discoveryStatus;
      if (message.getDiscovery() == null) {
        // not a proxy
        discoveryStatus = null;
      }
      else {
        final Outcome discoveryOutcome = Outcome.values()[message.getDiscovery().getDiscoveryLastStatus() + 1];
        discoveryStatus =
            new DiscoveryStatus(message.getDiscovery().isDiscoveryEnabled(),
                message.getDiscovery().getDiscoveryIntervalHours(), discoveryOutcome,
                message.getDiscovery().getDiscoveryLastStrategy(),
                message.getDiscovery().getDiscoveryLastMessage(),
                message.getDiscovery().getDiscoveryLastRunTimestamp());
      }

      final Outcome publishOutcome = Outcome.values()[message.getPublishedStatus() + 1];
      return new Status(publishOutcome, message.getPublishedMessage(), message.getPublishedTimestamp(),
          message.getPublishedUrl(), discoveryStatus);
    }
    catch (UniformInterfaceException e) {
      throw getNexusClient().convert(e);
    }
    catch (ClientHandlerException e) {
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.rest.model.RoutingStatusMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.