use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopSubMultiRepTypeProcessor method isValidAttributes.
private boolean isValidAttributes(RepositoryNode node) {
if (node == null) {
return true;
}
if (attributesMap != null && !attributesMap.isEmpty()) {
HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(node.getId());
if (hcConnection != null) {
IElement elem = (IElement) attributesMap.get(ELEMENT);
DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
if (hadoopDistribution != null) {
DistributionVersion distributionVersion = hadoopDistribution.getVersion(hcConnection.getDfVersion(), false);
if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
boolean validated = true;
Object isSpark = attributesMap.get(ISSPARK);
if (isSpark != null && Boolean.valueOf(isSpark.toString())) {
validated = (validated && distributionVersion.hadoopComponent instanceof SparkComponent);
if (!validated) {
return false;
}
}
Object useYarn = attributesMap.get(USEYARN);
if (useYarn != null && Boolean.valueOf(useYarn.toString())) {
// CustomDistribution.doSupportSparkYarnClusterMode = true
if (ICustomDistribution.DISTRIBUTION_NAME.equals(distributionVersion.hadoopComponent.getDistribution())) {
validated = true;
} else {
validated = (validated && (distributionVersion.hadoopComponent.isHadoop2() || distributionVersion.hadoopComponent.isHadoop3()));
}
if (!validated) {
return false;
}
}
}
}
}
}
return true;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class CreateHiveAction method initConnectionParameters.
@Override
protected void initConnectionParameters(Map<String, String> initMap, HadoopClusterConnectionItem hcConnectionItem) {
super.initConnectionParameters(initMap, hcConnectionItem);
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
initMap.put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS, hcConnection.getParameters().get(ECustomVersionGroup.HIVE.getName()));
initMap.put(ConnParameterKeys.CONN_PARA_KEY_DB_TYPE, EDatabaseConnTemplate.HIVE.getDBTypeName());
initMap.put(ConnParameterKeys.CONN_PARA_KEY_DB_PRODUCT, EDatabaseTypeName.HIVE.getProduct());
initMap.put(ConnParameterKeys.CONN_PARA_KEY_DB_PORT, EDatabaseConnTemplate.HIVE.getDefaultPort());
initMap.put(ConnParameterKeys.CONN_PARA_KEY_USERNAME, ConnectionContextHelper.getParamValueOffContext(hcConnection, hcConnection.getUserName()));
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class CreateHiveAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
DistributionBean hiveDistribution = HadoopDistributionsHelper.HIVE.getDistribution(hcConnection.getDistribution(), false);
if (hiveDistribution != null) {
IHDistributionVersion hdVersion = hiveDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null && !IMicrosoftHDInsightDistribution.DISTRIBUTION_NAME.equals(hdVersion.getDistribution().getName())) {
// found and not HD Insight, don't hide
return false;
}
}
}
return true;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class CreateHCatalogAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
// First check if the Distribution is a HD Insight one.
DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
if (hadoopDistribution != null) {
IHDistributionVersion hdVersion = hadoopDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null && IMicrosoftHDInsightDistribution.DISTRIBUTION_NAME.equals(hdVersion.getDistribution().getName())) {
return false;
}
}
// If not, check if the Distribution implements HCatalogComponent
DistributionBean hcatalogDistribution = HadoopDistributionsHelper.HCATALOG.getDistribution(hcConnection.getDistribution(), false);
if (hcatalogDistribution != null) {
IHDistributionVersion hdVersion = hcatalogDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null) {
// found, don't hide
return false;
}
}
}
return true;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterService method getHadoopSSLParameters.
@Override
public Map<String, String> getHadoopSSLParameters(String clusterId) {
Map<String, String> sslParameters = new HashMap<>();
HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(clusterId);
if (hcConnection == null) {
Item hcItem = getHadoopClusterBySubitemId(clusterId);
if (hcItem != null) {
hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(hcItem.getProperty().getId());
}
}
if (hcConnection != null && hcConnection.isUseWebHDFSSSL()) {
HadoopServiceProperties nnProperties = new HadoopServiceProperties();
ContextType contextType = null;
if (hcConnection.isContextMode()) {
contextType = ConnectionContextHelper.getContextTypeForContextMode(hcConnection, true);
}
nnProperties.setContextType(contextType);
nnProperties.setWebHDFSSSLTrustStorePath(hcConnection.getWebHDFSSSLTrustStorePath());
nnProperties.setWebHDFSSSLTrustStorePassword(hcConnection.getWebHDFSSSLTrustStorePassword());
sslParameters.put(ConnParameterKeys.CONN_PARA_KEY_WEBHDFS_SSL_TRUST_STORE_PATH, nnProperties.getWebHDFSSSLTrustStorePath());
sslParameters.put(ConnParameterKeys.CONN_PARA_KEY_WEBHDFS_SSL_TRUST_STORE_PASSWORD, nnProperties.getWebHDFSSSLTrustStorePassword());
}
return sslParameters;
}
Aggregations