Search in sources :

Example 1 with EHadoopParamName

use of org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName in project tbd-studio-se by Talend.

the class HCatalogContextHandler method setPropertiesForContextMode.

@Override
public void setPropertiesForContextMode(String prefixName, Connection connection, Set<IConnParamName> paramSet) {
    if (connection == null) {
        return;
    }
    if (connection instanceof HCatalogConnection) {
        HCatalogConnection conn = (HCatalogConnection) connection;
        String originalVariableName = prefixName + ConnectionContextHelper.LINE;
        String hadoopVariableName = null;
        for (IConnParamName param : paramSet) {
            if (param instanceof EHadoopParamName) {
                EHadoopParamName hcatalogConnectionParam = (EHadoopParamName) param;
                originalVariableName = prefixName + ConnectionContextHelper.LINE;
                hadoopVariableName = originalVariableName + hcatalogConnectionParam;
                matchContextForAttribues(conn, hcatalogConnectionParam, hadoopVariableName);
            }
        }
        String hadoopProperties = conn.getHadoopProperties();
        List<Map<String, Object>> propertiesAfterContext = transformHadoopPropertiesForContextMode(HadoopRepositoryUtil.getHadoopPropertiesList(hadoopProperties), prefixName);
        conn.setHadoopProperties(HadoopRepositoryUtil.getHadoopPropertiesJsonStr(propertiesAfterContext));
    }
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) EHadoopParamName(org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName) IConnParamName(org.talend.metadata.managment.ui.model.IConnParamName) Map(java.util.Map)

Example 2 with EHadoopParamName

use of org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName in project tbd-studio-se by Talend.

the class HCatalogContextHandler method setPropertiesForExistContextMode.

@Override
public void setPropertiesForExistContextMode(Connection connection, Set<IConnParamName> paramSet, Map<ContextItem, List<ConectionAdaptContextVariableModel>> adaptMap) {
    if (connection == null) {
        return;
    }
    if (connection instanceof HCatalogConnection) {
        HCatalogConnection hcatalogConn = (HCatalogConnection) connection;
        ContextItem currentContext = null;
        for (IConnParamName param : paramSet) {
            if (param instanceof EHadoopParamName) {
                String hcatalogVariableName = null;
                EHadoopParamName hcatalogParam = (EHadoopParamName) param;
                if (adaptMap != null && adaptMap.size() > 0) {
                    for (Map.Entry<ContextItem, List<ConectionAdaptContextVariableModel>> entry : adaptMap.entrySet()) {
                        currentContext = entry.getKey();
                        List<ConectionAdaptContextVariableModel> modelList = entry.getValue();
                        for (ConectionAdaptContextVariableModel model : modelList) {
                            if (model.getValue().equals(hcatalogParam.name())) {
                                hcatalogVariableName = model.getName();
                                break;
                            }
                        }
                    }
                }
                if (hcatalogVariableName != null) {
                    hcatalogVariableName = getCorrectVariableName(currentContext, hcatalogVariableName, hcatalogParam);
                    matchContextForAttribues(hcatalogConn, hcatalogParam, hcatalogVariableName);
                }
            }
        }
        matchAdditionProperties(hcatalogConn, adaptMap);
    }
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) ContextItem(org.talend.core.model.properties.ContextItem) EHadoopParamName(org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName) IConnParamName(org.talend.metadata.managment.ui.model.IConnParamName) ArrayList(java.util.ArrayList) List(java.util.List) ConectionAdaptContextVariableModel(org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel) Map(java.util.Map)

Example 3 with EHadoopParamName

use of org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName in project tbd-studio-se by Talend.

the class HCatalogContextHandler method matchContextForAttribues.

@Override
protected void matchContextForAttribues(Connection conn, IConnParamName paramName, String hcatalogVariableName) {
    HCatalogConnection hcatalogConn = (HCatalogConnection) conn;
    EHadoopParamName hcatalogParam = (EHadoopParamName) paramName;
    switch(hcatalogParam) {
        case HCatalogHostName:
            hcatalogConn.setHostName(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HCatalogPort:
            hcatalogConn.setPort(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HCatalogUser:
            hcatalogConn.setUserName(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HCatalogPassword:
            hcatalogConn.setPassword(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HCatalogKerPrin:
            hcatalogConn.setKrbPrincipal(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HCatalogRealm:
            hcatalogConn.setKrbRealm(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HCatalogDatabase:
            hcatalogConn.setDatabase(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HcataLogRowSeparator:
            hcatalogConn.setRowSeparator(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        case HcatalogFileSeparator:
            hcatalogConn.setFieldSeparator(ContextParameterUtils.getNewScriptCode(hcatalogVariableName, LANGUAGE));
            break;
        default:
    }
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) EHadoopParamName(org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName)

Example 4 with EHadoopParamName

use of org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName in project tbd-studio-se by Talend.

the class HdfsContextHandler method setPropertiesForContextMode.

@Override
public void setPropertiesForContextMode(String prefixName, Connection connection, Set<IConnParamName> paramSet) {
    if (connection == null) {
        return;
    }
    if (connection instanceof HDFSConnection) {
        HDFSConnection hdfsConn = (HDFSConnection) connection;
        String originalVariableName = prefixName + ConnectionContextHelper.LINE;
        String hdfsVariableName = null;
        for (IConnParamName param : paramSet) {
            if (param instanceof EHadoopParamName) {
                EHadoopParamName hdfsConnectionParam = (EHadoopParamName) param;
                originalVariableName = prefixName + ConnectionContextHelper.LINE;
                hdfsVariableName = originalVariableName + hdfsConnectionParam;
                matchContextForAttribues(hdfsConn, hdfsConnectionParam, hdfsVariableName);
            }
        }
        String hadoopProperties = hdfsConn.getHadoopProperties();
        List<Map<String, Object>> propertiesAfterContext = transformHadoopPropertiesForContextMode(HadoopRepositoryUtil.getHadoopPropertiesList(hadoopProperties), prefixName);
        hdfsConn.setHadoopProperties(HadoopRepositoryUtil.getHadoopPropertiesJsonStr(propertiesAfterContext));
    }
}
Also used : EHadoopParamName(org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName) HDFSConnection(org.talend.repository.model.hdfs.HDFSConnection) IConnParamName(org.talend.metadata.managment.ui.model.IConnParamName) Map(java.util.Map)

Example 5 with EHadoopParamName

use of org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName in project tbd-studio-se by Talend.

the class HdfsContextHandler method matchContextForAttribues.

@Override
protected void matchContextForAttribues(Connection conn, IConnParamName paramName, String hdfsVariableName) {
    HDFSConnection hdfsConn = (HDFSConnection) conn;
    EHadoopParamName hdfsParam = (EHadoopParamName) paramName;
    switch(hdfsParam) {
        case HdfsUser:
            hdfsConn.setUserName(ContextParameterUtils.getNewScriptCode(hdfsVariableName, LANGUAGE));
            break;
        case HdfsRowSeparator:
            hdfsConn.setRowSeparator(ContextParameterUtils.getNewScriptCode(hdfsVariableName, LANGUAGE));
            break;
        case HdfsFileSeparator:
            hdfsConn.setFieldSeparator(ContextParameterUtils.getNewScriptCode(hdfsVariableName, LANGUAGE));
            break;
        case HdfsRowHeader:
            hdfsConn.setHeaderValue(ContextParameterUtils.getNewScriptCode(hdfsVariableName, LANGUAGE));
            break;
        default:
    }
}
Also used : EHadoopParamName(org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName) HDFSConnection(org.talend.repository.model.hdfs.HDFSConnection)

Aggregations

EHadoopParamName (org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName)16 IConnParamName (org.talend.metadata.managment.ui.model.IConnParamName)12 ArrayList (java.util.ArrayList)8 Map (java.util.Map)8 List (java.util.List)4 IContextParameter (org.talend.core.model.process.IContextParameter)4 ContextItem (org.talend.core.model.properties.ContextItem)4 ConectionAdaptContextVariableModel (org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel)4 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)4 HCatalogConnection (org.talend.repository.model.hcatalog.HCatalogConnection)4 HDFSConnection (org.talend.repository.model.hdfs.HDFSConnection)4 NoSQLConnection (org.talend.repository.model.nosql.NoSQLConnection)4 JSONArray (org.talend.utils.json.JSONArray)3 JSONException (org.talend.utils.json.JSONException)3 JSONObject (org.talend.utils.json.JSONObject)3 JavaType (org.talend.core.model.metadata.types.JavaType)1