Search in sources :

Example 1 with IRetrieveConfsService

use of org.talend.repository.hadoopcluster.service.IRetrieveConfsService in project tbd-studio-se by Talend.

the class RetrieveLocalConfsServiceTest method testGetConfsMap.

@Test
public void testGetConfsMap() throws MalformedURLException {
    Map<String, Map<String, String>> confsMap = confsService.getConfsMap();
    assertFalse(confsMap.containsKey("MAPRDB"));
    IRetrieveConfsService confsService2 = getServiceWithDistribution(IMapRDistribution.DISTRIBUTION_NAME, "MAPR500");
    confsMap = confsService.getConfsMap();
    assertTrue(confsMap.containsKey("MAPRDB"));
}
Also used : IRetrieveConfsService(org.talend.repository.hadoopcluster.service.IRetrieveConfsService) Map(java.util.Map) Test(org.junit.Test)

Example 2 with IRetrieveConfsService

use of org.talend.repository.hadoopcluster.service.IRetrieveConfsService 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 3 with IRetrieveConfsService

use of org.talend.repository.hadoopcluster.service.IRetrieveConfsService in project tbd-studio-se by Talend.

the class HadoopImportConfsWizard method performFinish.

@Override
public boolean performFinish() {
    IImportConfsWizardPage currentPage = getCurrentConfPage();
    if (currentPage != null) {
        final IRetrieveConfsService confsService = currentPage.getConfsService();
        final boolean isCreateConnectionFromConfs = currentPage.isSupportCreateServiceConnection();
        try {
            if (confsService != null) {
                currentPage.applyFilter();
                List<String> selectedServices = currentPage.getSelectedServices();
                final String confsDir = confsService.exportConfs(selectedServices);
                if (confsDir != null) {
                    this.getContainer().run(true, true, new IRunnableWithProgress() {

                        @Override
                        public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                            // $NON-NLS-1$
                            monitor.beginTask(// $NON-NLS-1$
                            Messages.getString("HadoopImportConfsWizard.doingImport"), IProgressMonitor.UNKNOWN);
                            try {
                                if (contextGroup == null) {
                                    confJarName = HadoopConfsUtils.getConfsJarDefaultName(connectionItem, false);
                                } else {
                                    confJarName = HadoopConfsUtils.getConfsJarDefaultName(connectionItem, false, contextGroup);
                                }
                                HadoopConfsUtils.buildAndDeployConfsJar(connectionItem, contextGroup, confsDir, confJarName);
                            } catch (Exception e) {
                                confJarName = null;
                                throw new InvocationTargetException(e);
                            } finally {
                                monitor.done();
                            }
                        }
                    });
                }
                HadoopConfsManager confsManager = HadoopConfsManager.getInstance();
                confsManager.setHadoopClusterId(connectionItem.getProperty().getId());
                confsManager.setConfsMap(getSelectedConfsMap(selectedServices, confsService.getConfsMap()));
                confsManager.setCreateConnectionFromConfs(isCreateConnectionFromConfs);
            }
            if (creation) {
                HadoopConfsUtils.setConnectionParameters(connectionItem, optionPage.getDistribution(), optionPage.getVersion(), confsService);
                if ("SPARK".equals(((HadoopClusterConnectionImpl) this.connectionItem.getConnection()).getDistribution()) && confJarName != null) {
                    MavenArtifact artifact = new MavenArtifact();
                    artifact.setGroupId("org.talend.libraries");
                    artifact.setArtifactId(confJarName.split(".jar")[0]);
                    artifact.setVersion("6.0.0-SNAPSHOT");
                    artifact.setType(MavenConstants.TYPE_JAR);
                    HadoopClusterConnection connection = (HadoopClusterConnection) connectionItem.getConnection();
                    connection.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CONF_SPECIFIC_JAR, PomUtil.getArtifactFullPath(artifact));
                }
                if (parentForm != null) {
                    parentForm.reload();
                }
            }
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    return true;
}
Also used : HadoopConfsManager(org.talend.repository.hadoopcluster.conf.HadoopConfsManager) HadoopClusterConnectionImpl(org.talend.repository.model.hadoopcluster.impl.HadoopClusterConnectionImpl) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IRetrieveConfsService(org.talend.repository.hadoopcluster.service.IRetrieveConfsService) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) MavenArtifact(org.talend.core.runtime.maven.MavenArtifact)

Aggregations

IRetrieveConfsService (org.talend.repository.hadoopcluster.service.IRetrieveConfsService)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Map (java.util.Map)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Test (org.junit.Test)1 MavenArtifact (org.talend.core.runtime.maven.MavenArtifact)1 HadoopConfsManager (org.talend.repository.hadoopcluster.conf.HadoopConfsManager)1 RetrieveRemoteConfsService (org.talend.repository.hadoopcluster.conf.RetrieveRemoteConfsService)1 HadoopCluster (org.talend.repository.hadoopcluster.configurator.HadoopCluster)1 IRetrieveConfsJobService (org.talend.repository.hadoopcluster.configurator.IRetrieveConfsJobService)1 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)1 HadoopClusterConnectionImpl (org.talend.repository.model.hadoopcluster.impl.HadoopClusterConnectionImpl)1