Search in sources :

Example 1 with IRetrieveConfsJobService

use of org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService in project tbd-studio-se by Talend.

the class HadoopImportRemoteOptionPage method addListener.

private void addListener() {
    selectClusterButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                IRetrieveConfsJobService retrieveJobServer = connectionForm.getRetrieveJobService();
                if (retrieveJobServer != null) {
                    retrieveJobServer.setDistributionVersion(distriVersion);
                    retrieveJobServer.setSelectedCluster(getSelectedCluster());
                    confsService = (IRetrieveConfsService) retrieveJobServer;
                } else if (configurator != null) {
                    HadoopCluster cluster = configurator.getCluster(getSelectedCluster());
                    confsService = new RetrieveRemoteConfsService(cluster);
                }
                if (confsService != null) {
                    servicesTableComp.setServices(confsService.getAllServices());
                }
            } catch (Exception ex) {
                ExceptionHandler.process(ex);
            }
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IRetrieveConfsService(org.talend.repository.hadoopcluster.service.IRetrieveConfsService) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IRetrieveConfsJobService(org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService) RetrieveRemoteConfsService(org.talend.repository.hadoopcluster.conf.RetrieveRemoteConfsService) HadoopCluster(org.talend.repository.hadoopcluster.configurator.HadoopCluster)

Example 2 with IRetrieveConfsJobService

use of org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService in project tbd-studio-se by Talend.

the class HadoopImportRemoteOptionPage method propertyChange.

@Override
public void propertyChange(PropertyChangeEvent evt) {
    setErrorMessage(null);
    Exception exception = null;
    String propertyName = evt.getPropertyName();
    Object newValue = evt.getNewValue();
    if (IPropertyConstants.PROPERTY_CONNECT.equals(propertyName)) {
        if (newValue instanceof HadoopConfigurator) {
            configurator = (HadoopConfigurator) newValue;
            try {
                List<String> clusters = configurator.getAllClusters();
                bindCombo(clusters);
            } catch (Exception e) {
                exception = e;
            }
        } else if (newValue instanceof Exception) {
            exception = (Exception) newValue;
        }
    }
    if (IPropertyConstants.PROPERTY_RETRIEVE_JOB.equals(propertyName)) {
        if (newValue instanceof IRetrieveConfsJobService) {
            IRetrieveConfsJobService retrieveConfigJobService = (IRetrieveConfsJobService) newValue;
            List<String> clusters = retrieveConfigJobService.getAllClusterName();
            bindCombo(clusters);
        } else if (newValue instanceof Exception) {
            exception = (Exception) newValue;
        }
    }
    if (exception != null) {
        // $NON-NLS-1$
        setErrorMessage(Messages.getString("HadoopImportRemoteOptionPage.connectionFailed"));
        ExceptionHandler.process(exception);
    }
}
Also used : HadoopConfigurator(org.talend.repository.hadoopcluster.configurator.HadoopConfigurator) IRetrieveConfsJobService(org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService)

Example 3 with IRetrieveConfsJobService

use of org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService in project tbd-studio-se by Talend.

the class AbstractConnectionForm method createRetieveMetaFields.

protected boolean createRetieveMetaFields(Composite parent) {
    IRetrieveConfsJobService service = this.findRetrieveJobService();
    if (service != null) {
        // If find the service
        retrieveButton = new Button(parent, SWT.CHECK);
        GridData retrieveData = new GridData();
        retrieveData.horizontalSpan = 1;
        retrieveButton.setLayoutData(retrieveData);
        retrieveButton.setText(Messages.getString("HadoopImportRemoteOptionPage.retrieve.check"));
        retrieveButton.setSelection(false);
        retrieveButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                serverCombo.getControl().setEnabled(retrieveButton.getSelection());
            }
        });
        serverCombo = new ComboViewer(parent);
        serverCombo.setContentProvider(new ArrayContentProvider());
        serverCombo.setLabelProvider(new LabelProvider());
        GridData jobServerData = new GridData(GridData.FILL_HORIZONTAL);
        jobServerData.horizontalSpan = 1;
        serverCombo.getControl().setLayoutData(jobServerData);
        serverCombo.getControl().setEnabled(false);
        serverCombo.setInput(service.getAllJobServerLabel());
        serverCombo.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                retrieveJobService = null;
            }
        });
        return true;
    }
    return false;
}
Also used : Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IRetrieveConfsJobService(org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Aggregations

IRetrieveConfsJobService (org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 GridData (org.eclipse.swt.layout.GridData)1 Button (org.eclipse.swt.widgets.Button)1 RetrieveRemoteConfsService (org.talend.repository.hadoopcluster.conf.RetrieveRemoteConfsService)1 HadoopCluster (org.talend.repository.hadoopcluster.configurator.HadoopCluster)1 HadoopConfigurator (org.talend.repository.hadoopcluster.configurator.HadoopConfigurator)1 IRetrieveConfsService (org.talend.repository.hadoopcluster.service.IRetrieveConfsService)1