Search in sources :

Example 1 with CloudStorageSupportedV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.CloudStorageSupportedV4Response in project cloudbreak by hortonworks.

the class FileSystemSupportMatrixService method getCloudStorageMatrix.

public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) {
    VersionComparator versionComparator = new VersionComparator();
    Set<CloudStorageSupportedV4Response> response = new HashSet<>();
    cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> {
        Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream().filter(supportConfigEntry -> {
            Versioned minVersion = supportConfigEntry::getMinVersion;
            Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length() ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion;
            int compared = versionComparator.compare(minVersion, currentVersion);
            return compared <= 0;
        }).map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem).collect(Collectors.toSet());
        if (!supportedFileSystems.isEmpty()) {
            CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response();
            cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider());
            cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems);
            response.add(cloudStorageSupportedV4Response);
        }
    });
    return response;
}
Also used : Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) VersionComparator(com.sequenceiq.cloudbreak.util.VersionComparator) CloudStorageSupportedV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.CloudStorageSupportedV4Response) HashSet(java.util.HashSet)

Aggregations

CloudStorageSupportedV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.CloudStorageSupportedV4Response)1 Versioned (com.sequenceiq.cloudbreak.common.type.Versioned)1 VersionComparator (com.sequenceiq.cloudbreak.util.VersionComparator)1 HashSet (java.util.HashSet)1