Search in sources :

Example 1 with ApiConfigFile

use of org.apache.ambari.api.model.ApiConfigFile in project components by Talend.

the class HadoopAmbariCluster method distributeConfigFilesToService.

private Map<HadoopHostedService, HadoopClusterService> distributeConfigFilesToService(String serviceName, List<ApiConfigFile> configs) {
    Map<HadoopHostedService, HadoopClusterService> servicesMapping = new HashMap<HadoopHostedService, HadoopClusterService>();
    HadoopHostedService service = HadoopHostedService.fromString(serviceName);
    if (service == HadoopHostedService.HIVE) {
        ApiConfigFile hcatalogConfig = null;
        for (ApiConfigFile file : configs) {
            if ("webhcat-site".equals(file.getType())) {
                hcatalogConfig = file;
                break;
            }
        }
        if (hcatalogConfig != null) {
            configs.remove(hcatalogConfig);
            servicesMapping.put(HadoopHostedService.WEBHCAT, new HadoopAmbariClusterService(Arrays.asList(hcatalogConfig), blacklistParams));
        }
    }
    servicesMapping.put(service, new HadoopAmbariClusterService(configs, blacklistParams));
    return servicesMapping;
}
Also used : HashMap(java.util.HashMap) ApiConfigFile(org.apache.ambari.api.model.ApiConfigFile)

Example 2 with ApiConfigFile

use of org.apache.ambari.api.model.ApiConfigFile in project components by Talend.

the class HadoopAmbariClusterService method init.

private void init(List<String> blacklistParams) {
    confs = new HashMap<>();
    for (ApiConfigFile file : configFiles) {
        String type = file.getType();
        if (!type.endsWith(SUPPORT_FILE)) {
            continue;
        }
        Configuration conf = new Configuration(false);
        Map<String, String> properties = file.getProperties();
        for (String key : properties.keySet()) {
            if (blacklistParams != null && blacklistParams.contains(key)) {
                continue;
            }
            conf.set(key, properties.get(key));
        }
        confs.put(type, conf);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ApiConfigFile(org.apache.ambari.api.model.ApiConfigFile)

Example 3 with ApiConfigFile

use of org.apache.ambari.api.model.ApiConfigFile in project tbd-studio-se by Talend.

the class HadoopAmbariCluster method getConfigFiles.

private List<ApiConfigFile> getConfigFiles(Map<String, String> actualConfigFilesVersion) {
    List<ApiConfigFile> configFiles = new ArrayList<>();
    for (String type : actualConfigFilesVersion.keySet()) {
        String version = actualConfigFilesVersion.get(type);
        ApiConfigFileList2 configFile = cluster.getConfigsResource().readConfig(type, version);
        configFiles.addAll(configFile.getFiles());
    }
    return configFiles;
}
Also used : ArrayList(java.util.ArrayList) ApiConfigFile(org.apache.ambari.api.model.ApiConfigFile) ApiConfigFileList2(org.apache.ambari.api.model.ApiConfigFileList2)

Example 4 with ApiConfigFile

use of org.apache.ambari.api.model.ApiConfigFile in project tbd-studio-se by Talend.

the class HadoopAmbariCluster method distributeConfigFilesToService.

private Map<HadoopHostedService, HadoopClusterService> distributeConfigFilesToService(String serviceName, List<ApiConfigFile> configs) {
    Map<HadoopHostedService, HadoopClusterService> servicesMapping = new HashMap<HadoopHostedService, HadoopClusterService>();
    HadoopHostedService service = HadoopHostedService.fromString(serviceName);
    if (service == HadoopHostedService.HIVE) {
        ApiConfigFile hcatalogConfig = null;
        for (ApiConfigFile file : configs) {
            if ("webhcat-site".equals(file.getType())) {
                // $NON-NLS-1$
                hcatalogConfig = file;
                break;
            }
        }
        if (hcatalogConfig != null) {
            configs.remove(hcatalogConfig);
            servicesMapping.put(HadoopHostedService.WEBHCAT, new HadoopAmbariClusterService(Arrays.asList(hcatalogConfig), blacklistParams));
        }
    }
    servicesMapping.put(service, new HadoopAmbariClusterService(configs, blacklistParams));
    return servicesMapping;
}
Also used : HadoopHostedService(org.talend.repository.hadoopcluster.configurator.HadoopHostedService) HashMap(java.util.HashMap) HadoopClusterService(org.talend.repository.hadoopcluster.configurator.HadoopClusterService) ApiConfigFile(org.apache.ambari.api.model.ApiConfigFile)

Example 5 with ApiConfigFile

use of org.apache.ambari.api.model.ApiConfigFile in project components by Talend.

the class HadoopAmbariCluster method getConfigFiles.

private List<ApiConfigFile> getConfigFiles(Map<String, String> actualConfigFilesVersion) {
    List<ApiConfigFile> configFiles = new ArrayList<>();
    for (String type : actualConfigFilesVersion.keySet()) {
        String version = actualConfigFilesVersion.get(type);
        ApiConfigFileList2 configFile = cluster.getConfigsResource().readConfig(type, version);
        configFiles.addAll(configFile.getFiles());
    }
    return configFiles;
}
Also used : ArrayList(java.util.ArrayList) ApiConfigFile(org.apache.ambari.api.model.ApiConfigFile) ApiConfigFileList2(org.apache.ambari.api.model.ApiConfigFileList2)

Aggregations

ApiConfigFile (org.apache.ambari.api.model.ApiConfigFile)6 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ApiConfigFileList2 (org.apache.ambari.api.model.ApiConfigFileList2)2 Configuration (org.apache.hadoop.conf.Configuration)2 HadoopClusterService (org.talend.repository.hadoopcluster.configurator.HadoopClusterService)1 HadoopHostedService (org.talend.repository.hadoopcluster.configurator.HadoopHostedService)1