Search in sources :

Example 1 with DownloadInfo

use of com.google.gerrit.extensions.common.DownloadInfo in project gerrit by GerritCodeReview.

the class GetServerInfo method getDownloadInfo.

private DownloadInfo getDownloadInfo(DynamicMap<DownloadScheme> downloadSchemes, DynamicMap<DownloadCommand> downloadCommands, DynamicMap<CloneCommand> cloneCommands, AllowedFormats archiveFormats) {
    DownloadInfo info = new DownloadInfo();
    info.schemes = new HashMap<>();
    for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
        DownloadScheme scheme = e.getProvider().get();
        if (scheme.isEnabled() && scheme.getUrl("${project}") != null) {
            info.schemes.put(e.getExportName(), getDownloadSchemeInfo(scheme, downloadCommands, cloneCommands));
        }
    }
    info.archives = archiveFormats.getAllowed().stream().map(ArchiveFormat::getShortName).collect(toList());
    return info;
}
Also used : DynamicMap(com.google.gerrit.extensions.registration.DynamicMap) ArchiveFormat(com.google.gerrit.server.change.ArchiveFormat) DownloadInfo(com.google.gerrit.extensions.common.DownloadInfo) DownloadScheme(com.google.gerrit.extensions.config.DownloadScheme)

Example 2 with DownloadInfo

use of com.google.gerrit.extensions.common.DownloadInfo in project gerrit by GerritCodeReview.

the class GetServerInfo method getDownloadInfo.

private DownloadInfo getDownloadInfo() {
    DownloadInfo info = new DownloadInfo();
    info.schemes = new HashMap<>();
    downloadSchemes.runEach(extension -> {
        DownloadScheme scheme = extension.get();
        if (scheme.isEnabled() && scheme.getUrl("${project}") != null) {
            info.schemes.put(extension.getExportName(), getDownloadSchemeInfo(scheme));
        }
    });
    info.archives = archiveFormats.getAllowed().stream().map(ArchiveFormatInternal::getShortName).collect(toList());
    return info;
}
Also used : DownloadInfo(com.google.gerrit.extensions.common.DownloadInfo) DownloadScheme(com.google.gerrit.extensions.config.DownloadScheme) ArchiveFormatInternal(com.google.gerrit.server.change.ArchiveFormatInternal)

Aggregations

DownloadInfo (com.google.gerrit.extensions.common.DownloadInfo)2 DownloadScheme (com.google.gerrit.extensions.config.DownloadScheme)2 DynamicMap (com.google.gerrit.extensions.registration.DynamicMap)1 ArchiveFormat (com.google.gerrit.server.change.ArchiveFormat)1 ArchiveFormatInternal (com.google.gerrit.server.change.ArchiveFormatInternal)1