Examples of StrategyFailedException


Examples of org.sonatype.nexus.proxy.maven.routing.discovery.StrategyFailedException

      }
    }
    finally {
      uid.getLock().unlock();
    }
    throw new StrategyFailedException("Remote does not publish prefix files on path " + path);
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.discovery.StrategyFailedException

    final String remoteRepositoryRootUrl;
    try {
      remoteRepositoryRootUrl = getRemoteUrlOf(mavenProxyRepository);
    }
    catch (MalformedURLException e) {
      throw new StrategyFailedException("Proxy repository " + mavenProxyRepository + " remote URL malformed:"
          + e.getMessage(), e);
    }

    // get client configured in same way as proxy is using it
    final HttpClient httpClient = createHttpClientFor(mavenProxyRepository);
    final ScrapeContext context = new ScrapeContext(mavenProxyRepository, httpClient, config.getRemoteScrapeDepth());
    final Page rootPage = Page.getPageFor(context, remoteRepositoryRootUrl);
    final ArrayList<Scraper> appliedScrapers = new ArrayList<Scraper>(scrapers);
    Collections.sort(appliedScrapers, new PriorityOrderingComparator<Scraper>());
    for (Scraper scraper : appliedScrapers) {
      log.debug("Remote scraping {} with Scraper {}", mavenProxyRepository, scraper.getId());
      scraper.scrape(context, rootPage);
      if (context.isStopped()) {
        if (context.isSuccessful()) {
          log.debug("Remote scraping {} with Scraper {} succeeded.", mavenProxyRepository, scraper.getId());
          return new StrategyResult(context.getMessage(), context.getPrefixSource(), true);
        }
        else {
          log.debug("Remote scraping {} with Scraper {} stopped execution.", mavenProxyRepository,
              scraper.getId());
          throw new StrategyFailedException(context.getMessage());
        }
      }
      log.debug("Remote scraping {} with Scraper {} skipped.", mavenProxyRepository, scraper.getId());
    }

    log.info("Not possible remote scrape of {}, no scraper succeeded.", mavenProxyRepository);
    throw new StrategyFailedException("No scraper was able to scrape remote (or remote prevents scraping).");
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.discovery.StrategyFailedException

      final HttpResponse response  = httpClient.execute(get, httpContext);

      try {
        if (response.containsHeader("X-Artifactory-Id")) {
          log.debug("Remote server of proxy {} recognized as ARTF by response header", mavenProxyRepository);
          throw new StrategyFailedException("Server proxied by " + mavenProxyRepository
              + " proxy repository is not supported by automatic routing discovery");
        }
        if (response.getStatusLine().getStatusCode() >= 200 && response.getStatusLine().getStatusCode() <= 499) {
          if (response.getEntity() != null) {
            final Document document = Jsoup.parse(response.getEntity().getContent(), null, remoteUrl);
            final Elements addressElements = document.getElementsByTag("address");
            if (!addressElements.isEmpty()) {
              final String addressText = addressElements.get(0).text();
              if (addressText != null && addressText.toLowerCase(Locale.ENGLISH).startsWith("artifactory")) {
                log.debug("Remote server of proxy {} recognized as ARTF by address element in body",
                    mavenProxyRepository);
                throw new StrategyFailedException("Server proxied by " + mavenProxyRepository
                    + " proxy repository is not supported by automatic routing discovery");
              }
            }
          }
        }
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.