/*
 *  Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.twosigma.beakerx.clojure.handlers;

import com.twosigma.beakerx.BeakerImplementationInfo;
import com.twosigma.beakerx.KernelInfoHandler;
import com.twosigma.beakerx.kernel.KernelFunctionality;
import java.io.Serializable;
import java.util.HashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ClojureKernelInfoHandler extends KernelInfoHandler {

  public static final String CLOJURE_VERSION = "1.7";
  private final static Logger logger = LoggerFactory.getLogger(ClojureKernelInfoHandler.class);


  public ClojureKernelInfoHandler(KernelFunctionality kernel) {
    super(kernel);
  }

  @Override
  protected HashMap<String, Serializable> doLanguageInfo(HashMap<String, Serializable> languageInfo) {
    languageInfo.put("name", "Clojure");
    languageInfo.put("version", CLOJURE_VERSION);
    languageInfo.put("mimetype", "text/x-clojure");
    languageInfo.put("file_extension", ".clj");
    languageInfo.put("codemirror_mode", "Clojure");
    languageInfo.put("nbconverter_exporter", "");
    return languageInfo;
  }

  @Override
  protected HashMap<String, Serializable> doContent(HashMap<String, Serializable> content) {
    content.put("implementation", "clojure");
    content.put("banner", String.format(BeakerImplementationInfo.IMPLEMENTATION_VERSION, "Clojure", CLOJURE_VERSION));
    return content;
  }

}

@@ -664,16 +664,74 @@
 dlers;%0A%0A
+import clojure.java.api.Clojure;%0Aimport clojure.lang.IFn;%0A
 import c
@@ -776,16 +776,16 @@
 onInfo;%0A
-
 import c
@@ -879,16 +879,17 @@
 nality;%0A
+%0A
 import j
@@ -938,65 +938,8 @@
 Map;
-%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0Apu
@@ -1054,113 +1054,23 @@
 N = 
-%221.7%22;%0A  private final static Logger logger = LoggerFactory.getLogger(ClojureKernelInfoHandler.class
+getVersion(
 );%0A%0A
-%0A
   pu
@@ -1886,10 +1886,157 @@
 t;%0A  %7D%0A%0A
+  private static String getVersion() %7B%0A    IFn println = Clojure.var(%22clojure.core%22, %22clojure-version%22);%0A    return (String) println.invoke();%0A  %7D%0A
 %7D%0A

read version (#6881)