@Override public void process(final Module module) { if (log == null || !log.isDebug()) return; // dump input values to log log.debug("INPUTS:"); final Map<String, Object> inputs = module.getInputs(); for (final String key : inputs.keySet()) { log.debug("\t" + key + " = " + inputs.get(key)); } // dump output values to log log.debug("OUTPUTS:"); final Map<String, Object> outputs = module.getOutputs(); for (final String key : outputs.keySet()) { log.debug("\t" + key + " = " + outputs.get(key)); } }
@Override public void process(final Module module) { if (log == null || !log.isDebug()) return; // dump input values to log log.debug("INPUTS:"); final Map<String, Object> inputs = module.getInputs(); for (final String key : inputs.keySet()) { log.debug("\t" + key + " = " + inputs.get(key)); } // dump output values to log log.debug("OUTPUTS:"); final Map<String, Object> outputs = module.getOutputs(); for (final String key : outputs.keySet()) { log.debug("\t" + key + " = " + outputs.get(key)); } }
@SuppressWarnings("unchecked") private boolean processFile(Module module, ModuleItem<?> inputModuleItem, File file) { batchService.fillInput(module, inputModuleItem, file); //fileInput.setValue(module, file); outputTable.appendRow(file.getName()); Future<Module> instance = moduleService.run(module, true); try { // run the script Map<String, Object> outputs = instance.get().getOutputs(); for (Entry<String, Object> output : outputs.entrySet()) { outputTable.set(output.getKey(), outputTable.getRowCount() - 1, output.getValue()); } return true; } catch (InterruptedException exc) { log.error("Error: interrupted module execution", exc); return false; } catch (ExecutionException exc) { log.error("Error during module execution", exc); return true; // continue loop } }
@Override public void run() { // mark inputChoice as resolved, then harvest script parameters (i.e. run) ModuleItem<?> inputModuleItem = moduleInfo.getInput(inputChoice); // TODO check if conversion needed? Module scriptModule = moduleService.createModule(moduleInfo); scriptModule.resolveInput(inputChoice); /* Create output Table and mark all outputs as resolved */ outputTable = new DefaultGenericTable(); @SuppressWarnings("rawtypes") List<Column> columns = new ArrayList<>(); for (String outputKey : scriptModule.getOutputs().keySet()) { columns.add(outputTable.appendColumn(outputKey)); scriptModule.resolveOutput(outputKey); } for (File file : inputFileList) { if(!processFile(scriptModule, inputModuleItem, file)) { log.warn("Terminating batch process."); break; // end for loop } } // case File // feed files into input // case Image (not needed if conversion works // open each file as image (warn on errors) and feed image into input }