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());
}
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;
}
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);
}
}
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));
}
}
}
}
}
}
Aggregations