Search in sources :

Example 1 with HadoopServiceBean

use of org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean in project tbd-studio-se by Talend.

the class CheckHadoopServicesDialog method getServiceBeans.

private List<HadoopServiceBean> getServiceBeans() {
    List<HadoopServiceBean> checkedServiceBeans = new ArrayList<HadoopServiceBean>(CheckedServiceRegistryReader.getInstance().getCheckedServiceBeans());
    Iterator<HadoopServiceBean> beansIterator = checkedServiceBeans.iterator();
    while (beansIterator.hasNext()) {
        HadoopServiceBean serviceBean = beansIterator.next();
        serviceBean.setChecked(false);
        serviceBean.setErrorMsg(null);
        HadoopServiceProperties serviceProperties = serviceTypeToProperties.get(serviceBean.getServiceType());
        if (serviceProperties != null) {
            serviceBean.setServiceProperties(serviceProperties);
        } else {
            beansIterator.remove();
        }
    }
    return checkedServiceBeans;
}
Also used : HadoopServiceBean(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean) ArrayList(java.util.ArrayList) HadoopServiceProperties(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceProperties)

Example 2 with HadoopServiceBean

use of org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean in project tbd-studio-se by Talend.

the class CheckedServiceRegistryReader method readElement.

@Override
protected boolean readElement(final IConfigurationElement element) {
    if (ROOT_ELEMENT_NAME.equals(element.getName())) {
        final List<String> serviceTypes = new ArrayList<String>();
        SafeRunner.run(new RegistryReader.RegistrySafeRunnable() {

            @Override
            public void run() throws Exception {
                String serviceName = element.getAttribute(SERVICE_NAME_ELEMENT_NAME);
                String serviceType = element.getAttribute(SERVICE_TYPE_ELEMENT_NAME);
                String timeout = element.getAttribute(TIMEOUT_ELEMENT_NAME);
                if (serviceTypes.contains(serviceType)) {
                    return;
                }
                ICheckedServiceProvider checkedServiceProvider = (ICheckedServiceProvider) element.createExecutableExtension(CHECKED_SERVICE_PROVIDER_ELEMENT_NAME);
                HadoopServiceBean serviceBean = new HadoopServiceBean();
                serviceBean.setServiceName(serviceName);
                serviceBean.setServiceType(EHadoopServiceType.valueOf(serviceType));
                serviceBean.setTimeout(getTimeout(timeout));
                serviceBean.setCheckedServiceProvider(checkedServiceProvider);
                serviceBeans.add(serviceBean);
                serviceTypes.add(serviceType);
            }
        });
        return true;
    }
    return false;
}
Also used : HadoopServiceBean(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean) RegistryReader(org.talend.core.utils.RegistryReader) ArrayList(java.util.ArrayList)

Example 3 with HadoopServiceBean

use of org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean in project tbd-studio-se by Talend.

the class CheckHadoopServicesDialog method createAndExecCheckRunnables.

private void createAndExecCheckRunnables(TableItem tableItem) {
    Composite progressComp = new Composite(table, SWT.NONE);
    progressComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout progressLayout = new GridLayout(2, false);
    progressLayout.marginWidth = 0;
    progressLayout.marginHeight = 0;
    progressComp.setLayout(progressLayout);
    progressComp.setBackground(progressComp.getParent().getBackground());
    progressComps.add(progressComp);
    final HadoopServiceBean serviceBean = (HadoopServiceBean) tableItem.getData();
    ProgressBar progressBar = createProgressBar(progressComp, serviceBean);
    createStatusLink(progressComp, serviceBean);
    createTableEditor(progressComp, tableItem);
    checkExecutor.execute(spawnShowProgressRunnable(serviceBean, progressBar));
    checkExecutor.execute(spawnCheckedServiceRunnable(serviceBean));
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HadoopServiceBean(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean) GridData(org.eclipse.swt.layout.GridData) ProgressBar(org.eclipse.swt.widgets.ProgressBar)

Example 4 with HadoopServiceBean

use of org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean in project tbd-studio-se by Talend.

the class CheckHadoopServicesDialog method createStatusLink.

private Link createStatusLink(Composite parent, HadoopServiceBean serviceBean) {
    Link statusLink = new Link(parent, SWT.NONE);
    statusLink.setBackground(statusLink.getParent().getBackground());
    statusLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Link link = (Link) e.getSource();
            HadoopServiceBean service = (HadoopServiceBean) serviceToStatus.getKey(link);
            switchToExceptionsTab(service);
        }
    });
    serviceToStatus.put(serviceBean, statusLink);
    return statusLink;
}
Also used : HadoopServiceBean(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link)

Example 5 with HadoopServiceBean

use of org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean in project tbd-studio-se by Talend.

the class CheckHadoopServicesDialog method createServicesFields.

private void createServicesFields(Composite parent) {
    servicesComposite = new Composite(parent, SWT.NONE);
    servicesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    servicesComposite.setLayout(new GridLayout());
    tableViewer = new TableViewer(servicesComposite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
    tableViewer.setContentProvider(ArrayContentProvider.getInstance());
    table = tableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    TableViewerColumn serviceColumn = createTableViewerColumn(tableViewer, Messages.getString("CheckHadoopServicesDialog.table.service"), 0, 180, // $NON-NLS-1$
    true);
    serviceColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            HadoopServiceBean serviceBean = (HadoopServiceBean) element;
            return serviceBean.getServiceName();
        }
    });
    TableViewerColumn progressColumn = createTableViewerColumn(tableViewer, Messages.getString("CheckHadoopServicesDialog.table.progress"), 1, 350, // $NON-NLS-1$
    false);
    progressColumn.setLabelProvider(new ColumnLabelProvider());
    // $NON-NLS-1$
    createTabItem(servicesComposite, Messages.getString("CheckHadoopServicesDialog.tab.services.title"), SWT.NONE, null);
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HadoopServiceBean(org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

HadoopServiceBean (org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean)5 ArrayList (java.util.ArrayList)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Link (org.eclipse.swt.widgets.Link)1 ProgressBar (org.eclipse.swt.widgets.ProgressBar)1 RegistryReader (org.talend.core.utils.RegistryReader)1 HadoopServiceProperties (org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceProperties)1