use of com.sequenceiq.cloudbreak.api.model.FileSystemBase in project cloudbreak by hortonworks.
the class ClusterRequestToClusterConverter method convert.
@Override
public Cluster convert(ClusterRequest source) {
Cluster cluster = new Cluster();
cluster.setName(source.getName());
cluster.setStatus(REQUESTED);
cluster.setDescription(source.getDescription());
cluster.setEmailNeeded(source.getEmailNeeded());
cluster.setUserName(source.getUserName());
cluster.setPassword(source.getPassword());
cluster.setExecutorType(source.getExecutorType());
Boolean enableSecurity = source.getEnableSecurity();
cluster.setSecure(enableSecurity == null ? Boolean.FALSE : enableSecurity);
convertKnox(source, cluster);
if (source.getKerberos() != null) {
KerberosConfig kerberosConfig = getConversionService().convert(source.getKerberos(), KerberosConfig.class);
cluster.setKerberosConfig(kerberosConfig);
}
cluster.setConfigStrategy(source.getConfigStrategy());
cluster.setEmailTo(source.getEmailTo());
FileSystemBase fileSystem = source.getFileSystem();
cluster.setCloudbreakAmbariPassword(PasswordUtil.generatePassword());
cluster.setCloudbreakAmbariUser("cloudbreak");
convertAttributes(source, cluster);
if (fileSystem != null) {
cluster.setFileSystem(getConversionService().convert(fileSystem, FileSystem.class));
}
Map<String, String> inputs = source.getBlueprintInputs() == null ? Collections.emptyMap() : convertBlueprintInputJsons(source.getBlueprintInputs());
try {
cluster.setBlueprintInputs(new Json(inputs));
if (source.getBlueprintCustomProperties() != null) {
cluster.setBlueprintCustomProperties(source.getBlueprintCustomProperties());
} else {
cluster.setBlueprintCustomProperties(null);
}
} catch (JsonProcessingException ignored) {
cluster.setBlueprintInputs(null);
}
try {
Json json = new Json(convertContainerConfigs(source.getCustomContainer()));
cluster.setCustomContainerDefinition(json);
} catch (JsonProcessingException ignored) {
cluster.setCustomContainerDefinition(null);
}
cluster.setAmbariSecurityMasterKey(source.getAmbariSecurityMasterKey());
return cluster;
}
Aggregations