Skip to content

Commit fbd8bef

Browse files
committed
Move per-node-execution preprocessing into private method.
Signed-off-by: Squareys <[email protected]>
1 parent fe6e1bb commit fbd8bef

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

org.knime.scijava.commands/src/org/knime/scijava/commands/module/DefaultNodeModule.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,32 @@ public DefaultNodeModule(final Context context, final ModuleInfo info,
7070
this.inputMapping = inputMapping;
7171
this.outputMapping = outputMapping;
7272
this.module = ms.createModule(info);
73+
this.outputListener = new NodeModuleOutputChangedListener();
7374

75+
preProcess(params);
76+
}
77+
78+
/*
79+
* "Once per node execution" pre-processing. Called in constructor.
80+
*
81+
* @param params key-value pairs of pre resolved module inputs.
82+
*/
83+
private void preProcess(final Map<String, Object> params) {
7484
// Setting parameters
7585
for (final Entry<String, Object> entry : params.entrySet()) {
7686
module.setInput(entry.getKey(), entry.getValue());
7787
module.resolveInput(entry.getKey());
7888
}
7989

8090
// FIXME: do we need them all?
81-
// FIXME add our own preprocessors, i.e. to call preprocess?
82-
// FIXME or move this to "preprocess"
8391
final List<PreprocessorPlugin> pre = ps
8492
.createInstancesOfType(PreprocessorPlugin.class);
8593

8694
for (final ModulePreprocessor p : pre) {
8795
p.process(module);
8896
}
8997

90-
outputListener = new NodeModuleOutputChangedListener();
91-
for (final ModuleItem<?> item : info.inputs()) {
98+
for (final ModuleItem<?> item : this.module.getInfo().inputs()) {
9299
if (MultiOutputListener.class.isAssignableFrom(item.getType())) {
93100
final String name = item.getName();
94101

0 commit comments

Comments
 (0)