def _listRepository(self, repoUrls, gavPatterns): """ Loads maven artifacts from a repository. :param repoUrl: repository URL (local or remote, supported are [file://], http:// and https:// urls) :param gavPatterns: list of patterns to filter by GAV :returns: Dictionary where index is MavenArtifact object and value is ArtifactSpec with its repo root URL. """ prefixes = self._getPrefixes(gavPatterns) artifacts = {} for repoUrl in reversed(repoUrls): urlWithSlash = maven_repo_util.slashAtTheEnd(repoUrl) protocol = maven_repo_util.urlProtocol(urlWithSlash) if protocol == 'file': for prefix in prefixes: artifacts.update( self._listLocalRepository(urlWithSlash[7:], prefix)) elif protocol == '': for prefix in prefixes: artifacts.update( self._listLocalRepository(urlWithSlash, prefix)) elif protocol == 'http' or protocol == 'https': for prefix in prefixes: artifacts.update( self._listRemoteRepository(urlWithSlash, prefix)) else: raise "Invalid protocol!", protocol artifacts = self._filterArtifactsByPatterns(artifacts, gavPatterns) logging.debug("Found %d artifacts", len(artifacts)) return artifacts
def _listRepository(self, repoUrls, gavPatterns): """ Loads maven artifacts from a repository. :param repoUrl: repository URL (local or remote, supported are [file://], http:// and https:// urls) :param gavPatterns: list of patterns to filter by GAV :returns: Dictionary where index is MavenArtifact object and value is ArtifactSpec with its repo root URL. """ prefixes = self._getPrefixes(gavPatterns) artifacts = {} for repoUrl in reversed(repoUrls): urlWithSlash = maven_repo_util.slashAtTheEnd(repoUrl) protocol = maven_repo_util.urlProtocol(urlWithSlash) if protocol == 'file': for prefix in prefixes: artifacts.update(self._listLocalRepository(urlWithSlash[7:], prefix)) elif protocol == '': for prefix in prefixes: artifacts.update(self._listLocalRepository(urlWithSlash, prefix)) elif protocol == 'http' or protocol == 'https': for prefix in prefixes: artifacts.update(self._listRemoteRepository(urlWithSlash, prefix)) else: raise "Invalid protocol!", protocol artifacts = self._filterArtifactsByPatterns(artifacts, gavPatterns) logging.debug("Found %d artifacts", len(artifacts)) return artifacts
def _listRepository(self, repoUrls, gavPatterns): """ Loads maven artifacts from a repository. :param repoUrl: repository URL (local or remote, supported are [file://], http:// and https:// urls) :returns: Dictionary where index is MavenArtifact object and value is it's repo root URL. """ artifacts = {} for repoUrl in reversed(repoUrls): protocol = mrbutils.urlProtocol(repoUrl) if protocol == 'file': artifacts.update(self._listLocalRepository(repoUrl[7:])) elif protocol == '': artifacts.update(self._listLocalRepository(repoUrl)) elif protocol == 'http' or protocol == 'https': artifacts.update(self._listRemoteRepository(repoUrl)) else: raise "Invalid protocol!", protocol artifacts = self._filterArtifactsByPatterns(artifacts, gavPatterns) logging.debug("Found %d artifacts", len(artifacts)) return artifacts