use of org.talend.repository.model.hcatalog.HCatalogConnection 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));
}
}
use of org.talend.repository.model.hcatalog.HCatalogConnection 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);
}
}
use of org.talend.repository.model.hcatalog.HCatalogConnection in project tbd-studio-se by Talend.
the class HCatalogContextHandler method getConAdditionPropertiesForContextMode.
@Override
public Set<String> getConAdditionPropertiesForContextMode(Connection conn) {
Set<String> conVarList = new HashSet<String>();
if (conn instanceof HCatalogConnection) {
HCatalogConnection hcatalogConn = (HCatalogConnection) conn;
conVarList = getConAdditionProperties(HadoopRepositoryUtil.getHadoopPropertiesList(hcatalogConn.getHadoopProperties()));
}
return conVarList;
}
use of org.talend.repository.model.hcatalog.HCatalogConnection in project tbd-studio-se by Talend.
the class HCatalogConnectionCreator method create.
@Override
public ConnectionItem create(Map<String, Map<String, String>> initParams) throws CoreException {
HCatalogConnection connection = HCatalogFactory.eINSTANCE.createHCatalogConnection();
Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
setPropertyParameters(connectionProperty);
initializeConnectionParameters(connection);
HadoopSubConnectionItem connectionItem = HCatalogFactory.eINSTANCE.createHCatalogConnectionItem();
connectionItem.setProperty(connectionProperty);
connectionItem.setConnection(connection);
setParameters(connection, initParams);
appendToHadoopCluster(connectionItem);
return connectionItem;
}
use of org.talend.repository.model.hcatalog.HCatalogConnection 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:
}
}
Aggregations