use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class StandardHCInfoForm method updateForm.
@Override
public void updateForm() {
HadoopClusterConnection connection = getConnection();
final DistributionVersion distributionVersion = getDistributionVersion();
if (distributionVersion.distribution.useCustom()) {
hideControl(customGroup, false);
String authModeName = connection.getAuthMode();
if (authModeName != null) {
EAuthenticationMode authMode = EAuthenticationMode.getAuthenticationByName(authModeName, false);
switch(authMode) {
case KRB:
kerberosBtn.setEnabled(true);
namenodePrincipalText.setEditable(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
jtOrRmPrincipalText.setEditable(namenodePrincipalText.getEditable());
jobHistoryPrincipalText.setEditable(isJobHistoryPrincipalEditable());
keytabBtn.setEnabled(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
keytabPrincipalText.setEditable(keytabBtn.isEnabled() && keytabBtn.getSelection());
keytabText.setEditable(keytabBtn.isEnabled() && keytabBtn.getSelection());
keytabPrincipalText.setHideWidgets(!(kerberosBtn.isEnabled() && kerberosBtn.getSelection() && keytabBtn.isEnabled() && keytabBtn.getSelection()));
keytabText.setVisible(kerberosBtn.isEnabled() && kerberosBtn.getSelection() && keytabBtn.isEnabled() && keytabBtn.getSelection());
userNameText.setEditable(false);
groupText.setEditable(false);
// userNameText.setHideWidgets(true);
userNameText.setVisible(false);
groupText.setHideWidgets(true);
hideKerberosControl(!kerberosBtn.getSelection());
hideMaprTicketControl(true);
maprTPasswordText.setEditable(false);
break;
case UGI:
kerberosBtn.setEnabled(true);
namenodePrincipalText.setEditable(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
jtOrRmPrincipalText.setEditable(namenodePrincipalText.getEditable());
jobHistoryPrincipalText.setEditable(namenodePrincipalText.getEditable());
keytabBtn.setEnabled(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
keytabPrincipalText.setEditable(keytabBtn.isEnabled() && keytabBtn.getSelection());
keytabText.setEditable(keytabBtn.isEnabled() && keytabBtn.getSelection());
keytabPrincipalText.setHideWidgets(!(kerberosBtn.isEnabled() && kerberosBtn.getSelection() && keytabBtn.isEnabled() && keytabBtn.getSelection()));
keytabText.setVisible(kerberosBtn.isEnabled() && kerberosBtn.getSelection() && keytabBtn.isEnabled() && keytabBtn.getSelection());
userNameText.setEditable(!(kerberosBtn.isEnabled() && kerberosBtn.getSelection()));
groupText.setEditable(true);
userNameText.setHideWidgets(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
groupText.setHideWidgets(false);
hideKerberosControl(!kerberosBtn.getSelection());
// maprt
hideMaprTicketChildControl(!maprTBtn.getSelection());
maprTPasswordText.setEditable(maprTBtn.isEnabled() && (maprTBtn.getSelection() && !(kerberosBtn.isEnabled() && kerberosBtn.getSelection())));
break;
default:
kerberosBtn.setEnabled(false);
namenodePrincipalText.setEditable(false);
jtOrRmPrincipalText.setEditable(false);
jobHistoryPrincipalText.setEditable(false);
keytabBtn.setEnabled(false);
keytabPrincipalText.setEditable(false);
keytabText.setEditable(false);
userNameText.setEditable(true);
groupText.setEditable(false);
userNameText.setHideWidgets(false);
groupText.setHideWidgets(true);
hideKerberosControl(true);
hideMaprTicketControl(true);
maprTPasswordText.setEditable(false);
break;
}
}
} else {
hideControl(customGroup, true);
kerberosBtn.setEnabled(isCurrentHadoopVersionSupportSecurity());
namenodePrincipalText.setEditable(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
jtOrRmPrincipalText.setEditable(namenodePrincipalText.getEditable());
jobHistoryPrincipalText.setEditable(isJobHistoryPrincipalEditable());
keytabBtn.setEnabled(kerberosBtn.isEnabled() && kerberosBtn.getSelection());
keytabPrincipalText.setEditable(keytabBtn.isEnabled() && keytabBtn.getSelection());
keytabText.setEditable(keytabBtn.isEnabled() && keytabBtn.getSelection());
keytabPrincipalText.setHideWidgets(!(kerberosBtn.isEnabled() && kerberosBtn.getSelection() && keytabBtn.isEnabled() && keytabBtn.getSelection()));
keytabText.setVisible(kerberosBtn.isEnabled() && kerberosBtn.getSelection() && keytabBtn.isEnabled() && keytabBtn.getSelection());
groupText.setEditable(isCurrentHadoopVersionSupportGroup());
userNameText.setEditable(!kerberosBtn.getSelection());
if (isCurrentHadoopVersionSupportGroup()) {
userNameText.setHideWidgets(kerberosBtn.getSelection());
} else {
userNameText.setVisible(!kerberosBtn.getSelection());
}
groupText.setHideWidgets(!isCurrentHadoopVersionSupportGroup());
hideKerberosControl(!kerberosBtn.getSelection());
// maprt
hideControl(maprTBtn, !isCurrentHadoopVersionSupportMapRTicket());
maprTBtn.setEnabled(isCurrentHadoopVersionSupportMapRTicket());
maprTPasswordText.setEditable(maprTBtn.isEnabled() && (maprTBtn.getSelection() && !(kerberosBtn.isEnabled() && kerberosBtn.getSelection())));
maprTClusterText.setEditable(maprTBtn.isEnabled() && maprTBtn.getSelection());
maprTDurationText.setEditable(maprTBtn.isEnabled() && maprTBtn.getSelection());
setMaprTHomeDirBtn.setEnabled(maprTBtn.isEnabled() && maprTBtn.getSelection());
setHadoopLoginBtn.setEnabled(maprTBtn.isEnabled() && maprTBtn.getSelection());
preloadAuthentificationBtn.setEnabled(maprTBtn.isEnabled() && maprTBtn.getSelection());
hideMaprTicketChildControl(!maprTBtn.getSelection());
}
updateMRRelatedContent();
updateConnectionContent();
hideWebHDFSControl(!isCurrentHadoopVersionSupportWebHDFS());
if (isContextMode()) {
adaptFormToEditable();
}
hideFieldsOnSparkMode();
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class StandardHCInfoForm method initCommonProperties.
private void initCommonProperties(HadoopServiceProperties properties) {
properties.setItem(this.connectionItem);
HadoopClusterConnection connection = getConnection();
ContextType contextType = null;
if (getConnection().isContextMode()) {
contextType = ConnectionContextHelper.getContextTypeForContextMode(connection, true);
}
properties.setContextType(contextType);
properties.setDistribution(connection.getDistribution());
properties.setVersion(connection.getDfVersion());
properties.setGroup(connection.getGroup());
properties.setUseKrb(connection.isEnableKerberos());
properties.setCustom(connection.isUseCustomVersion());
properties.setUseCustomConfs(connection.isUseCustomConfs());
properties.setPrincipal(connection.getPrincipal());
properties.setJtOrRmPrincipal(connection.getJtOrRmPrincipal());
properties.setJobHistoryPrincipal(connection.getJobHistoryPrincipal());
properties.setUseKeytab(connection.isUseKeytab());
properties.setKeytabPrincipal(connection.getKeytabPrincipal());
properties.setKeytab(connection.getKeytab());
properties.setHadoopProperties(HadoopRepositoryUtil.getHadoopPropertiesWithOriginalValue(connection.getHadoopProperties(), contextType, false));
properties.setRelativeHadoopClusterId(connectionItem.getProperty().getId());
properties.setRelativeHadoopClusterLabel(connectionItem.getProperty().getLabel());
properties.setMaprT(connection.isEnableMaprT());
properties.setUserName(connection.getUserName());
properties.setMaprTPassword(connection.getMaprTPassword());
properties.setMaprTCluster(connection.getMaprTCluster());
properties.setMaprTDuration(connection.getMaprTDuration());
properties.setSetMaprTHomeDir(connection.isSetMaprTHomeDir());
properties.setSetHadoopLogin(connection.isSetHadoopLogin());
properties.setPreloadAuthentification(connection.isPreloadAuthentification());
properties.setMaprTHomeDir(connection.getMaprTHomeDir());
properties.setMaprTHadoopLogin(connection.getMaprTHadoopLogin());
properties.setSetHadoopConf(connection.isUseCustomConfs() && HCParameterUtil.isOverrideHadoopConfs(connection));
properties.setHadoopConfSpecificJar(ContextParameterUtils.getOriginalValue(contextType, Optional.ofNullable(connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CONF_SPECIFIC_JAR)).orElse("")));
properties.setUseWebHDFSSSL(connection.isUseWebHDFSSSL());
properties.setWebHDFSSSLTrustStorePath(connection.getWebHDFSSSLTrustStorePath());
properties.setWebHDFSSSLTrustStorePassword(connection.getWebHDFSSSLTrustStorePassword());
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class AbstractHadoopSubConnectionCreator method appendToHadoopCluster.
protected void appendToHadoopCluster(HadoopSubConnectionItem connectionItem) {
HadoopSubConnection connection = (HadoopSubConnection) connectionItem.getConnection();
HadoopClusterConnection hcConnection = (HadoopClusterConnection) ((HadoopClusterConnectionItem) relativeHadoopClusterItem).getConnection();
if (hcConnection != null) {
connection.setRelativeHadoopClusterId(relativeHadoopClusterId);
hcConnection.getConnectionList().add(connectionItem.getProperty().getId());
}
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class AbstractHadoopClusterMigrationTask method convert.
protected void convert(ConnectionItem item) throws Exception {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
Connection connection = item.getConnection();
if (connection instanceof HadoopSubConnection) {
HadoopSubConnection hadoopSubConnection = (HadoopSubConnection) connection;
String relClusterId = hadoopSubConnection.getRelativeHadoopClusterId();
if (StringUtils.isNotBlank(relClusterId)) {
modified[0] = false;
return;
} else {
modified[0] = true;
}
HadoopClusterConnection hcConn = null;
HadoopClusterConnectionItem hcConnItem = null;
String migratedHCName = getClusterName(hadoopSubConnection);
List<IRepositoryViewObject> hcRepObjs = factory.getAll(HadoopClusterRepositoryNodeType.HADOOPCLUSTER);
for (IRepositoryViewObject repObj : hcRepObjs) {
if (repObj != null && repObj.getProperty() != null && migratedHCName.equals(repObj.getProperty().getLabel())) {
hcConnItem = (HadoopClusterConnectionItem) repObj.getProperty().getItem();
break;
}
}
if (hcConnItem == null) {
hcConn = HadoopClusterFactory.eINSTANCE.createHadoopClusterConnection();
Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
connectionProperty.setAuthor(((RepositoryContext) CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
// $NON-NLS-1$
connectionProperty.setStatusCode("");
hcConnItem = HadoopClusterFactory.eINSTANCE.createHadoopClusterConnectionItem();
hcConnItem.setProperty(connectionProperty);
hcConnItem.setConnection(hcConn);
connectionProperty.setLabel(migratedHCName);
hcConn.setName(migratedHCName);
hcConn.setLabel(migratedHCName);
String nextId = factory.getNextId();
connectionProperty.setId(nextId);
// $NON-NLS-1$
factory.create(hcConnItem, new Path(""));
}
if (hcConn == null) {
hcConn = (HadoopClusterConnection) hcConnItem.getConnection();
}
initCluster(hcConn, hadoopSubConnection);
factory.save(hcConnItem);
if (hcConnItem != null) {
hadoopSubConnection.setRelativeHadoopClusterId(hcConnItem.getProperty().getId());
factory.save(item);
HCRepositoryUtil.setupConnectionToHadoopCluster(hcConnItem, item.getProperty().getId());
}
}
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterConnectionRelationshipHandler method collect.
@Override
protected Set<Relation> collect(Item baseItem) {
if (baseItem instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem hcItem = (HadoopClusterConnectionItem) baseItem;
HadoopClusterConnection connection = (HadoopClusterConnection) hcItem.getConnection();
if (connection != null) {
String version = connection.getDfVersion();
if (StringUtils.isNotEmpty(version)) {
if (DynamicDistributionManager.getInstance().isUsersDynamicDistribution(version)) {
Set<Relation> relationSet = new HashSet<Relation>();
Relation addedRelation = new Relation();
addedRelation.setId(version);
addedRelation.setType(RelationshipItemBuilder.DYNAMIC_DISTRIBUTION_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
return relationSet;
}
}
}
}
if (baseItem instanceof DatabaseConnectionItem) {
Connection connection = ((DatabaseConnectionItem) baseItem).getConnection();
if (connection != null) {
Object value = RepositoryToComponentProperty.getValue(connection, EParameterName.DB_VERSION.getName(), null);
if (value instanceof String) {
String version = (String) value;
if (DynamicDistributionManager.getInstance().isUsersDynamicDistribution(version)) {
Set<Relation> relationSet = new HashSet<Relation>();
Relation addedRelation = new Relation();
addedRelation.setId(version);
addedRelation.setType(RelationshipItemBuilder.DYNAMIC_DISTRIBUTION_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
return relationSet;
}
}
}
}
return Collections.emptySet();
}
Aggregations