Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dietzc committed Aug 30, 2016
1 parent 6eaf0be commit fa4c988
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 7 deletions.
6 changes: 6 additions & 0 deletions org.knime.scijava.commands/scripts/myjython.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @double value
# @OUTPUT double greeting

greeting = value

print greeting
4 changes: 4 additions & 0 deletions org.knime.scijava.commands/scripts/test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; @Integer(label="My integer",description="Input integer.",value=17) test-int
; @OUTPUT Integer output-int

(def output-int test-int)
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SciJavaTestCommand implements Command {
@Parameter
private MultiOutputListener rowOutput;

@Parameter(label = "From Text")
@Parameter(label = "From Text", style = StyleHook.COLUMNSELECTION)
private String fromText;

@Parameter(label = "From Int")
Expand All @@ -23,12 +23,11 @@ public class SciJavaTestCommand implements Command {

@Override
public void run() {

for (int i = 0; i < fromInt; i++) {
outInt = i;
rowOutput.notifyListener();
}

}


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.knime.scijava.commands;

public interface EnforcerHook {
public interface StyleHook {
public final static String COLUMNSELECTION = "colSel";
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import org.knime.core.node.ExecutionContext;
import org.scijava.service.Service;

// FIXME NAMING (KNIPConverterCache?!)
// FIXME CACHING (isn't implemented everywhere, yet)
// FIXME can we always delegate to Jonathans implementations?
public interface ConverterCacheService extends Service {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public DefaultNodeModule(final Context context, final ModuleInfo info,
}

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

Expand All @@ -77,6 +79,7 @@ public DefaultNodeModule(final Context context, final ModuleInfo info,
}

private void preProcess(final DataRow input) throws Exception {
// input can be null if source node
if (input != null) {
for (final Entry<Integer, ModuleItem<?>> entry : inputMapping
.entrySet()) {
Expand All @@ -90,6 +93,7 @@ private void preProcess(final DataRow input) throws Exception {

private void postProcess(final CellOutput output,
final ExecutionContext ctx) throws Exception {
// output can be null if sink node
if (output != null) {
final List<DataCell> cells = new ArrayList<DataCell>();
for (final ModuleItem<?> entry : module.getInfo().outputs()) {
Expand All @@ -109,6 +113,8 @@ private void postProcess(final CellOutput output,
@Override
public void run(final DataRow input, final CellOutput output,
final ExecutionContext ctx) throws Exception {

// FIXME: Nicer logic possible here?
preProcess(input);

if (outputListener != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public OutputPortRole[] getOutputPortRoles() {
}
}

// FIXME must be super performant
@Override
public StreamableOperator createStreamableOperator(
final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public String getAfterID(final String id) {

@Override
public ConfigRO getAdditionalSettings(final String id) {
// TODO manage versions?
// FIXME manage versions?
final NodeSettings settings = new NodeSettings(
"scijavacommand-factory");
settings.addString(SCIJAVA_COMMAND_KEY, id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.knime.core.data.convert.util.ClassUtil;
import org.knime.core.node.defaultnodesettings.SettingsModel;
import org.knime.scijava.commands.EnforcerHook;
import org.knime.scijava.commands.StyleHook;
import org.knime.scijava.commands.converter.ConverterCacheService;
import org.knime.scijava.commands.settings.types.SettingsModelColumnSelectionType;
import org.scijava.module.ModuleItem;
Expand Down Expand Up @@ -59,7 +59,7 @@ public SettingsModelType getSettingsModelTypeFor(final ModuleItem<?> item) {

// FIXME why do I need this check in case of scripts?
if (item.getWidgetStyle() != null
&& item.getWidgetStyle().equals(EnforcerHook.COLUMNSELECTION)) {
&& item.getWidgetStyle().equals(StyleHook.COLUMNSELECTION)) {
return new SettingsModelColumnSelectionType();
} else {

Expand Down

0 comments on commit fa4c988

Please sign in to comment.