use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HadoopClusterService method getSubitemIdsOfHadoopCluster.
@Override
public List<String> getSubitemIdsOfHadoopCluster(Item item) {
if (!isHadoopClusterItem(item)) {
return new ArrayList<>();
}
HadoopClusterConnectionItem clusterConnectionItem = (HadoopClusterConnectionItem) item;
HadoopClusterConnection clusterConnection = (HadoopClusterConnection) clusterConnectionItem.getConnection();
return clusterConnection.getConnectionList();
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HadoopClusterService method useCustomConfsJarIfNeeded.
@Override
public void useCustomConfsJarIfNeeded(List<ModuleNeeded> modulesNeeded, String clusterId) {
Item item = getHadoopClusterItemById(clusterId);
if (item instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem connectionItem = (HadoopClusterConnectionItem) item;
HadoopClusterConnection connection = (HadoopClusterConnection) connectionItem.getConnection();
if (connection.isUseCustomConfs()) {
Set<String> confsJarNames = HadoopConfsUtils.getConfsJarDefaultNames(connectionItem, true);
Consumer<String> action = null;
if (HCParameterUtil.isOverrideHadoopConfs(connection)) {
action = (confsJarName) -> removeHadoopConfJar(modulesNeeded, confsJarName);
} else {
action = (confsJarName) -> addConfsModule(modulesNeeded, connection, confsJarName);
}
for (String confsJarName : confsJarNames) {
action.accept(confsJarName);
}
}
}
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HadoopClusterService method getHadoopClusterContextType.
@Override
public ContextType getHadoopClusterContextType(String id) {
Item item = getHadoopClusterItemById(id);
if (item instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem hcItem = (HadoopClusterConnectionItem) item;
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcItem.getConnection();
if (hcConnection != null && hcConnection.isContextMode()) {
return ConnectionContextHelper.getContextTypeForContextMode(hcConnection, true);
}
}
return null;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class StandardHCInfoForm method addFieldsListeners.
@Override
protected void addFieldsListeners() {
authenticationCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
String newAuthDisplayName = authenticationCombo.getText();
EAuthenticationMode newAuthMode = EAuthenticationMode.getAuthenticationByDisplayName(newAuthDisplayName);
String originalAuthName = getConnection().getAuthMode();
EAuthenticationMode originalAuthMode = EAuthenticationMode.getAuthenticationByName(originalAuthName, false);
if (newAuthMode != null && newAuthMode != originalAuthMode) {
if (EAuthenticationMode.UGI.equals(newAuthMode)) {
maprTBtn.setEnabled(true);
hideControl(maprTBtn, false);
if (maprTBtn.getSelection()) {
hideControl(maprTPCDCompposite, false);
hideControl(maprTSetComposite, false);
}
authMaprTComposite.layout();
authMaprTComposite.getParent().layout();
}
getConnection().setAuthMode(newAuthMode.getName());
updateForm();
checkFieldsValue();
}
}
});
namenodeUriText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setNameNodeURI(namenodeUriText.getText());
checkFieldsValue();
}
});
jobtrackerUriText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setJobTrackerURI(jobtrackerUriText.getText());
checkFieldsValue();
}
});
rmSchedulerText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setRmScheduler(rmSchedulerText.getText());
checkFieldsValue();
}
});
jobHistoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setJobHistory(jobHistoryText.getText());
checkFieldsValue();
}
});
stagingDirectoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setStagingDirectory(stagingDirectoryText.getText());
checkFieldsValue();
}
});
useDNHostBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getConnection().setUseDNHost(useDNHostBtn.getSelection());
checkFieldsValue();
}
});
useSparkPropertiesBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
sparkPropertiesDialog.propertyButton.setEnabled(useSparkPropertiesBtn.getSelection());
getConnection().setUseSparkProperties(useSparkPropertiesBtn.getSelection());
checkFieldsValue();
}
});
useCustomConfBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onUseCustomConfBtnSelected(e);
}
});
hadoopConfsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AbstractHadoopForm form = null;
if (parentForm instanceof AbstractHadoopForm) {
form = (AbstractHadoopForm) parentForm;
}
new HadoopContextConfConfigDialog(getShell(), form, (HadoopClusterConnectionItem) connectionItem).open();
}
});
if (useClouderaNaviBtn != null) {
useClouderaNaviBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
clouderaNaviButton.setEnabled(useClouderaNaviBtn.getSelection());
getConnection().setUseClouderaNavi(useClouderaNaviBtn.getSelection());
checkFieldsValue();
}
});
clouderaNaviButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AbstractHadoopForm form = null;
if (parentForm instanceof AbstractHadoopForm) {
form = (AbstractHadoopForm) parentForm;
}
HadoopConfsUtils.openClouderaNaviWizard(form, (HadoopClusterConnectionItem) connectionItem, creation);
}
});
}
rmSchedulerText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setRmScheduler(rmSchedulerText.getText());
checkFieldsValue();
}
});
jobHistoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setJobHistory(jobHistoryText.getText());
checkFieldsValue();
}
});
stagingDirectoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setStagingDirectory(stagingDirectoryText.getText());
checkFieldsValue();
}
});
useDNHostBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getConnection().setUseDNHost(useDNHostBtn.getSelection());
checkFieldsValue();
}
});
namenodePrincipalText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setPrincipal(namenodePrincipalText.getText());
checkFieldsValue();
}
});
jtOrRmPrincipalText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setJtOrRmPrincipal(jtOrRmPrincipalText.getText());
checkFieldsValue();
}
});
jobHistoryPrincipalText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
getConnection().setJobHistoryPrincipal(jobHistoryPrincipalText.getText());
checkFieldsValue();
}
});
userNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setUserName(userNameText.getText());
checkFieldsValue();
}
});
groupText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setGroup(groupText.getText());
checkFieldsValue();
}
});
kerberosBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
hideControl(authNodejtOrRmHistoryComposite, !kerberosBtn.getSelection());
hideControl(authKeytabComposite, !kerberosBtn.getSelection());
hideControl(maprTPasswordCompposite, kerberosBtn.getSelection() && maprTBtn.getSelection());
getConnection().setEnableKerberos(kerberosBtn.getSelection());
updateForm();
authGroup.layout();
authGroup.getParent().layout();
checkFieldsValue();
}
});
keytabBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getConnection().setUseKeytab(keytabBtn.getSelection());
updateForm();
checkFieldsValue();
}
});
keytabPrincipalText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setKeytabPrincipal(keytabPrincipalText.getText());
checkFieldsValue();
}
});
keytabText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setKeytab(keytabText.getText());
checkFieldsValue();
}
});
maprTBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
hideControl(maprTPCDCompposite, !maprTBtn.getSelection());
hideControl(maprTSetComposite, !maprTBtn.getSelection());
hideControl(maprTPasswordCompposite, kerberosBtn.getSelection() && maprTBtn.getSelection());
getConnection().setEnableMaprT(maprTBtn.getSelection());
updateForm();
authGroup.layout();
authGroup.getParent().layout();
checkFieldsValue();
}
});
maprTPasswordText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setMaprTPassword(maprTPasswordText.getText());
checkFieldsValue();
}
});
maprTClusterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setMaprTCluster(maprTClusterText.getText());
checkFieldsValue();
}
});
maprTDurationText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setMaprTDuration(maprTDurationText.getText());
checkFieldsValue();
}
});
setMaprTHomeDirBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getConnection().setSetMaprTHomeDir(setMaprTHomeDirBtn.getSelection());
maprTHomeDirText.setText(getConnection().getMaprTHomeDir());
updateForm();
checkFieldsValue();
}
});
maprTHomeDirText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setMaprTHomeDir(maprTHomeDirText.getText());
checkFieldsValue();
}
});
setHadoopLoginBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getConnection().setSetHadoopLogin(setHadoopLoginBtn.getSelection());
maprTHadoopLoginText.setText(getConnection().getMaprTHadoopLogin());
updateForm();
checkFieldsValue();
}
});
maprTHadoopLoginText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setMaprTHadoopLogin(maprTHadoopLoginText.getText());
checkFieldsValue();
}
});
preloadAuthentificationBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getConnection().setPreloadAuthentification(preloadAuthentificationBtn.getSelection());
updateForm();
checkFieldsValue();
}
});
setHadoopConfBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onOverrideHadoopConfBtnSelected(e);
}
});
hadoopConfSpecificJarText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onHadoopConfPathTextModified(e);
}
});
browseHadoopConfBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onBrowseHadoopConfBtnSelected(e);
}
});
useWebHDFSSSLEncryptionBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
hideControl(webHDFSSSLEncryptionDetailComposite, !useWebHDFSSSLEncryptionBtn.getSelection());
getConnection().setUseWebHDFSSSL(useWebHDFSSSLEncryptionBtn.getSelection());
updateForm();
checkFieldsValue();
}
});
webHDFSSSLTrustStorePath.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
getConnection().setWebHDFSSSLTrustStorePath(webHDFSSSLTrustStorePath.getText());
checkFieldsValue();
}
});
webHDFSSSLTrustStorePassword.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
getConnection().setWebHDFSSSLTrustStorePassword(webHDFSSSLTrustStorePassword.getText());
checkFieldsValue();
}
});
if (sparkModeCombo != null) {
sparkModeCombo.getCombo().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
hideFieldsOnSparkMode();
checkFieldsValue();
}
});
}
cloudProviderCombo.getCombo().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String providerLableName = cloudProviderCombo.getText();
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_CLOUD_PROVIDER, getDatabriksCloudProviderByName(providerLableName).getProviderValue());
checkFieldsValue();
}
});
runSubmitCombo.getCombo().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String runModeLableName = runSubmitCombo.getText();
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_RUN_MODE, getDatabriksRunModeByName(runModeLableName).getRunModeValue());
checkFieldsValue();
}
});
endpointText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_ENDPOINT, endpointText.getText());
checkFieldsValue();
}
});
clusterIDText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_CLUSTER_ID, clusterIDText.getText());
checkFieldsValue();
}
});
tokenText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_TOKEN, EncryptionUtil.getValue(tokenText.getText(), true));
checkFieldsValue();
}
});
dbfsDepFolderText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_DATABRICKS_DBFS_DEP_FOLDER, dbfsDepFolderText.getText());
checkFieldsValue();
}
});
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem 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());
}
}
}
Aggregations