Package org.sonatype.nexus.rest.model

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


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

TOP

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

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.