You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/03/27 15:23:56 UTC
[incubator-hop] branch master updated: HOP-2657, HOP-2658, HOP-2453
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new 5b8157e HOP-2657, HOP-2658, HOP-2453
new e033045 Merge pull request #711 from bamaer/importer-improvements
5b8157e is described below
commit 5b8157e266e554f4083c419fe3a2d8fd479b902d
Author: Bart Maertens <ba...@know.bi>
AuthorDate: Fri Mar 26 19:56:40 2021 +0100
HOP-2657, HOP-2658, HOP-2453
---
.../org/apache/hop/imports/kettle/KettleConst.java | 4 +-
.../apache/hop/imports/kettle/KettleImport.java | 79 +++++++++++++++++-----
.../hop/imports/kettle/KettleImportDialog.java | 1 -
3 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java
index 9e49a4e..35c4d81 100644
--- a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java
+++ b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleConst.java
@@ -52,7 +52,8 @@ public class KettleConst {
{"target_step", "target_transform"},
{"step1", "transform1"},
{"step2", "transform2"},
- {"accept_stepname","accept_transform_name"}
+ {"accept_stepname","accept_transform_name"},
+ {"steps","transforms"}
})
.collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1]));
@@ -101,6 +102,7 @@ public class KettleConst {
{"StepMetastructure", "TransformMetaStructure"},
{"Pentaho local", "local"},
{"JobExecutor", "WorkflowExecutor"},
+ {"execution_result_target_step","execution_result_target_transform"},
{"TransExecutor", "PipelineExecutor"},
})
.collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1]));
diff --git a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java
index 21041a0..bfd6156 100644
--- a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java
+++ b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImport.java
@@ -24,6 +24,11 @@ import org.apache.hop.core.plugins.IPlugin;
import org.apache.hop.core.util.StringUtil;
import org.apache.hop.imports.HopImport;
import org.apache.hop.imports.IHopImport;
+import org.apache.hop.ui.core.dialog.ErrorDialog;
+import org.apache.hop.ui.hopgui.HopGui;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -57,29 +62,67 @@ public class KettleImport extends HopImport implements IHopImport {
@Override
public void importHopFolder(){
+ HopGui hopGui = HopGui.getInstance();
+ Shell shell = hopGui.getShell();
+
FilenameFilter kettleFilter = (dir, name) -> name.endsWith(".ktr") | name.endsWith("*.kjb");
String[] kettleFileNames = inputFolder.list(kettleFilter);
try {
- // Walk over all ktr and kjb files we received, migrate to hpl and hwf
- Stream<Path> kettleWalk = Files.walk(Paths.get(inputFolder.getAbsolutePath()));
- List<String> result = kettleWalk.map(x -> x.toString()).filter(f -> f.endsWith(".ktr") || f.endsWith(".kjb")).collect(Collectors.toList());
- result.forEach(kettleFilename -> {
- File kettleFile = new File(kettleFilename);
- importHopFile(kettleFile);
- });
- kettleWalk = Files.walk(Paths.get(inputFolder.getAbsolutePath()));
- // TODO: add a proper way to exclude folders instead of hard coded .git exclude.
- List<String> otherFilesList = kettleWalk.map(x -> x.toString()).filter(f -> !f.endsWith(".ktr") && !f.endsWith(".kjb") && !f.contains(".git/")).collect(Collectors.toList());
- otherFilesList.forEach(otherFilename -> {
- File otherFile = new File(otherFilename);
- if(!otherFile.isDirectory()){
- migratedFilesMap.put(otherFilename, null);
- otherCounter++;
+ IRunnableWithProgress op = monitor -> {
+ monitor.setTaskName("Import Kettle/PDI Files to Hop... ");
+ try{
+ Stream<Path> kettleWalk = Files.walk(Paths.get(inputFolder.getAbsolutePath()));
+ List<String> result = kettleWalk.map(x -> x.toString()).filter(f -> f.endsWith(".ktr") || f.endsWith(".kjb")).collect(Collectors.toList());
+ result.forEach(kettleFilename -> {
+ File kettleFile = new File(kettleFilename);
+ importHopFile(kettleFile);
+ });
+ }catch(IOException e){
+ e.printStackTrace();
}
- });
- } catch (IOException e) {
- e.printStackTrace();
+ };
+
+ ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
+ pmd.run(true, false, op);
+ }catch(Exception e){
+ new ErrorDialog(shell, "Error", "Error importing PDI/Kettle files into Hop project", e);
+ }
+
+ try {
+ IRunnableWithProgress op = monitor -> {
+
+ monitor.setTaskName("Import other files to Hop... ");
+ // Walk over all ktr and kjb files we received, migrate to hpl and hwf
+ try{
+ Stream<Path> kettleWalk = Files.walk(Paths.get(inputFolder.getAbsolutePath()));
+
+ List<String> result = kettleWalk.map(x -> x.toString()).filter(f -> f.endsWith(".ktr") || f.endsWith(".kjb")).collect(Collectors.toList());
+ result.forEach(kettleFilename -> {
+ File kettleFile = new File(kettleFilename);
+ importHopFile(kettleFile);
+ });
+ kettleWalk = Files.walk(Paths.get(inputFolder.getAbsolutePath()));
+ // TODO: add a proper way to exclude folders instead of hard coded .git exclude.
+ List<String> otherFilesList = kettleWalk.map(x -> x.toString()).filter(f -> !f.endsWith(".ktr") && !f.endsWith(".kjb") && !f.contains(".git/")).collect(Collectors.toList());
+ otherFilesList.forEach(otherFilename -> {
+ File otherFile = new File(otherFilename);
+ if (!otherFile.isDirectory()) {
+ migratedFilesMap.put(otherFilename, null);
+ otherCounter++;
+ }
+ });
+ }catch(IOException e){
+ e.printStackTrace();
+ }
+ };
+
+ ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
+ pmd.run(true, false, op);
+
+
+ }catch(Exception e){
+ new ErrorDialog(shell, "Error", "Error importing other files into Hop project", e);
}
log.logBasic("We found " + kettleFileNames.length + " kettle files. ");
}
diff --git a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImportDialog.java b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImportDialog.java
index 7e4013b..517eda4 100644
--- a/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImportDialog.java
+++ b/plugins/misc/import/src/main/java/org/apache/hop/imports/kettle/KettleImportDialog.java
@@ -302,7 +302,6 @@ public class KettleImportDialog extends Dialog {
//
Button wOK = new Button( shell, SWT.PUSH );
wOK.setText("Import");
-// wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
wOK.addListener( SWT.Selection, event -> doImport() );
Button wCancel = new Button( shell, SWT.PUSH );
wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );