Search in sources :

Example 11 with HCatalogConnection

use of org.talend.repository.model.hcatalog.HCatalogConnection in project tbd-studio-se by Talend.

the class PushHCatalogIntoHadoopClusterMigrationTask method initCluster.

/*
     * (non-Javadoc)
     *
     * @see
     * org.talend.repository.hadoopcluster.model.migration.AbstractHadoopClusterMigrationTask#initCluster(org.talend
     * .repository.model.hadoopcluster.HadoopClusterConnection,
     * org.talend.repository.model.hadoopcluster.HadoopSubConnection)
     */
@Override
protected void initCluster(HadoopClusterConnection clusterConnection, HadoopSubConnection hadoopSubConnection) throws Exception {
    super.initCluster(clusterConnection, hadoopSubConnection);
    HCatalogConnection hCatConnection = (HCatalogConnection) hadoopSubConnection;
    clusterConnection.setDfVersion(hCatConnection.getHcatVersion());
    clusterConnection.setPrincipal(hCatConnection.getNnPrincipal());
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection)

Example 12 with HCatalogConnection

use of org.talend.repository.model.hcatalog.HCatalogConnection in project tbd-studio-se by Talend.

the class PushHCatalogIntoHadoopClusterMigrationTask method getClusterName.

/*
     * (non-Javadoc)
     *
     * @see
     * org.talend.repository.hadoopcluster.model.migration.AbstractHadoopClusterMigrationTask#getClusterName(org.talend
     * .repository.model.hadoopcluster.HadoopConnection)
     */
@Override
protected String getClusterName(HadoopSubConnection hadoopSubConnection) {
    StringBuffer cnBuffer = new StringBuffer();
    HCatalogConnection connection = (HCatalogConnection) hadoopSubConnection;
    EHadoopVersion4Drivers version = EHadoopVersion4Drivers.indexOfByVersion(connection.getHcatVersion());
    String hostName = connection.getHostName();
    if (version != null) {
        cnBuffer.append(version.getVersionValue());
        cnBuffer.append(UNDER_LINE);
    }
    if (hostName != null) {
        cnBuffer.append(hostName);
    }
    String clusterName = cnBuffer.toString();
    // $NON-NLS-1$
    clusterName = clusterName.replaceAll("[^a-zA-Z0-9_]", UNDER_LINE);
    return clusterName;
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) EHadoopVersion4Drivers(org.talend.core.hadoop.version.EHadoopVersion4Drivers)

Example 13 with HCatalogConnection

use of org.talend.repository.model.hcatalog.HCatalogConnection in project tbd-studio-se by Talend.

the class HCatalogContextHandler method revertPropertiesForContextMode.

@Override
public void revertPropertiesForContextMode(Connection connection, ContextType contextType) {
    if (connection instanceof HCatalogConnection) {
        HCatalogConnection conn = (HCatalogConnection) connection;
        String hostName = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getHostName()));
        String port = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getPort()));
        String userName = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getUserName()));
        String password = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getValue(conn.getPassword(), false)));
        String kerberosPrin = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getKrbPrincipal()));
        String kerberosRealm = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getKrbRealm()));
        String database = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getDatabase()));
        String rowSeparator = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getRowSeparator()));
        String fileSeparator = TalendQuoteUtils.removeQuotes(ContextParameterUtils.getOriginalValue(contextType, conn.getFieldSeparator()));
        String hadoopProperties = conn.getHadoopProperties();
        List<Map<String, Object>> propertiesAfterRevert = transformContextModeToHadoopProperties(HadoopRepositoryUtil.getHadoopPropertiesList(hadoopProperties), contextType);
        conn.setHadoopProperties(HadoopRepositoryUtil.getHadoopPropertiesJsonStr(propertiesAfterRevert));
        conn.setHostName(hostName);
        conn.setPort(port);
        conn.setUserName(userName);
        conn.setPassword(password);
        conn.setKrbPrincipal(kerberosPrin);
        conn.setKrbRealm(kerberosRealm);
        conn.setDatabase(database);
        conn.setRowSeparator(rowSeparator);
        conn.setFieldSeparator(fileSeparator);
    }
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) Map(java.util.Map)

Example 14 with HCatalogConnection

use of org.talend.repository.model.hcatalog.HCatalogConnection in project tbd-studio-se by Talend.

the class HCatalogContextHandler method matchAdditionProperties.

@Override
protected void matchAdditionProperties(Connection conn, Map<ContextItem, List<ConectionAdaptContextVariableModel>> adaptMap) {
    if (conn instanceof HCatalogConnection) {
        HCatalogConnection hadoopConn = (HCatalogConnection) conn;
        if (adaptMap != null && !adaptMap.isEmpty()) {
            List<Map<String, Object>> hadoopListProperties = HadoopRepositoryUtil.getHadoopPropertiesList(hadoopConn.getHadoopProperties());
            Set<String> keys = getConAdditionPropertiesForContextMode(conn);
            for (Map.Entry<ContextItem, List<ConectionAdaptContextVariableModel>> entry : adaptMap.entrySet()) {
                List<ConectionAdaptContextVariableModel> modelList = entry.getValue();
                for (ConectionAdaptContextVariableModel model : modelList) {
                    String propertyKey = model.getValue();
                    if (keys.contains(propertyKey)) {
                        List<Map<String, Object>> propertiesAfterContext = transformHadoopPropertiesForExistContextMode(hadoopListProperties, propertyKey, model.getName());
                        hadoopConn.setHadoopProperties(HadoopRepositoryUtil.getHadoopPropertiesJsonStr(propertiesAfterContext));
                    }
                }
            }
        }
    }
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) ContextItem(org.talend.core.model.properties.ContextItem) ArrayList(java.util.ArrayList) List(java.util.List) ConectionAdaptContextVariableModel(org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel) Map(java.util.Map)

Aggregations

HCatalogConnection (org.talend.repository.model.hcatalog.HCatalogConnection)14 Map (java.util.Map)5 ArrayList (java.util.ArrayList)4 EHadoopParamName (org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName)4 IConnParamName (org.talend.metadata.managment.ui.model.IConnParamName)3 List (java.util.List)2 ContextItem (org.talend.core.model.properties.ContextItem)2 ConectionAdaptContextVariableModel (org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel)2 HashSet (java.util.HashSet)1 EHadoopVersion4Drivers (org.talend.core.hadoop.version.EHadoopVersion4Drivers)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1 IContextParameter (org.talend.core.model.process.IContextParameter)1 Property (org.talend.core.model.properties.Property)1 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)1 TdTable (org.talend.cwm.relational.TdTable)1 HCatalogNode (org.talend.repository.hcatalog.model.HCatalogNode)1 IHCatalogNode (org.talend.repository.hcatalog.model.IHCatalogNode)1 HadoopSubConnectionItem (org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem)1 HCatalogConnectionItem (org.talend.repository.model.hcatalog.HCatalogConnectionItem)1