Skip to content

Commit 6eaf0be

Browse files
committed
WIP: refactored scijava-integration
1 parent 4f2c7ef commit 6eaf0be

File tree

73 files changed

+2100
-1791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2100
-1791
lines changed

org.knime.scijava.commands/.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
44
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
55
<classpathentry excluding="org/knime/knip/scijava/commands/adapter/basic/ImgInputAdapter.java|org/knime/knip/scijava/commands/adapter/basic/ImgOutputAdapter.java|org/knime/knip/scijava/commands/adapter/basic/ImgPlusInputAdapter.java|org/knime/knip/scijava/commands/adapter/basic/ImgPlusOutputAdapter.java" kind="src" path="src"/>
6+
<classpathentry exported="true" kind="lib" path="lib/tools.jar"/>
67
<classpathentry kind="output" path="bin"/>
78
</classpath>

org.knime.scijava.commands/META-INF/MANIFEST.MF

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.0",
1616
scijava-plugins-text-plain;bundle-version="0.1.2",
1717
scijava-ui-awt;bundle-version="0.1.4",
1818
scijava-ui-swing;bundle-version="0.8.0",
19-
org.knime.scijava.core;bundle-version="0.2.1"
19+
org.knime.scijava.core;bundle-version="0.2.1",
20+
com.google.guava;bundle-version="19.0.0",
21+
scripting-jython;bundle-version="0.3.0",
22+
jython-shaded;bundle-version="2.5.3",
23+
scripting-java;bundle-version="0.4.0",
24+
scripting-clojure;bundle-version="0.1.4"
2025
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
2126
Bundle-ActivationPolicy: lazy
22-
Bundle-ClassPath: scijava_commands.jar
27+
Bundle-ClassPath: scijava_commands.jar,
28+
lib/tools.jar
2329
Export-Package: org.knime.scijava.commands,
2430
org.knime.scijava.commands.adapter,
2531
org.knime.scijava.commands.adapter.basic,

org.knime.scijava.commands/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ bin.includes = plugin.xml,\
66
lib/,\
77
icons/,\
88
lib/mvn/scijava-common-2.1.0.jar,\
9-
scijava_commands.jar
9+
scijava_commands.jar,\
10+
lib/tools.jar
1011
output.knipknime.jar = bin/
1112
src.includes = lib/src/,\
1213
src/
17.3 MB
Binary file not shown.

org.knime.scijava.commands/plugin.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<?eclipse version="3.0"?>
33
<plugin>
4+
<extension
5+
point="org.knime.workbench.repository.nodes">
6+
</extension>
7+
<extension
8+
point="org.knime.workbench.repository.nodesets">
9+
<nodeset
10+
default-category-icon="org.knime.scijava.commands.nodes.SciJavaNodeSetFactory"
11+
deprecated="false"
12+
factory-class="org.knime.scijava.commands.nodes.SciJavaNodeSetFactory"
13+
id="SciJavaNodeSet (TMP)">
14+
</nodeset>
15+
</extension>
416
</plugin>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.knime.scijava.commands;
2+
3+
import org.knime.core.data.DataCell;
4+
5+
public interface CellOutput {
6+
void push(final DataCell[] cells);
7+
}

org.knime.scijava.commands/src/org/knime/scijava/commands/DefaultKnimeExecutionService.java

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.knime.scijava.commands;
2+
3+
public interface EnforcerHook {
4+
public final static String COLUMNSELECTION = "colSel";
5+
}

org.knime.scijava.commands/src/org/knime/scijava/commands/KNIMEExecutionService.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

org.knime.scijava.commands/src/org/knime/scijava/commands/KNIMESciJavaConstants.java

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.knime.scijava.commands;
2+
3+
public interface MultiOutputListener {
4+
public void notifyListener();
5+
}

org.knime.scijava.commands/src/org/knime/scijava/commands/SciJavaGateway.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
import java.util.List;
55

66
import org.knime.scijava.commands.converter.ConverterCacheService;
7-
import org.knime.scijava.commands.io.InputDataRowService;
8-
import org.knime.scijava.commands.io.OutputDataRowService;
9-
import org.knime.scijava.commands.settings.NodeModelSettingsService;
7+
import org.knime.scijava.commands.module.NodeModuleService;
108
import org.knime.scijava.commands.settings.NodeSettingsService;
119
import org.knime.scijava.commands.settings.SettingsModelTypeService;
12-
import org.knime.scijava.commands.simplemapping.SimpleColumnMappingService;
13-
import org.knime.scijava.commands.widget.KNIMEWidgetService;
1410
import org.knime.scijava.core.ResourceAwareClassLoader;
1511
import org.knime.scijava.core.SubContext;
1612
import org.knime.scijava.core.pluginindex.ReusablePluginIndex;
@@ -22,6 +18,7 @@
2218
import org.scijava.plugin.PluginIndex;
2319
import org.scijava.plugin.PluginService;
2420
import org.scijava.prefs.PrefService;
21+
import org.scijava.script.ScriptService;
2522
import org.scijava.service.Service;
2623
import org.scijava.ui.UIService;
2724
import org.scijava.widget.WidgetService;
@@ -50,15 +47,11 @@ public class SciJavaGateway {
5047

5148
/** a list of services which need to be present in newly created contexts */
5249
protected static List<Class<? extends Service>> requiredServices = Arrays
53-
.<Class<? extends Service>> asList(InputDataRowService.class,
54-
OutputDataRowService.class, PrefService.class,
55-
KNIMEExecutionService.class, NodeSettingsService.class,
56-
ObjectService.class, WidgetService.class,
57-
KNIMEWidgetService.class, UIService.class,
50+
.<Class<? extends Service>> asList(PrefService.class,
51+
ObjectService.class, WidgetService.class, UIService.class,
5852
ConverterCacheService.class, CommandService.class,
59-
NodeModelSettingsService.class,
60-
SettingsModelTypeService.class,
61-
SimpleColumnMappingService.class);
53+
NodeModuleService.class, SettingsModelTypeService.class,
54+
NodeSettingsService.class, ScriptService.class);
6255

6356
/**
6457
* Constructor. Only to be called from {@link #get()}.
@@ -101,7 +94,7 @@ public Context createSubContext() {
10194
return context;
10295
}
10396

104-
private Context getGlobalContext() {
97+
public Context getGlobalContext() {
10598
if (m_globalContext == null) {
10699
m_globalContext = new Context(m_pluginIndex);
107100

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
package org.knime.scijava.commands;
3+
4+
import org.scijava.ItemIO;
5+
import org.scijava.command.Command;
6+
import org.scijava.plugin.Parameter;
7+
import org.scijava.plugin.Plugin;
8+
9+
@Plugin(type = Command.class, headless = true, label = "Test Command")
10+
public class SciJavaTestCommand implements Command {
11+
12+
@Parameter
13+
private MultiOutputListener rowOutput;
14+
15+
@Parameter(label = "From Text")
16+
private String fromText;
17+
18+
@Parameter(label = "From Int")
19+
private int fromInt;
20+
21+
@Parameter(type = ItemIO.OUTPUT, label = "Output Int")
22+
private int outInt;
23+
24+
@Override
25+
public void run() {
26+
27+
for (int i = 0; i < fromInt; i++) {
28+
outInt = i;
29+
rowOutput.notifyListener();
30+
}
31+
32+
}
33+
34+
}

org.knime.scijava.commands/src/org/knime/scijava/commands/converter/ConverterCacheService.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package org.knime.scijava.commands.converter;
22

3+
import java.util.Collection;
34
import java.util.Optional;
45

56
import org.knime.core.data.DataCell;
67
import org.knime.core.data.DataType;
78
import org.knime.core.data.DataValue;
9+
import org.knime.core.data.convert.datacell.JavaToDataCellConverterFactory;
10+
import org.knime.core.data.convert.java.DataCellToJavaConverterFactory;
11+
import org.knime.core.node.ExecutionContext;
812
import org.scijava.service.Service;
913

1014
public interface ConverterCacheService extends Service {
@@ -35,7 +39,8 @@ public interface ConverterCacheService extends Service {
3539
* @throws Exception
3640
* When the conversion fails
3741
*/
38-
DataCell convertToKnime(Object in, Class<?> inType) throws Exception;
42+
DataCell convertToKnime(Object in, Class<?> inType, DataType type,
43+
ExecutionContext es) throws Exception;
3944

4045
/**
4146
* Flush all caches.
@@ -67,7 +72,22 @@ public interface ConverterCacheService extends Service {
6772
* the preferred value class
6873
* @return the matching java type
6974
*/
70-
Optional<Class<?>> getMatchingJavaType(
71-
DataType dataType);
75+
Optional<Class<?>> getMatchingJavaType(DataType dataType);
76+
77+
/**
78+
* @FIXME
79+
*
80+
* @return
81+
*/
82+
Collection<DataCellToJavaConverterFactory<?, ?>> getMatchingJavaTypes(
83+
ClassLoader loader, DataType dataType);
84+
85+
/**
86+
* FIXME
87+
*
88+
* @return
89+
*/
90+
Collection<JavaToDataCellConverterFactory<?>> getMatchingFactories(
91+
Class<?> javaType);
7292

7393
}

0 commit comments

Comments
 (0)