Search in sources :

Example 1 with FileSystemType

use of com.sequenceiq.cloudbreak.api.model.FileSystemType in project cloudbreak by hortonworks.

the class FileSystemConfigurationProvider method fileSystemConfiguration.

public FileSystemConfiguration fileSystemConfiguration(FileSystem fs, Stack stack) throws IOException {
    FileSystemConfiguration fileSystemConfiguration = null;
    if (fs != null) {
        FileSystemType fileSystemType = FileSystemType.valueOf(fs.getType());
        String json = JsonUtil.writeValueAsString(fs.getProperties());
        fileSystemConfiguration = JsonUtil.readValue(json, fileSystemType.getClazz());
        if (stack != null) {
            fileSystemConfiguration = decorateFsConfigurationProperties(fileSystemConfiguration, stack);
        }
    }
    return fileSystemConfiguration;
}
Also used : FileSystemType(com.sequenceiq.cloudbreak.api.model.FileSystemType) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Example 2 with FileSystemType

use of com.sequenceiq.cloudbreak.api.model.FileSystemType in project cloudbreak by hortonworks.

the class BlueprintComponentProviderProcessor method extendBlueprintWithFsConfig.

private String extendBlueprintWithFsConfig(BlueprintTextProcessor blueprintProcessor, FileSystemConfiguration fsConfiguration, boolean defaultFs) {
    FileSystemType fileSystemType = FileSystemType.fromClass(fsConfiguration.getClass());
    FileSystemConfigurator<FileSystemConfiguration> fsConfigurator = fileSystemConfigurators.get(fileSystemType);
    Map<String, String> resourceProperties = fsConfigurator.createResources(fsConfiguration);
    List<BlueprintConfigurationEntry> bpConfigEntries = fsConfigurator.getFsProperties(fsConfiguration, resourceProperties);
    if (defaultFs) {
        bpConfigEntries.addAll(fsConfigurator.getDefaultFsProperties(fsConfiguration));
    }
    return blueprintProcessor.addConfigEntries(bpConfigEntries, true).asText();
}
Also used : FileSystemType(com.sequenceiq.cloudbreak.api.model.FileSystemType) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Aggregations

FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)2 FileSystemType (com.sequenceiq.cloudbreak.api.model.FileSystemType)2