1515 */
1616package org .scijava .jupyter .kernel ;
1717
18-
1918import com .twosigma .beaker .jupyter .handler .CommOpenHandler ;
20- import com .twosigma .jupyter .KernelRunner ;
2119import com .twosigma .jupyter .handler .KernelHandler ;
2220import com .twosigma .jupyter .message .Message ;
2321import com .twosigma .jupyter .Kernel ;
2422
25- import java .io .IOException ;
26-
27- import static com .twosigma .beaker .jupyter .Utils .uuid ;
2823import com .twosigma .jupyter .KernelSocketsFactoryImpl ;
2924import org .scijava .Context ;
30- import org .scijava .jupyter .ScijavaKernelConfigurationFile ;
31- import org .scijava .jupyter .comm .ScijavaCommOpenHandler ;
32- import org .scijava .jupyter .evaluator .ScijavaEvaluator ;
33- import org .scijava .jupyter .handler .ScijavaKernelInfoHandler ;
25+ import org .scijava .jupyter .kernel .configuration .ScijavaKernelConfigurationFile ;
26+ import org .scijava .jupyter .kernel .comm .ScijavaCommOpenHandler ;
27+ import org .scijava .jupyter .kernel .evaluator .ScijavaEvaluator ;
28+ import org .scijava .jupyter .kernel .handler .ScijavaKernelInfoHandler ;
29+ import org .scijava .jupyter .service .JupyterService ;
3430import org .scijava .log .LogService ;
3531import org .scijava .plugin .Parameter ;
3632import org .scijava .script .ScriptLanguage ;
@@ -48,7 +44,7 @@ public class ScijavaKernel extends Kernel {
4844 private transient LogService log ;
4945
5046 // Ugly but needed (should be fixed upstream soon)
51- private static ScriptLanguage scriptLanguage ;
47+ public static ScriptLanguage scriptLanguage ;
5248
5349 private final ScijavaKernelConfigurationFile config ;
5450 private final ScijavaEvaluator evaluator ;
@@ -67,6 +63,8 @@ public ScijavaKernel(final Context context, final String id, final ScijavaEvalua
6763
6864 this .setLogLevel (config .getLogLevel ());
6965 log .info ("Log level used is : " + this .config .getLogLevel ());
66+
67+ log .info ("Scijava Kernel is started and ready to use." );
7068 }
7169
7270 @ Override
@@ -99,21 +97,10 @@ private void setLogLevel(String logLevel) {
9997 }
10098 }
10199
102- public static void main (final String [] args ) throws InterruptedException , IOException {
103-
104- // TODO : Should this be a Scijava command ?
105- KernelRunner .run (() -> {
106-
107- Context context = new Context ();
108- String id = uuid ();
109-
110- ScijavaKernelConfigurationFile config = new ScijavaKernelConfigurationFile (context , args );
111- KernelSocketsFactoryImpl kernelSocketsFactory = new KernelSocketsFactoryImpl (config );
112- ScijavaEvaluator evaluator = new ScijavaEvaluator (context , id , id , config .getLanguageName ());
113-
114- ScijavaKernel .scriptLanguage = evaluator .getScriptLanguage ();
115-
116- return new ScijavaKernel (context , id , evaluator , config , kernelSocketsFactory );
117- });
100+ public static void main (String ... args ) {
101+ Context context = new Context ();
102+ JupyterService jupyter = context .service (JupyterService .class );
103+ jupyter .runKernel (args );
104+ context .dispose ();
118105 }
119106}
0 commit comments