Search in sources :

Example 21 with HadoopClusterConnection

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;
}
Also used : IElement(org.talend.core.model.process.IElement) DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) SparkComponent(org.talend.hadoop.distribution.component.SparkComponent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 22 with HadoopClusterConnection

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()));
}
Also used : HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection)

Example 23 with HadoopClusterConnection

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;
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 24 with HadoopClusterConnection

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;
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 25 with HadoopClusterConnection

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;
}
Also used : ContextItem(org.talend.core.model.properties.ContextItem) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) HadoopSubConnectionItem(org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) ContextType(org.talend.designer.core.model.utils.emf.talendfile.ContextType) HashMap(java.util.HashMap) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopServiceProperties(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceProperties)

Aggregations

HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)78 HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)30 Test (org.junit.Test)15 ContextItem (org.talend.core.model.properties.ContextItem)14 ContextType (org.talend.designer.core.model.utils.emf.talendfile.ContextType)13 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)9 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 Item (org.talend.core.model.properties.Item)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)7 ConnectionItem (org.talend.core.model.properties.ConnectionItem)6 HadoopSubConnectionItem (org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem)6 File (java.io.File)5 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 List (java.util.List)4 PersistenceException (org.talend.commons.exception.PersistenceException)4 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)4