Search in sources :

Example 1 with HadoopContextConfConfigDialog

use of org.talend.repository.hadoopcluster.ui.conf.HadoopContextConfConfigDialog 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();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) EAuthenticationMode(org.talend.core.hadoop.version.EAuthenticationMode) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) HadoopContextConfConfigDialog(org.talend.repository.hadoopcluster.ui.conf.HadoopContextConfConfigDialog) AbstractHadoopForm(org.talend.repository.hadoopcluster.ui.common.AbstractHadoopForm) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 EAuthenticationMode (org.talend.core.hadoop.version.EAuthenticationMode)1 AbstractHadoopForm (org.talend.repository.hadoopcluster.ui.common.AbstractHadoopForm)1 HadoopContextConfConfigDialog (org.talend.repository.hadoopcluster.ui.conf.HadoopContextConfConfigDialog)1 HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)1