Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 1cb7b1a

Browse files
committed
Update to beakerx-base version 0.9.1
1 parent 237ff87 commit 1cb7b1a

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<dependency>
128128
<groupId>com.github.twosigma.beakerx</groupId>
129129
<artifactId>beaker-kernel-base</artifactId>
130-
<version>2d1a1e2</version>
130+
<version>0.9.1</version>
131131
</dependency>
132132

133133
<!-- The package to convert images to PNG/JPEG -->

src/main/java/org/scijava/jupyter/kernel/ScijavaKernel.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121

2222
import com.twosigma.beakerx.handler.KernelHandler;
2323
import com.twosigma.beakerx.kernel.Kernel;
24-
import com.twosigma.beakerx.kernel.KernelParameters;
2524
import com.twosigma.beakerx.kernel.KernelSocketsFactory;
2625
import com.twosigma.beakerx.kernel.handler.CommOpenHandler;
2726
import com.twosigma.beakerx.message.Message;
28-
import java.util.HashMap;
29-
import java.util.Map;
3027

3128
import net.imagej.table.process.ResultsPostprocessor;
3229

@@ -56,7 +53,6 @@ public class ScijavaKernel extends Kernel {
5653
private transient LogService log;
5754

5855
private final ScijavaKernelConfigurationFile config;
59-
private final ScijavaEvaluator evaluator;
6056

6157
public ScijavaKernel(final Context context, final String id, final ScijavaEvaluator evaluator,
6258
ScijavaKernelConfigurationFile config, KernelSocketsFactory kernelSocketsFactory) {
@@ -65,7 +61,6 @@ public ScijavaKernel(final Context context, final String id, final ScijavaEvalua
6561
this.context = context;
6662
this.context.inject(this);
6763
this.config = config;
68-
this.evaluator = evaluator;
6964

7065
// Don't show output when it is null
7166
Kernel.showNullExecutionResult = false;
@@ -106,12 +101,6 @@ private void setLogLevel(String logLevel) {
106101
}
107102
}
108103

109-
@Override
110-
public KernelParameters getKernelParameters() {
111-
Map<String, Object> kernelParameters = new HashMap<>();
112-
return new KernelParameters(kernelParameters);
113-
}
114-
115104
public static void main(String... args) {
116105
final Context context = new Context();
117106

src/main/java/org/scijava/jupyter/kernel/evaluator/ScijavaEvaluator.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
import com.twosigma.beakerx.evaluator.Evaluator;
2424
import com.twosigma.beakerx.jvm.object.SimpleEvaluationObject;
2525
import com.twosigma.beakerx.kernel.Classpath;
26+
import com.twosigma.beakerx.kernel.EvaluatorParameters;
2627
import com.twosigma.beakerx.kernel.ImportPath;
2728
import com.twosigma.beakerx.kernel.Imports;
28-
import com.twosigma.beakerx.kernel.KernelParameters;
2929
import com.twosigma.beakerx.kernel.PathToJar;
30+
3031
import java.io.IOException;
3132
import java.nio.file.Path;
3233
import java.util.ArrayList;
@@ -48,6 +49,7 @@
4849
import org.scijava.script.ScriptLanguage;
4950
import org.scijava.script.ScriptService;
5051
import org.scijava.thread.ThreadService;
52+
import org.scijava.util.FileUtils;
5153

5254
/**
5355
*
@@ -92,7 +94,7 @@ public ScijavaEvaluator(Context context, String shellId, String sessionId) {
9294
}
9395

9496
@Override
95-
public void setShellOptions(KernelParameters kp) throws IOException {
97+
public void setShellOptions(EvaluatorParameters kp) throws IOException {
9698
log.debug("Set shell options : " + kp);
9799
}
98100

@@ -113,7 +115,7 @@ public AutocompleteResult autocomplete(String code, int index) {
113115
if (completer != null) {
114116
AutoCompletionResult result = completer.autocomplete(line, index, scriptEngine);
115117

116-
matches = (List<String>) result.getMatches();
118+
matches = result.getMatches();
117119
startIndex = index;
118120

119121
} else {
@@ -252,11 +254,6 @@ public void removeImport(ImportPath ip) {
252254
log.debug("addJarToClasspath()");
253255
}
254256

255-
@Override
256-
public void initKernel(KernelParameters kp) {
257-
log.debug("initKernel()");
258-
}
259-
260257
@Override
261258
public List<Path> addJarsToClasspath(List<PathToJar> list) {
262259
log.debug("addJarsToClasspath()");
@@ -269,4 +266,28 @@ public boolean addJarToClasspath(PathToJar ptj) {
269266
return true;
270267
}
271268

269+
@Override
270+
public void cancelExecution() {
271+
log.debug("cancelExecution()");
272+
}
273+
274+
@Override
275+
public Path getTempFolder() {
276+
log.debug("getTempFolder()");
277+
try {
278+
return FileUtils.createTemporaryDirectory("scijava-jupyter-kernel", null).toPath();
279+
}
280+
catch (final IOException exc) {
281+
throw new RuntimeException(exc);
282+
}
283+
}
284+
285+
@Override
286+
public Class<?> loadClass(String clazzName) throws ClassNotFoundException {
287+
log.debug("loadClass()");
288+
final ClassLoader ccl = Thread.currentThread().getContextClassLoader();
289+
final ClassLoader cl = ccl == null ? ClassLoader.getSystemClassLoader() : ccl;
290+
return cl.loadClass(clazzName);
291+
}
292+
272293
}

0 commit comments

Comments
 (0)