Examples of DiscoveryConfig


Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

    final DiscoveryStatus discoveryStatus = getStatusFor(mavenProxyRepository).getDiscoveryStatus();
    if (discoveryStatus.getStatus().isEnabled()) {
      // only update if any of these below are true:
      // status is ERROR or ENABLED_NOT_POSSIBLE (hit an error during last discovery)
      // status is anything else and prefix list update period is here
      final DiscoveryConfig config = getRemoteDiscoveryConfig(mavenProxyRepository);
      if (discoveryStatus.getStatus() == DStatus.ERROR
          || discoveryStatus.getStatus() == DStatus.ENABLED_NOT_POSSIBLE
          || ((System.currentTimeMillis() - discoveryStatus.getLastDiscoveryTimestamp()) >
          config.getDiscoveryInterval())) {
        if (discoveryStatus.getStatus() == DStatus.ENABLED_IN_PROGRESS) {
          log.debug("Proxy {} has never been discovered before", mavenProxyRepository);
        }
        else if (discoveryStatus.getStatus() == DStatus.ENABLED_NOT_POSSIBLE) {
          log.debug("Proxy {} discovery was not possible before", mavenProxyRepository);
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

          + RepositoryStringUtils.getHumanizedNameString(mavenProxyRepository)
          + " not in state to be updated (is blocked).");
    }

    PrefixSource prefixSource = null;
    final DiscoveryConfig config = getRemoteDiscoveryConfig(mavenProxyRepository);
    if (config.isEnabled()) {
      final DiscoveryResult<MavenProxyRepository> discoveryResult;
      if (null == remoteStrategies) {
        discoveryResult = remoteContentDiscoverer.discoverRemoteContent(mavenProxyRepository);
      }
      else {
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

  @Override
  public RoutingStatus getStatusFor(final MavenRepository mavenRepository) {
    final MavenProxyRepository mavenProxyRepository = mavenRepository.adaptToFacet(MavenProxyRepository.class);
    final boolean remoteDiscoveryEnabled;
    if (mavenProxyRepository != null) {
      final DiscoveryConfig discoveryConfig = getRemoteDiscoveryConfig(mavenProxyRepository);
      remoteDiscoveryEnabled = discoveryConfig.isEnabled();
    }
    else {
      remoteDiscoveryEnabled = false;
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

    final AbstractMavenRepositoryConfiguration configuration =
        (AbstractMavenRepositoryConfiguration)((AbstractMavenRepository) mavenProxyRepository).getCurrentCoreConfiguration()
            .getExternalConfiguration().getConfiguration(
                false);

    return new DiscoveryConfig(config.isFeatureActive() && configuration.isRoutingDiscoveryEnabled(),
        configuration.getRoutingDiscoveryInterval());
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

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

Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

  public RoutingConfigMessageWrapper get(final Context context, final Request request, final Response response,
                                         final Variant variant)
      throws ResourceException
  {
    final MavenProxyRepository mavenProxyRepository = getMavenRepository(request, MavenProxyRepository.class);
    final DiscoveryConfig config = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
    final RoutingConfigMessage payload = new RoutingConfigMessage();
    payload.setDiscoveryEnabled(config.isEnabled());
    payload.setDiscoveryIntervalHours(Ints.saturatedCast(TimeUnit.MILLISECONDS.toHours(config.getDiscoveryInterval())));
    final RoutingConfigMessageWrapper responseNessage = new RoutingConfigMessageWrapper();
    responseNessage.setData(payload);
    return responseNessage;
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.DiscoveryConfig

                                         final Object payload)
      throws ResourceException
  {
    try {
      final MavenProxyRepository mavenProxyRepository = getMavenRepository(request, MavenProxyRepository.class);
      final DiscoveryConfig oldConfig = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
      final RoutingConfigMessageWrapper wrapper = RoutingConfigMessageWrapper.class.cast(payload);
      // NEXUS-5567 related and some other cases (like scripting and sending partial message to enable/disable only).
      // The error range of the interval value is (>0) since it's defined in hours, and 0 or negative value would be
      // undefined. But still, due to unmarshalling, the field in the bean would be 0 (or is -1 like in NEXUS-5567).
      // Hence, if non valid value sent, we use the "old" value to keep it.
      final DiscoveryConfig config =
          new DiscoveryConfig(
              wrapper.getData().isDiscoveryEnabled(),
              wrapper.getData().getDiscoveryIntervalHours() > 0 ? TimeUnit.HOURS
                  .toMillis(wrapper.getData().getDiscoveryIntervalHours())
                  : oldConfig.getDiscoveryInterval());
      getManager().setRemoteDiscoveryConfig(mavenProxyRepository, config);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.