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"));
}
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);
}
}
});
}
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;
}
Aggregations