use of org.talend.repository.model.hadoopcluster.impl.HadoopClusterConnectionImpl 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