private List<MavenVersion> getAllVersions(RepoResponse repoResponse) { List<MavenVersion> versions; NexusResponseHandler nexusReponseHandler = new NexusResponseHandler(repoResponse); if (nexusReponseHandler.canHandle()) { versions = nexusReponseHandler.getAllVersions(); } else { LOGGER.warn("Returning empty version list - no XML nor HTML Nexus answer found"); versions = Collections.emptyList(); } return versions; }
public MavenVersion getLatest() { RepoResponse repoResponse = repositoryConnector.makeAllVersionsRequest(lookupParams); LOGGER.debug(repoResponse.responseBody); List<MavenVersion> allVersions = getAllVersions(repoResponse); MavenVersion latest = getLatest(allVersions); if (latest != null) { latest.setArtifactId(lookupParams.getArtifactId()); latest.setGroupId(lookupParams.getGroupId()); LOGGER.info("Latest is " + latest.getRevisionLabel()); setLocationAndTrackBack(latest); } else { LOGGER.warn("getLatest returning null"); } return latest; }
Files getFiles(MavenVersion version) { RepoResponse repoResponse = repositoryConnector.makeFilesRequest(lookupParams, version.getV_Q()); LOGGER.debug(repoResponse.responseBody); NexusResponseHandler nexusReponseHandler = new NexusResponseHandler(repoResponse); List<String> files; String pomFile = null; if (nexusReponseHandler.canHandle()) { files = nexusReponseHandler.getFilesMatching(lookupParams.getArtifactSelectionPattern()); pomFile = nexusReponseHandler.getPOMurl(); LOGGER.info("pomFile is " + pomFile); } else { LOGGER.warn("Returning empty version list - no XML nor HTML Nexus answer found"); files = Collections.emptyList(); } LOGGER.info("Files: " + files); return files.size() > 0 ? new Files( repositoryConnector.getFilesUrlWithBasicAuth(lookupParams, version.getV_Q()), files.get(0), repositoryConnector.getFilesUrl(lookupParams, version.getV_Q()) + pomFile, lookupParams) : null; }