You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lb...@apache.org on 2016/01/22 23:07:09 UTC

[01/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Repository: incubator-toree
Updated Branches:
  refs/heads/TestBranch [created] 846292233


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala b/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
new file mode 100644
index 0000000..a8f439c
--- /dev/null
+++ b/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
+import com.ibm.spark.kernel.interpreter.sql.{SqlInterpreter, SqlException}
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
+import com.ibm.spark.magic.dependencies.IncludeKernel
+
+/**
+ * Represents the magic interface to use the SQL interpreter.
+ */
+class Sql extends CellMagic with IncludeKernel {
+  override def execute(code: String): CellMagicOutput = {
+    val sparkR = kernel.interpreter("SQL")
+
+    if (sparkR.isEmpty || sparkR.get == null)
+      throw new SqlException("SQL is not available!")
+
+    sparkR.get match {
+      case sparkRInterpreter: SqlInterpreter =>
+        val (_, output) = sparkRInterpreter.interpret(code)
+        output match {
+          case Left(executeOutput) =>
+            CellMagicOutput(MIMEType.PlainText -> executeOutput)
+          case Right(executeFailure) => executeFailure match {
+            case executeAborted: ExecuteAborted =>
+              throw new SqlException("SQL code was aborted!")
+            case executeError: ExecuteError =>
+              throw new SqlException(executeError.value)
+          }
+        }
+      case otherInterpreter =>
+        val className = otherInterpreter.getClass.getName
+        throw new SqlException(s"Invalid SQL interpreter: $className")
+    }
+  }
+}
+


[15/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
new file mode 100644
index 0000000..db99cc1
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.PrintStream
+
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.dependencies.IncludeOutputStream
+
+class LSMagic extends LineMagic with IncludeOutputStream {
+
+  private lazy val printStream = new PrintStream(outputStream)
+
+  /**
+   * Lists all available magics.
+   * @param code The single line of code
+   * @return The output of the magic
+   */
+  override def execute(code: String): Unit = {
+    val classes = new BuiltinLoader().loadClasses().toList
+    val lineMagics = magicNames("%", classOf[LineMagic], classes)
+      .mkString(" ").toLowerCase
+    val cellMagics = magicNames("%%", classOf[CellMagic], classes)
+      .mkString(" ").toLowerCase
+    val message =
+      s"""|Available line magics:
+           |$lineMagics
+           |
+           |Available cell magics:
+           |$cellMagics
+           |
+           |Type %<magic_name> for usage info.
+         """.stripMargin
+
+    printStream.println(message)
+  }
+
+  /**
+   * Provides a list of class names from the given list that implement
+   * the specified interface, with the specified prefix prepended.
+   * @param prefix prepended to each name, e.g. "%%"
+   * @param interface a magic interface, e.g. classOf[LineMagic]
+   * @param classes a list of magic classes
+   * @return list of class names with prefix
+   */
+  protected[magic] def magicNames(prefix: String, interface: Class[_],
+                                  classes: List[Class[_]]) : List[String] = {
+    val filteredClasses = classes.filter(_.getInterfaces.contains(interface))
+    filteredClasses.map(c => s"${prefix}${c.getSimpleName}")
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
new file mode 100644
index 0000000..dbee517
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.interpreter.{ExecuteFailure, Results, ExecuteAborted, ExecuteError}
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
+import com.ibm.spark.utils.LogLike
+import com.ibm.spark.utils.json.RddToJson
+import org.apache.spark.sql.SchemaRDD
+
+/**
+ * Temporary magic to show an RDD as JSON
+ */
+class RDD extends CellMagic with IncludeKernelInterpreter with LogLike {
+
+  private def convertToJson(code: String) = {
+    val (result, message) = kernelInterpreter.interpret(code)
+    result match {
+      case Results.Success =>
+        val rddVarName = kernelInterpreter.lastExecutionVariableName.getOrElse("")
+        kernelInterpreter.read(rddVarName).map(rddVal => {
+          try{
+            CellMagicOutput(MIMEType.ApplicationJson -> RddToJson.convert(rddVal.asInstanceOf[SchemaRDD]))
+          } catch {
+            case _: Throwable =>
+              CellMagicOutput(MIMEType.PlainText -> s"Could note convert RDD to JSON: ${rddVarName}->${rddVal}")
+          }
+        }).getOrElse(CellMagicOutput(MIMEType.PlainText -> "No RDD Value found!"))
+      case _ =>
+        val errorMessage = message.right.toOption match {
+          case Some(executeFailure) => executeFailure match {
+            case _: ExecuteAborted => throw new Exception("RDD magic aborted!")
+            case executeError: ExecuteError => throw new Exception(executeError.value)
+          }
+          case _ =>  "No error information available!"
+        }
+        logger.error(s"Error retrieving RDD value: ${errorMessage}")
+        CellMagicOutput(MIMEType.PlainText ->
+          (s"An error occurred converting RDD to JSON.\n${errorMessage}"))
+    }
+  }
+
+  override def execute(code: String): CellMagicOutput =
+    convertToJson(code)
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
new file mode 100644
index 0000000..47d4f65
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.magic.LineMagic
+import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import java.io.PrintStream
+import com.ibm.spark.kernel.api.KernelOptions
+
+
+class ShowTypes extends LineMagic with IncludeOutputStream {
+  private lazy val printStream = new PrintStream(outputStream)
+
+  override def execute(code: String): Unit = {
+    code match {
+      case "on" =>
+        printStream.println(s"Types will be printed.")
+        KernelOptions.showTypes = true
+      case "off" =>
+        printStream.println(s"Types will not be printed")
+        KernelOptions.showTypes = false
+      case "" =>
+        printStream.println(s"ShowTypes is currently ${if (KernelOptions.showTypes) "on" else "off"} ")
+      case other =>
+        printStream.println(s"${other} is not a valid option for the ShowTypes magic.")
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
new file mode 100644
index 0000000..d30736e
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.magic.LineMagic
+import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import java.io.PrintStream
+import com.ibm.spark.kernel.api.KernelOptions
+
+
+class Truncation extends LineMagic with IncludeOutputStream {
+  private lazy val printStream = new PrintStream(outputStream)
+
+  override def execute(code: String): Unit = {
+    code match {
+      case "on" =>
+        printStream.println(s"Output WILL be truncated.")
+        KernelOptions.noTruncation = false
+      case "off" =>
+        printStream.println(s"Output will NOT be truncated")
+        KernelOptions.noTruncation = true
+      case "" =>
+        printStream.println(s"Truncation is currently ${if (KernelOptions.noTruncation) "off" else "on"} ")
+      case other =>
+        printStream.println(s"${other} is not a valid option for the NoTruncation magic.")
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala b/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
new file mode 100644
index 0000000..05c2216
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import com.ibm.spark.kernel.protocol.v5.{MessageType, KernelMessage}
+
+trait MessageLogSupport extends LogLike {
+  /**
+   * Logs various pieces of a KernelMessage at different levels of logging.
+   * @param km
+   */
+  def logMessage(km: KernelMessage): Unit = {
+    logger.trace(s"Kernel message ids: ${km.ids}")
+    logger.trace(s"Kernel message signature: ${km.signature}")
+    logger.debug(s"Kernel message header id: ${km.header.msg_id}")
+    logger.debug(s"Kernel message header type: ${km.header.msg_type}")
+    val incomingMessage = isIncomingMessage(km.header.msg_type)
+    (km.parentHeader, incomingMessage) match {
+      case (null, true)   =>  //  Don't do anything, this is expected
+      case (null, false)  =>  //  Messages coming from the kernel should have parent headers
+        logger.warn(s"Parent header is null for message ${km.header.msg_id} " +
+          s"of type ${km.header.msg_type}")
+      case _ =>
+        logger.trace(s"Kernel message parent id: ${km.parentHeader.msg_id}")
+        logger.trace(s"Kernel message parent type: ${km.parentHeader.msg_type}")
+    }
+    logger.trace(s"Kernel message metadata: ${km.metadata}")
+    logger.trace(s"Kernel message content: ${km.contentString}")
+  }
+
+  /**
+   * Logs an action, along with message id and type for a KernelMessage.
+   * @param action
+   * @param km
+   */
+  def logKernelMessageAction(action: String, km: KernelMessage): Unit = {
+    logger.debug(s"${action} KernelMessage ${km.header.msg_id} " +
+      s"of type ${km.header.msg_type}")
+  }
+
+  // TODO: Migrate this to a helper method in MessageType.Incoming
+  /**
+   * This method is used to determine if a message is being received by the
+   * kernel or being sent from the kernel.
+   * @return true if the message is received by the kernel, false otherwise.
+   */
+  private def isIncomingMessage(messageType: String): Boolean ={
+    MessageType.Incoming.CompleteRequest.toString.equals(messageType) ||
+      MessageType.Incoming.ConnectRequest.toString.equals(messageType) ||
+      MessageType.Incoming.ExecuteRequest.toString.equals(messageType) ||
+      MessageType.Incoming.HistoryRequest.toString.equals(messageType) ||
+      MessageType.Incoming.InspectRequest.toString.equals(messageType) ||
+      MessageType.Incoming.ShutdownRequest.toString.equals(messageType)||
+      MessageType.Incoming.KernelInfoRequest.toString.equals(messageType) ||
+      MessageType.Incoming.CommOpen.toString.equals(messageType) ||
+      MessageType.Incoming.CommMsg.toString.equals(messageType) ||
+      MessageType.Incoming.CommClose.toString.equals(messageType)
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala b/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
new file mode 100644
index 0000000..3439d0d
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils.json
+
+import org.apache.spark.sql.{DataFrame, SchemaRDD}
+import play.api.libs.json.{JsObject, JsString, Json}
+
+/**
+ * Utility to convert RDD to JSON.
+ */
+object RddToJson {
+
+  /**
+   * Converts a SchemaRDD to a JSON table format.
+   *
+   * @param rdd The schema rdd (now a dataframe) to convert
+   *
+   * @return The resulting string representing the JSON
+   */
+  def convert(rdd: DataFrame, limit: Int = 10): String =
+    JsObject(Seq(
+      "type" -> JsString("rdd/schema"),
+      "columns" -> Json.toJson(rdd.schema.fieldNames),
+      "rows" -> Json.toJson(rdd.map(row =>
+        row.toSeq.map(_.toString).toArray).take(limit))
+    )).toString()
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/boot/CommandLineOptionsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/boot/CommandLineOptionsSpec.scala b/kernel/src/test/scala/com/ibm/spark/boot/CommandLineOptionsSpec.scala
deleted file mode 100644
index 703d677..0000000
--- a/kernel/src/test/scala/com/ibm/spark/boot/CommandLineOptionsSpec.scala
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.boot
-
-import java.io.File
-
-import com.typesafe.config.Config
-import joptsimple.OptionException
-import org.scalatest.{FunSpec, Matchers}
-
-import scala.collection.JavaConverters._
-
-class CommandLineOptionsSpec extends FunSpec with Matchers {
-
-  describe("CommandLineOptions") {
-    describe("when received --max-interpreter-threads=<int>") {
-      it("should set the configuration to the specified value") {
-        val expected = 999
-        val options = new CommandLineOptions(
-          s"--max-interpreter-threads=$expected" :: Nil
-        )
-
-        val actual = options.toConfig.getInt("max_interpreter_threads")
-
-        actual should be (expected)
-      }
-    }
-
-    describe("when received --help") {
-      it("should set the help flag to true") {
-        val options = new CommandLineOptions("--help" :: Nil)
-
-        options.help should be (true)
-      }
-    }
-
-    describe("when received -h") {
-      it("should set the help flag to true") {
-        val options = new CommandLineOptions("-h" :: Nil)
-
-        options.help should be (true)
-      }
-    }
-
-    describe("when not received --help or -h") {
-      it("should set the help flag to false") {
-        val options = new CommandLineOptions(Nil)
-
-        options.help should be (false)
-      }
-    }
-
-    describe("when received --version") {
-      it("should set the version flag to true") {
-        val options = new CommandLineOptions("--version" :: Nil)
-
-        options.version should be (true)
-      }
-    }
-
-    describe("when received -v") {
-      it("should set the version flag to true") {
-        val options = new CommandLineOptions("-v" :: Nil)
-
-        options.version should be (true)
-      }
-    }
-
-    describe("when not received --version or -v") {
-      it("should set the version flag to false") {
-        val options = new CommandLineOptions(Nil)
-
-        options.version should be (false)
-      }
-    }
-
-    describe("when received --spark-conf=<key>=<value>") {
-      it("should add the key-value pair to the string representation") {
-        val expected = "key=value"
-        val options = new CommandLineOptions(s"--spark-conf=$expected" :: Nil)
-        val actual = options.toConfig.getString("spark_configuration")
-
-        actual should be (expected)
-      }
-
-      it("should append to existing command line key-value pairs") {
-        val expected = "key1=value1" :: "key2=value2" :: Nil
-        val options = new CommandLineOptions(
-          s"--spark-conf=${expected(0)}" ::
-          s"--spark-conf=${expected(1)}" ::
-          Nil
-        )
-        val actual = options.toConfig.getString("spark_configuration")
-
-        actual should be (expected.mkString(","))
-      }
-    }
-
-    describe("when received -S<key>=<value>") {
-      it("should add the key-value pair to the string representation") {
-        val expected = "key=value"
-        val options = new CommandLineOptions(s"-S$expected" :: Nil)
-        val actual = options.toConfig.getString("spark_configuration")
-
-        actual should be(expected)
-      }
-
-      it("should append to existing command line key-value pairs") {
-        val expected = "key1=value1" :: "key2=value2" :: Nil
-        val options = new CommandLineOptions(
-          s"-S${expected(0)}" ::
-          s"-S${expected(1)}" ::
-          Nil
-        )
-        val actual = options.toConfig.getString("spark_configuration")
-
-        actual should be (expected.mkString(","))
-      }
-    }
-
-    describe("when received --profile=<path>") {
-      it("should error if path is not set") {
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--profile"))
-        }
-      }
-
-      describe("#toConfig") {
-        it("should include values specified in file") {
-
-          val pathToProfileFixture: String = new File(getClass.getResource("/fixtures/profile.json").toURI).getAbsolutePath
-          val options = new CommandLineOptions(Seq("--profile="+pathToProfileFixture))
-
-          val config: Config = options.toConfig
-
-          config.entrySet() should not be ('empty)
-          config.getInt("stdin_port") should be(12345)
-          config.getInt("shell_port") should be(54321)
-          config.getInt("iopub_port") should be(11111)
-          config.getInt("control_port") should be(22222)
-          config.getInt("hb_port") should be(33333)
-        }
-      }
-    }
-
-    describe("when received --<protocol port name>=<value>"){
-      it("should error if value is not set") {
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--stdin-port"))
-        }
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--shell-port"))
-        }
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--iopub-port"))
-        }
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--control-port"))
-        }
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--heartbeat-port"))
-        }
-      }
-
-      describe("#toConfig") {
-        it("should return config with commandline option values") {
-
-          val options = new CommandLineOptions(List(
-            "--stdin-port", "99999",
-            "--shell-port", "88888",
-            "--iopub-port", "77777",
-            "--control-port", "55555",
-            "--heartbeat-port", "44444"
-          ))
-
-          val config: Config = options.toConfig
-
-          config.entrySet() should not be ('empty)
-          config.getInt("stdin_port") should be(99999)
-          config.getInt("shell_port") should be(88888)
-          config.getInt("iopub_port") should be(77777)
-          config.getInt("control_port") should be(55555)
-          config.getInt("hb_port") should be(44444)
-        }
-      }
-    }
-
-    describe("when received --profile and --<protocol port name>=<value>"){
-      describe("#toConfig") {
-        it("should return config with <protocol port> argument value") {
-
-          val pathToProfileFixture: String = (new File(getClass.getResource("/fixtures/profile.json").toURI)).getAbsolutePath
-          val options = new CommandLineOptions(List("--profile", pathToProfileFixture, "--stdin-port", "99999", "--shell-port", "88888"))
-
-          val config: Config = options.toConfig
-
-          config.entrySet() should not be ('empty)
-          config.getInt("stdin_port") should be(99999)
-          config.getInt("shell_port") should be(88888)
-          config.getInt("iopub_port") should be(11111)
-          config.getInt("control_port") should be(22222)
-        }
-      }
-
-    }
-
-    describe("when no arguments are received"){
-      describe("#toConfig") {
-        it("should read default value set in reference.conf") {
-
-          val options = new CommandLineOptions(Nil)
-
-          val config: Config = options.toConfig
-          config.getInt("stdin_port") should be(48691)
-          config.getInt("shell_port") should be(40544)
-          config.getInt("iopub_port") should be(43462)
-          config.getInt("control_port") should be(44808)
-        }
-      }
-    }
-
-    describe("when using -- to separate interpreter arguments"){
-      describe("#toConfig") {
-        it("should return interpreter_args config property when there are args before --") {
-
-          val options = new CommandLineOptions(List("--stdin-port", "99999", "--shell-port", "88888", "--", "someArg1", "someArg2", "someArg3"))
-
-          val config: Config = options .toConfig
-
-          config.entrySet() should not be ('empty)
-          config.getStringList("interpreter_args").asScala should be (List("someArg1", "someArg2", "someArg3"))
-        }
-
-        it("should return interpreter_args config property when args is at the beginning") {
-
-          val options = new CommandLineOptions(List("--", "someArg1", "someArg2", "someArg3"))
-
-          val config: Config = options .toConfig
-
-          config.entrySet() should not be ('empty)
-          config.getStringList("interpreter_args").asScala should be (List("someArg1", "someArg2", "someArg3"))
-        }
-
-        it("should return interpreter_args config property as empty list when there is nothing after --") {
-
-          val options = new CommandLineOptions(List("--stdin-port", "99999", "--shell-port", "88888", "--"))
-
-          val config: Config = options .toConfig
-
-          config.entrySet() should not be ('empty)
-          config.getStringList("interpreter_args").asScala should be ('empty)
-        }
-      }
-    }
-
-    describe("when received --ip=<value>") {
-      it("should error if value is not set") {
-        intercept[OptionException] {
-          new CommandLineOptions(Seq("--ip"))
-        }
-      }
-
-      describe("#toConfig") {
-        it("should set ip to specified value") {
-          val expected = "1.2.3.4"
-          val options = new CommandLineOptions(s"--ip=${expected}" :: Nil)
-          val config: Config = options.toConfig
-
-          config.getString("ip") should be(expected)
-        }
-
-        it("should set ip to 127.0.0.1") {
-          val options = new CommandLineOptions(Nil)
-          val config: Config = options.toConfig
-
-          config.getString("ip") should be("127.0.0.1")
-        }
-      }
-    }
-
-    describe("when received options with surrounding whitespace") {
-      it("should trim whitespace") {
-        val url1 = "url1"
-        val url2 = "url2"
-
-        val options = new CommandLineOptions(Seq(
-          " --magic-url ", s" ${url1}\t",
-          "--magic-url", s" \t ${url2} \t"
-        ))
-        val config: Config = options.toConfig
-
-        config.getList("magic_urls").unwrapped.asScala should
-          be (Seq(url1, url2))
-      }
-    }
-
-    describe("when received --interpreter-plugin") {
-      it("should return the interpreter-plugin along with the defaults") {
-        val options = new CommandLineOptions(Seq(
-          "--interpreter-plugin",
-          "dummy:test.utils.DummyInterpreter"
-        ))
-
-        val config: Config = options.toConfig
-
-        val p = config.getList("interpreter_plugins")
-
-        p should not be empty
-
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/comm/KernelCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/comm/KernelCommManagerSpec.scala b/kernel/src/test/scala/com/ibm/spark/comm/KernelCommManagerSpec.scala
deleted file mode 100644
index 7b4442c..0000000
--- a/kernel/src/test/scala/com/ibm/spark/comm/KernelCommManagerSpec.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.CommContent
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import org.scalatest.mock.MockitoSugar
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-
-class KernelCommManagerSpec extends FunSpec with Matchers with BeforeAndAfter
-  with MockitoSugar
-{
-  private val TestTargetName = "some target"
-
-  private var mockActorLoader: ActorLoader = _
-  private var mockKMBuilder: KMBuilder = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var kernelCommManager: KernelCommManager = _
-
-  private var generatedCommWriter: CommWriter = _
-
-  before {
-    mockActorLoader = mock[ActorLoader]
-    mockKMBuilder = mock[KMBuilder]
-    mockCommRegistrar = mock[CommRegistrar]
-
-    kernelCommManager = new KernelCommManager(
-      mockActorLoader,
-      mockKMBuilder,
-      mockCommRegistrar
-    ) {
-      override protected def newCommWriter(commId: UUID): CommWriter = {
-        val commWriter = super.newCommWriter(commId)
-
-        generatedCommWriter = commWriter
-
-        val spyCommWriter = spy(commWriter)
-        doNothing().when(spyCommWriter)
-          .sendCommKernelMessage(any[KernelMessageContent with CommContent])
-
-        spyCommWriter
-      }
-    }
-  }
-
-  describe("KernelCommManager") {
-    describe("#open") {
-      it("should return a wrapped instance of KernelCommWriter") {
-        kernelCommManager.open(TestTargetName, v5.MsgData.Empty)
-
-        // Exposed hackishly for testing
-        generatedCommWriter shouldBe a [KernelCommWriter]
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/comm/KernelCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/comm/KernelCommWriterSpec.scala b/kernel/src/test/scala/com/ibm/spark/comm/KernelCommWriterSpec.scala
deleted file mode 100644
index eb792bb..0000000
--- a/kernel/src/test/scala/com/ibm/spark/comm/KernelCommWriterSpec.scala
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.comm
-
-import java.util.UUID
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import play.api.libs.json.Json
-import scala.concurrent.duration._
-
-import akka.actor.{ActorSelection, ActorSystem}
-import akka.testkit.{TestProbe, TestKit}
-import com.typesafe.config.ConfigFactory
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-object KernelCommWriterSpec {
-  val config ="""
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class KernelCommWriterSpec extends TestKit(
-  ActorSystem("KernelCommWriterSpec",
-    ConfigFactory.parseString(KernelCommWriterSpec.config))
-) with FunSpecLike with Matchers with BeforeAndAfter with MockitoSugar
-{
-
-  private val commId = UUID.randomUUID().toString
-  private var kernelCommWriter: KernelCommWriter = _
-  private var kernelMessageBuilder: KMBuilder = _
-
-  private var actorLoader: ActorLoader = _
-  private var kernelMessageRelayProbe: TestProbe = _
-
-  /**
-   * Retrieves the next message available.
-   *
-   * @return The KernelMessage instance (or an error if timed out)
-   */
-  private def getNextMessage =
-    kernelMessageRelayProbe.receiveOne(200.milliseconds)
-      .asInstanceOf[KernelMessage]
-
-  /**
-   * Retrieves the next message available and returns its type.
-   *
-   * @return The type of the message (pulled from message header)
-   */
-  private def getNextMessageType = getNextMessage.header.msg_type
-
-  /**
-   * Retrieves the next message available and parses the content string.
-   *
-   * @tparam T The type to coerce the content string into
-   *
-   * @return The resulting KernelMessageContent instance
-   */
-  private def getNextMessageContents[T <: KernelMessageContent]
-    (implicit fjs: play.api.libs.json.Reads[T], mf: Manifest[T]) =
-  {
-    val receivedMessage = getNextMessage
-
-    Json.parse(receivedMessage.contentString).as[T]
-  }
-
-  before {
-    kernelMessageBuilder = spy(KMBuilder())
-
-    // Construct path for kernel message relay
-    actorLoader = mock[ActorLoader]
-    kernelMessageRelayProbe = TestProbe()
-    val kernelMessageRelaySelection: ActorSelection =
-      system.actorSelection(kernelMessageRelayProbe.ref.path.toString)
-    doReturn(kernelMessageRelaySelection)
-      .when(actorLoader).load(SystemActorType.KernelMessageRelay)
-
-    // Create a new writer to use for testing
-    kernelCommWriter = new KernelCommWriter(actorLoader, kernelMessageBuilder, commId)
-  }
-
-  describe("KernelCommWriter") {
-    describe("#writeOpen") {
-      it("should send a comm_open message to the relay") {
-        kernelCommWriter.writeOpen(anyString())
-
-        getNextMessageType should be (CommOpen.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        kernelCommWriter.writeOpen(anyString())
-
-        val actual = getNextMessageContents[CommOpen].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should include the target name in the message") {
-        val expected = "<TARGET_NAME>"
-        kernelCommWriter.writeOpen(expected)
-
-        val actual = getNextMessageContents[CommOpen].target_name
-
-        actual should be (expected)
-      }
-
-      it("should provide empty data in the message if no data is provided") {
-        val expected = MsgData.Empty
-        kernelCommWriter.writeOpen(anyString())
-
-        val actual = getNextMessageContents[CommOpen].data
-
-        actual should be (expected)
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("some key" -> "some value")
-        kernelCommWriter.writeOpen(anyString(), expected)
-
-        val actual = getNextMessageContents[CommOpen].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#writeMsg") {
-      it("should send a comm_msg message to the relay") {
-        kernelCommWriter.writeMsg(MsgData.Empty)
-
-        getNextMessageType should be (CommMsg.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        kernelCommWriter.writeMsg(MsgData.Empty)
-
-        val actual = getNextMessageContents[CommMsg].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should fail a require if the data is null") {
-        intercept[IllegalArgumentException] {
-          kernelCommWriter.writeMsg(null)
-        }
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("some key" -> "some value")
-        kernelCommWriter.writeMsg(expected)
-
-        val actual = getNextMessageContents[CommMsg].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#writeClose") {
-      it("should send a comm_close message to the relay") {
-        kernelCommWriter.writeClose()
-
-        getNextMessageType should be (CommClose.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        kernelCommWriter.writeClose()
-
-        val actual = getNextMessageContents[CommClose].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should provide empty data in the message if no data is provided") {
-        val expected = MsgData.Empty
-        kernelCommWriter.writeClose()
-
-        val actual = getNextMessageContents[CommClose].data
-
-        actual should be (expected)
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("some key" -> "some value")
-        kernelCommWriter.writeClose(expected)
-
-        val actual = getNextMessageContents[CommClose].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#write") {
-      it("should send a comm_msg message to the relay") {
-        kernelCommWriter.write(Array('a'), 0, 1)
-
-        getNextMessageType should be (CommMsg.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        kernelCommWriter.write(Array('a'), 0, 1)
-
-        val actual = getNextMessageContents[CommMsg].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should package the string as part of the data with a 'message' key") {
-        val expected = MsgData("message" -> "a")
-        kernelCommWriter.write(Array('a'), 0, 1)
-
-        val actual = getNextMessageContents[CommMsg].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#flush") {
-      it("should do nothing") {
-        // TODO: Is this test necessary? It does nothing.
-        kernelCommWriter.flush()
-      }
-    }
-
-    describe("#close") {
-      it("should send a comm_close message to the relay") {
-        kernelCommWriter.close()
-
-        getNextMessageType should be (CommClose.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        kernelCommWriter.close()
-
-        val actual = getNextMessageContents[CommClose].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should provide empty data in the message") {
-        val expected = MsgData.Empty
-        kernelCommWriter.close()
-
-        val actual = getNextMessageContents[CommClose].data
-
-        actual should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/global/ExecutionCounterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/global/ExecutionCounterSpec.scala b/kernel/src/test/scala/com/ibm/spark/global/ExecutionCounterSpec.scala
deleted file mode 100644
index 4d1641f..0000000
--- a/kernel/src/test/scala/com/ibm/spark/global/ExecutionCounterSpec.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.global
-
-import org.scalatest.{FunSpec, Matchers}
-
-class ExecutionCounterSpec extends FunSpec with Matchers {
-  describe("ExecutionCounter") {
-    describe("#increment( String )"){
-      it("should increment value when key is not present"){
-        ExecutionCounter incr "foo" should be(1)
-      }
-      it("should increment value for key when it is present"){
-        ExecutionCounter incr "bar" should be(1)
-        ExecutionCounter incr "bar" should be(2)
-      }
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/api/KernelSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/api/KernelSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/api/KernelSpec.scala
deleted file mode 100644
index 58ea0c5..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/api/KernelSpec.scala
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.ibm.spark.kernel.api
-
-import java.io.{InputStream, PrintStream}
-
-import com.ibm.spark.boot.layer.InterpreterManager
-import com.ibm.spark.comm.CommManager
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.magic.MagicLoader
-import com.typesafe.config.Config
-import org.apache.spark.{SparkConf, SparkContext}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-import com.ibm.spark.global.ExecuteRequestState
-
-class KernelSpec extends FunSpec with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val BadCode = Some("abc foo bar")
-  private val GoodCode = Some("val foo = 1")
-  private val ErrorCode = Some("val foo = bar")
-  private val ErrorMsg = "Name: error\n" +
-    "Message: bad\n" +
-    "StackTrace: 1"
-
-  private var mockConfig: Config = _
-  private var mockSparkContext: SparkContext = _
-  private var mockSparkConf: SparkConf = _
-  private var mockActorLoader: ActorLoader = _
-  private var mockInterpreter: Interpreter = _
-  private var mockInterpreterManager: InterpreterManager = _
-  private var mockCommManager: CommManager = _
-  private var mockMagicLoader: MagicLoader = _
-  private var kernel: Kernel = _
-  private var spyKernel: Kernel = _
-
-  before {
-    mockConfig = mock[Config]
-    mockInterpreter = mock[Interpreter]
-    mockInterpreterManager = mock[InterpreterManager]
-    mockSparkContext = mock[SparkContext]
-    mockSparkConf = mock[SparkConf]
-    when(mockInterpreterManager.defaultInterpreter)
-      .thenReturn(Some(mockInterpreter))
-    when(mockInterpreterManager.interpreters)
-      .thenReturn(Map[String, com.ibm.spark.interpreter.Interpreter]())
-    when(mockInterpreter.interpret(BadCode.get))
-      .thenReturn((Results.Incomplete, null))
-    when(mockInterpreter.interpret(GoodCode.get))
-      .thenReturn((Results.Success, Left(new ExecuteOutput("ok"))))
-    when(mockInterpreter.interpret(ErrorCode.get))
-      .thenReturn((Results.Error, Right(ExecuteError("error","bad", List("1")))))
-
-
-    mockCommManager = mock[CommManager]
-    mockActorLoader = mock[ActorLoader]
-    mockMagicLoader = mock[MagicLoader]
-
-    kernel = new Kernel(
-      mockConfig, mockActorLoader, mockInterpreterManager, mockCommManager,
-      mockMagicLoader
-    )
-
-    spyKernel = spy(kernel)
-
-  }
-
-  after {
-    ExecuteRequestState.reset()
-  }
-
-  describe("Kernel") {
-    describe("#eval") {
-      it("should return syntax error") {
-        kernel eval BadCode should be((false, "Syntax Error!"))
-      }
-
-      it("should return ok") {
-        kernel eval GoodCode should be((true, "ok"))
-      }
-
-      it("should return error") {
-        kernel eval ErrorCode should be((false, ErrorMsg))
-      }
-
-      it("should return error on None") {
-        kernel eval None should be ((false, "Error!"))
-      }
-    }
-
-    describe("#out") {
-      it("should throw an exception if the ExecuteRequestState has not been set") {
-        intercept[IllegalArgumentException] {
-          kernel.out
-        }
-      }
-
-      it("should create a new PrintStream instance if the ExecuteRequestState has been set") {
-        ExecuteRequestState.processIncomingKernelMessage(
-          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
-            mock[Metadata], "")
-        )
-        kernel.out shouldBe a [PrintStream]
-      }
-    }
-
-    describe("#err") {
-      it("should throw an exception if the ExecuteRequestState has not been set") {
-        intercept[IllegalArgumentException] {
-          kernel.err
-        }
-      }
-
-      it("should create a new PrintStream instance if the ExecuteRequestState has been set") {
-        ExecuteRequestState.processIncomingKernelMessage(
-          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
-            mock[Metadata], "")
-        )
-
-        // TODO: Access the underlying streamType field to assert stderr?
-        kernel.err shouldBe a [PrintStream]
-      }
-    }
-
-    describe("#in") {
-      it("should throw an exception if the ExecuteRequestState has not been set") {
-        intercept[IllegalArgumentException] {
-          kernel.in
-        }
-      }
-
-      it("should create a new InputStream instance if the ExecuteRequestState has been set") {
-        ExecuteRequestState.processIncomingKernelMessage(
-          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
-            mock[Metadata], "")
-        )
-
-        kernel.in shouldBe a [InputStream]
-      }
-    }
-
-    describe("#stream") {
-      it("should throw an exception if the ExecuteRequestState has not been set") {
-        intercept[IllegalArgumentException] {
-          kernel.stream
-        }
-      }
-
-      it("should create a StreamMethods instance if the ExecuteRequestState has been set") {
-        ExecuteRequestState.processIncomingKernelMessage(
-          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
-            mock[Metadata], "")
-        )
-
-        kernel.stream shouldBe a [StreamMethods]
-      }
-    }
-
-    describe("when spark.master is set in config") {
-
-      it("should create SparkConf") {
-        val expected = "some value"
-        doReturn(expected).when(mockConfig).getString("spark.master")
-        doReturn("").when(mockConfig).getString("spark_configuration")
-
-        // Provide stub for interpreter classServerURI since also executed
-        doReturn("").when(mockInterpreter).classServerURI
-
-        val sparkConf = kernel.createSparkConf(new SparkConf().setMaster(expected))
-
-        sparkConf.get("spark.master") should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/api/StreamMethodsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/api/StreamMethodsSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/api/StreamMethodsSpec.scala
deleted file mode 100644
index fc87588..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/api/StreamMethodsSpec.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.ibm.spark.kernel.api
-
-import akka.actor.ActorSystem
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, BeforeAndAfter, Matchers, FunSpec}
-import play.api.libs.json.Json
-
-import scala.concurrent.duration._
-
-import org.mockito.Mockito._
-
-class StreamMethodsSpec extends TestKit(
-  ActorSystem("StreamMethodsSpec")
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val MaxDuration = 300.milliseconds
-
-  private var kernelMessageRelayProbe: TestProbe = _
-  private var mockParentHeader: v5.ParentHeader = _
-  private var mockActorLoader: v5.kernel.ActorLoader = _
-  private var mockKernelMessage: v5.KernelMessage = _
-  private var streamMethods: StreamMethods = _
-
-  before {
-    kernelMessageRelayProbe = TestProbe()
-
-    mockParentHeader = mock[v5.ParentHeader]
-
-    mockActorLoader = mock[v5.kernel.ActorLoader]
-    doReturn(system.actorSelection(kernelMessageRelayProbe.ref.path))
-      .when(mockActorLoader).load(v5.SystemActorType.KernelMessageRelay)
-
-    mockKernelMessage = mock[v5.KernelMessage]
-    doReturn(mockParentHeader).when(mockKernelMessage).header
-
-    streamMethods = new StreamMethods(mockActorLoader, mockKernelMessage)
-  }
-
-  describe("StreamMethods") {
-    describe("#()") {
-      it("should put the header of the given message as the parent header") {
-        val expected = mockKernelMessage.header
-        val actual = streamMethods.kmBuilder.build.parentHeader
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#sendAll") {
-      it("should send a message containing all of the given text") {
-        val expected = "some text"
-
-        streamMethods.sendAll(expected)
-
-        val outgoingMessage = kernelMessageRelayProbe.receiveOne(MaxDuration)
-        val kernelMessage = outgoingMessage.asInstanceOf[KernelMessage]
-
-        val actual = Json.parse(kernelMessage.contentString)
-          .as[v5.content.StreamContent].text
-
-        actual should be (expected)
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
deleted file mode 100644
index 60d3b42..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.dispatch
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.KernelStatus
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import play.api.libs.json.Json
-
-import scala.concurrent.duration._
-
-class StatusDispatchSpec extends TestKit(ActorSystem("StatusDispatchSystem"))
-with FunSpecLike with Matchers with MockitoSugar with BeforeAndAfter{
-  var statusDispatchRef: ActorRef = _
-  var relayProbe: TestProbe = _
-  before {
-    //  Mock the relay with a probe
-    relayProbe = TestProbe()
-    //  Mock the ActorLoader
-    val mockActorLoader: ActorLoader = mock[ActorLoader]
-    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
-      .thenReturn(system.actorSelection(relayProbe.ref.path.toString))
-
-    statusDispatchRef = system.actorOf(Props(classOf[StatusDispatch],mockActorLoader))
-  }
-
-
-  describe("StatusDispatch") {
-    describe("#receive( KernelStatusType )") {
-      it("should send a status message to the relay") {
-        statusDispatchRef ! KernelStatusType.Busy
-        //  Check the kernel message is the correct type
-        val statusMessage: KernelMessage = relayProbe.receiveOne(500.milliseconds).asInstanceOf[KernelMessage]
-        statusMessage.header.msg_type should be (MessageType.Outgoing.Status.toString)
-        //  Check the status is what we sent
-        val status: KernelStatus = Json.parse(statusMessage.contentString).as[KernelStatus]
-         status.execution_state should be (KernelStatusType.Busy.toString)
-      }
-    }
-
-    describe("#receive( KernelStatusType, Header )") {
-      it("should send a status message to the relay") {
-        val tuple = Tuple2(KernelStatusType.Busy, mock[Header])
-        statusDispatchRef ! tuple
-        //  Check the kernel message is the correct type
-        val statusMessage: KernelMessage = relayProbe.receiveOne(500.milliseconds).asInstanceOf[KernelMessage]
-        statusMessage.header.msg_type should be (MessageType.Outgoing.Status.toString)
-        //  Check the status is what we sent
-        val status: KernelStatus = Json.parse(statusMessage.contentString).as[KernelStatus]
-        status.execution_state should be (KernelStatusType.Busy.toString)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
deleted file mode 100644
index b44ad1c..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.actor._
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.CompleteRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5Test._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, BeforeAndAfter, Matchers}
-import org.mockito.Mockito._
-import scala.concurrent.duration._
-
-class CodeCompleteHandlerSpec extends TestKit(
-  ActorSystem("CodeCompleteHandlerSpec")
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter {
-
-  var actorLoader: ActorLoader = _
-  var handlerActor: ActorRef = _
-  var kernelMessageRelayProbe: TestProbe = _
-  var interpreterProbe: TestProbe = _
-  var statusDispatchProbe: TestProbe = _
-
-  before {
-    actorLoader = mock[ActorLoader]
-
-    handlerActor = system.actorOf(Props(classOf[CodeCompleteHandler], actorLoader))
-
-    kernelMessageRelayProbe = TestProbe()
-    when(actorLoader.load(SystemActorType.KernelMessageRelay))
-      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
-
-    interpreterProbe = new TestProbe(system)
-    when(actorLoader.load(SystemActorType.Interpreter))
-      .thenReturn(system.actorSelection(interpreterProbe.ref.path.toString))
-
-    statusDispatchProbe = new TestProbe(system)
-    when(actorLoader.load(SystemActorType.StatusDispatch))
-      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
-  }
-
-  def replyToHandlerWithOkAndResult() = {
-    val expectedClass = classOf[CompleteRequest]
-    interpreterProbe.expectMsgClass(expectedClass)
-    interpreterProbe.reply((0, List[String]()))
-  }
-
-  def replyToHandlerWithOkAndBadResult() = {
-    val expectedClass = classOf[CompleteRequest]
-    interpreterProbe.expectMsgClass(expectedClass)
-    interpreterProbe.reply("hello")
-  }
-
-  describe("CodeCompleteHandler (ActorLoader)") {
-    it("should send a CompleteRequest") {
-      handlerActor ! MockCompleteRequestKernelMessage
-      replyToHandlerWithOkAndResult()
-      kernelMessageRelayProbe.fishForMessage(500.milliseconds) {
-        case KernelMessage(_, _, header, _, _, _) =>
-          header.msg_type == MessageType.Outgoing.CompleteReply.toString
-      }
-    }
-
-    it("should throw an error for bad JSON") {
-      handlerActor ! MockKernelMessageWithBadJSON
-      var result = false
-      try {
-        replyToHandlerWithOkAndResult()
-      }
-      catch {
-        case t: Throwable => result = true
-      }
-      result should be (true)
-    }
-
-    it("should throw an error for bad code completion") {
-      handlerActor ! MockCompleteRequestKernelMessage
-      try {
-        replyToHandlerWithOkAndBadResult()
-      }
-      catch {
-        case error: Exception => error.getMessage should be ("Parse error in CodeCompleteHandler")
-      }
-    }
-
-    it("should send an idle message") {
-      handlerActor ! MockCompleteRequestKernelMessage
-      replyToHandlerWithOkAndResult()
-      statusDispatchProbe.fishForMessage(500.milliseconds) {
-        case Tuple2(status, _) =>
-          status == KernelStatusType.Idle
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
deleted file mode 100644
index 49582f8..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import java.util.UUID
-
-import akka.actor.{Props, ActorRef, ActorSystem}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.content.{ClearOutput, CommClose}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SystemActorType, KMBuilder}
-import com.ibm.spark.comm.{CommRegistrar, CommWriter, CommCallbacks, CommStorage}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-import scala.concurrent.duration._
-
-class CommCloseHandlerSpec extends TestKit(
-  ActorSystem("CommCloseHandlerSpec")
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val TestCommId = UUID.randomUUID().toString
-  private val TestTargetName = "some test target"
-
-  private var kmBuilder: KMBuilder = _
-  private var spyCommStorage: CommStorage = _
-  private var mockCommCallbacks: CommCallbacks = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var mockActorLoader: ActorLoader = _
-  private var commCloseHandler: ActorRef = _
-  private var kernelMessageRelayProbe: TestProbe = _
-  private var statusDispatchProbe: TestProbe = _
-
-  before {
-    kmBuilder = KMBuilder()
-    mockCommCallbacks = mock[CommCallbacks]
-    spyCommStorage = spy(new CommStorage())
-    mockCommRegistrar = mock[CommRegistrar]
-
-    mockActorLoader = mock[ActorLoader]
-
-    commCloseHandler = system.actorOf(Props(
-      classOf[CommCloseHandler],
-      mockActorLoader, mockCommRegistrar, spyCommStorage
-    ))
-
-    // Used to intercept responses
-    kernelMessageRelayProbe = TestProbe()
-    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
-      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
-
-    // Used to intercept busy/idle messages
-    statusDispatchProbe = new TestProbe(system)
-    when(mockActorLoader.load(SystemActorType.StatusDispatch))
-      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
-  }
-
-  describe("CommCloseHandler") {
-    describe("#process") {
-      it("should execute close callbacks if the id is registered") {
-        // Mark our id as registered
-        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(TestCommId)
-
-        // Send a comm_open message with the test target
-        commCloseHandler ! kmBuilder
-          .withHeader(CommClose.toTypeString)
-          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Should receive a busy and an idle message
-        statusDispatchProbe.receiveN(2, 200.milliseconds)
-
-        // Verify that the msg callbacks were triggered along the way
-        verify(mockCommCallbacks).executeCloseCallbacks(
-          any[CommWriter], any[v5.UUID], any[v5.MsgData])
-      }
-
-      it("should not execute close callbacks if the id is not registered") {
-        // Mark our target as not registered
-        doReturn(None).when(spyCommStorage).getCommIdCallbacks(TestCommId)
-
-        // Send a comm_msg message with the test id
-        commCloseHandler ! kmBuilder
-          .withHeader(CommClose.toTypeString)
-          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Should receive a busy and an idle message
-        statusDispatchProbe.receiveN(2, 200.milliseconds)
-
-        // Verify that the msg callbacks were NOT triggered along the way
-        verify(mockCommCallbacks, never()).executeCloseCallbacks(
-          any[CommWriter], any[v5.UUID], any[v5.MsgData])
-      }
-
-      it("should do nothing if there is a parsing error") {
-        // Send a comm_open message with an invalid content string
-        commCloseHandler ! kmBuilder
-          .withHeader(CommClose.toTypeString)
-          .withContentString(ClearOutput(_wait = true))
-          .build
-
-        // TODO: Is there a better way to test for this without an upper time
-        //       limit? Is there a different logical approach?
-        kernelMessageRelayProbe.expectNoMsg(200.milliseconds)
-      }
-
-      it("should include the parent's header in the parent header of " +
-        "outgoing messages"){
-
-        // Register a callback that sends a message using the comm writer
-        val closeCallback: CommCallbacks.CloseCallback =
-          new CommCallbacks.CloseCallback() {
-            def apply(v1: CommWriter, v2: v5.UUID, v4: v5.MsgData) =
-              v1.writeMsg(v5.MsgData.Empty)
-          }
-        val callbacks = (new CommCallbacks).addCloseCallback(closeCallback)
-        doReturn(Some(callbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(TestCommId)
-
-        // Send a comm close message
-        val msg = kmBuilder
-          .withHeader(CommClose.toTypeString)
-          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
-          .build
-        commCloseHandler ! msg
-
-        // Verify that the message sent by the handler has the desired property
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, _, parentHeader, _, _) =>
-            parentHeader == msg.header
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
deleted file mode 100644
index 582a08e..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import java.util.UUID
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.comm._
-import com.ibm.spark.kernel.protocol.v5.content.{CommMsg, ClearOutput, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-
-import scala.concurrent.duration._
-
-class CommMsgHandlerSpec extends TestKit(
-  ActorSystem("CommMsgHandlerSpec")
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val TestCommId = UUID.randomUUID().toString
-  private val TestTargetName = "some test target"
-
-  private var kmBuilder: KMBuilder = _
-  private var spyCommStorage: CommStorage = _
-  private var mockCommCallbacks: CommCallbacks = _
-  private var mockActorLoader: ActorLoader = _
-  private var commMsgHandler: ActorRef = _
-  private var kernelMessageRelayProbe: TestProbe = _
-  private var statusDispatchProbe: TestProbe = _
-
-  before {
-    kmBuilder = KMBuilder()
-    mockCommCallbacks = mock[CommCallbacks]
-    spyCommStorage = spy(new CommStorage())
-
-    mockActorLoader = mock[ActorLoader]
-
-    commMsgHandler = system.actorOf(Props(
-      classOf[CommMsgHandler],
-      mockActorLoader, mock[CommRegistrar], spyCommStorage
-    ))
-
-    // Used to intercept responses
-    kernelMessageRelayProbe = TestProbe()
-    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
-      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
-
-    // Used to intercept busy/idle messages
-    statusDispatchProbe = new TestProbe(system)
-    when(mockActorLoader.load(SystemActorType.StatusDispatch))
-      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
-  }
-
-  describe("CommMsgHandler") {
-    describe("#process") {
-      it("should execute msg callbacks if the id is registered") {
-        // Mark our id as registered
-        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(TestCommId)
-
-        // Send a comm_open message with the test target
-        commMsgHandler ! kmBuilder
-          .withHeader(CommMsg.toTypeString)
-          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Should receive a busy and an idle message
-        statusDispatchProbe.receiveN(2, 200.milliseconds)
-
-        // Verify that the msg callbacks were triggered along the way
-        verify(mockCommCallbacks).executeMsgCallbacks(
-          any[CommWriter], any[v5.UUID], any[v5.MsgData])
-      }
-
-      it("should not execute msg callbacks if the id is not registered") {
-        // Mark our target as not registered
-        doReturn(None).when(spyCommStorage).getCommIdCallbacks(TestCommId)
-
-        // Send a comm_msg message with the test id
-        commMsgHandler ! kmBuilder
-          .withHeader(CommMsg.toTypeString)
-          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Should receive a busy and an idle message
-        statusDispatchProbe.receiveN(2, 200.milliseconds)
-
-        // Verify that the msg callbacks were NOT triggered along the way
-        verify(mockCommCallbacks, never()).executeMsgCallbacks(
-          any[CommWriter], any[v5.UUID], any[v5.MsgData])
-      }
-
-      it("should do nothing if there is a parsing error") {
-        // Send a comm_open message with an invalid content string
-        commMsgHandler ! kmBuilder
-          .withHeader(CommMsg.toTypeString)
-          .withContentString(ClearOutput(_wait = true))
-          .build
-
-        // TODO: Is there a better way to test for this without an upper time
-        //       limit? Is there a different logical approach?
-        kernelMessageRelayProbe.expectNoMsg(200.milliseconds)
-      }
-
-      it("should include the parent's header in the parent header of " +
-         "outgoing messages"){
-
-        // Register a callback that sends a message using the comm writer
-        val msgCallback: CommCallbacks.MsgCallback =
-          new CommCallbacks.MsgCallback() {
-            def apply(v1: CommWriter, v2: v5.UUID, v3: v5.MsgData): Unit =
-              v1.writeMsg(MsgData.Empty)
-          }
-        val callbacks = (new CommCallbacks).addMsgCallback(msgCallback)
-        doReturn(Some(callbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(TestCommId)
-
-        // Send a comm_msg message with the test id
-        val msg = kmBuilder
-          .withHeader(CommMsg.toTypeString)
-          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
-          .build
-        commMsgHandler ! msg
-
-        // Verify that the message sent by the handler has the desired property
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, _, parentHeader, _, _) =>
-            parentHeader == msg.header
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
deleted file mode 100644
index 64013e9..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import java.util.UUID
-
-import com.ibm.spark.kernel.protocol.v5
-
-import akka.actor.{Props, ActorRef, ActorSystem}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, ClearOutput, CommOpen}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.comm._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-
-import scala.concurrent.duration._
-
-class CommOpenHandlerSpec extends TestKit(
-  ActorSystem("CommOpenHandlerSpec")
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val TestCommId = UUID.randomUUID().toString
-  private val TestTargetName = "some test target"
-
-  private var kmBuilder: KMBuilder = _
-  private var spyCommStorage: CommStorage = _
-  private var mockCommCallbacks: CommCallbacks = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var mockActorLoader: ActorLoader = _
-  private var commOpenHandler: ActorRef = _
-  private var kernelMessageRelayProbe: TestProbe = _
-  private var statusDispatchProbe: TestProbe = _
-
-  before {
-    kmBuilder = KMBuilder()
-    mockCommCallbacks = mock[CommCallbacks]
-    spyCommStorage = spy(new CommStorage())
-    mockCommRegistrar = mock[CommRegistrar]
-
-    mockActorLoader = mock[ActorLoader]
-
-    commOpenHandler = system.actorOf(Props(
-      classOf[CommOpenHandler],
-      mockActorLoader, mockCommRegistrar, spyCommStorage
-    ))
-
-    // Used to intercept responses
-    kernelMessageRelayProbe = TestProbe()
-    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
-      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
-
-    // Used to intercept busy/idle messages
-    statusDispatchProbe = new TestProbe(system)
-    when(mockActorLoader.load(SystemActorType.StatusDispatch))
-      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
-  }
-
-  describe("CommOpenHandler") {
-    describe("#process") {
-      it("should execute open callbacks if the target exists") {
-        // Mark our target as registered
-        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
-          .getTargetCallbacks(TestTargetName)
-
-        // Send a comm_open message with the test target
-        commOpenHandler ! kmBuilder
-          .withHeader(CommOpen.toTypeString)
-          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
-          .build
-
-        // Should receive a busy and an idle message
-        statusDispatchProbe.receiveN(2, 200.milliseconds)
-
-        // Verify that the open callbacks were triggered along the way
-        verify(mockCommCallbacks).executeOpenCallbacks(
-          any[CommWriter], any[v5.UUID], anyString(), any[v5.MsgData])
-      }
-
-      it("should close the comm connection if the target does not exist") {
-        // Mark our target as not registered
-        doReturn(None).when(spyCommStorage).getTargetCallbacks(TestTargetName)
-
-        // Send a comm_open message with the test target
-        commOpenHandler ! kmBuilder
-          .withHeader(CommOpen.toTypeString)
-          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
-          .build
-
-        // Should receive a close message as a result of the target missing
-        kernelMessageRelayProbe.expectMsgPF(200.milliseconds) {
-          case KernelMessage(_, _, header, _, _, _) =>
-            header.msg_type should be (CommClose.toTypeString)
-        }
-      }
-
-      it("should do nothing if there is a parsing error") {
-        // Send a comm_open message with an invalid content string
-        commOpenHandler ! kmBuilder
-          .withHeader(CommOpen.toTypeString)
-          .withContentString(ClearOutput(_wait = true))
-          .build
-
-        // TODO: Is there a better way to test for this without an upper time
-        //       limit? Is there a different logical approach?
-        kernelMessageRelayProbe.expectNoMsg(200.milliseconds)
-      }
-
-      it("should include the parent's header in the parent header of " +
-        "outgoing messages"){
-
-        // Register a callback that sends a message using the comm writer
-        val openCallback: CommCallbacks.OpenCallback =
-          new CommCallbacks.OpenCallback() {
-            def apply(v1: CommWriter, v2: v5.UUID, v3: String, v4: v5.MsgData) =
-              v1.writeMsg(MsgData.Empty)
-          }
-        val callbacks = (new CommCallbacks).addOpenCallback(openCallback)
-        doReturn(Some(callbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(TestCommId)
-
-        // Send a comm_open message
-        val msg = kmBuilder
-          .withHeader(CommOpen.toTypeString)
-          .withContentString(
-            CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty)
-          )
-          .build
-        commOpenHandler ! msg
-
-        // Verify that the message sent by the handler has the desired property
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, _, parentHeader, _, _) =>
-            parentHeader == msg.header
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
deleted file mode 100644
index c22bc41..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import java.io.OutputStream
-import java.util.concurrent.atomic.AtomicInteger
-
-import akka.actor._
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.api.{FactoryMethods, FactoryMethodsLike, Kernel}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5Test._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import play.api.libs.json.Json
-
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import scala.concurrent.duration._
-import scala.concurrent.ExecutionContext.Implicits.global
-import scala.concurrent._
-
-class ExecuteRequestHandlerSpec extends TestKit(
-  ActorSystem("ExecuteRequestHandlerSpec")
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter {
-
-  private var mockActorLoader: ActorLoader = _
-  private var mockFactoryMethods: FactoryMethods = _
-  private var mockKernel: Kernel = _
-  private var mockOutputStream: OutputStream = _
-  private var handlerActor: ActorRef = _
-  private var kernelMessageRelayProbe: TestProbe = _
-  private var executeRequestRelayProbe: TestProbe = _
-  private var statusDispatchProbe: TestProbe = _
-
-  before {
-    mockActorLoader = mock[ActorLoader]
-    mockFactoryMethods = mock[FactoryMethods]
-    mockKernel = mock[Kernel]
-    mockOutputStream = mock[OutputStream]
-    doReturn(mockFactoryMethods).when(mockKernel)
-      .factory(any[KernelMessage], any[KMBuilder])
-
-    doReturn(mockOutputStream).when(mockFactoryMethods)
-      .newKernelOutputStream(anyString(), anyBoolean())
-
-    // Add our handler and mock interpreter to the actor system
-    handlerActor = system.actorOf(Props(
-      classOf[ExecuteRequestHandler],
-      mockActorLoader,
-      mockKernel
-    ))
-
-    kernelMessageRelayProbe = new TestProbe(system)
-    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
-      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
-
-    executeRequestRelayProbe = new TestProbe(system)
-    when(mockActorLoader.load(SystemActorType.ExecuteRequestRelay))
-      .thenReturn(system.actorSelection(executeRequestRelayProbe.ref.path.toString))
-
-    statusDispatchProbe = new TestProbe(system)
-    when(mockActorLoader.load(SystemActorType.StatusDispatch))
-      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
-  }
-
-  /**
-   * This method simulates the interpreter passing back an
-   * execute result and reply.
-   */
-  def replyToHandlerWithOkAndResult() = {
-    //  This stubs the behaviour of the interpreter executing code
-    val expectedClass = classOf[(ExecuteRequest, KernelMessage, OutputStream)]
-    executeRequestRelayProbe.expectMsgClass(expectedClass)
-    executeRequestRelayProbe.reply((
-      ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
-      ExecuteResult(1, Data("text/plain" -> "resulty result"), Metadata())
-    ))
-  }
-  
-  def replyToHandlerWithOk() = {
-    //  This stubs the behaviour of the interpreter executing code
-    val expectedClass = classOf[(ExecuteRequest, KernelMessage, OutputStream)]
-    executeRequestRelayProbe.expectMsgClass(expectedClass)
-    executeRequestRelayProbe.reply((
-      ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
-      ExecuteResult(1, Data("text/plain" -> ""), Metadata())
-    ))
-  }
-
-  /**
-   * This method simulates the interpreter passing back an
-   * execute result and reply
-   */
-  def replyToHandlerWithErrorAndResult() = {
-    //  This stubs the behaviour of the interpreter executing code
-    val expectedClass = classOf[(ExecuteRequest, KernelMessage, OutputStream)]
-    executeRequestRelayProbe.expectMsgClass(expectedClass)
-    executeRequestRelayProbe.reply((
-      ExecuteReplyError(1, Some(""), Some(""), Some(Nil)),
-      ExecuteResult(1, Data("text/plain" -> "resulty result"), Metadata())
-    ))
-  }
-
-  describe("ExecuteRequestHandler( ActorLoader )") {
-    describe("#receive( KernelMessage ) when interpreter replies") {
-
-      it("should send an execute result message if the result is not empty") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        replyToHandlerWithOkAndResult()
-        kernelMessageRelayProbe.fishForMessage(100.milliseconds) {
-          case KernelMessage(_, _, header, _, _, _) =>
-            header.msg_type == ExecuteResult.toTypeString
-        }
-      }
-
-      it("should not send an execute result message if there is no result") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        replyToHandlerWithOk()
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, header, _, _, _) =>
-            header.msg_type != ExecuteResult.toTypeString
-        }
-
-      }
-
-      it("should send an execute reply message") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        replyToHandlerWithOkAndResult()
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, header, _, _, _) =>
-            header.msg_type == ExecuteResult.toTypeString
-        }
-      }
-
-      it("should send a status idle message after the reply and result") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        replyToHandlerWithOkAndResult()
-
-        val msgCount = new AtomicInteger(0)
-        var statusMsgNum = -1
-        var statusReceived = false
-
-        val f1 = future {
-          kernelMessageRelayProbe.fishForMessage(4.seconds) {
-            case KernelMessage(_, _, header, _, _, _) =>
-              if (header.msg_type == ExecuteResult.toTypeString &&
-                    !statusReceived)
-                msgCount.incrementAndGet()
-              else if (header.msg_type == ExecuteReply.toTypeString &&
-                    !statusReceived)
-                msgCount.incrementAndGet()
-              statusReceived || (msgCount.get() >= 2)
-          }
-        }
-
-        val f2 = future {
-          statusDispatchProbe.fishForMessage(4.seconds) {
-            case (status, header) =>
-              if (status == KernelStatusIdle.toString)
-                statusReceived = true
-                statusMsgNum = msgCount.get()
-            statusReceived || (msgCount.get() >= 2)
-          }
-        }
-        val fs = (f1 zip f2)
-        Await.ready(fs, 5.seconds)
-
-        statusMsgNum should equal(2)
-      }
-
-      it("should send an execute input message") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, header, _, _, _) =>
-            header.msg_type == ExecuteInput.toTypeString
-        }
-      }
-
-      it("should send a message with ids equal to the incoming " +
-        "KernelMessage's ids") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(ids, _, _, _, _, _) =>
-            ids == MockExecuteRequestKernelMessage.ids
-        }
-      }
-
-      it("should send a message with parent header equal to the incoming " +
-        "KernelMessage's header") {
-        handlerActor ! MockExecuteRequestKernelMessage
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          case KernelMessage(_, _, _, parentHeader, _, _) =>
-            parentHeader == MockExecuteRequestKernelMessage.header
-        }
-      }
-
-      // TODO: Investigate if this is still relevant at all
-//      it("should send a status busy and idle message") {
-//        handlerActor ! MockExecuteRequestKernelMessage
-//        replyToHandlerWithOkAndResult()
-//        var busy = false
-//        var idle = false
-//
-//        statusDispatchProbe.receiveWhile(100.milliseconds) {
-//          case Tuple2(status: KernelStatusType, header: Header)=>
-//            if(status == KernelStatusType.Busy)
-//              busy = true
-//            if(status == KernelStatusType.Idle)
-//              idle = true
-//        }
-//
-//        idle should be (true)
-//        busy should be (true)
-//      }
-    }
-  }
-
-  //  Testing error timeout for interpreter future
-  describe("ExecuteRequestHandler( ActorLoader )") {
-    describe("#receive( KernelMessage with bad JSON content )"){
-      it("should respond with an execute_reply with status error")    {
-        handlerActor ! MockKernelMessageWithBadExecuteRequest
-
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          // Only mark as successful if this specific message was received
-          case KernelMessage(_, _, header, _, _, contentString)
-            if header.msg_type == ExecuteReply.toTypeString =>
-            val reply = Json.parse(contentString).as[ExecuteReply]
-            reply.status == "error"
-          case _ => false
-        }
-      }
-
-      it("should send error message to relay") {
-        handlerActor ! MockKernelMessageWithBadExecuteRequest
-
-        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
-          // Only mark as successful if this specific message was received
-          case KernelMessage(_, _, header, _, _, _)
-            if header.msg_type == ErrorContent.toTypeString => true
-          case _ => false
-        }
-      }
-
-      // TODO: Investigate if this is still relevant at all
-//      it("should send a status idle message") {
-//        handlerActor ! MockKernelMessageWithBadExecuteRequest
-//        var busy = false
-//        var idle = false
-//
-//        statusDispatchProbe.receiveWhile(100.milliseconds) {
-//          case Tuple2(status: KernelStatusType, header: Header)=>
-//            if(status == KernelStatusType.Busy)
-//              busy = true
-//            if(status == KernelStatusType.Idle)
-//              idle = true
-//        }
-//
-//        idle should be (true)
-//        busy should be (false)
-//      }
-    }
-  }
-}



[17/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
new file mode 100644
index 0000000..1d16ac4
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.boot.layer
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import com.ibm.spark.comm.{CommRegistrar, CommStorage}
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.kernel.api.Kernel
+import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
+import com.ibm.spark.kernel.protocol.v5.SocketType.SocketType
+import com.ibm.spark.kernel.protocol.v5.handler._
+import com.ibm.spark.kernel.protocol.v5.interpreter.InterpreterActor
+import com.ibm.spark.kernel.protocol.v5.interpreter.tasks.InterpreterTaskFactory
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
+import com.ibm.spark.kernel.protocol.v5.relay.ExecuteRequestRelay
+import com.ibm.spark.kernel.protocol.v5.{MessageType, SocketType, SystemActorType}
+import com.ibm.spark.magic.MagicLoader
+import com.ibm.spark.utils.LogLike
+
+/**
+ * Represents the Akka handler initialization. All actors (not needed in bare
+ * initialization) should be constructed here.
+ */
+trait HandlerInitialization {
+  /**
+   * Initializes and registers all handlers.
+   *
+   * @param actorSystem The actor system needed for registration
+   * @param actorLoader The actor loader needed for registration
+   * @param kernel The kernel api needed for registration
+   * @param interpreter The main interpreter needed for registration
+   * @param magicLoader The magic loader needed for registration
+   * @param commRegistrar The comm registrar needed for registration
+   * @param commStorage The comm storage needed for registration
+   */
+  def initializeHandlers(
+    actorSystem: ActorSystem, actorLoader: ActorLoader,
+    kernel: Kernel,
+    interpreter: Interpreter, magicLoader: MagicLoader,
+    commRegistrar: CommRegistrar, commStorage: CommStorage,
+    responseMap: collection.mutable.Map[String, ActorRef]
+  ): Unit
+}
+
+/**
+ * Represents the standard implementation of HandlerInitialization.
+ */
+trait StandardHandlerInitialization extends HandlerInitialization {
+  this: LogLike =>
+
+  /**
+   * Initializes and registers all handlers.
+   *
+   * @param actorSystem The actor system needed for registration
+   * @param actorLoader The actor loader needed for registration
+   * @param kernel The kernel api needed for registration
+   * @param interpreter The main interpreter needed for registration
+   * @param magicLoader The magic loader needed for registration
+   * @param commRegistrar The comm registrar needed for registration
+   * @param commStorage The comm storage needed for registration
+   */
+  def initializeHandlers(
+    actorSystem: ActorSystem, actorLoader: ActorLoader,
+    kernel: Kernel,
+    interpreter: Interpreter, magicLoader: MagicLoader,
+    commRegistrar: CommRegistrar, commStorage: CommStorage,
+    responseMap: collection.mutable.Map[String, ActorRef]
+  ): Unit = {
+    initializeKernelHandlers(
+      actorSystem, actorLoader, kernel, commRegistrar, commStorage, responseMap
+    )
+    initializeSystemActors(actorSystem, actorLoader, interpreter, magicLoader)
+  }
+
+  private def initializeSystemActors(
+    actorSystem: ActorSystem, actorLoader: ActorLoader,
+    interpreter: Interpreter, magicLoader: MagicLoader
+  ): Unit = {
+    logger.debug("Creating interpreter actor")
+    val interpreterActor = actorSystem.actorOf(
+      Props(classOf[InterpreterActor], new InterpreterTaskFactory(interpreter)),
+      name = SystemActorType.Interpreter.toString
+    )
+
+    logger.debug("Creating execute request relay actor")
+    val postProcessor = new PostProcessor(interpreter)
+    val magicParser = new MagicParser(magicLoader)
+    val executeRequestRelayActor = actorSystem.actorOf(
+      Props(classOf[ExecuteRequestRelay],
+        actorLoader, magicLoader, magicParser, postProcessor
+      ),
+      name = SystemActorType.ExecuteRequestRelay.toString
+    )
+  }
+
+  private def initializeKernelHandlers(
+    actorSystem: ActorSystem, actorLoader: ActorLoader,
+    kernel: Kernel,
+    commRegistrar: CommRegistrar, commStorage: CommStorage,
+    responseMap: collection.mutable.Map[String, ActorRef]
+  ): Unit = {
+    def initializeRequestHandler[T](clazz: Class[T], messageType: MessageType, extraArguments: AnyRef*) = {
+      logger.debug("Creating %s handler".format(messageType.toString))
+      actorSystem.actorOf(
+        Props(clazz, actorLoader +: extraArguments: _*),
+        name = messageType.toString
+      )
+    }
+
+    def initializeInputHandler[T](
+      clazz: Class[T],
+      messageType: MessageType
+    ): Unit = {
+      logger.debug("Creating %s handler".format(messageType.toString))
+      actorSystem.actorOf(
+        Props(clazz, actorLoader, responseMap),
+        name = messageType.toString
+      )
+    }
+
+    // TODO: Figure out how to pass variable number of arguments to actor
+    def initializeCommHandler[T](clazz: Class[T], messageType: MessageType) = {
+      logger.debug("Creating %s handler".format(messageType.toString))
+      actorSystem.actorOf(
+        Props(clazz, actorLoader, commRegistrar, commStorage),
+        name = messageType.toString
+      )
+    }
+
+    def initializeSocketHandler(socketType: SocketType, messageType: MessageType): Unit = {
+      logger.debug("Creating %s to %s socket handler ".format(messageType.toString ,socketType.toString))
+      actorSystem.actorOf(
+        Props(classOf[GenericSocketMessageHandler], actorLoader, socketType),
+        name = messageType.toString
+      )
+    }
+
+    //  These are the handlers for messages coming into the
+    initializeRequestHandler(classOf[ExecuteRequestHandler],
+      MessageType.Incoming.ExecuteRequest, kernel)
+    initializeRequestHandler(classOf[KernelInfoRequestHandler],
+      MessageType.Incoming.KernelInfoRequest)
+    initializeRequestHandler(classOf[CodeCompleteHandler],
+      MessageType.Incoming.CompleteRequest)
+    initializeInputHandler(classOf[InputRequestReplyHandler],
+      MessageType.Incoming.InputReply)
+    initializeCommHandler(classOf[CommOpenHandler],
+      MessageType.Incoming.CommOpen)
+    initializeCommHandler(classOf[CommMsgHandler],
+      MessageType.Incoming.CommMsg)
+    initializeCommHandler(classOf[CommCloseHandler],
+      MessageType.Incoming.CommClose)
+
+    //  These are handlers for messages leaving the kernel through the sockets
+    initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.KernelInfoReply)
+    initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.ExecuteReply)
+    initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.CompleteReply)
+
+    initializeSocketHandler(SocketType.StdIn, MessageType.Outgoing.InputRequest)
+
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.ExecuteResult)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.Stream)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.ExecuteInput)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.Status)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.Error)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.CommOpen)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.CommMsg)
+    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.CommClose)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
new file mode 100644
index 0000000..c590394
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.boot.layer
+
+import com.ibm.spark.boot.KernelBootstrap
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.utils.LogLike
+
+/**
+ * Represents the hook (interrupt/shutdown) initialization. All JVM-related
+ * hooks should be constructed here.
+ */
+trait HookInitialization {
+  /**
+   * Initializes and registers all hooks except shutdown.
+   *
+   * @param interpreter The main interpreter
+   */
+  def initializeHooks(interpreter: Interpreter): Unit
+
+  /**
+   * Initializes the shutdown hook.
+   */
+  def initializeShutdownHook(): Unit
+}
+
+/**
+ * Represents the standard implementation of HookInitialization.
+ */
+trait StandardHookInitialization extends HookInitialization {
+  this: KernelBootstrap with LogLike =>
+
+  /**
+   * Initializes and registers all hooks.
+   *
+   * @param interpreter The main interpreter
+   */
+  def initializeHooks(interpreter: Interpreter): Unit = {
+    registerInterruptHook(interpreter)
+  }
+
+  /**
+   * Initializes the shutdown hook.
+   */
+  def initializeShutdownHook(): Unit = {
+    registerShutdownHook()
+  }
+
+  private def registerInterruptHook(interpreter: Interpreter): Unit = {
+    val self = this
+
+    import sun.misc.{Signal, SignalHandler}
+
+    // TODO: Signals are not a good way to handle this since JVM only has the
+    // proprietary sun API that is not necessarily available on all platforms
+    Signal.handle(new Signal("INT"), new SignalHandler() {
+      private val MaxSignalTime: Long = 3000 // 3 seconds
+      var lastSignalReceived: Long    = 0
+
+      def handle(sig: Signal) = {
+        val currentTime = System.currentTimeMillis()
+        if (currentTime - lastSignalReceived > MaxSignalTime) {
+          logger.info("Resetting code execution!")
+          interpreter.interrupt()
+
+          // TODO: Cancel group representing current code execution
+          //sparkContext.cancelJobGroup()
+
+          logger.info("Enter Ctrl-C twice to shutdown!")
+          lastSignalReceived = currentTime
+        } else {
+          logger.info("Shutting down kernel")
+          self.shutdown()
+        }
+      }
+    })
+  }
+
+  private def registerShutdownHook(): Unit = {
+    logger.debug("Registering shutdown hook")
+    val self = this
+    val mainThread = Thread.currentThread()
+    Runtime.getRuntime.addShutdownHook(new Thread() {
+      override def run() = {
+        logger.info("Shutting down kernel")
+        self.shutdown()
+        // TODO: Check if you can magically access the spark context to stop it
+        // TODO: inside a different thread
+        if (mainThread.isAlive) mainThread.join()
+      }
+    })
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
new file mode 100644
index 0000000..520d68c
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
@@ -0,0 +1,66 @@
+package com.ibm.spark.boot.layer
+
+import com.ibm.spark.kernel.api.KernelLike
+import com.typesafe.config.Config
+import com.ibm.spark.interpreter._
+import scala.collection.JavaConverters._
+
+import org.slf4j.LoggerFactory
+
+case class InterpreterManager(
+  default: String = "Scala",
+  interpreters: Map[String, Interpreter] = Map[String, Interpreter]()
+) {
+
+
+  def initializeInterpreters(kernel: KernelLike): Unit = {
+    interpreters.values.foreach(interpreter =>
+      interpreter.init(kernel)
+    )
+  }
+
+  def addInterpreter(
+    name:String,
+    interpreter: Interpreter
+  ): InterpreterManager = {
+    copy(interpreters = interpreters + (name -> interpreter))
+  }
+
+  def defaultInterpreter: Option[Interpreter] = {
+    interpreters.get(default)
+  }
+}
+
+object InterpreterManager {
+
+  protected val logger = LoggerFactory.getLogger(this.getClass.getName)
+
+  def apply(config: Config): InterpreterManager = {
+    val ip = config.getStringList("interpreter_plugins").asScala ++
+      config.getStringList("default_interpreter_plugin").asScala
+
+    val m = ip.foldLeft(Map[String, Interpreter]())( (acc, v) => {
+      v.split(":") match {
+        case Array(name, className) =>
+          try {
+            val i = Class
+                .forName(className)
+                .newInstance()
+                .asInstanceOf[Interpreter]
+            acc + (name -> i)
+          }
+          catch {
+            case e:Throwable =>
+              logger.error("Error loading interpreter class " + className)
+              logger.error(e.getMessage())
+              acc
+          }
+        case _ => acc
+      }
+    })
+
+    val default = config.getString("default_interpreter")
+
+    InterpreterManager(interpreters = m, default = default)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala b/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
new file mode 100644
index 0000000..9706ce7
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, UUID}
+
+/**
+ * Represents a CommManager that uses a KernelCommWriter for its underlying
+ * open implementation.
+ *
+ * @param actorLoader The actor loader to use with the ClientCommWriter
+ * @param kmBuilder The KMBuilder to use with the ClientCommWriter
+ * @param commRegistrar The registrar to use for callback registration
+ */
+@Experimental
+class KernelCommManager(
+  private val actorLoader: ActorLoader,
+  private val kmBuilder: KMBuilder,
+  private val commRegistrar: CommRegistrar
+) extends CommManager(commRegistrar)
+{
+  /**
+   * Creates a new CommWriter instance given the Comm id.
+   *
+   * @param commId The Comm id to use with the Comm writer
+   *
+   * @return The new CommWriter instance
+   */
+  override protected def newCommWriter(commId: UUID): CommWriter =
+    new KernelCommWriter(actorLoader, kmBuilder, commId)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala b/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
new file mode 100644
index 0000000..e494663
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.content.{CommMsg, CommOpen, CommClose, CommContent}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+
+/**
+ * Represents a CommWriter to send messages from the Kernel to the Client.
+ *
+ * @param actorLoader The actor loader to use for loading actors responsible for
+ *                    communication
+ * @param kmBuilder The kernel message builder used to construct kernel messages
+ * @param commId The comm id associated with this writer (defaults to a
+ *               random UUID)
+ */
+@Experimental
+class KernelCommWriter(
+  private val actorLoader: ActorLoader,
+  private val kmBuilder: KMBuilder,
+  override private[comm] val commId: v5.UUID
+)  extends CommWriter(commId) {
+  /**
+   * Sends the comm message (open/msg/close) to the actor responsible for
+   * relaying messages.
+   *
+   * @param commContent The message to relay (will be packaged)
+   *
+   * @tparam T Either CommOpen, CommMsg, or CommClose
+   */
+  override protected[comm] def sendCommKernelMessage[
+    T <: KernelMessageContent with CommContent
+  ](commContent: T): Unit = {
+    val messageType = commContent match {
+      case _: CommOpen  => CommOpen.toTypeString
+      case _: CommMsg   => CommMsg.toTypeString
+      case _: CommClose => CommClose.toTypeString
+      case _            => throw new Throwable("Invalid kernel message type!")
+    }
+    actorLoader.load(SystemActorType.KernelMessageRelay) !
+      kmBuilder.withHeader(messageType).withContentString(commContent).build
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala b/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
new file mode 100644
index 0000000..389cf82
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.global
+
+import com.ibm.spark.kernel.api.Kernel
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+
+/**
+ * Represents the state of the kernel messages being received containing
+ * execute requests.
+ */
+object ExecuteRequestState {
+  private var _lastKernelMessage: Option[KernelMessage] = None
+
+  /**
+   * Processes the incoming kernel message and updates any associated state.
+   *
+   * @param kernelMessage The kernel message to process
+   */
+  def processIncomingKernelMessage(kernelMessage: KernelMessage) =
+    _lastKernelMessage = Some(kernelMessage)
+
+  /**
+   * Returns the last kernel message funneled through the KernelMessageRelay
+   * if any.
+   *
+   * @return Some KernelMessage instance if the relay has processed one,
+   *         otherwise None
+   */
+  def lastKernelMessage: Option[KernelMessage] = _lastKernelMessage
+
+  /**
+   * Resets the state of the ExecuteRequestState to the default.
+   */
+  def reset() = _lastKernelMessage = None
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala b/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
new file mode 100644
index 0000000..c00f937
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.global
+
+import com.ibm.spark.kernel.protocol.v5.UUID
+
+import scala.collection.concurrent._
+
+/**
+ * A class to keep track of execution counts for sessions.
+ */
+object ExecutionCounter {
+  private val executionCounts: Map[UUID, Int] = TrieMap[UUID, Int]()
+
+  /**
+   * This function will increase, by 1, an integer value associated with the given key. The incremented value
+   * will be returned. If the key has no value associated value, 1 will be returned.
+   * @param key The key for incrementing the value.
+   * @return The incremented value
+   */
+  def incr(key: UUID): Int = {
+    (executionCounts += (key -> (executionCounts.getOrElse(key, 0) + 1))) (key)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala b/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
new file mode 100644
index 0000000..83d2cea
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.global
+
+import com.ibm.spark.utils
+
+object ScheduledTaskManager {
+  lazy val instance = new utils.ScheduledTaskManager
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
new file mode 100644
index 0000000..36c5c5c
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.api
+
+import java.io.{InputStream, OutputStream}
+
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
+import com.typesafe.config.Config
+
+/**
+ * Represents the methods available to stream data from the kernel to the
+ * client.
+ *
+ * @param config The kernel configuration to use during object creation
+ * @param actorLoader The actor loader to use when retrieve actors needed for
+ *                    object creation
+ * @param parentMessage The parent message to use when needed for object
+ *                      creation
+ * @param kernelMessageBuilder The builder to use when constructing kernel
+ *                             messages inside objects created
+ */
+class FactoryMethods(
+  private val config: Config,
+  private val actorLoader: ActorLoader,
+  private val parentMessage: KernelMessage,
+  private val kernelMessageBuilder: KMBuilder
+) extends FactoryMethodsLike {
+  require(parentMessage != null, "Parent message cannot be null!")
+
+  private[api] val kmBuilder = kernelMessageBuilder.withParent(parentMessage)
+
+  /**
+   * Creates a new kernel input stream.
+   *
+   * @param prompt The text to use as a prompt
+   * @param password If true, should treat input as a password field
+   *
+   * @return The new KernelInputStream instance
+   */
+  override def newKernelInputStream(
+    prompt: String = KernelInputStream.DefaultPrompt,
+    password: Boolean = KernelInputStream.DefaultPassword
+  ): InputStream = {
+    new KernelInputStream(
+      actorLoader,
+      kmBuilder.withIds(parentMessage.ids),
+      prompt = prompt,
+      password = password
+    )
+  }
+
+  /**
+   * Creates a new kernel output stream.
+   *
+   * @param streamType The type of output stream (stdout/stderr)
+   * @param sendEmptyOutput If true, will send message even if output is empty
+   *
+   * @return The new KernelOutputStream instance
+   */
+  override def newKernelOutputStream(
+    streamType: String = KernelOutputStream.DefaultStreamType,
+    sendEmptyOutput: Boolean = config.getBoolean("send_empty_output")
+  ): OutputStream = {
+    new v5.stream.KernelOutputStream(
+      actorLoader,
+      kmBuilder,
+      com.ibm.spark.global.ScheduledTaskManager.instance,
+      streamType = streamType,
+      sendEmptyOutput = sendEmptyOutput
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
new file mode 100644
index 0000000..219804a
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.api
+
+import java.io.{OutputStream, InputStream, PrintStream}
+import java.util.concurrent.ConcurrentHashMap
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.boot.layer.InterpreterManager
+import com.ibm.spark.comm.CommManager
+import com.ibm.spark.global
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.interpreter._
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.magic.MagicParser
+import com.ibm.spark.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
+import com.ibm.spark.magic.{MagicLoader, MagicExecutor}
+import com.ibm.spark.utils.{KeyValuePairUtils, LogLike}
+import com.typesafe.config.Config
+import org.apache.spark.api.java.JavaSparkContext
+import org.apache.spark.sql.SQLContext
+import org.apache.spark.{SparkContext, SparkConf}
+import scala.util.{Try, DynamicVariable}
+
+import scala.reflect.runtime.universe._
+
+import scala.language.dynamics
+import com.ibm.spark.global.ExecuteRequestState
+
+/**
+ * Represents the main kernel API to be used for interaction.
+ *
+ * @param _config The configuration used when starting the kernel
+ * @param interpreterManager The interpreter manager to expose in this instance
+ * @param comm The Comm manager to expose in this instance
+ * @param actorLoader The actor loader to use for message relaying
+ */
+@Experimental
+class Kernel (
+  private val _config: Config,
+  private val actorLoader: ActorLoader,
+  val interpreterManager: InterpreterManager,
+  val comm: CommManager,
+  val magicLoader: MagicLoader
+) extends KernelLike with LogLike {
+
+  /**
+   * Represents the current input stream used by the kernel for the specific
+   * thread.
+   */
+  private val currentInputStream =
+    new DynamicVariable[InputStream](null)
+  private val currentInputKernelMessage =
+    new DynamicVariable[KernelMessage](null)
+
+  /**
+   * Represents the current output stream used by the kernel for the specific
+   * thread.
+   */
+  private val currentOutputStream =
+    new DynamicVariable[PrintStream](null)
+  private val currentOutputKernelMessage =
+    new DynamicVariable[KernelMessage](null)
+
+  /**
+   * Represents the current error stream used by the kernel for the specific
+   * thread.
+   */
+  private val currentErrorStream =
+    new DynamicVariable[PrintStream](null)
+  private val currentErrorKernelMessage =
+    new DynamicVariable[KernelMessage](null)
+
+  private var _sparkContext:SparkContext = null;
+  private var _sparkConf:SparkConf = null;
+  private var _javaSparkContext:JavaSparkContext = null;
+  private var _sqlContext:SQLContext = null;
+
+  /**
+   * Represents magics available through the kernel.
+   */
+  val magics = new MagicExecutor(magicLoader)
+
+  /**
+   * Represents magic parsing functionality.
+   */
+  val magicParser = new MagicParser(magicLoader)
+
+  /**
+   * Represents the data that can be shared using the kernel as the middleman.
+   *
+   * @note Using Java structure to enable other languages to have easy access!
+   */
+  val data: java.util.Map[String, Any] = new ConcurrentHashMap[String, Any]()
+
+
+  interpreterManager.initializeInterpreters(this)
+
+  val interpreter = interpreterManager.defaultInterpreter.get
+
+  /**
+   * Handles the output of interpreting code.
+   * @param output the output of the interpreter
+   * @return (success, message) or (failure, message)
+   */
+  private def handleInterpreterOutput(
+    output: (Result, Either[ExecuteOutput, ExecuteFailure])
+  ): (Boolean, String) = {
+    val (success, result) = output
+    success match {
+      case Results.Success =>
+        (true, result.left.getOrElse("").asInstanceOf[String])
+      case Results.Error =>
+        (false, result.right.getOrElse("").toString)
+      case Results.Aborted =>
+        (false, "Aborted!")
+      case Results.Incomplete =>
+        // If we get an incomplete it's most likely a syntax error, so
+        // let the user know.
+        (false, "Syntax Error!")
+    }
+  }
+
+  override def config:Config = {
+    _config
+  }
+
+  /**
+   * Executes a block of code represented as a string and returns the result.
+   *
+   * @param code The code as an option to execute
+   * @return A tuple containing the result (true/false) and the output as a
+   *         string
+   */
+  def eval(code: Option[String]): (Boolean, String) = {
+    code.map(c => {
+      magicParser.parse(c) match {
+        case Left(parsedCode) =>
+          val output = interpreter.interpret(parsedCode)
+          handleInterpreterOutput(output)
+        case Right(errMsg) =>
+          (false, errMsg)
+      }
+    }).getOrElse((false, "Error!"))
+  }
+
+  /**
+   * Constructs a new instance of the stream methods using the latest
+   * kernel message instance.
+   *
+   * @return The collection of stream methods
+   */
+  override def stream: StreamMethods = stream()
+
+  /**
+   * Constructs a new instance of the stream methods using the specified
+   * kernel message instance.
+   *
+   * @param parentMessage The message to serve as the parent of outgoing
+   *                      messages sent as a result of using streaming methods
+   *
+   * @return The collection of streaming methods
+   */
+  private[spark] def stream(
+    parentMessage: v5.KernelMessage = lastKernelMessage()
+  ): StreamMethods = {
+    new StreamMethods(actorLoader, parentMessage)
+  }
+
+  /**
+   * Constructs a new instance of the factory methods using the latest
+   * kernel message instance.
+   *
+   * @return The collection of factory methods
+   */
+  override def factory: FactoryMethods = factory()
+
+  /**
+   * Constructs a new instance of the factory methods using the specified
+   * kernel message and kernel message builder.
+   *
+   * @param parentMessage The message to serve as the parent of outgoing
+   *                      messages sent as a result of using an object created
+   *                      by the factory methods
+   * @param kmBuilder The builder to be used by objects created by factory
+   *                  methods
+   *
+   * @return The collection of factory methods
+   */
+  private[spark] def factory(
+    parentMessage: v5.KernelMessage = lastKernelMessage(),
+    kmBuilder: v5.KMBuilder = v5.KMBuilder()
+  ): FactoryMethods = {
+    new FactoryMethods(_config, actorLoader, parentMessage, kmBuilder)
+  }
+
+  /**
+   * Returns a print stream to be used for communication back to clients
+   * via standard out.
+   *
+   * @return The print stream instance or an error if the stream info is
+   *         not found
+   */
+  override def out: PrintStream = {
+    val kernelMessage = lastKernelMessage()
+
+    constructStream(currentOutputStream, currentOutputKernelMessage, kernelMessage, { kernelMessage =>
+      val outputStream = this.factory(parentMessage = kernelMessage)
+        .newKernelOutputStream("stdout")
+
+      new PrintStream(outputStream)
+    })
+  }
+
+  /**
+   * Returns a print stream to be used for communication back to clients
+   * via standard error.
+   *
+   * @return The print stream instance or an error if the stream info is
+   *         not found
+   */
+  override def err: PrintStream = {
+    val kernelMessage = lastKernelMessage()
+
+    constructStream(currentErrorStream, currentErrorKernelMessage, kernelMessage, { kernelMessage =>
+      val outputStream = this.factory(parentMessage = kernelMessage)
+        .newKernelOutputStream("stderr")
+
+      new PrintStream(outputStream)
+    })
+  }
+
+  /**
+   * Returns an input stream to be used to receive information from the client.
+   *
+   * @return The input stream instance or an error if the stream info is
+   *         not found
+   */
+  override def in: InputStream = {
+    val kernelMessage = lastKernelMessage()
+
+    constructStream(currentInputStream, currentInputKernelMessage, kernelMessage, { kernelMessage =>
+      this.factory(parentMessage = kernelMessage).newKernelInputStream()
+    })
+  }
+
+  /**
+   * Constructs or uses an existing stream.
+   *
+   * @param dynamicStream The DynamicVariable containing the stream to modify
+   *                      or use
+   * @param dynamicKernelMessage The DynamicVariable containing the KernelMessage to
+   *                          check against the new KernelMessage
+   * @param newKernelMessage The potentially-new KernelMessage
+   * @param streamConstructionFunc The function used to create a new stream
+   * @param typeTag The type information associated with the stream
+   * @tparam T The stream type
+   * @return The new stream or existing stream
+   */
+  private def constructStream[T](
+    dynamicStream: DynamicVariable[T],
+    dynamicKernelMessage: DynamicVariable[KernelMessage],
+    newKernelMessage: KernelMessage,
+    streamConstructionFunc: (KernelMessage) => T
+  )(implicit typeTag: TypeTag[T]) = {
+    // Update the stream being used only if the information has changed
+    // or if the stream has not been initialized
+    if (updateKernelMessage(dynamicKernelMessage, newKernelMessage) ||
+      dynamicStream.value == null)
+    {
+      logger.trace("Creating new kernel " + typeTag.tpe.toString + "!")
+      dynamicStream.value = streamConstructionFunc(newKernelMessage)
+    }
+
+    dynamicStream.value
+  }
+
+  /**
+   * Updates the last stream info returning the status of whether or not the
+   * new stream info was different than the last stream info.
+   *
+   * @param dynamicKernelMessage The dynamic variable containing the current
+   *                          stream info
+   * @param kernelMessage The new stream info
+   * @return True if the new stream info is different from the last (therefore
+   *         replaced), otherwise false
+   */
+  private def updateKernelMessage(
+    dynamicKernelMessage: DynamicVariable[KernelMessage],
+    kernelMessage: KernelMessage
+  ): Boolean =
+    if (kernelMessage != null && !kernelMessage.equals(dynamicKernelMessage.value)) {
+      dynamicKernelMessage.value = kernelMessage
+      true
+    } else {
+      false
+    }
+
+  /**
+   * Retrieves the last kernel message received by the kernel.
+   *
+   * @throws IllegalArgumentException If no kernel message has been received
+   *
+   * @return The kernel message instance
+   */
+  private def lastKernelMessage() = {
+    val someKernelMessage = ExecuteRequestState.lastKernelMessage
+    require(someKernelMessage.nonEmpty, "No kernel message received!")
+    someKernelMessage.get
+  }
+
+  override def createSparkContext(conf: SparkConf): SparkContext = {
+    _sparkConf = createSparkConf(conf)
+    _sparkContext = initializeSparkContext(sparkConf)
+    _javaSparkContext = new JavaSparkContext(_sparkContext)
+    _sqlContext = initializeSqlContext(_sparkContext)
+
+    val sparkMaster = _sparkConf.getOption("spark.master").getOrElse("not_set")
+    logger.info( s"Connecting to spark.master $sparkMaster")
+
+    updateInterpreterWithSparkContext(interpreter, sparkContext)
+    updateInterpreterWithSqlContext(interpreter, sqlContext)
+
+    magicLoader.dependencyMap =
+      magicLoader.dependencyMap.setSparkContext(_sparkContext)
+
+    _sparkContext
+  }
+
+  override def createSparkContext(
+    master: String, appName: String
+  ): SparkContext = {
+    createSparkContext(new SparkConf().setMaster(master).setAppName(appName))
+  }
+
+  // TODO: Think of a better way to test without exposing this
+  protected[kernel] def createSparkConf(conf: SparkConf) = {
+
+    logger.info("Setting deployMode to client")
+    conf.set("spark.submit.deployMode", "client")
+
+    KeyValuePairUtils.stringToKeyValuePairSeq(
+      _config.getString("spark_configuration")
+    ).foreach { keyValuePair =>
+      logger.info(s"Setting ${keyValuePair.key} to ${keyValuePair.value}")
+      Try(conf.set(keyValuePair.key, keyValuePair.value))
+    }
+
+    // TODO: Move SparkIMain to private and insert in a different way
+    logger.warn("Locked to Scala interpreter with SparkIMain until decoupled!")
+
+    // TODO: Construct class server outside of SparkIMain
+    logger.warn("Unable to control initialization of REPL class server!")
+    logger.info("REPL Class Server Uri: " + interpreter.classServerURI)
+    conf.set("spark.repl.class.uri", interpreter.classServerURI)
+
+    conf
+  }
+
+  // TODO: Think of a better way to test without exposing this
+  protected[kernel] def initializeSparkContext(sparkConf: SparkConf): SparkContext = {
+
+    logger.debug("Constructing new Spark Context")
+    // TODO: Inject stream redirect headers in Spark dynamically
+    var sparkContext: SparkContext = null
+    val outStream = new KernelOutputStream(
+      actorLoader, KMBuilder(), global.ScheduledTaskManager.instance,
+      sendEmptyOutput = _config.getBoolean("send_empty_output")
+    )
+
+    // Update global stream state and use it to set the Console local variables
+    // for threads in the Spark threadpool
+    global.StreamState.setStreams(System.in, outStream, outStream)
+    global.StreamState.withStreams {
+      sparkContext = new SparkContext(sparkConf)
+    }
+
+    sparkContext
+  }
+
+  // TODO: Think of a better way to test without exposing this
+  protected[kernel] def updateInterpreterWithSparkContext(
+    interpreter: Interpreter, sparkContext: SparkContext
+  ) = {
+
+    interpreter.bindSparkContext(sparkContext)
+  }
+
+  protected[kernel] def initializeSqlContext(
+    sparkContext: SparkContext
+  ): SQLContext = {
+    val sqlContext: SQLContext = try {
+      logger.info("Attempting to create Hive Context")
+      val hiveContextClassString =
+        "org.apache.spark.sql.hive.HiveContext"
+
+      logger.debug(s"Looking up $hiveContextClassString")
+      val hiveContextClass = Class.forName(hiveContextClassString)
+
+      val sparkContextClass = classOf[SparkContext]
+      val sparkContextClassName = sparkContextClass.getName
+
+      logger.debug(s"Searching for constructor taking $sparkContextClassName")
+      val hiveContextContructor =
+        hiveContextClass.getConstructor(sparkContextClass)
+
+      logger.debug("Invoking Hive Context constructor")
+      hiveContextContructor.newInstance(sparkContext).asInstanceOf[SQLContext]
+    } catch {
+      case _: Throwable =>
+        logger.warn("Unable to create Hive Context! Defaulting to SQL Context!")
+        new SQLContext(sparkContext)
+    }
+
+    sqlContext
+  }
+
+  protected[kernel] def updateInterpreterWithSqlContext(
+    interpreter: Interpreter, sqlContext: SQLContext
+  ): Unit = {
+    interpreter.bindSqlContext(sqlContext)
+  }
+
+  override def interpreter(name: String): Option[Interpreter] = {
+    interpreterManager.interpreters.get(name)
+  }
+
+  override def sparkContext: SparkContext = _sparkContext
+  override def sparkConf: SparkConf = _sparkConf
+  override def javaSparkContext: JavaSparkContext = _javaSparkContext
+  override def sqlContext: SQLContext = _sqlContext
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
new file mode 100644
index 0000000..35c4960
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.api
+
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+
+/**
+ * Represents the methods available to stream data from the kernel to the
+ * client.
+ */
+class StreamMethods(actorLoader: ActorLoader, parentMessage: KernelMessage)
+  extends StreamMethodsLike
+{
+  private[api] val kmBuilder = v5.KMBuilder()
+    .withParent(parentMessage)
+    .withIds(Seq(v5.content.StreamContent.toTypeString))
+    .withHeader(v5.content.StreamContent.toTypeString)
+
+  /**
+   * Sends all text provided as one stream message to the client.
+   * @param text The text to wrap in a stream message
+   */
+  override def sendAll(text: String): Unit = {
+    val streamContent = v5.content.StreamContent(
+      "stdout", text
+    )
+
+    val kernelMessage = kmBuilder.withContentString(streamContent).build
+
+    actorLoader.load(v5.SystemActorType.KernelMessageRelay) ! kernelMessage
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
new file mode 100644
index 0000000..144b067
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.dispatch
+
+import akka.actor.Actor
+import com.ibm.spark.kernel.protocol.v5.KernelStatusType.KernelStatusType
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.KernelStatus
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.utils.LogLike
+import play.api.libs.json.Json
+
+class StatusDispatch(actorLoader: ActorLoader) extends Actor with LogLike {
+  private def sendStatusMessage(kernelStatus: KernelStatusType, parentHeader: Header) {
+    //  Create the status message and send it to the relay
+    val km : KernelMessage = KMBuilder()
+      .withIds(Seq(MessageType.Outgoing.Status.toString))
+      .withSignature("")
+      .withHeader(MessageType.Outgoing.Status)
+      .withParentHeader(parentHeader)
+      .withContentString(KernelStatus(kernelStatus.toString)).build
+
+    actorLoader.load(SystemActorType.KernelMessageRelay) ! km
+  }
+
+  override def receive: Receive = {
+    case (status: KernelStatusType, null) =>
+      //  TODO Determine if this should be null or an empty parent header
+      sendStatusMessage(status, null)
+
+    case (status: KernelStatusType, parentHeader: Header) =>
+      sendStatusMessage( status, parentHeader )
+
+    case status: KernelStatusType =>
+      sendStatusMessage(status , HeaderBuilder.empty)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
new file mode 100644
index 0000000..abbf6d3
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.utils.MessageLogSupport
+
+import scala.concurrent.Future
+
+abstract class BaseHandler(actorLoader: ActorLoader) extends OrderedSupport
+  with MessageLogSupport {
+  /**
+   * Implements the receive method, sending a busy message out before
+   * processing the message and sending an idle message out once finished.
+   *
+   * @return The Akka partial function n
+   */
+  final def receive = {
+    // NOTE: Not using withProcessing as the finishedProcessing call is inside
+    //       a future (not triggered immediately)
+    case kernelMessage: KernelMessage =>
+      startProcessing()
+      // Send the busy message before we process the message
+      logKernelMessageAction("Sending Busy message for", kernelMessage)
+      actorLoader.load(SystemActorType.StatusDispatch) !
+        Tuple2(KernelStatusType.Busy, kernelMessage.header)
+
+      // Process the message
+      logKernelMessageAction("Processing", kernelMessage)
+      import scala.concurrent.ExecutionContext.Implicits.global
+      val processFuture = process(kernelMessage)
+
+      // Send the idle message since message has been processed
+      logKernelMessageAction("Sending Idle message for", kernelMessage)
+      processFuture onComplete {
+        case _ =>
+          actorLoader.load(SystemActorType.StatusDispatch) !
+            Tuple2(KernelStatusType.Idle, kernelMessage.header)
+          finishedProcessing()
+      }
+  }
+
+  override def orderedTypes() : Seq[Class[_]] = {Seq(classOf[KernelMessage])}
+
+  /**
+   * Processes the provided kernel message.
+   *
+   * @param kernelMessage The kernel message instance to process
+   */
+  def process(kernelMessage: KernelMessage): Future[_]
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
new file mode 100644
index 0000000..c3b38ee
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.pattern.ask
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import Utilities._
+import com.ibm.spark.utils.{MessageLogSupport, LogLike}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, Json}
+
+import scala.concurrent.ExecutionContext.Implicits.global
+import scala.concurrent.Future
+import scala.util.Success
+
+class CodeCompleteHandler(actorLoader: ActorLoader)
+  extends BaseHandler(actorLoader) with MessageLogSupport
+{
+  override def process(kernelMessage: KernelMessage): Future[_] = {
+    logKernelMessageAction("Generating code completion for", kernelMessage)
+    Utilities.parseAndHandle(
+      kernelMessage.contentString,
+      CompleteRequest.completeRequestReads,
+      completeRequest(kernelMessage, _ : CompleteRequest)
+    )
+  }
+
+  private def completeRequest(km: KernelMessage, cr: CompleteRequest):
+                              Future[(Int, List[String])] = {
+    val interpreterActor = actorLoader.load(SystemActorType.Interpreter)
+    val codeCompleteFuture = ask(interpreterActor, cr).mapTo[(Int, List[String])]
+    codeCompleteFuture.onComplete {
+      case Success(tuple) =>
+        val reply = CompleteReplyOk(tuple._2, cr.cursor_pos,
+                                    tuple._1, Metadata())
+        val completeReplyType = MessageType.Outgoing.CompleteReply.toString
+        logKernelMessageAction("Sending code complete reply for", km)
+        actorLoader.load(SystemActorType.KernelMessageRelay) !
+          km.copy(
+            header = HeaderBuilder.create(completeReplyType),
+            parentHeader = km.header,
+            contentString = Json.toJson(reply).toString
+          )
+      case _ =>
+        new Exception("Parse error in CodeCompleteHandler")
+    }
+    codeCompleteFuture
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
new file mode 100644
index 0000000..2c87dd7
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import com.ibm.spark.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
+import com.ibm.spark.kernel.protocol.v5.content.CommClose
+import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import com.ibm.spark.utils.MessageLogSupport
+import play.api.data.validation.ValidationError
+import play.api.libs.json.JsPath
+
+import scala.concurrent.Future
+import scala.concurrent.future
+import scala.concurrent.ExecutionContext.Implicits.global
+
+/**
+ * Represents the handler for comm_close messages.
+ *
+ * @param actorLoader The actor loader to use for actor communication
+ * @param commRegistrar The Comm registrar used for unlinking
+ * @param commStorage The Comm storage used for close callbacks
+ */
+class CommCloseHandler(
+  actorLoader: ActorLoader, commRegistrar: CommRegistrar,
+  commStorage: CommStorage
+) extends BaseHandler(actorLoader) with MessageLogSupport
+{
+  override def process(kernelMessage: KernelMessage): Future[_] = future {
+    logKernelMessageAction("Initiating Comm Close for", kernelMessage)
+
+    val kmBuilder = KMBuilder().withParent(kernelMessage)
+
+    Utilities.parseAndHandle(
+      kernelMessage.contentString,
+      CommClose.commCloseReads,
+      handler = handleCommClose(kmBuilder),
+      errHandler = handleParseError
+    )
+  }
+
+  private def handleCommClose(kmBuilder: KMBuilder)(commClose: CommClose) = {
+    val commId = commClose.comm_id
+    val data = commClose.data
+
+    logger.debug(s"Received comm_close with id '$commId'")
+
+    val commWriter = new KernelCommWriter(actorLoader, kmBuilder, commId)
+
+    commStorage.getCommIdCallbacks(commId) match {
+      case None             =>
+        logger.warn(s"Received invalid id for Comm Close: $commId")
+      case Some(callbacks)  =>
+        logger.debug(s"Executing close callbacks for id '$commId'")
+
+        // TODO: Should we be checking the return values? Probably not.
+        callbacks.executeCloseCallbacks(commWriter, commId, data)
+          .filter(_.isFailure).map(_.failed).foreach(throwable => {
+            logger.error("Comm close callback encountered an error!", throwable)
+          })
+    }
+  }
+
+  private def handleParseError(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
+    // TODO: Determine proper response for a parse failure
+    logger.warn("Parse error for Comm Close! Not responding!")
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
new file mode 100644
index 0000000..03baef9
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import com.ibm.spark.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
+import com.ibm.spark.kernel.protocol.v5.content.CommMsg
+import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import com.ibm.spark.utils.MessageLogSupport
+import play.api.data.validation.ValidationError
+import play.api.libs.json.JsPath
+
+import scala.concurrent.Future
+import scala.concurrent.future
+import scala.concurrent.ExecutionContext.Implicits.global
+
+/**
+ * Represents the handler for comm_msg messages.
+ *
+ * @param actorLoader The actor loader to use for actor communication
+ * @param commRegistrar The Comm registrar (unused)
+ * @param commStorage The Comm storage used for msg callbacks
+ */
+class CommMsgHandler(
+  actorLoader: ActorLoader, commRegistrar: CommRegistrar,
+  commStorage: CommStorage
+) extends BaseHandler(actorLoader) with MessageLogSupport
+{
+  override def process(kernelMessage: KernelMessage): Future[_] = future {
+    logKernelMessageAction("Initiating Comm Msg for", kernelMessage)
+
+    val kmBuilder = KMBuilder().withParent(kernelMessage)
+
+    Utilities.parseAndHandle(
+      kernelMessage.contentString,
+      CommMsg.commMsgReads,
+      handler = handleCommMsg(kmBuilder),
+      errHandler = handleParseError
+    )
+  }
+
+  private def handleCommMsg(kmBuilder: KMBuilder)(commMsg: CommMsg) = {
+    val commId = commMsg.comm_id
+    val data = commMsg.data
+
+    logger.debug(s"Received comm_msg with id '$commId'")
+
+    val commWriter = new KernelCommWriter(actorLoader, kmBuilder, commId)
+
+    commStorage.getCommIdCallbacks(commId) match {
+      case None             =>
+        logger.warn(s"Received invalid id for Comm Msg: $commId")
+      case Some(callbacks)  =>
+        logger.debug(s"Executing msg callbacks for id '$commId'")
+
+        // TODO: Should we be checking the return values? Probably not.
+        callbacks.executeMsgCallbacks(commWriter, commId, data)
+          .filter(_.isFailure).map(_.failed).foreach(throwable => {
+            logger.error("Comm msg callback encountered an error!", throwable)
+          })
+    }
+  }
+
+  private def handleParseError(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
+    // TODO: Determine proper response for a parse failure
+    logger.warn("Parse error for Comm Msg! Not responding!")
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
new file mode 100644
index 0000000..80e2b35
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import com.ibm.spark.comm.{KernelCommWriter, CommStorage, CommRegistrar, CommWriter}
+import com.ibm.spark.kernel.protocol.v5.content.CommOpen
+import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import com.ibm.spark.utils.MessageLogSupport
+import play.api.data.validation.ValidationError
+import play.api.libs.json.JsPath
+
+import scala.concurrent.Future
+import scala.concurrent.future
+import scala.concurrent.ExecutionContext.Implicits.global
+
+/**
+ * Represents the handler for comm_open messages.
+ *
+ * @param actorLoader The actor loader to use for actor communication
+ * @param commRegistrar The Comm registrar used for linking
+ * @param commStorage The Comm storage used for open callbacks
+ */
+class CommOpenHandler(
+  actorLoader: ActorLoader, commRegistrar: CommRegistrar,
+  commStorage: CommStorage
+) extends BaseHandler(actorLoader) with MessageLogSupport
+{
+  override def process(kernelMessage: KernelMessage): Future[_] = future {
+    logKernelMessageAction("Initiating Comm Open for", kernelMessage)
+
+    val kmBuilder = KMBuilder().withParent(kernelMessage)
+
+    Utilities.parseAndHandle(
+      kernelMessage.contentString,
+      CommOpen.commOpenReads,
+      handler = handleCommOpen(kmBuilder),
+      errHandler = handleParseError
+    )
+  }
+
+  private def handleCommOpen(kmBuilder: KMBuilder)(commOpen: CommOpen) = {
+    val commId = commOpen.comm_id
+    val targetName = commOpen.target_name
+    val data = commOpen.data
+
+    logger.debug(
+      s"Received comm_open for target '$targetName' with id '$commId'")
+
+    val commWriter = new KernelCommWriter(actorLoader, kmBuilder, commId)
+
+    commStorage.getTargetCallbacks(targetName) match {
+      case None             =>
+        logger.warn(s"Received invalid target for Comm Open: $targetName")
+
+        commWriter.close()
+      case Some(callbacks)  =>
+        logger.debug(s"Executing open callbacks for id '$commId'")
+
+        // TODO: Should we be checking the return values? Probably not.
+        callbacks.executeOpenCallbacks(commWriter, commId, targetName, data)
+          .filter(_.isFailure).map(_.failed).foreach(throwable => {
+            logger.error("Comm open callback encountered an error!", throwable)
+          })
+    }
+  }
+
+  private def handleParseError(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
+    // TODO: Determine proper response for a parse failure
+    logger.warn("Parse error for Comm Open! Not responding!")
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
new file mode 100644
index 0000000..c066d98
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.actor.ActorSelection
+import akka.pattern.ask
+import com.ibm.spark.global.{ExecuteRequestState, ExecutionCounter}
+import com.ibm.spark.kernel.api.{Kernel, KernelLike}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
+import com.ibm.spark.{global => kernelGlobal}
+import Utilities._
+import com.ibm.spark.utils._
+import play.api.data.validation.ValidationError
+import play.api.libs.json.JsPath
+
+import scala.concurrent.ExecutionContext.Implicits.global
+import scala.concurrent._
+import scala.util.{Failure, Success}
+
+/**
+ * Receives an ExecuteRequest KernelMessage and forwards the ExecuteRequest
+ * to the interpreter actor.
+ *
+ * @param actorLoader The loader to use when needing to retrieve actors for
+ *                    code execution and output
+ * @param kernel The kernel whose factory methods to use
+ */
+class ExecuteRequestHandler(
+  private val actorLoader: ActorLoader,
+  private val kernel: Kernel
+) extends BaseHandler(actorLoader) with LogLike {
+  override def process(km: KernelMessage): Future[_] = {
+    // Mark the message as our new incoming kernel message for execution
+    ExecuteRequestState.processIncomingKernelMessage(km)
+
+    val skeletonBuilder = KMBuilder().withParent(km).withIds(km.ids)
+    val executionCount = ExecutionCounter.incr(km.header.session)
+    val relayActor = actorLoader.load(SystemActorType.KernelMessageRelay)
+
+    def handleExecuteRequest(executeRequest: ExecuteRequest):
+                             Future[(ExecuteReply, ExecuteResult)] = {
+      //  Send an ExecuteInput to the client saying we are executing something
+      val executeInputMessage = skeletonBuilder
+        .withHeader(MessageType.Outgoing.ExecuteInput)
+        .withContentString(ExecuteInput(executeRequest.code, executionCount)).build
+
+      relayMsg(executeInputMessage, relayActor)
+
+      // Construct our new set of streams
+      // TODO: Add support for error streams
+      val outputStream = kernel.factory(
+        parentMessage = km,
+        kmBuilder = skeletonBuilder
+      ).newKernelOutputStream()
+      val executeFuture = ask(
+        actorLoader.load(SystemActorType.ExecuteRequestRelay),
+        (executeRequest, km, outputStream)
+      ).mapTo[(ExecuteReply, ExecuteResult)]
+
+      // Flush the output stream after code execution completes to ensure
+      // stream messages are sent prior to idle status messages.
+      executeFuture andThen { case result =>
+        outputStream.flush()
+        result
+      } andThen {
+        case Success(tuple) =>
+          val (executeReply, executeResult) = updateCount(tuple, executionCount)
+
+          //  Send an ExecuteReply to the client
+          val executeReplyMsg = skeletonBuilder
+            .withHeader(MessageType.Outgoing.ExecuteReply)
+            .withContentString(executeReply).build
+          relayMsg(executeReplyMsg, relayActor)
+
+          //  Send an ExecuteResult with the result of the code execution
+          if (executeResult.hasContent) {
+            val executeResultMsg = skeletonBuilder
+              .withIds(Seq(MessageType.Outgoing.ExecuteResult.toString))
+              .withHeader(MessageType.Outgoing.ExecuteResult)
+              .withContentString(executeResult).build
+            relayMsg(executeResultMsg, relayActor)
+          }
+
+        case Failure(error: Throwable) =>
+          //  Send an ExecuteReplyError to the client on the Shell socket
+          val replyError: ExecuteReply = ExecuteReplyError(
+            executionCount,
+            Option(error.getClass.getCanonicalName),
+            Option(error.getMessage),
+            Option(error.getStackTrace.map(_.toString).toList))
+          relayErrorMessages(relayActor, replyError, skeletonBuilder)
+      }
+    }
+
+    def parseErrorHandler(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
+      val errs = invalid.map (e => s"JSPath ${e._1} has error ${e._2}").toList
+      logger.error(s"Validation errors when parsing ExecuteRequest: ${errs}")
+      val replyError: ExecuteReply = ExecuteReplyError(
+        executionCount,
+        Option("JsonParseException"),
+        Option("Error parsing fields"),
+        Option(errs)
+      )
+      future { relayErrorMessages(relayActor, replyError, skeletonBuilder) }
+    }
+
+    Utilities.parseAndHandle(
+      km.contentString,
+      ExecuteRequest.executeRequestReads,
+      handler    = handleExecuteRequest,
+      errHandler = parseErrorHandler)
+  }
+
+  private def updateCount(tuple: (ExecuteReply, ExecuteResult), n: Int) =
+    (tuple._1.copy(execution_count = n), tuple._2.copy(execution_count = n))
+
+  /**
+   * Sends an ExecuteReplyError and and Error message to the given actor.
+   * @param relayActor The relay to send kernelMessages through
+   * @param replyError The reply error to build the error kernelMessages from.
+   * @param skeletonBuilder A builder with common base KernelMessage parameters.
+   */
+  def relayErrorMessages(relayActor: ActorSelection,
+                         replyError: ExecuteReply,
+                         skeletonBuilder: KMBuilder) {
+    val executeReplyMsg = skeletonBuilder
+      .withHeader(MessageType.Outgoing.ExecuteReply)
+      .withContentString(replyError).build
+
+    val errorContent: ErrorContent =  ErrorContent(
+      replyError.ename.get, replyError.evalue.get, replyError.traceback.get)
+
+    val errorMsg = skeletonBuilder
+      .withHeader(MessageType.Outgoing.Error)
+      .withContentString(errorContent).build
+
+    relayMsg(executeReplyMsg, relayActor)
+    //  Send the Error to the client on the IOPub socket
+    relayMsg(errorMsg, relayActor)
+  }
+
+  private def relayMsg(km: KernelMessage, relayActor: ActorSelection) = {
+    logKernelMessageAction("Sending to KernelMessageRelay.", km)
+    relayActor ! km
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
new file mode 100644
index 0000000..834f632
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.actor.Actor
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.utils.{MessageLogSupport, LogLike}
+
+/**
+ * All KernelMessage leaving the kernel for the client will exit the relay in a similar pattern. This class is meant
+ * to encapsulate this behaviour into one generic method. This class should be used by mapping a
+ * {@link com.ibm.spark.kernel.protocol.MessageType} to the {@link com.ibm.spark.kernel.protocol.SocketType} constructor
+ * parameter. This will map MessageTypes to their corresponding SocketTypes. An example us of this class would be
+ *
+ * actorSystem.actorOf(
+ *      //  Tells the handler to forward anything it receives to the Control socket
+ *      Props(classOf[GenericSocketMessageHandler], actorLoader, SocketType.Control),
+ *
+ *      // Creates the Actor with the name of the message type, this allows the Relay to route messages here
+ *      name = MessageType.KernelInfoReply.toString
+ *   )
+ *
+ * @param actorLoader The ActorLoader used to load the socket actors
+ * @param socketType The type of socket, mapping to an Actor for this class to pass messages along to
+ */
+class GenericSocketMessageHandler(actorLoader: ActorLoader, socketType: Enumeration#Value)
+  extends Actor with LogLike with OrderedSupport {
+  override def receive: Receive = {
+    case message: KernelMessage => withProcessing {
+      logger.debug(s"Sending KernelMessage ${message.header.msg_id} of type " +
+        s"${message.header.msg_type} to ${socketType} socket")
+      actorLoader.load(socketType) ! message
+    }
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[KernelMessage])
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
new file mode 100644
index 0000000..dba0eef
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.actor.ActorRef
+import com.ibm.spark.comm.{CommRegistrar, CommStorage}
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5.{SystemActorType, KernelMessage}
+import com.ibm.spark.kernel.protocol.v5.content.{InputReply, CommOpen}
+import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.utils.MessageLogSupport
+import play.api.libs.json.Json
+
+import scala.concurrent.{Promise, Future}
+
+/**
+ * Represents the handler for both input request and input reply messages. Does
+ * not extend BaseHandler because it does not send busy/idle status messages.
+ *
+ * @param actorLoader The actor loader to use for actor communication
+ * @param responseMap The map used to maintain the links to responses
+ */
+class InputRequestReplyHandler(
+  actorLoader: ActorLoader,
+  responseMap: collection.mutable.Map[String, ActorRef]
+) extends OrderedSupport with MessageLogSupport
+{
+  // TODO: Is there a better way than storing actor refs?
+  def receive = {
+    case kernelMessage: KernelMessage =>
+      startProcessing()
+
+      val kernelMessageType = kernelMessage.header.msg_type
+      val inputRequestType = v5.MessageType.Outgoing.InputRequest.toString
+      val inputReplyType = v5.MessageType.Incoming.InputReply.toString
+
+      // Is this an outgoing message to request data?
+      if (kernelMessageType == inputRequestType) {
+        val session = kernelMessage.parentHeader.session
+        responseMap(session) = sender
+
+        logger.debug("Associating input request with session " + session)
+
+        actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelMessage
+
+      // Is this an incoming response to a previous request for data?
+      } else if (kernelMessageType == inputReplyType) {
+        val session = kernelMessage.header.session
+        val inputReply = Json.parse(kernelMessage.contentString).as[InputReply]
+
+        logger.debug(s"Received input reply for session $session with value " +
+          s"'${inputReply.value}'")
+
+        responseMap(session) ! inputReply.value
+        responseMap.remove(session)
+      }
+
+      finishedProcessing()
+  }
+
+  override def orderedTypes() : Seq[Class[_]] = {Seq(classOf[KernelMessage])}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
new file mode 100644
index 0000000..854a759
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.KernelInfoReply
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.utils.LogLike
+import play.api.libs.json.Json
+
+import scala.concurrent._
+
+/**
+ * Receives a KernelInfoRequest KernelMessage and returns a KernelInfoReply
+ * KernelMessage.
+ */
+class KernelInfoRequestHandler(actorLoader: ActorLoader)
+  extends BaseHandler(actorLoader) with LogLike
+{
+  def process(kernelMessage: KernelMessage): Future[_] = {
+    import scala.concurrent.ExecutionContext.Implicits.global
+    future {
+      logger.debug("Sending kernel info reply message")
+
+      val kernelInfo = SparkKernelInfo
+      val kernelInfoReply = KernelInfoReply(
+        kernelInfo.protocolVersion,
+        kernelInfo.implementation,
+        kernelInfo.implementationVersion,
+        kernelInfo.language_info,
+        kernelInfo.languageVersion,
+        kernelInfo.banner
+      )
+
+      // TODO could we use HeaderBuilder here?
+      val replyHeader = Header(
+        java.util.UUID.randomUUID.toString,
+        "",
+        java.util.UUID.randomUUID.toString,
+        MessageType.Outgoing.KernelInfoReply.toString,
+        kernelInfo.protocolVersion
+      )
+
+      val kernelResponseMessage = KMBuilder()
+        .withIds(kernelMessage.ids)
+        .withSignature("")
+        .withHeader(replyHeader)
+        .withParent(kernelMessage)
+        .withContentString(kernelInfoReply).build
+
+      actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelResponseMessage
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
new file mode 100644
index 0000000..a0a2001
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import com.ibm.spark.comm.{CommRegistrar, CommStorage, KernelCommWriter}
+import com.ibm.spark.kernel.protocol.v5.content.{ShutdownReply, ShutdownRequest, CommOpen}
+import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.utils.MessageLogSupport
+import play.api.data.validation.ValidationError
+import play.api.libs.json.JsPath
+
+import scala.concurrent.ExecutionContext.Implicits.global
+import scala.concurrent.{Future, future}
+
+/**
+ * Represents the handler to shutdown the kernel
+ *
+ * @param actorLoader The actor loader to use for actor communication
+ */
+class ShutdownHandler(
+  actorLoader: ActorLoader
+) extends BaseHandler(actorLoader) with MessageLogSupport
+{
+  override def process(kernelMessage: KernelMessage): Future[_] = future {
+    logKernelMessageAction("Initiating Shutdown request for", kernelMessage)
+
+    val shutdownReply = ShutdownReply(false)
+
+    val replyHeader = Header(
+      java.util.UUID.randomUUID.toString,
+      "",
+      java.util.UUID.randomUUID.toString,
+      ShutdownReply.toTypeString,
+      "")
+
+    val kernelResponseMessage = KMBuilder()
+      .withIds(kernelMessage.ids)
+      .withSignature("")
+      .withHeader(replyHeader)
+      .withParent(kernelMessage)
+      .withContentString(shutdownReply).build
+
+    logger.debug("Attempting graceful shutdown.")
+    actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelResponseMessage
+    System.exit(0)
+  }
+
+}
+


[16/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
new file mode 100644
index 0000000..b5ae174
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.interpreter
+
+import java.io.OutputStream
+
+import akka.actor.{Actor, ActorRef, Props}
+import akka.pattern.{ask, pipe}
+import akka.util.Timeout
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.kernel.protocol.v5.interpreter.tasks._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.interpreter._
+import com.ibm.spark.utils.LogLike
+
+import scala.concurrent.duration._
+
+object InterpreterActor {
+  def props(interpreter: Interpreter): Props =
+    Props(classOf[InterpreterActor], interpreter)
+}
+
+// TODO: Investigate restart sequence
+//
+// http://doc.akka.io/docs/akka/2.2.3/general/supervision.html
+//
+// "create new actor instance by invoking the originally provided factory again"
+//
+// Does this mean that the interpreter instance is not gc and is passed in?
+//
+class InterpreterActor(
+  interpreterTaskFactory: InterpreterTaskFactory
+) extends Actor with LogLike {
+  // NOTE: Required to provide the execution context for futures with akka
+  import context._
+
+  // NOTE: Required for ask (?) to function... maybe can define elsewhere?
+  implicit val timeout = Timeout(21474835.seconds)
+
+  //
+  // List of child actors that the interpreter contains
+  //
+  private var executeRequestTask: ActorRef = _
+  private var completeCodeTask: ActorRef = _
+
+  /**
+   * Initializes all child actors performing tasks for the interpreter.
+   */
+  override def preStart = {
+    executeRequestTask = interpreterTaskFactory.ExecuteRequestTask(
+      context, InterpreterChildActorType.ExecuteRequestTask.toString)
+    completeCodeTask = interpreterTaskFactory.CodeCompleteTask(
+      context, InterpreterChildActorType.CodeCompleteTask.toString)
+  }
+
+  override def receive: Receive = {
+    case (executeRequest: ExecuteRequest, parentMessage: KernelMessage,
+      outputStream: OutputStream) =>
+      val data = (executeRequest, parentMessage, outputStream)
+      (executeRequestTask ? data) recover {
+        case ex: Throwable =>
+          logger.error(s"Could not execute code ${executeRequest.code} because "
+            + s"of exception: ${ex.getMessage}")
+          Right(ExecuteError(
+            ex.getClass.getName,
+            ex.getLocalizedMessage,
+            ex.getStackTrace.map(_.toString).toList)
+          )
+      } pipeTo sender
+    case (completeRequest: CompleteRequest) =>
+      logger.debug(s"InterpreterActor requesting code completion for code " +
+        s"${completeRequest.code}")
+      (completeCodeTask ? completeRequest) recover {
+        case ex: Throwable =>
+          logger.error(s"Could not complete code ${completeRequest.code}: " +
+            s"${ex.getMessage}")
+          Right(ExecuteError(
+            ex.getClass.getName,
+            ex.getLocalizedMessage,
+            ex.getStackTrace.map(_.toString).toList)
+          )
+      } pipeTo sender
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
new file mode 100644
index 0000000..6738520
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+package object interpreter {
+  object InterpreterChildActorType extends Enumeration {
+    type InterpreterChildActorType = Value
+
+    val ExecuteRequestTask = Value("execute_request_task")
+    val CodeCompleteTask = Value("code_complete_task")
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
new file mode 100644
index 0000000..87f37b0
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
+
+import akka.actor.{Actor, Props}
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.kernel.protocol.v5.content.CompleteRequest
+import com.ibm.spark.utils.LogLike
+
+object CodeCompleteTaskActor {
+  def props(interpreter: Interpreter): Props =
+    Props(classOf[CodeCompleteTaskActor], interpreter)
+}
+
+class CodeCompleteTaskActor(interpreter: Interpreter)
+  extends Actor with LogLike {
+  require(interpreter != null)
+
+  override def receive: Receive = {
+    case completeRequest: CompleteRequest =>
+      logger.debug("Invoking the interpreter completion")
+      sender ! interpreter.completion(completeRequest.code, completeRequest.cursor_pos)
+    case _ =>
+      sender ! "Unknown message" // TODO: Provide a failure message type to be passed around?
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
new file mode 100644
index 0000000..dc22b21
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
+
+import java.io.OutputStream
+
+import akka.actor.{Props, Actor}
+import com.ibm.spark.global.StreamState
+import com.ibm.spark.interpreter.{ExecuteAborted, Results, ExecuteError, Interpreter}
+import com.ibm.spark.kernel.api.StreamInfo
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.security.KernelSecurityManager
+import com.ibm.spark.utils.{ConditionalOutputStream, MultiOutputStream, LogLike}
+
+object ExecuteRequestTaskActor {
+  def props(interpreter: Interpreter): Props =
+    Props(classOf[ExecuteRequestTaskActor], interpreter)
+}
+
+class ExecuteRequestTaskActor(interpreter: Interpreter) extends Actor with LogLike {
+  require(interpreter != null)
+
+  override def receive: Receive = {
+    case (executeRequest: ExecuteRequest, parentMessage: KernelMessage,
+      outputStream: OutputStream) =>
+      // If the cell is not empty, then interpret.
+      if(executeRequest.code.trim != "") {
+        //interpreter.updatePrintStreams(System.in, outputStream, outputStream)
+        val newInputStream = System.in
+        val newOutputStream = buildOutputStream(outputStream, System.out)
+        val newErrorStream = buildOutputStream(outputStream, System.err)
+
+        // Update our global streams to be used by future output
+        // NOTE: This is not async-safe! This is expected to be broken when
+        //       running asynchronously! Use an alternative for data
+        //       communication!
+        StreamState.setStreams(newInputStream, newOutputStream, newErrorStream)
+
+        val (success, result) = {
+            // Add our parent message with StreamInfo type included
+//            interpreter.doQuietly {
+//              interpreter.bind(
+//                "$streamInfo",
+//                "com.ibm.spark.kernel.api.StreamInfo",
+//                new KernelMessage(
+//                  ids = parentMessage.ids,
+//                  signature = parentMessage.signature,
+//                  header = parentMessage.header,
+//                  parentHeader = parentMessage.parentHeader,
+//                  metadata = parentMessage.metadata,
+//                  contentString = parentMessage.contentString
+//                ) with StreamInfo,
+//                List( """@transient""", """implicit""")
+//              )
+              // TODO: Think of a cleaner wrapper to handle updating the Console
+              //       input and output streams
+//              interpreter.interpret(
+//                """val $updateOutput = {
+//                Console.setIn(System.in)
+//                Console.setOut(System.out)
+//                Console.setErr(System.err)
+//              }""".trim)
+//            }
+            interpreter.interpret(executeRequest.code.trim)
+          }
+
+        logger.debug(s"Interpreter execution result was ${success}")
+        success match {
+          case Results.Success =>
+            val output = result.left.get
+            sender ! Left(output)
+          case Results.Error =>
+            val error = result.right.get
+            sender ! Right(error)
+          case Results.Aborted =>
+            sender ! Right(new ExecuteAborted)
+          case Results.Incomplete =>
+            // If we get an incomplete it's most likely a syntax error, so
+            // let the user know.
+            sender ! Right(new ExecuteError("Syntax Error.", "", List()))
+        }
+      } else {
+        // If we get empty code from a cell then just return ExecuteReplyOk
+        sender ! Left("")
+      }
+    case unknownValue =>
+      logger.warn(s"Received unknown message type ${unknownValue}")
+      sender ! "Unknown message" // TODO: Provide a failure message type to be passed around?
+  }
+
+  private def buildOutputStream(
+    newOutput: OutputStream,
+    defaultOutput: OutputStream
+  ) = {
+    def isRestrictedThread = {
+      val currentGroup = Thread.currentThread().getThreadGroup
+      val restrictedGroupName =
+        KernelSecurityManager.RestrictedGroupName
+
+      currentGroup != null && currentGroup.getName == restrictedGroupName
+    }
+
+    new MultiOutputStream(List[OutputStream](
+      new ConditionalOutputStream(newOutput, isRestrictedThread),
+      new ConditionalOutputStream(defaultOutput, !isRestrictedThread)
+    ))
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
new file mode 100644
index 0000000..5f5a7ad
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
+
+import akka.actor.{ActorRefFactory, ActorRef}
+import com.ibm.spark.interpreter.Interpreter
+
+class InterpreterTaskFactory(interpreter: Interpreter) {
+  /**
+   * Creates a new actor representing this specific task.
+   * @param actorRefFactory The factory used to task actor will belong
+   * @return The ActorRef created for the task
+   */
+  def ExecuteRequestTask(actorRefFactory: ActorRefFactory, name: String): ActorRef =
+    actorRefFactory.actorOf(ExecuteRequestTaskActor.props(interpreter), name)
+
+  /**
+   *
+   */
+  def CodeCompleteTask(actorRefFactory: ActorRefFactory, name: String): ActorRef =
+    actorRefFactory.actorOf(CodeCompleteTaskActor.props(interpreter), name)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
new file mode 100644
index 0000000..171934d
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel
+
+import akka.actor.{ActorRefFactory, ActorSelection}
+
+/**
+ * This trait defines the interface for loading actors based on some value
+ * (enum, attribute, etc...). The thought is to allow external consumers
+ * acquire actors through a common interface, minimizing the spread of the
+ * logic about the Actors, ActorSystem, and other similar concepts.
+ */
+trait ActorLoader {
+  /**
+   * This method is meant to find an actor associated with an enum value. This
+   * enum value can map to an actor associated with handling a specific kernel
+   * message, a socket type, or other functionality.
+   *
+   * @param actorEnum The enum value used to load the actor
+   *
+   * @return An ActorSelection to pass messages to
+   */
+  def load(actorEnum: Enumeration#Value): ActorSelection
+}
+
+case class SimpleActorLoader(actorRefFactory: ActorRefFactory)
+  extends ActorLoader
+{
+  private val userActorDirectory: String = "/user/%s"
+
+  override def load(actorEnum: Enumeration#Value): ActorSelection = {
+    actorRefFactory.actorSelection(
+      userActorDirectory.format(actorEnum.toString)
+    )
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
new file mode 100644
index 0000000..73cf1b1
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel
+
+import java.nio.charset.Charset
+
+import akka.util.{ByteString, Timeout}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.utils.LogLike
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, Json, Reads}
+
+import scala.concurrent.duration._
+
+object Utilities extends LogLike {
+  //
+  // NOTE: This is brought in to remove feature warnings regarding the use of
+  //       implicit conversions regarding the following:
+  //
+  //       1. ByteStringToString
+  //       2. ZMQMessageToKernelMessage
+  //
+  import scala.language.implicitConversions
+
+  /**
+   * This timeout needs to be defined for the Akka asks to timeout
+   */
+  implicit val timeout = Timeout(21474835.seconds)
+
+  implicit def ByteStringToString(byteString : ByteString) : String = {
+    new String(byteString.toArray, Charset.forName("UTF-8"))
+  }
+
+  implicit def StringToByteString(string : String) : ByteString = {
+    ByteString(string.getBytes)
+  }
+
+  implicit def ZMQMessageToKernelMessage(message: ZMQMessage): KernelMessage = {
+    val delimiterIndex: Int =
+      message.frames.indexOf(ByteString("<IDS|MSG>".getBytes))
+    //  TODO Handle the case where there is no delimiter
+    val ids: Seq[String] =
+      message.frames.take(delimiterIndex).map(
+        (byteString : ByteString) =>  { new String(byteString.toArray) }
+      )
+    val header = Json.parse(message.frames(delimiterIndex + 2)).as[Header]
+    // TODO: Investigate better solution than setting parentHeader to null for {}
+    val parentHeader = parseAndHandle(message.frames(delimiterIndex + 3),
+                                  ParentHeader.headerReads,
+                                  handler = (valid: ParentHeader) => valid,
+                                  errHandler = _ => null
+    )
+    val metadata = Json.parse(message.frames(delimiterIndex + 4)).as[Metadata]
+
+    KMBuilder().withIds(ids.toList)
+               .withSignature(message.frame(delimiterIndex + 1))
+               .withHeader(header)
+               .withParentHeader(parentHeader)
+               .withMetadata(metadata)
+               .withContentString(message.frame(delimiterIndex + 5)).build(false)
+  }
+
+  implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = {
+    val frames: scala.collection.mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer()
+    kernelMessage.ids.map((id : String) => frames += id )
+    frames += "<IDS|MSG>"
+    frames += kernelMessage.signature
+    frames += Json.toJson(kernelMessage.header).toString()
+    frames += Json.toJson(kernelMessage.parentHeader).toString()
+    frames += Json.toJson(kernelMessage.metadata).toString
+    frames += kernelMessage.contentString
+    ZMQMessage(frames  : _*)
+  }
+
+  def parseAndHandle[T, U](json: String, reads: Reads[T],
+                           handler: T => U) : U = {
+    parseAndHandle(json, reads, handler,
+      (invalid: Seq[(JsPath, Seq[ValidationError])]) => {
+        logger.error(s"Could not parse JSON, ${json}")
+        throw new Throwable(s"Could not parse JSON, ${json}")
+      }
+    )
+  }
+
+  def parseAndHandle[T, U](json: String, reads: Reads[T],
+                           handler: T => U,
+                           errHandler: Seq[(JsPath, Seq[ValidationError])] => U) : U = {
+    Json.parse(json).validate[T](reads).fold(
+      errHandler,
+      (content: T) => handler(content)
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
new file mode 100644
index 0000000..df42b03
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import com.ibm.spark.kernel.protocol.v5.SystemActorType
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+
+/**
+ * The server endpoint for control messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ * @param actorLoader The actor loader to use to load the relay for kernel
+ *                    messages
+ */
+class Control(socketFactory: SocketFactory, actorLoader: ActorLoader)
+  extends ZeromqKernelMessageSocket(
+    socketFactory.Control,
+    () => actorLoader.load(SystemActorType.KernelMessageRelay)
+  )
+{
+  logger.trace("Created new Control actor")
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
new file mode 100644
index 0000000..d17c360
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import akka.actor.Actor
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.utils.LogLike
+
+/**
+ * The server endpoint for heartbeat messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ */
+class Heartbeat(socketFactory : SocketFactory) extends Actor with LogLike {
+  logger.debug("Created new Heartbeat actor")
+  val socket = socketFactory.Heartbeat(context.system, self)
+
+  override def receive: Receive = {
+    case message: ZMQMessage =>
+      logger.trace("Heartbeat received message: " +
+        message.frames.map((byteString: ByteString) =>
+          new String(byteString.toArray)).mkString("\n"))
+      socket ! message
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
new file mode 100644
index 0000000..d2ff8e9
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import akka.actor.Actor
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.Utilities
+import Utilities._
+import com.ibm.spark.utils.{MessageLogSupport, LogLike}
+
+/**
+ * The server endpoint for IOPub messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ */
+class IOPub(socketFactory: SocketFactory)
+  extends Actor with MessageLogSupport with OrderedSupport
+{
+  logger.trace("Created new IOPub actor")
+  val socket = socketFactory.IOPub(context.system)
+  override def receive: Receive = {
+    case message: KernelMessage => withProcessing {
+      val zmqMessage: ZMQMessage = message
+      logMessage(message)
+      socket ! zmqMessage
+    }
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[KernelMessage])
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
new file mode 100644
index 0000000..b5c4bfb
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.SystemActorType
+
+/**
+ * The server endpoint for shell messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ * @param actorLoader The actor loader to use to load the relay for kernel
+ *                    messages
+ */
+class Shell(socketFactory: SocketFactory, actorLoader: ActorLoader)
+  extends ZeromqKernelMessageSocket(
+    socketFactory.Shell,
+    () => actorLoader.load(SystemActorType.KernelMessageRelay)
+  )
+{
+  logger.trace("Created new Shell actor")
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
new file mode 100644
index 0000000..5fe3e39
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import com.typesafe.config.Config
+import play.api.libs.json.Json
+
+case class SocketConfig (
+  stdin_port: Int,
+  control_port: Int,
+  hb_port: Int,
+  shell_port: Int,
+  iopub_port: Int,
+  ip : String,
+  transport: String,
+  signature_scheme: String,
+  key: String
+)
+
+object SocketConfig {
+  implicit val socketConfigReads = Json.reads[SocketConfig]
+  implicit val socketConfigWrites = Json.writes[SocketConfig]
+
+  def fromConfig(config: Config) = {
+    new SocketConfig(
+      config.getInt("stdin_port"),
+      config.getInt("control_port"),
+      config.getInt("hb_port"),
+      config.getInt("shell_port"),
+      config.getInt("iopub_port"),
+      config.getString("ip"),
+      config.getString("transport"),
+      config.getString("signature_scheme"),
+      config.getString("key")
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
new file mode 100644
index 0000000..865c383
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+object SocketConnection {
+  def apply(protocol: String, ip: String, port: Int) = new SocketConnection(protocol, ip, port)
+}
+
+/**
+ * Represent a connection string for a socket
+ * @param protocol The protocol portion of the connection (e.g. tcp, akka, udp)
+ * @param ip The hostname or ip address to bind on (e.g. *, myhost, 127.0.0.1)
+ * @param port The port for the socket to listen on
+ */
+class SocketConnection(protocol: String, ip: String, port: Int) {
+  private val SocketConnectionString : String = "%s://%s:%d"
+
+  override def toString: String = {
+    SocketConnectionString.format(protocol, ip, port)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
new file mode 100644
index 0000000..ef2001f
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import akka.actor.{Props, ActorRef, ActorSystem}
+import com.ibm.spark.communication.actors.{RouterSocketActor, RepSocketActor, PubSocketActor}
+
+object SocketFactory {
+  def apply(socketConfig: SocketConfig) = {
+    new SocketFactory(socketConfig)
+  }
+}
+
+/**
+ * A Factory class to provide various socket connections for IPython Kernel Spec
+ * @param socketConfig The configuration for the sockets to be properly
+ *                     instantiated
+ */
+class SocketFactory(socketConfig: SocketConfig) {
+  val HeartbeatConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.hb_port)
+  val ShellConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.shell_port)
+  val ControlConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.control_port)
+  val IOPubConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.iopub_port)
+  val StdinConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.stdin_port)
+
+  /**
+   * Creates a ZeroMQ reply socket representing the server endpoint for
+   * heartbeat messages
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   * @return The ActorRef created for the socket connection
+   */
+  def Heartbeat(system: ActorSystem, listener: ActorRef) : ActorRef =
+    system.actorOf(Props(classOf[RepSocketActor], HeartbeatConnection.toString, listener))
+//    ZeroMQExtension(system).newRepSocket(
+//      Array(Listener(listener), Bind(HeartbeatConnection.toString))
+//    )
+
+  /**
+   * Creates a ZeroMQ reply socket representing the server endpoint for shell
+   * messages
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   * @return The ActorRef created for the socket connection
+   */
+  def Shell(system: ActorSystem, listener: ActorRef) : ActorRef =
+    system.actorOf(Props(classOf[RouterSocketActor], ShellConnection.toString, listener))
+//    ZeroMQExtension(system).newRouterSocket(
+//      Array(Listener(listener), Bind(ShellConnection.toString))
+//    )
+
+  /**
+   * Creates a ZeroMQ reply socket representing the server endpoint for control
+   * messages
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   * @return The ActorRef created for the socket connection
+   */
+  def Control(system: ActorSystem, listener: ActorRef) : ActorRef =
+    system.actorOf(Props(classOf[RouterSocketActor], ControlConnection.toString, listener))
+
+  /**
+   * Creates a ZeroMQ reply socket representing the server endpoint for stdin
+   * messages
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   * @return The ActorRef created for the socket connection
+   */
+  def Stdin(system: ActorSystem, listener: ActorRef) : ActorRef =
+    system.actorOf(Props(classOf[RouterSocketActor], StdinConnection.toString, listener))
+//    ZeroMQExtension(system).newRouterSocket(
+//      Array(Listener(listener), Bind(StdinConnection.toString))
+//    )
+
+  /**
+   * Creates a ZeroMQ reply socket representing the server endpoint for IOPub
+   * messages
+   * @param system The actor system the socket actor will belong
+   * @return The ActorRef created for the socket connection
+   */
+  def IOPub(system: ActorSystem) : ActorRef =
+    system.actorOf(Props(classOf[PubSocketActor], IOPubConnection.toString))
+//    ZeroMQExtension(system).newPubSocket(
+//      Bind(IOPubConnection.toString)
+//    )
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
new file mode 100644
index 0000000..261151e
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.SystemActorType
+
+/**
+ * The server endpoint for stdin messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ * @param actorLoader The actor loader to use to load the relay for kernel
+ *                    messages
+ */
+class Stdin(socketFactory: SocketFactory, actorLoader: ActorLoader)
+  extends ZeromqKernelMessageSocket(
+    socketFactory.Stdin,
+    () => actorLoader.load(SystemActorType.KernelMessageRelay)
+  )
+{
+  logger.trace("Created new Stdin actor")
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
new file mode 100644
index 0000000..3d02f0b
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import java.nio.charset.Charset
+
+import akka.actor.{ActorSelection, ActorSystem, ActorRef, Actor}
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+
+//import com.ibm.spark.kernel.protocol.v5.kernel.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.kernel.protocol.v5.kernel.Utilities._
+import com.ibm.spark.utils.MessageLogSupport
+
+/**
+ * Represents a generic socket geared toward two-way communication using
+ * ZeroMQ and KernelMessage structures.
+ * @param actorSocketFunc The function used to retrieve the actor for outgoing
+ *                        communication via sockets
+ * @param actorForwardFunc The function used to retrieve the actor for incoming
+ *                         kernel messages
+ */
+abstract class ZeromqKernelMessageSocket(
+  actorSocketFunc: (ActorSystem, ActorRef) => ActorRef,
+  actorForwardFunc: () => ActorSelection
+) extends Actor with MessageLogSupport {
+  val actorSocketRef = actorSocketFunc(context.system, self)
+  val actorForwardRef = actorForwardFunc()
+
+  override def receive: Receive = {
+    case message: ZMQMessage =>
+      val kernelMessage: KernelMessage = message
+      logMessage(kernelMessage)
+
+      // Grab the strings to use for signature verification
+      val zmqStrings = message.frames.map((byteString: ByteString) =>
+        new String(byteString.toArray, Charset.forName("UTF-8"))
+      ).takeRight(4) // TODO: This assumes NO extra buffers, refactor?
+
+      // Forward along our message (along with the strings used for
+      // signatures)
+      actorForwardRef ! ((zmqStrings, kernelMessage))
+
+    case message: KernelMessage =>
+      val zmqMessage: ZMQMessage = message
+      logMessage(message)
+      actorSocketRef ! zmqMessage
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
new file mode 100644
index 0000000..a24c062
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
@@ -0,0 +1,145 @@
+package com.ibm.spark.kernel.protocol.v5.magic
+
+import com.ibm.spark.magic.MagicLoader
+
+class MagicParser(magicLoader: MagicLoader) {
+  private val magicRegex = """^[%]{1,2}(\w+)""".r
+  protected[magic] val kernelObjectName = "kernel.magics"
+
+  /**
+   * Determines whether a given line of code represents a line magic.
+   * @param codeLine a single line of code
+   * @return
+   */
+  private def isLineMagic(codeLine: String) = codeLine.startsWith("%") &&
+    !isCellMagic(codeLine)
+
+  /**
+   * Determines whether a given string of code represents a cell magic.
+   * @param codeBlob a string of code separated by newlines
+   * @return
+   */
+  private def isCellMagic(codeBlob: String) = codeBlob.startsWith("%%")
+
+  /**
+   * Finds the first occurrence of a "magic string" i.e. "%%magic" or "%magic"
+   * in a given code string, and separates the magic name from the code that
+   * follows it.
+   *
+   * E.g.
+   * "%magic foo bar" -> ("magic", "foo bar")
+   * @param codeBlob a string of code separated by newlines
+   * @return (magicName, args)
+   */
+  protected[magic] def parseMagic(codeBlob: String): Option[(String, String)] = {
+    val matchData =
+      magicRegex.findFirstMatchIn(codeBlob)
+
+    matchData match {
+      case Some(m) => Some((m.group(1), m.after(1).toString.trim))
+      case None => None
+    }
+  }
+
+  /**
+   * Given a line of code representing a magic invocation determines whether
+   * the magic has an implementation.
+   * @param codeLine a single line of code
+   * @return true if the magic exists and is a line magic
+   */
+  protected[magic] def isValidLineMagic(codeLine: String): Boolean = {
+    parseMagic(codeLine) match {
+      case Some((magicName, _)) =>
+        isLineMagic(codeLine) && magicLoader.hasLineMagic(magicName)
+      case None => false
+    }
+  }
+
+  /**
+   * Given a blob of code, finds any magic invocations of magics that don't
+   * exist.
+   * @param codeBlob a string of code separated by newlines
+   * @return invalid magic names from the given code blob
+   */
+  protected[magic] def parseOutInvalidMagics(codeBlob: String): List[String] = {
+    val lineMagics = codeBlob.split("\n").toList.filter(isLineMagic)
+    lineMagics.filterNot(isValidLineMagic).map(line => {
+      val (magicName, _) = parseMagic(line).get
+      magicName
+    })
+  }
+
+  /**
+   * Formats a given magic name and args to code for a kernel method call.
+   * @param magicName the name of the magic
+   * @param args the arguments to the magic
+   * @return equivalent kernel method call
+   */
+  protected[magic] def substitute(magicName: String, args: String): String =
+    s"""$kernelObjectName.$magicName(\"\"\"$args\"\"\")"""
+
+  /**
+   * Formats a given line of code representing a line magic invocation into an
+   * equivalent kernel object call if the magic invocation is valid.
+   * @param codeLine the line of code to convert.
+   * @return a substituted line of code if valid else the original line
+   */
+  protected[magic] def substituteLine(codeLine: String): String = {
+    isValidLineMagic(codeLine) match {
+      case true =>
+        val (magicName, args) = parseMagic(codeLine).get
+        substitute(magicName, args)
+      case false => codeLine
+    }
+  }
+
+  /**
+   * Formats a given code blob representing a cell magic invocation into an
+   * equivalent kernel object call if the cell magic invocation is valid. An
+   * error message is returned if not.
+   * @param codeBlob the blob of code representing a cell magic invocation
+   * @return Left(the substituted code) or Right(error message)
+   */
+  protected[magic] def parseCell(codeBlob: String): Either[String, String] = {
+    parseMagic(codeBlob.trim) match {
+      case Some((cellMagicName, args)) =>
+        magicLoader.hasCellMagic(cellMagicName) match {
+          case true => Left(substitute(cellMagicName, args))
+          case false => Right(s"Magic $cellMagicName does not exist!")
+        }
+      case None => Left(codeBlob)
+    }
+  }
+
+  /**
+   * Parses all lines in a given code blob and either substitutes equivalent
+   * kernel object calls for each line magic in the code blob OR returns
+   * an error message if any of the line magic invocations were invalid.
+   * @param codeBlob a string of code separated by newlines
+   * @return Left(code blob with substitutions) or Right(error message)
+   */
+  protected[magic] def parseLines(codeBlob: String): Either[String, String] = {
+    val invalidMagics = parseOutInvalidMagics(codeBlob.trim)
+    invalidMagics match {
+      case Nil =>
+        val substitutedCode = codeBlob.trim.split("\n").map(substituteLine)
+        Left(substitutedCode.mkString("\n"))
+      case _ =>
+        Right(s"Magics [${invalidMagics.mkString(", ")}] do not exist!")
+    }
+  }
+
+  /**
+   * Parses a given code blob and returns an equivalent blob with substitutions
+   * for magic invocations, if any, or an error string.
+   * @param codeBlob the blob of code to parse
+   * @return Left(parsed code) or Right(error message)
+   */
+  def parse(codeBlob: String): Either[String, String] = {
+    val trimCodeBlob = codeBlob.trim
+    isCellMagic(trimCodeBlob) match {
+      case true => parseCell(trimCodeBlob)
+      case false => parseLines(trimCodeBlob)
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
new file mode 100644
index 0000000..73c3c9f
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
@@ -0,0 +1,35 @@
+package com.ibm.spark.kernel.protocol.v5.magic
+
+import com.ibm.spark.interpreter.{ExecuteOutput, Interpreter}
+import com.ibm.spark.kernel.protocol.v5.{Data, MIMEType}
+import com.ibm.spark.magic.{CellMagicOutput, LineMagicOutput}
+import com.ibm.spark.utils.LogLike
+
+class PostProcessor(interpreter: Interpreter) extends LogLike {
+  val defaultErr = "Something went wrong in postprocessor!"
+
+  def process(codeOutput: ExecuteOutput): Data = {
+    interpreter.lastExecutionVariableName.flatMap(interpreter.read) match {
+      case Some(l: Left[_, _]) => matchCellMagic(codeOutput, l)
+      case Some(r: Right[_, _]) => matchLineMagic(codeOutput, r)
+      case _ => Data(MIMEType.PlainText -> codeOutput)
+    }
+  }
+
+  protected[magic] def matchCellMagic(code: String, l: Left[_,_]) =
+    l.left.getOrElse(None) match {
+      case cmo: CellMagicOutput => cmo
+      case _ => Data(MIMEType.PlainText -> code)
+    }
+
+  protected[magic] def matchLineMagic(code: String, r: Right[_,_]) =
+    r.right.getOrElse(None) match {
+      case lmo: LineMagicOutput => processLineMagic(code)
+      case _ => Data(MIMEType.PlainText -> code)
+    }
+
+  protected[magic] def processLineMagic(code: String): Data = {
+    val parts = code.split("\n")
+    Data(MIMEType.PlainText -> parts.take(parts.size - 1).mkString("\n"))
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
new file mode 100644
index 0000000..a1b846a
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.relay
+
+import java.io.OutputStream
+
+import akka.actor.Actor
+import akka.pattern._
+import akka.util.Timeout
+import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError, ExecuteFailure, ExecuteOutput}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.magic.{PostProcessor, MagicParser}
+import com.ibm.spark.magic.MagicLoader
+import com.ibm.spark.utils.LogLike
+
+import scala.concurrent.Future
+import scala.concurrent.duration._
+
+case class ExecuteRequestRelay(
+  actorLoader: ActorLoader,
+  magicLoader: MagicLoader,
+  magicParser: MagicParser,
+  postProcessor: PostProcessor
+)
+  extends Actor with LogLike
+{
+  import context._
+  implicit val timeout = Timeout(21474835.seconds)
+
+  /**
+   * Takes an ExecuteFailure and (ExecuteReply, ExecuteResult) with contents
+   * dictated by the type of failure (either an error or an abort).
+   * @param failure the failure
+   * @return (ExecuteReply, ExecuteResult)
+   */
+  private def failureMatch(failure: ExecuteFailure) =
+    failure match {
+      case err: ExecuteError =>
+        val error = ExecuteReplyError(
+          1, Some(err.name), Some(err.value), Some(err.stackTrace)
+        )
+        val result =
+          ExecuteResult(1, Data(MIMEType.PlainText -> err.toString), Metadata())
+        (error, result)
+
+      case _: ExecuteAborted =>
+        val abort = ExecuteReplyAbort(1)
+        val result = ExecuteResult(1, Data(), Metadata())
+        (abort, result)
+    }
+
+  /**
+   * Packages the response into an ExecuteReply,ExecuteResult tuple.
+   * @param future The future containing either the output or failure
+   * @return The tuple representing the proper response
+   */
+  private def packageFutureResponse(
+    future: Future[Either[ExecuteOutput, ExecuteFailure]]
+  ): Future[(ExecuteReply, ExecuteResult)] = future.map { value =>
+    if (value.isLeft) {
+      val output = value.left.get
+      val data = postProcessor.process(output)
+      (
+        ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
+        ExecuteResult(1, data, Metadata())
+      )
+    } else {
+      failureMatch(value.right.get)
+    }
+  }
+
+  override def receive: Receive = {
+    case (executeRequest: ExecuteRequest, parentMessage: KernelMessage,
+      outputStream: OutputStream) =>
+      val interpreterActor = actorLoader.load(SystemActorType.Interpreter)
+
+      // Store our old sender so we don't lose it in the callback
+      // NOTE: Should point back to our KernelMessageRelay
+      val oldSender = sender()
+
+      // Sets the outputStream for this particular ExecuteRequest
+      magicLoader.dependencyMap.setOutputStream(outputStream)
+
+      // Parse the code for magics before sending it to the interpreter and
+      // pipe the response to sender
+      (magicParser.parse(executeRequest.code) match {
+        case Left(code) =>
+          val parsedRequest =
+            (executeRequest.copy(code = code), parentMessage, outputStream)
+          val interpreterFuture = (interpreterActor ? parsedRequest)
+            .mapTo[Either[ExecuteOutput, ExecuteFailure]]
+          packageFutureResponse(interpreterFuture)
+
+        case Right(error) =>
+          val failure = ExecuteError("Error parsing magics!", error, Nil)
+          Future { failureMatch(failure) }
+      }) pipeTo oldSender
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
new file mode 100644
index 0000000..cc45479
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.relay
+
+import akka.pattern.ask
+import akka.util.Timeout
+import com.ibm.spark.communication.security.SecurityActorType
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
+import com.ibm.spark.kernel.protocol.v5.content.ShutdownRequest
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.{KernelMessage, MessageType, _}
+import com.ibm.spark.utils.MessageLogSupport
+import scala.collection.immutable.HashMap
+import scala.concurrent.duration._
+import scala.util.{Random, Failure, Success}
+
+/**
+ * This class is meant to be a relay for send KernelMessages through kernel
+ * system.
+ * @param actorLoader The ActorLoader used by this class for finding actors for
+ *                    relaying messages
+ * @param incomingSpecialCases The special cases for incoming messages
+ * @param outgoingSpecialCases The special cases for outgoing messages
+ * @param useSignatureManager Whether or not to use signature verification and
+ *                            generation
+ */
+case class KernelMessageRelay(
+  actorLoader: ActorLoader,
+  useSignatureManager: Boolean,
+  incomingSpecialCases: Map[String, String] = new HashMap[String, String](),
+  outgoingSpecialCases: Map[String, String] = new HashMap[String, String]()
+) extends OrderedSupport with MessageLogSupport  {
+  // NOTE: Required to provide the execution context for futures with akka
+  import context._
+
+  // NOTE: Required for ask (?) to function... maybe can define elsewhere?
+  implicit val timeout = Timeout(5.seconds)
+
+  // Flag indicating if can receive messages (or add them to buffer)
+  var isReady = false
+
+  def this(actorLoader: ActorLoader) =
+    this(actorLoader, true)
+
+  /**
+   * Relays a KernelMessage to a specific actor to handle that message.
+   *
+   * @param messageType The enumeration representing the message type
+   * @param kernelMessage The message to relay
+   */
+  private def relay(messageType: MessageType, kernelMessage: KernelMessage) = {
+    logger.debug("Relaying message type of " + messageType.toString)
+    logKernelMessageAction("Relaying", kernelMessage)
+    actorLoader.load(messageType) ! kernelMessage
+  }
+
+  private def incomingRelay(kernelMessage: KernelMessage) = {
+    var messageTypeString = kernelMessage.header.msg_type
+
+    // If this is a special case, transform the message type accordingly
+    if (incomingSpecialCases.contains(messageTypeString)) {
+      logger.debug(s"$messageTypeString is a special incoming case!")
+      messageTypeString = incomingSpecialCases(messageTypeString)
+    }
+
+    relay(MessageType.withName(messageTypeString), kernelMessage)
+  }
+
+  private def outgoingRelay(kernelMessage: KernelMessage) = {
+    var messageTypeString = kernelMessage.header.msg_type
+
+    // If this is a special case, transform the message type accordingly
+    if (outgoingSpecialCases.contains(messageTypeString)) {
+      logger.debug(s"$messageTypeString is a special outgoing case!")
+      messageTypeString = outgoingSpecialCases(messageTypeString)
+    }
+
+    relay(MessageType.withName(messageTypeString), kernelMessage)
+  }
+
+
+  /**
+   * This actor will receive and handle two types; ZMQMessage and KernelMessage.
+   * These messages will be forwarded to the actors that are responsible for them.
+   */
+  override def receive = {
+    // TODO: How to restore this when the actor dies?
+    // Update ready status
+    case ready: Boolean =>
+      isReady = ready
+      if (isReady) {
+        logger.info("Unstashing all messages received!")
+        unstashAll()
+        logger.info("Relay is now fully ready to receive messages!")
+      } else {
+        logger.info("Relay is now disabled!")
+      }
+
+
+    // Add incoming messages (when not ready) to buffer to be processed
+    case (zmqStrings: Seq[_], kernelMessage: KernelMessage) if !isReady && kernelMessage.header.msg_type != ShutdownRequest.toTypeString =>
+      logger.info("Not ready for messages! Stashing until ready!")
+      stash()
+
+    // Assuming these messages are incoming messages
+    case (zmqStrings: Seq[_], kernelMessage: KernelMessage) if isReady || kernelMessage.header.msg_type == ShutdownRequest.toTypeString =>
+      startProcessing()
+      if (useSignatureManager) {
+        logger.trace(s"Verifying signature for incoming message " +
+          s"${kernelMessage.header.msg_id}")
+        val signatureManager =
+          actorLoader.load(SecurityActorType.SignatureManager)
+        val signatureVerificationFuture = signatureManager ? (
+          (kernelMessage.signature, zmqStrings)
+        )
+
+        signatureVerificationFuture.mapTo[Boolean].onComplete {
+          case Success(true) =>
+            incomingRelay(kernelMessage)
+            finishedProcessing()
+          case Success(false) =>
+            // TODO: Figure out what the failure message structure should be!
+            logger.error(s"Invalid signature received from message " +
+              s"${kernelMessage.header.msg_id}!")
+            finishedProcessing()
+          case Failure(t) =>
+            logger.error("Failure when verifying signature!", t)
+            finishedProcessing()
+        }
+      } else {
+        logger.debug(s"Relaying incoming message " +
+          s"${kernelMessage.header.msg_id} without SignatureManager")
+        incomingRelay(kernelMessage)
+        finishedProcessing()
+      }
+
+    // Assuming all kernel messages without zmq strings are outgoing
+    case kernelMessage: KernelMessage =>
+      startProcessing()
+      if (useSignatureManager) {
+        logger.trace(s"Creating signature for outgoing message " +
+          s"${kernelMessage.header.msg_id}")
+        val signatureManager = actorLoader.load(SecurityActorType.SignatureManager)
+        val signatureInsertFuture = signatureManager ? kernelMessage
+
+        // TODO: Handle error case for mapTo and non-present onFailure
+        signatureInsertFuture.mapTo[KernelMessage] onSuccess {
+          case message =>
+            outgoingRelay(message)
+            finishedProcessing()
+        }
+      } else {
+        logger.debug(s"Relaying outgoing message " +
+          s"${kernelMessage.header.msg_id} without SignatureManager")
+        outgoingRelay(kernelMessage)
+        finishedProcessing()
+      }
+  }
+
+  override def orderedTypes(): Seq[Class[_]] = Seq(
+    classOf[(Seq[_], KernelMessage)],
+    classOf[KernelMessage]
+  )
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
new file mode 100644
index 0000000..e57fd84
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.stream
+
+import java.io.InputStream
+import java.nio.charset.Charset
+
+import akka.pattern.ask
+import com.ibm.spark.kernel.protocol.v5.content.InputRequest
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.kernel.Utilities.timeout
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, MessageType}
+
+import scala.collection.mutable.ListBuffer
+import scala.concurrent.{Await, Future}
+
+import KernelInputStream._
+
+object KernelInputStream {
+  val DefaultPrompt = ""
+  val DefaultPassword = false
+}
+
+/**
+ * Represents an OutputStream that sends data back to the clients connect to the
+ * kernel instance.
+ *
+ * @param actorLoader The actor loader used to access the message relay
+ * @param kmBuilder The KMBuilder used to construct outgoing kernel messages
+ * @param prompt The prompt to use for input requests
+ * @param password Whether or not the input request is for a password
+ */
+class KernelInputStream(
+  actorLoader: ActorLoader,
+  kmBuilder: KMBuilder,
+  prompt: String = DefaultPrompt,
+  password: Boolean = DefaultPassword
+) extends InputStream {
+  private val EncodingType = Charset.forName("UTF-8")
+  @volatile private var internalBytes: ListBuffer[Byte] = ListBuffer()
+
+  /**
+   * Returns the number of bytes available before the next request is made
+   * for more data.
+   * @return The total number of bytes in the internal buffer
+   */
+  override def available(): Int = internalBytes.length
+
+  /**
+   * Requests the next byte of data from the client. If the buffer containing
+   * @return The byte of data as an integer
+   */
+  override def read(): Int = {
+    if (!this.hasByte) this.requestBytes()
+
+    this.nextByte()
+  }
+
+  private def hasByte: Boolean = internalBytes.nonEmpty
+
+  private def nextByte(): Int = {
+    val byte = internalBytes.head
+
+    internalBytes = internalBytes.tail
+
+    byte
+  }
+
+  private def requestBytes(): Unit = {
+    val inputRequest = InputRequest(prompt, password)
+    // NOTE: Assuming already provided parent header and correct ids
+    val kernelMessage = kmBuilder
+      .withHeader(MessageType.Outgoing.InputRequest)
+      .withContentString(inputRequest)
+      .build
+
+    // NOTE: The same handler is being used in both request and reply
+    val responseFuture: Future[String] =
+      (actorLoader.load(MessageType.Incoming.InputReply) ? kernelMessage)
+      .mapTo[String]
+
+    // Block until we get a response
+    import scala.concurrent.duration._
+    internalBytes ++=
+      Await.result(responseFuture, Duration.Inf).getBytes(EncodingType)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
new file mode 100644
index 0000000..56b0cbb
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.stream
+
+import java.io.OutputStream
+import java.nio.charset.Charset
+
+import com.ibm.spark.kernel.protocol.v5.content.StreamContent
+import com.ibm.spark.kernel.protocol.v5.{SystemActorType, MessageType, KMBuilder}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.utils.{LogLike, ScheduledTaskManager}
+import scala.collection.mutable.ListBuffer
+import KernelOutputStream._
+
+object KernelOutputStream {
+  val DefaultStreamType = "stdout"
+  val DefaultSendEmptyOutput = false
+}
+
+/**
+ * Represents an OutputStream that sends data back to the clients connect to the
+ * kernel instance.
+ *
+ * @param actorLoader The actor loader used to access the message relay
+ * @param kmBuilder The KMBuilder used to construct outgoing kernel messages
+ * @param scheduledTaskManager The task manager used to schedule periodic
+ *                             flushes to send data across the wire
+ * @param streamType The type of stream (stdout/stderr)
+ * @param sendEmptyOutput If true, will allow empty output to be flushed and
+ *                        sent out to listening clients
+ */
+class KernelOutputStream(
+  private val actorLoader: ActorLoader,
+  private val kmBuilder: KMBuilder,
+  private val scheduledTaskManager: ScheduledTaskManager,
+  private val streamType: String = DefaultStreamType,
+  private val sendEmptyOutput: Boolean = DefaultSendEmptyOutput
+) extends OutputStream with LogLike {
+  private val EncodingType = Charset.forName("UTF-8")
+  @volatile private var internalBytes: ListBuffer[Byte] = ListBuffer()
+
+  private var taskId: String = _
+
+  private def enableAutoFlush() =
+    if (taskId == null) {
+      logger.trace("Enabling auto flush")
+      taskId = scheduledTaskManager.addTask(task = this.flush())
+    }
+
+  private def disableAutoFlush() =
+    if (taskId != null) {
+      logger.trace("Disabling auto flush")
+      scheduledTaskManager.removeTask(taskId)
+      taskId = null
+    }
+
+  /**
+   * Takes the current byte array contents in memory, packages them up into a
+   * KernelMessage, and sends the message to the KernelMessageRelay.
+   */
+  override def flush(): Unit = {
+    val contents = internalBytes.synchronized {
+      logger.trace("Getting content to flush")
+      val bytesToString = new String(internalBytes.toArray, EncodingType)
+
+      // Clear the internal buffer
+      internalBytes.clear()
+
+      // Stop the auto-flushing
+      disableAutoFlush()
+
+      bytesToString
+    }
+
+    // Avoid building and sending a kernel message if the contents (when
+    // trimmed) are empty and the flag to send anyway is disabled
+    if (!sendEmptyOutput && contents.trim.isEmpty) {
+      val contentsWithVisibleWhitespace = contents
+        .replace("\n", "\\n")
+        .replace("\t", "\\t")
+        .replace("\r", "\\r")
+        .replace(" ", "\\s")
+      logger.warn(s"Suppressing empty output: '$contentsWithVisibleWhitespace'")
+      return
+    }
+
+    logger.trace(s"Content to flush: '$contents'")
+
+    val streamContent = StreamContent(
+      streamType, contents
+    )
+
+    val kernelMessage = kmBuilder
+      .withIds(Seq(MessageType.Outgoing.Stream.toString))
+      .withHeader(MessageType.Outgoing.Stream)
+      .withContentString(streamContent).build
+
+    actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelMessage
+
+    // Ensure any underlying implementation is processed
+    super.flush()
+  }
+
+  /**
+   * Adds the specified byte to the end of the internal buffer. The most
+   * significant 24 bits are ignored. Only the least significant 8 bits
+   * are appended.
+   * @param b The byte whose least significant 8 bits are to be appended
+   */
+  override def write(b: Int): Unit = internalBytes.synchronized {
+    // Begin periodic flushing if this is a new set of bytes
+    enableAutoFlush()
+
+    internalBytes += b.toByte
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
new file mode 100644
index 0000000..5555c08
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.PrintStream
+
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.dependencies._
+import com.ibm.spark.utils.ArgumentParsingSupport
+
+class AddDeps extends LineMagic with IncludeInterpreter
+  with IncludeOutputStream with IncludeSparkContext with ArgumentParsingSupport
+  with IncludeDependencyDownloader with IncludeKernel
+{
+
+  private lazy val printStream = new PrintStream(outputStream)
+
+  val _transitive =
+    parser.accepts("transitive", "retrieve dependencies recursively")
+
+  /**
+   * Execute a magic representing a line magic.
+   * @param code The single line of code
+   * @return The output of the magic
+   */
+  override def execute(code: String): Unit = {
+    val nonOptionArgs = parseArgs(code)
+    dependencyDownloader.setPrintStream(printStream)
+
+    // TODO: require a version or use the most recent if omitted?
+    if (nonOptionArgs.size == 3) {
+      // get the jars and hold onto the paths at which they reside
+      val urls = dependencyDownloader.retrieve(
+        nonOptionArgs(0), nonOptionArgs(1), nonOptionArgs(2), _transitive)
+
+      // add the jars to the interpreter and spark context
+      interpreter.addJars(urls:_*)
+      urls.foreach(url => sparkContext.addJar(url.getPath))
+    } else {
+      printHelp(printStream, """%AddDeps my.company artifact-id version""")
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
new file mode 100644
index 0000000..bdfdbe2
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.{File, PrintStream}
+import java.net.URL
+import java.nio.file.{Files, Paths}
+
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.builtin.AddJar._
+import com.ibm.spark.magic.dependencies._
+import com.ibm.spark.utils.{ArgumentParsingSupport, DownloadSupport, LogLike}
+import com.typesafe.config.Config
+
+object AddJar {
+
+  private var jarDir:Option[String] = None
+  def getJarDir(config: Config): String = {
+    jarDir.getOrElse({
+      jarDir = Some(
+        if(config.hasPath("jar_dir") && Files.exists(Paths.get(config.getString("jar_dir")))) {
+          config.getString("jar_dir")
+        } else {
+          Files.createTempDirectory("spark_kernel_add_jars").toFile.getAbsolutePath
+        }
+      )
+      jarDir.get
+    })
+  }
+}
+
+class AddJar
+  extends LineMagic with IncludeInterpreter with IncludeSparkContext
+  with IncludeOutputStream with DownloadSupport with ArgumentParsingSupport
+  with IncludeKernel with IncludeMagicLoader with IncludeConfig with LogLike
+{
+  // Option to mark re-downloading of jars
+  private val _force =
+    parser.accepts("f", "forces re-download of specified jar")
+
+  // Option to mark re-downloading of jars
+  private val _magic =
+    parser.accepts("magic", "loads jar as a magic extension")
+
+  // Lazy because the outputStream is not provided at construction
+  private lazy val printStream = new PrintStream(outputStream)
+
+  /**
+   * Retrieves file name from URL.
+   *
+   * @param location The remote location (URL) 
+   * @return The name of the remote URL, or an empty string if one does not exist
+   */
+  def getFileFromLocation(location: String): String = {
+    val url = new URL(location)
+    val file = url.getFile.split("/")
+    if (file.length > 0) {
+        file.last
+    } else {
+        ""
+    }
+  }
+
+  /**
+   * Downloads and adds the specified jar to the
+   * interpreter/compiler/cluster classpaths.
+   *
+   * @param code The line containing the location of the jar
+   */
+  override def execute(code: String): Unit = {
+    val nonOptionArgs = parseArgs(code.trim)
+
+    // Check valid arguments
+    if (nonOptionArgs.length != 1) {
+      printHelp(printStream, """%AddJar <jar_url>""")
+      return
+    }
+
+    // Check if the jar we want to download is valid
+    val jarRemoteLocation = nonOptionArgs(0)
+    if (jarRemoteLocation.isEmpty) {
+      printHelp(printStream, """%AddJar <jar_url>""")
+      return
+    }
+
+    // Get the destination of the jar
+    val jarName = getFileFromLocation(jarRemoteLocation)
+
+    // Ensure the URL actually contains a jar or zip file
+    if (!jarName.endsWith(".jar") && !jarName.endsWith(".zip")) {
+        throw new IllegalArgumentException(s"The jar file $jarName must end in .jar or .zip.")
+    }
+
+    val downloadLocation = getJarDir(config) + "/" + jarName
+
+    logger.debug( "Downloading jar to %s".format(downloadLocation) )
+
+    val fileDownloadLocation = new File(downloadLocation)
+
+    // Check if exists in cache or force applied
+    if (_force || !fileDownloadLocation.exists()) {
+      // Report beginning of download
+      printStream.println(s"Starting download from $jarRemoteLocation")
+
+      downloadFile(
+        new URL(jarRemoteLocation),
+        new File(downloadLocation).toURI.toURL
+      )
+
+      // Report download finished
+      printStream.println(s"Finished download of $jarName")
+    } else {
+      printStream.println(s"Using cached version of $jarName")
+    }
+
+
+    if (_magic)
+    {
+
+      magicLoader.addJar(fileDownloadLocation.toURI.toURL)
+
+    }
+    else
+    {
+      interpreter.addJars(fileDownloadLocation.toURI.toURL)
+      sparkContext.addJar(fileDownloadLocation.getCanonicalPath)
+
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
new file mode 100644
index 0000000..aecc90f
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.google.common.reflect.ClassPath
+import com.google.common.reflect.ClassPath.ClassInfo
+import com.ibm.spark.magic.InternalClassLoader
+import com.google.common.base.Strings._
+import scala.collection.JavaConversions._
+
+/**
+ * Represents a class loader that loads classes from the builtin package.
+ */
+class BuiltinLoader
+  extends InternalClassLoader(classOf[BuiltinLoader].getClassLoader) {
+
+  private val pkgName = this.getClass.getPackage.getName
+
+  /**
+   * Provides a list of ClassInfo objects for each class in the specified
+   * package.
+   * @param pkg package name
+   * @return list of ClassInfo objects
+   */
+  def getClasses(pkg: String = pkgName): List[ClassInfo] = {
+    isNullOrEmpty(pkg) match {
+      case true =>
+        List()
+      case false =>
+        // TODO: Decide if this.getClass.getClassLoader should just be this
+        val classPath = ClassPath.from(this.getClass.getClassLoader)
+        classPath.getTopLevelClasses(pkg).filter(
+          _.getSimpleName != this.getClass.getSimpleName
+        ).toList
+    }
+  }
+
+  /**
+   * Provides a list of Class[_] objects for each class in the specified
+   * package.
+   * @param pkg package name
+   * @return list of Class[_] objects
+   */
+  def loadClasses(pkg: String = pkgName): List[Class[_]] =
+    getClasses(pkg).map(_.load())
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
new file mode 100644
index 0000000..95fa31a
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.PrintStream
+
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import com.ibm.spark.utils.ArgumentParsingSupport
+import com.google.common.base.Strings
+
+class Html extends CellMagic with ArgumentParsingSupport
+  with IncludeOutputStream {
+
+  // Lazy because the outputStream is not provided at construction
+  private lazy val printStream = new PrintStream(outputStream)
+
+  override def execute(code: String): CellMagicOutput = {
+    def printHelpAndReturn: CellMagicOutput = {
+      printHelp(printStream, """%%Html <string_code>""")
+      CellMagicOutput()
+    }
+
+    Strings.isNullOrEmpty(code) match {
+      case true => printHelpAndReturn
+      case false => CellMagicOutput(MIMEType.TextHtml -> code)
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
new file mode 100644
index 0000000..42772c1
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.PrintStream
+
+import com.google.common.base.Strings
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import com.ibm.spark.utils.ArgumentParsingSupport
+import org.slf4j.LoggerFactory
+
+class JavaScript extends CellMagic with ArgumentParsingSupport
+  with IncludeOutputStream {
+
+  // Lazy because the outputStream is not provided at construction
+  private lazy val printStream = new PrintStream(outputStream)
+
+  override def execute(code: String): CellMagicOutput = {
+    def printHelpAndReturn: CellMagicOutput = {
+      printHelp(printStream, """%JavaScript <string_code>""")
+      CellMagicOutput()
+    }
+
+    Strings.isNullOrEmpty(code) match {
+      case true => printHelpAndReturn
+      case false => CellMagicOutput(MIMEType.ApplicationJavaScript -> code)
+    }
+  }
+}



[45/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
index c86b7dd..c7e59c5 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
index e458d2e..a38bcf7 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
index 00b9b23..b035de4 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
index ed6e0e7..99e452d 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala b/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
index e9f41b2..73661ba 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
index d4cfd1b..6242735 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
index e280a70..28d1e7d 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
index d04ebac..aa1127a 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala b/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
index b0654df..d8751d3 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.utils
 
 import java.util.concurrent.atomic.AtomicInteger

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
index 17d3fbf..8ab4959 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
index cef5cd2..a48ed00 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
index 787c7fa..6564c46 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
index 073ae60..08d91cd 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
index 7c4dbcc..797504c 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala b/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
index 1507dcf..39e2c75 100644
--- a/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala b/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
index a65b9d9..8e03881 100644
--- a/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
@@ -1,18 +1,19 @@
 /*
-* Copyright 2014 IBM Corp.
-*
-* 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.
-*/
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.magic
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
index 67c4b35..7746ed8 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
index 83e08cf..701ed16 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
index be5eb29..3236d8d 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
index fe2eaf0..a20fb12 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
index 67590c6..5bd53dd 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
index e23e09e..a3e2153 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
index f23e188..563e06a 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
index 23b1fa3..3f97cbb 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/test/scala/test/utils/UncaughtExceptionSuppression.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/test/utils/UncaughtExceptionSuppression.scala b/kernel-api/src/test/scala/test/utils/UncaughtExceptionSuppression.scala
index 240f87c..4783b7e 100644
--- a/kernel-api/src/test/scala/test/utils/UncaughtExceptionSuppression.scala
+++ b/kernel-api/src/test/scala/test/utils/UncaughtExceptionSuppression.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 test.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/build.sbt
----------------------------------------------------------------------
diff --git a/kernel/build.sbt b/kernel/build.sbt
index 733283e..fa53ce6 100644
--- a/kernel/build.sbt
+++ b/kernel/build.sbt
@@ -1,19 +1,20 @@
-import Common._
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
+
 //
 // TEST DEPENDENCIES
 //

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/project/plugins.sbt
----------------------------------------------------------------------
diff --git a/kernel/project/plugins.sbt b/kernel/project/plugins.sbt
index 542f406..0f6d149 100644
--- a/kernel/project/plugins.sbt
+++ b/kernel/project/plugins.sbt
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
 
 logLevel := Level.Warn

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/Main.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/Main.scala b/kernel/src/main/scala/org/apache/toree/Main.scala
index 27e914d..ace7bd6 100644
--- a/kernel/src/main/scala/org/apache/toree/Main.scala
+++ b/kernel/src/main/scala/org/apache/toree/Main.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
index d85d0b7..68d2458 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.boot

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala b/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
index 5e97457..b391f20 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.boot

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
index f300659..429ac7c 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.boot.layer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
index 248cf56..f9b8d96 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.boot.layer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
index d86f826..05edb2a 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.boot.layer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
index beb0707..87a0e94 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.boot.layer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
index dbdadda..1b5ad72 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.boot.layer
 
 import org.apache.toree.kernel.api.KernelLike

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala b/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
index 333f4c1..1d9ca69 100644
--- a/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
+++ b/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala b/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
index 75e3a2a..d191929 100644
--- a/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
+++ b/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala b/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
index d770054..45ebeff 100644
--- a/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
+++ b/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.global

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala b/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
index b34a6da..ca0ddea 100644
--- a/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
+++ b/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.global

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala b/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
index bc530c9..8e34d59 100644
--- a/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
+++ b/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.global

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
index 8be5af0..c5536d2 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.api

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
index 1ee3147..af2474b 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.api

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
index 1b60f77..99ac5e4 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.api

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
index 0d1e6cd..76e326c 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.dispatch

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
index b0be249..8cd2c68 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
index 39c446d..f03309e 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler



[41/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
index 41b2d47..6d5cbf6 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
index e965b5c..d7e7e96 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
index e818926..acf4747 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
index cf6d43d..cf76584 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
index 304ad86..990ec4e 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
index 3eb2cd4..cc483d9 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala b/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
index edbfd8f..2b7562b 100644
--- a/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
+++ b/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
index 45acb4d..21c16b7 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
index 1bdbebf..28c91da 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
index dde8259..05e0c09 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
index 3adbd4f..2b90404 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
index b3f2b09..db32714 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
@@ -1,9 +1,11 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,8 +13,9 @@
  *  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.
+ *  limitations under the License
  */
+
 package org.apache.toree.comm
 
 import java.util.UUID

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
index 754ec2a..5513303 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
index 815dbe6..2903948 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
index 6abf28b..afdf5b1 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
index cce14e1..6eeb509 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
index f11f3f6..4d0ab4a 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
index 2b294a8..1beb0dc 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
index d1bec90..c74ec54 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
index 7710555..2fb4dab 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
index 8f50386..45fc5a0 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
index 5ec860d..57e94f2 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
index 47b8c14..f4c30d9 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
index 2ba3f5c..aa271d7 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
index c2c5568..2f341c4 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
index bda4267..309d5ac 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
index 030f7cd..278ef8a 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
index 6846836..58a383f 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
index 60d4d3e..9316c3d 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
index 97e6a10..f67ed9a 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
index 96ddbe0..22da3a1 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
index 242ff99..4009679 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
index 5500b69..b280e1e 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
index 8723fea..1f40abe 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
index d144574..56a9c7e 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
index 55fb801..6757dcc 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
index 3356905..a5770d8 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
index 0fe0dac..ac2a070 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
index c3d98fa..6325c3c 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
index 28f07d0..6ee2e53 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
index 435b34f..17e1ab2 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
index cb67fc1..6f6ca05 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
index 2d07042..6b247dc 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
index 66b0830..64af363 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content



[02/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/ReflectiveRBackend.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/ReflectiveRBackend.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/ReflectiveRBackend.scala
deleted file mode 100644
index 81cb86e..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/ReflectiveRBackend.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-/**
- * Provides reflective access into the backend R component that is not
- * publically accessible.
- */
-class ReflectiveRBackend {
-  private val rBackendClass = Class.forName("org.apache.spark.api.r.RBackend")
-  private val rBackendInstance = rBackendClass.newInstance()
-
-  /**
-   * Initializes the underlying RBackend service.
-   *
-   * @return The port used by the service
-   */
-  def init(): Int = {
-    val runMethod = rBackendClass.getDeclaredMethod("init")
-
-    runMethod.invoke(rBackendInstance).asInstanceOf[Int]
-  }
-
-  /** Blocks until the service has finished. */
-  def run(): Unit = {
-    val runMethod = rBackendClass.getDeclaredMethod("run")
-
-    runMethod.invoke(rBackendInstance)
-  }
-
-  /** Closes the underlying RBackend service. */
-  def close(): Unit = {
-    val runMethod = rBackendClass.getDeclaredMethod("close")
-
-    runMethod.invoke(rBackendInstance)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRBridge.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRBridge.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRBridge.scala
deleted file mode 100644
index 44fa203..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRBridge.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, JavaSparkContextProducerLike, SQLContextProducerLike}
-import com.ibm.spark.interpreter.broker.{BrokerState, BrokerBridge}
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.SparkContext
-
-/**
- * Represents constants for the SparkR bridge.
- */
-object SparkRBridge {
-  /** Represents the maximum amount of code that can be queued for Python. */
-  val MaxQueuedCode = 500
-
-  /** Contains the bridge used by the current R process. */
-  @volatile private var _sparkRBridge: Option[SparkRBridge] = None
-
-  /** Allows kernel to set bridge dynamically. */
-  private[sparkr] def sparkRBridge_=(newSparkRBridge: SparkRBridge): Unit = {
-    _sparkRBridge = Some(newSparkRBridge)
-  }
-
-  /** Clears the bridge currently hosted statically. */
-  private[sparkr] def reset(): Unit = _sparkRBridge = None
-
-  /** Must be exposed in a static location for RBackend to access. */
-  def sparkRBridge: SparkRBridge = {
-    assert(_sparkRBridge.nonEmpty, "SparkRBridge has not been initialized!")
-    _sparkRBridge.get
-  }
-
-  /**
-   * Creates a new SparkRBridge instance.
-   *
-   * @param brokerState The container of broker state to expose
-   * @param kernel The kernel API to expose through the bridge
-   *
-   * @return The new SparkR bridge
-   */
-  def apply(
-    brokerState: BrokerState,
-    kernel: KernelLike
-    ): SparkRBridge = {
-    new SparkRBridge(
-      _brokerState = brokerState,
-      _kernel = kernel
-    ) with StandardJavaSparkContextProducer with StandardSQLContextProducer
-  }
-}
-
-/**
- * Represents the API available to SparkR to act as the bridge for data
- * between the JVM and R.
- *
- * @param _brokerState The container of broker state to expose
- * @param _kernel The kernel API to expose through the bridge
- */
-class SparkRBridge private (
-  private val _brokerState: BrokerState,
-  private val _kernel: KernelLike
-) extends BrokerBridge(_brokerState, _kernel) {
-  override val brokerName: String = "SparkR"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRException.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRException.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRException.scala
deleted file mode 100644
index 0be8f61..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRException.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.BrokerException
-
-/**
- * Represents a generic SparkR exception.
- *
- * @param message The message to associate with the exception
- */
-class SparkRException(message: String) extends BrokerException(message)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRInterpreter.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRInterpreter.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRInterpreter.scala
deleted file mode 100644
index 45fe03c..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRInterpreter.scala
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import java.net.URL
-
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
-import org.slf4j.LoggerFactory
-
-import scala.concurrent.Await
-import scala.concurrent.duration._
-import scala.tools.nsc.interpreter.{InputStream, OutputStream}
-
-/**
- * Represents an interpreter interface to SparkR. Requires a properly-set
- * SPARK_HOME pointing to a binary distribution (needs packaged SparkR library)
- * and an implementation of R on the path.
- *
- */
-class SparkRInterpreter(
-) extends Interpreter {
-  private val logger = LoggerFactory.getLogger(this.getClass)
-  private var _kernel: KernelLike = _
-
-  // TODO: Replace hard-coded maximum queue count
-  /** Represents the state used by this interpreter's R instance. */
-  private lazy val sparkRState = new SparkRState(500)
-
-  /** Represents the bridge used by this interpreter's R instance. */
-  private lazy val sparkRBridge = SparkRBridge(
-    sparkRState,
-    _kernel
-  )
-
-  /** Represents the interface for R to talk to JVM Spark components. */
-  private lazy val rBackend = new ReflectiveRBackend
-
-  /** Represents the process handler used for the SparkR process. */
-  private lazy val sparkRProcessHandler: SparkRProcessHandler =
-    new SparkRProcessHandler(
-      sparkRBridge,
-      restartOnFailure = true,
-      restartOnCompletion = true
-    )
-
-  private lazy val sparkRService = new SparkRService(
-    rBackend,
-    sparkRBridge,
-    sparkRProcessHandler
-  )
-  private lazy val sparkRTransformer = new SparkRTransformer
-
-  override def init(kernel: KernelLike): Interpreter = {
-    _kernel = kernel
-    this
-  }
-
-  /**
-   * Executes the provided code with the option to silence output.
-   * @param code The code to execute
-   * @param silent Whether or not to execute the code silently (no output)
-   * @return The success/failure of the interpretation and the output from the
-   *         execution or the failure
-   */
-  override def interpret(code: String, silent: Boolean):
-    (Result, Either[ExecuteOutput, ExecuteFailure]) =
-  {
-    if (!sparkRService.isRunning) sparkRService.start()
-
-    val futureResult = sparkRTransformer.transformToInterpreterResult(
-      sparkRService.submitCode(code)
-    )
-
-    Await.result(futureResult, Duration.Inf)
-  }
-
-  /**
-   * Starts the interpreter, initializing any internal state.
-   * @return A reference to the interpreter
-   */
-  override def start(): Interpreter = {
-    sparkRService.start()
-
-    this
-  }
-
-  /**
-   * Stops the interpreter, removing any previous internal state.
-   * @return A reference to the interpreter
-   */
-  override def stop(): Interpreter = {
-    sparkRService.stop()
-
-    this
-  }
-
-  /**
-   * Returns the class loader used by this interpreter.
-   *
-   * @return The runtime class loader used by this interpreter
-   */
-  override def classLoader: ClassLoader = this.getClass.getClassLoader
-
-  // Unsupported (but can be invoked)
-  override def lastExecutionVariableName: Option[String] = None
-
-  // Unsupported (but can be invoked)
-  override def read(variableName: String): Option[AnyRef] = None
-
-  // Unsupported (but can be invoked)
-  override def completion(code: String, pos: Int): (Int, List[String]) =
-    (pos, Nil)
-
-  // Unsupported
-  override def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit = ???
-
-  // Unsupported
-  override def classServerURI: String = ""
-
-  // Unsupported (but can be invoked)
-  override def bindSparkContext(sparkContext: SparkContext): Unit = {}
-
-  // Unsupported (but can be invoked)
-  override def bindSqlContext(sqlContext: SQLContext): Unit = {}
-
-  // Unsupported
-  override def interrupt(): Interpreter = ???
-
-  // Unsupported
-  override def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit = ???
-
-  // Unsupported
-  override def addJars(jars: URL*): Unit = ???
-
-  // Unsupported
-  override def doQuietly[T](body: => T): T = ???
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcess.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcess.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcess.scala
deleted file mode 100644
index 2429dc4..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcess.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.BrokerProcess
-import scala.collection.JavaConverters._
-
-/**
- * Represents the R process used to evaluate SparkR code.
- *
- * @param sparkRBridge The bridge to use to retrieve kernel output streams
- *                      and the Spark version to be verified
- * @param sparkRProcessHandler The handler to use when the process fails or
- *                             completes
- * @param port The port to provide to the SparkR process to use to connect
- *             back to the JVM
- */
-class SparkRProcess(
-  private val sparkRBridge: SparkRBridge,
-  private val sparkRProcessHandler: SparkRProcessHandler,
-  private val port: Int
-) extends BrokerProcess(
-  processName = "Rscript",
-  entryResource = "kernelR/sparkr_runner.R",
-  otherResources = Seq("kernelR/sparkr_runner_utils.R", "sparkr_bundle.tar.gz"),
-  brokerBridge = sparkRBridge,
-  brokerProcessHandler = sparkRProcessHandler,
-  arguments = Seq(
-    "--default-packages=datasets,utils,grDevices,graphics,stats,methods"
-  )
-) {
-  override val brokerName: String = "SparkR"
-  private val sparkHome = Option(System.getenv("SPARK_HOME"))
-    .orElse(Option(System.getProperty("spark.home")))
-
-  assert(sparkHome.nonEmpty, "SparkR process requires Spark Home to be set!")
-
-  /**
-   * Creates a new process environment to be used for environment variable
-   * retrieval by the new process.
-   *
-   * @return The map of environment variables and their respective values
-   */
-  override protected def newProcessEnvironment(): Map[String, String] = {
-    val baseEnvironment = super.newProcessEnvironment()
-
-    // Note: Adding the new map values should override the old ones
-    baseEnvironment ++ Map(
-      "SPARK_HOME"                    -> sparkHome.get,
-      "EXISTING_SPARKR_BACKEND_PORT"  -> port.toString
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcessHandler.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcessHandler.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcessHandler.scala
deleted file mode 100644
index d33d265..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRProcessHandler.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.BrokerProcessHandler
-
-/**
- * Represents the handler for events triggered by the SparkR process.
- *
- * @param sparkRBridge The bridge to reset when the process fails or completes
- * @param restartOnFailure If true, restarts the process if it fails
- * @param restartOnCompletion If true, restarts the process if it completes
- */
-class SparkRProcessHandler(
-  private val sparkRBridge: SparkRBridge,
-  private val restartOnFailure: Boolean,
-  private val restartOnCompletion: Boolean
-) extends BrokerProcessHandler(
-  sparkRBridge,
-  restartOnFailure,
-  restartOnCompletion
-) {
-  override val brokerName: String = "SparkR"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRService.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRService.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRService.scala
deleted file mode 100644
index 71731a8..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRService.scala
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import java.util.concurrent.{TimeUnit, Semaphore}
-
-import com.ibm.spark.interpreter.broker.BrokerService
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.kernel.interpreter.sparkr.SparkRTypes.{Code, CodeResults}
-import org.apache.spark.SparkContext
-import org.slf4j.LoggerFactory
-
-import scala.concurrent.{future, Future}
-
-/**
- * Represents the service that provides the high-level interface between the
- * JVM and R.
- *
- * @param rBackend The backend to start to communicate between the JVM and R
- * @param sparkRBridge The bridge to use for communication between the JVM and R
- * @param sparkRProcessHandler The handler used for events that occur with the
- *                             SparkR process
- */
-class SparkRService(
-  private val rBackend: ReflectiveRBackend,
-  private val sparkRBridge: SparkRBridge,
-  private val sparkRProcessHandler: SparkRProcessHandler
-) extends BrokerService {
-  private val logger = LoggerFactory.getLogger(this.getClass)
-  @volatile private var rBackendPort: Int = -1
-  @volatile private var _isRunning: Boolean = false
-  override def isRunning: Boolean = _isRunning
-
-  /** Represents the process used to execute R code via the bridge. */
-  private lazy val sparkRProcess: SparkRProcess = {
-    val p = new SparkRProcess(
-      sparkRBridge,
-      sparkRProcessHandler,
-      rBackendPort
-    )
-
-    // Update handlers to correctly reset and restart the process
-    sparkRProcessHandler.setResetMethod(message => {
-      p.stop()
-      sparkRBridge.state.reset(message)
-    })
-    sparkRProcessHandler.setRestartMethod(() => p.start())
-
-    p
-  }
-
-  /** Starts the SparkR service. */
-  override def start(): Unit = {
-    logger.debug("Initializing statically-accessible SparkR bridge")
-    SparkRBridge.sparkRBridge = sparkRBridge
-
-    val initialized = new Semaphore(0)
-    import scala.concurrent.ExecutionContext.Implicits.global
-    val rBackendRun = future {
-      logger.debug("Initializing RBackend")
-      rBackendPort = rBackend.init()
-      logger.debug(s"RBackend running on port $rBackendPort")
-      initialized.release()
-      logger.debug("Running RBackend")
-      rBackend.run()
-      logger.debug("RBackend has finished")
-    }
-
-    // Wait for backend to start before starting R process to connect
-    val backendTimeout =
-      sys.env.getOrElse("SPARKR_BACKEND_TIMEOUT", "120").toInt
-    if (initialized.tryAcquire(backendTimeout, TimeUnit.SECONDS)) {
-      // Start the R process used to execute code
-      logger.debug("Launching process to execute R code")
-      sparkRProcess.start()
-      _isRunning = true
-    } else {
-      // Unable to initialize, so throw an exception
-      throw new SparkRException(
-        s"Unable to initialize R backend in $backendTimeout seconds!")
-    }
-  }
-
-  /**
-   * Submits code to the SparkR service to be executed and return a result.
-   *
-   * @param code The code to execute
-   *
-   * @return The result as a future to eventually return
-   */
-  override def submitCode(code: Code): Future[CodeResults] = {
-    sparkRBridge.state.pushCode(code)
-  }
-
-  /** Stops the running SparkR service. */
-  override def stop(): Unit = {
-    // Stop the R process used to execute code
-    sparkRProcess.stop()
-
-    // Stop the server used as an entrypoint for R
-    rBackend.close()
-
-    // Clear the bridge
-    SparkRBridge.reset()
-
-    _isRunning = false
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRState.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRState.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRState.scala
deleted file mode 100644
index 60f67a3..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRState.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.BrokerState
-
-/**
- * Represents the state structure of SparkR.
- *
- * @param maxQueuedCode The maximum amount of code to support being queued
- *                      at the same time for SparkR execution
- */
-class SparkRState(private val maxQueuedCode: Int)
-  extends BrokerState(maxQueuedCode)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTransformer.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTransformer.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTransformer.scala
deleted file mode 100644
index 45c44c0..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTransformer.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.BrokerTransformer
-
-/**
- * Represents the transformer used by SparkR.
- */
-class SparkRTransformer extends BrokerTransformer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTypes.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTypes.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTypes.scala
deleted file mode 100644
index 11f33c0..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/SparkRTypes.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sparkr
-
-import com.ibm.spark.interpreter.broker.BrokerTypesProvider
-
-/**
- * Represents all types associated with the SparkR interface.
- */
-object SparkRTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/package.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/package.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/package.scala
deleted file mode 100644
index 872d376..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sparkr/package.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter
-
-import com.ibm.spark.interpreter.broker.{BrokerCode, BrokerPromise}
-
-/**
- * Contains aliases to broker types.
- */
-package object sparkr {
-  /**
-   * Represents a promise made regarding the completion of SparkR code
-   * execution.
-   */
-  type SparkRPromise = BrokerPromise
-
-  /**
-   * Represents a block of SparkR code to be evaluated.
-   */
-  type SparkRCode = BrokerCode
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/com/ibm/spark/magic/builtin/SparkR.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/com/ibm/spark/magic/builtin/SparkR.scala b/sparkr-interpreter/src/main/scala/com/ibm/spark/magic/builtin/SparkR.scala
deleted file mode 100644
index 7eba136..0000000
--- a/sparkr-interpreter/src/main/scala/com/ibm/spark/magic/builtin/SparkR.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
-import com.ibm.spark.kernel.interpreter.sparkr.{SparkRInterpreter, SparkRException}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
-import com.ibm.spark.magic.dependencies.IncludeKernel
-
-/**
- * Represents the magic interface to use the SparkR interpreter.
- */
-class SparkR extends CellMagic with IncludeKernel {
-  override def execute(code: String): CellMagicOutput = {
-    val sparkR = kernel.interpreter("SparkR")
-
-    if (sparkR.isEmpty || sparkR.get == null)
-      throw new SparkRException("SparkR is not available!")
-
-    sparkR.get match {
-      case sparkRInterpreter: SparkRInterpreter =>
-        val (_, output) = sparkRInterpreter.interpret(code)
-        output match {
-          case Left(executeOutput) =>
-            CellMagicOutput(MIMEType.PlainText -> executeOutput)
-          case Right(executeFailure) => executeFailure match {
-            case executeAborted: ExecuteAborted =>
-              throw new SparkRException("SparkR code was aborted!")
-            case executeError: ExecuteError =>
-              throw new SparkRException(executeError.value)
-          }
-        }
-      case otherInterpreter =>
-        val className = otherInterpreter.getClass.getName
-        throw new SparkRException(s"Invalid SparkR interpreter: $className")
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
new file mode 100644
index 0000000..81cb86e
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+/**
+ * Provides reflective access into the backend R component that is not
+ * publically accessible.
+ */
+class ReflectiveRBackend {
+  private val rBackendClass = Class.forName("org.apache.spark.api.r.RBackend")
+  private val rBackendInstance = rBackendClass.newInstance()
+
+  /**
+   * Initializes the underlying RBackend service.
+   *
+   * @return The port used by the service
+   */
+  def init(): Int = {
+    val runMethod = rBackendClass.getDeclaredMethod("init")
+
+    runMethod.invoke(rBackendInstance).asInstanceOf[Int]
+  }
+
+  /** Blocks until the service has finished. */
+  def run(): Unit = {
+    val runMethod = rBackendClass.getDeclaredMethod("run")
+
+    runMethod.invoke(rBackendInstance)
+  }
+
+  /** Closes the underlying RBackend service. */
+  def close(): Unit = {
+    val runMethod = rBackendClass.getDeclaredMethod("close")
+
+    runMethod.invoke(rBackendInstance)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
new file mode 100644
index 0000000..44fa203
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, JavaSparkContextProducerLike, SQLContextProducerLike}
+import com.ibm.spark.interpreter.broker.{BrokerState, BrokerBridge}
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.SparkContext
+
+/**
+ * Represents constants for the SparkR bridge.
+ */
+object SparkRBridge {
+  /** Represents the maximum amount of code that can be queued for Python. */
+  val MaxQueuedCode = 500
+
+  /** Contains the bridge used by the current R process. */
+  @volatile private var _sparkRBridge: Option[SparkRBridge] = None
+
+  /** Allows kernel to set bridge dynamically. */
+  private[sparkr] def sparkRBridge_=(newSparkRBridge: SparkRBridge): Unit = {
+    _sparkRBridge = Some(newSparkRBridge)
+  }
+
+  /** Clears the bridge currently hosted statically. */
+  private[sparkr] def reset(): Unit = _sparkRBridge = None
+
+  /** Must be exposed in a static location for RBackend to access. */
+  def sparkRBridge: SparkRBridge = {
+    assert(_sparkRBridge.nonEmpty, "SparkRBridge has not been initialized!")
+    _sparkRBridge.get
+  }
+
+  /**
+   * Creates a new SparkRBridge instance.
+   *
+   * @param brokerState The container of broker state to expose
+   * @param kernel The kernel API to expose through the bridge
+   *
+   * @return The new SparkR bridge
+   */
+  def apply(
+    brokerState: BrokerState,
+    kernel: KernelLike
+    ): SparkRBridge = {
+    new SparkRBridge(
+      _brokerState = brokerState,
+      _kernel = kernel
+    ) with StandardJavaSparkContextProducer with StandardSQLContextProducer
+  }
+}
+
+/**
+ * Represents the API available to SparkR to act as the bridge for data
+ * between the JVM and R.
+ *
+ * @param _brokerState The container of broker state to expose
+ * @param _kernel The kernel API to expose through the bridge
+ */
+class SparkRBridge private (
+  private val _brokerState: BrokerState,
+  private val _kernel: KernelLike
+) extends BrokerBridge(_brokerState, _kernel) {
+  override val brokerName: String = "SparkR"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
new file mode 100644
index 0000000..0be8f61
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.BrokerException
+
+/**
+ * Represents a generic SparkR exception.
+ *
+ * @param message The message to associate with the exception
+ */
+class SparkRException(message: String) extends BrokerException(message)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
new file mode 100644
index 0000000..45fe03c
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import java.net.URL
+
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.interpreter._
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+import org.slf4j.LoggerFactory
+
+import scala.concurrent.Await
+import scala.concurrent.duration._
+import scala.tools.nsc.interpreter.{InputStream, OutputStream}
+
+/**
+ * Represents an interpreter interface to SparkR. Requires a properly-set
+ * SPARK_HOME pointing to a binary distribution (needs packaged SparkR library)
+ * and an implementation of R on the path.
+ *
+ */
+class SparkRInterpreter(
+) extends Interpreter {
+  private val logger = LoggerFactory.getLogger(this.getClass)
+  private var _kernel: KernelLike = _
+
+  // TODO: Replace hard-coded maximum queue count
+  /** Represents the state used by this interpreter's R instance. */
+  private lazy val sparkRState = new SparkRState(500)
+
+  /** Represents the bridge used by this interpreter's R instance. */
+  private lazy val sparkRBridge = SparkRBridge(
+    sparkRState,
+    _kernel
+  )
+
+  /** Represents the interface for R to talk to JVM Spark components. */
+  private lazy val rBackend = new ReflectiveRBackend
+
+  /** Represents the process handler used for the SparkR process. */
+  private lazy val sparkRProcessHandler: SparkRProcessHandler =
+    new SparkRProcessHandler(
+      sparkRBridge,
+      restartOnFailure = true,
+      restartOnCompletion = true
+    )
+
+  private lazy val sparkRService = new SparkRService(
+    rBackend,
+    sparkRBridge,
+    sparkRProcessHandler
+  )
+  private lazy val sparkRTransformer = new SparkRTransformer
+
+  override def init(kernel: KernelLike): Interpreter = {
+    _kernel = kernel
+    this
+  }
+
+  /**
+   * Executes the provided code with the option to silence output.
+   * @param code The code to execute
+   * @param silent Whether or not to execute the code silently (no output)
+   * @return The success/failure of the interpretation and the output from the
+   *         execution or the failure
+   */
+  override def interpret(code: String, silent: Boolean):
+    (Result, Either[ExecuteOutput, ExecuteFailure]) =
+  {
+    if (!sparkRService.isRunning) sparkRService.start()
+
+    val futureResult = sparkRTransformer.transformToInterpreterResult(
+      sparkRService.submitCode(code)
+    )
+
+    Await.result(futureResult, Duration.Inf)
+  }
+
+  /**
+   * Starts the interpreter, initializing any internal state.
+   * @return A reference to the interpreter
+   */
+  override def start(): Interpreter = {
+    sparkRService.start()
+
+    this
+  }
+
+  /**
+   * Stops the interpreter, removing any previous internal state.
+   * @return A reference to the interpreter
+   */
+  override def stop(): Interpreter = {
+    sparkRService.stop()
+
+    this
+  }
+
+  /**
+   * Returns the class loader used by this interpreter.
+   *
+   * @return The runtime class loader used by this interpreter
+   */
+  override def classLoader: ClassLoader = this.getClass.getClassLoader
+
+  // Unsupported (but can be invoked)
+  override def lastExecutionVariableName: Option[String] = None
+
+  // Unsupported (but can be invoked)
+  override def read(variableName: String): Option[AnyRef] = None
+
+  // Unsupported (but can be invoked)
+  override def completion(code: String, pos: Int): (Int, List[String]) =
+    (pos, Nil)
+
+  // Unsupported
+  override def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit = ???
+
+  // Unsupported
+  override def classServerURI: String = ""
+
+  // Unsupported (but can be invoked)
+  override def bindSparkContext(sparkContext: SparkContext): Unit = {}
+
+  // Unsupported (but can be invoked)
+  override def bindSqlContext(sqlContext: SQLContext): Unit = {}
+
+  // Unsupported
+  override def interrupt(): Interpreter = ???
+
+  // Unsupported
+  override def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit = ???
+
+  // Unsupported
+  override def addJars(jars: URL*): Unit = ???
+
+  // Unsupported
+  override def doQuietly[T](body: => T): T = ???
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
new file mode 100644
index 0000000..2429dc4
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.BrokerProcess
+import scala.collection.JavaConverters._
+
+/**
+ * Represents the R process used to evaluate SparkR code.
+ *
+ * @param sparkRBridge The bridge to use to retrieve kernel output streams
+ *                      and the Spark version to be verified
+ * @param sparkRProcessHandler The handler to use when the process fails or
+ *                             completes
+ * @param port The port to provide to the SparkR process to use to connect
+ *             back to the JVM
+ */
+class SparkRProcess(
+  private val sparkRBridge: SparkRBridge,
+  private val sparkRProcessHandler: SparkRProcessHandler,
+  private val port: Int
+) extends BrokerProcess(
+  processName = "Rscript",
+  entryResource = "kernelR/sparkr_runner.R",
+  otherResources = Seq("kernelR/sparkr_runner_utils.R", "sparkr_bundle.tar.gz"),
+  brokerBridge = sparkRBridge,
+  brokerProcessHandler = sparkRProcessHandler,
+  arguments = Seq(
+    "--default-packages=datasets,utils,grDevices,graphics,stats,methods"
+  )
+) {
+  override val brokerName: String = "SparkR"
+  private val sparkHome = Option(System.getenv("SPARK_HOME"))
+    .orElse(Option(System.getProperty("spark.home")))
+
+  assert(sparkHome.nonEmpty, "SparkR process requires Spark Home to be set!")
+
+  /**
+   * Creates a new process environment to be used for environment variable
+   * retrieval by the new process.
+   *
+   * @return The map of environment variables and their respective values
+   */
+  override protected def newProcessEnvironment(): Map[String, String] = {
+    val baseEnvironment = super.newProcessEnvironment()
+
+    // Note: Adding the new map values should override the old ones
+    baseEnvironment ++ Map(
+      "SPARK_HOME"                    -> sparkHome.get,
+      "EXISTING_SPARKR_BACKEND_PORT"  -> port.toString
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
new file mode 100644
index 0000000..d33d265
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.BrokerProcessHandler
+
+/**
+ * Represents the handler for events triggered by the SparkR process.
+ *
+ * @param sparkRBridge The bridge to reset when the process fails or completes
+ * @param restartOnFailure If true, restarts the process if it fails
+ * @param restartOnCompletion If true, restarts the process if it completes
+ */
+class SparkRProcessHandler(
+  private val sparkRBridge: SparkRBridge,
+  private val restartOnFailure: Boolean,
+  private val restartOnCompletion: Boolean
+) extends BrokerProcessHandler(
+  sparkRBridge,
+  restartOnFailure,
+  restartOnCompletion
+) {
+  override val brokerName: String = "SparkR"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
new file mode 100644
index 0000000..71731a8
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import java.util.concurrent.{TimeUnit, Semaphore}
+
+import com.ibm.spark.interpreter.broker.BrokerService
+import com.ibm.spark.kernel.api.KernelLike
+import com.ibm.spark.kernel.interpreter.sparkr.SparkRTypes.{Code, CodeResults}
+import org.apache.spark.SparkContext
+import org.slf4j.LoggerFactory
+
+import scala.concurrent.{future, Future}
+
+/**
+ * Represents the service that provides the high-level interface between the
+ * JVM and R.
+ *
+ * @param rBackend The backend to start to communicate between the JVM and R
+ * @param sparkRBridge The bridge to use for communication between the JVM and R
+ * @param sparkRProcessHandler The handler used for events that occur with the
+ *                             SparkR process
+ */
+class SparkRService(
+  private val rBackend: ReflectiveRBackend,
+  private val sparkRBridge: SparkRBridge,
+  private val sparkRProcessHandler: SparkRProcessHandler
+) extends BrokerService {
+  private val logger = LoggerFactory.getLogger(this.getClass)
+  @volatile private var rBackendPort: Int = -1
+  @volatile private var _isRunning: Boolean = false
+  override def isRunning: Boolean = _isRunning
+
+  /** Represents the process used to execute R code via the bridge. */
+  private lazy val sparkRProcess: SparkRProcess = {
+    val p = new SparkRProcess(
+      sparkRBridge,
+      sparkRProcessHandler,
+      rBackendPort
+    )
+
+    // Update handlers to correctly reset and restart the process
+    sparkRProcessHandler.setResetMethod(message => {
+      p.stop()
+      sparkRBridge.state.reset(message)
+    })
+    sparkRProcessHandler.setRestartMethod(() => p.start())
+
+    p
+  }
+
+  /** Starts the SparkR service. */
+  override def start(): Unit = {
+    logger.debug("Initializing statically-accessible SparkR bridge")
+    SparkRBridge.sparkRBridge = sparkRBridge
+
+    val initialized = new Semaphore(0)
+    import scala.concurrent.ExecutionContext.Implicits.global
+    val rBackendRun = future {
+      logger.debug("Initializing RBackend")
+      rBackendPort = rBackend.init()
+      logger.debug(s"RBackend running on port $rBackendPort")
+      initialized.release()
+      logger.debug("Running RBackend")
+      rBackend.run()
+      logger.debug("RBackend has finished")
+    }
+
+    // Wait for backend to start before starting R process to connect
+    val backendTimeout =
+      sys.env.getOrElse("SPARKR_BACKEND_TIMEOUT", "120").toInt
+    if (initialized.tryAcquire(backendTimeout, TimeUnit.SECONDS)) {
+      // Start the R process used to execute code
+      logger.debug("Launching process to execute R code")
+      sparkRProcess.start()
+      _isRunning = true
+    } else {
+      // Unable to initialize, so throw an exception
+      throw new SparkRException(
+        s"Unable to initialize R backend in $backendTimeout seconds!")
+    }
+  }
+
+  /**
+   * Submits code to the SparkR service to be executed and return a result.
+   *
+   * @param code The code to execute
+   *
+   * @return The result as a future to eventually return
+   */
+  override def submitCode(code: Code): Future[CodeResults] = {
+    sparkRBridge.state.pushCode(code)
+  }
+
+  /** Stops the running SparkR service. */
+  override def stop(): Unit = {
+    // Stop the R process used to execute code
+    sparkRProcess.stop()
+
+    // Stop the server used as an entrypoint for R
+    rBackend.close()
+
+    // Clear the bridge
+    SparkRBridge.reset()
+
+    _isRunning = false
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
new file mode 100644
index 0000000..60f67a3
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.BrokerState
+
+/**
+ * Represents the state structure of SparkR.
+ *
+ * @param maxQueuedCode The maximum amount of code to support being queued
+ *                      at the same time for SparkR execution
+ */
+class SparkRState(private val maxQueuedCode: Int)
+  extends BrokerState(maxQueuedCode)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
new file mode 100644
index 0000000..45c44c0
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.BrokerTransformer
+
+/**
+ * Represents the transformer used by SparkR.
+ */
+class SparkRTransformer extends BrokerTransformer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
new file mode 100644
index 0000000..11f33c0
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sparkr
+
+import com.ibm.spark.interpreter.broker.BrokerTypesProvider
+
+/**
+ * Represents all types associated with the SparkR interface.
+ */
+object SparkRTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
new file mode 100644
index 0000000..872d376
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter
+
+import com.ibm.spark.interpreter.broker.{BrokerCode, BrokerPromise}
+
+/**
+ * Contains aliases to broker types.
+ */
+package object sparkr {
+  /**
+   * Represents a promise made regarding the completion of SparkR code
+   * execution.
+   */
+  type SparkRPromise = BrokerPromise
+
+  /**
+   * Represents a block of SparkR code to be evaluated.
+   */
+  type SparkRCode = BrokerCode
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
new file mode 100644
index 0000000..7eba136
--- /dev/null
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
+import com.ibm.spark.kernel.interpreter.sparkr.{SparkRInterpreter, SparkRException}
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
+import com.ibm.spark.magic.dependencies.IncludeKernel
+
+/**
+ * Represents the magic interface to use the SparkR interpreter.
+ */
+class SparkR extends CellMagic with IncludeKernel {
+  override def execute(code: String): CellMagicOutput = {
+    val sparkR = kernel.interpreter("SparkR")
+
+    if (sparkR.isEmpty || sparkR.get == null)
+      throw new SparkRException("SparkR is not available!")
+
+    sparkR.get match {
+      case sparkRInterpreter: SparkRInterpreter =>
+        val (_, output) = sparkRInterpreter.interpret(code)
+        output match {
+          case Left(executeOutput) =>
+            CellMagicOutput(MIMEType.PlainText -> executeOutput)
+          case Right(executeFailure) => executeFailure match {
+            case executeAborted: ExecuteAborted =>
+              throw new SparkRException("SparkR code was aborted!")
+            case executeError: ExecuteError =>
+              throw new SparkRException(executeError.value)
+          }
+        }
+      case otherInterpreter =>
+        val className = otherInterpreter.getClass.getName
+        throw new SparkRException(s"Invalid SparkR interpreter: $className")
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlException.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlException.scala b/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlException.scala
deleted file mode 100644
index 2c0b4d5..0000000
--- a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlException.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sql
-
-import com.ibm.spark.interpreter.broker.BrokerException
-
-/**
- * Represents a generic SQL exception.
- *
- * @param message The message to associate with the exception
- */
-class SqlException(message: String) extends BrokerException(message)
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlInterpreter.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlInterpreter.scala b/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlInterpreter.scala
deleted file mode 100644
index 889d4a6..0000000
--- a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlInterpreter.scala
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sql
-
-import java.net.URL
-
-import com.ibm.spark.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter}
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
-
-import scala.concurrent.duration._
-import scala.concurrent.Await
-import scala.tools.nsc.interpreter.{OutputStream, InputStream}
-
-/**
- * Represents an interpreter interface to Spark SQL.
- */
-class SqlInterpreter() extends Interpreter {
-  private var _kernel: KernelLike = _
-  private lazy val sqlService = new SqlService(_kernel)
-  private lazy val sqlTransformer = new SqlTransformer
-
-  override def init(kernel: KernelLike): Interpreter = {
-    _kernel = kernel
-    this
-  }
-
-  /**
-   * Executes the provided code with the option to silence output.
-   * @param code The code to execute
-   * @param silent Whether or not to execute the code silently (no output)
-   * @return The success/failure of the interpretation and the output from the
-   *         execution or the failure
-   */
-  override def interpret(code: String, silent: Boolean):
-    (Result, Either[ExecuteOutput, ExecuteFailure]) =
-  {
-    if (!sqlService.isRunning) sqlService.start()
-
-    val futureResult = sqlTransformer.transformToInterpreterResult(
-      sqlService.submitCode(code)
-    )
-
-    Await.result(futureResult, Duration.Inf)
-  }
-
-  /**
-   * Starts the interpreter, initializing any internal state.
-   * @return A reference to the interpreter
-   */
-  override def start(): Interpreter = {
-    sqlService.start()
-
-    this
-  }
-
-  /**
-   * Stops the interpreter, removing any previous internal state.
-   * @return A reference to the interpreter
-   */
-  override def stop(): Interpreter = {
-    sqlService.stop()
-
-    this
-  }
-
-  /**
-   * Returns the class loader used by this interpreter.
-   *
-   * @return The runtime class loader used by this interpreter
-   */
-  override def classLoader: ClassLoader = this.getClass.getClassLoader
-
-  // Unsupported (but can be invoked)
-  override def lastExecutionVariableName: Option[String] = None
-
-  // Unsupported (but can be invoked)
-  override def read(variableName: String): Option[AnyRef] = None
-
-  // Unsupported (but can be invoked)
-  override def completion(code: String, pos: Int): (Int, List[String]) =
-    (pos, Nil)
-
-  // Unsupported
-  override def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit = ???
-
-  // Unsupported
-  override def classServerURI: String = ""
-
-  // Unsupported (but can be invoked)
-  override def bindSparkContext(sparkContext: SparkContext): Unit = {}
-
-  // Unsupported (but can be invoked)
-  override def bindSqlContext(sqlContext: SQLContext): Unit = {}
-
-  // Unsupported
-  override def interrupt(): Interpreter = ???
-
-  // Unsupported
-  override def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit = ???
-
-  // Unsupported
-  override def addJars(jars: URL*): Unit = ???
-
-  // Unsupported
-  override def doQuietly[T](body: => T): T = ???
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlService.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlService.scala b/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlService.scala
deleted file mode 100644
index 2f2fed6..0000000
--- a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlService.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sql
-
-import com.ibm.spark.kernel.api.KernelLike
-import java.io.ByteArrayOutputStream
-
-import com.ibm.spark.interpreter.broker.BrokerService
-import com.ibm.spark.kernel.interpreter.sql.SqlTypes._
-import org.apache.spark.sql.SQLContext
-
-import scala.concurrent.{Future, future}
-
-/**
- * Represents the service that provides the high-level interface between the
- * JVM and Spark SQL.
- *
- * @param kernel The SQL Context of Apache Spark to use to perform SQL
- *                   queries
- */
-class SqlService(private val kernel: KernelLike) extends BrokerService {
-  import scala.concurrent.ExecutionContext.Implicits.global
-
-  @volatile private var _isRunning: Boolean = false
-  override def isRunning: Boolean = _isRunning
-
-  /**
-   * Submits code to the broker service to be executed and return a result.
-   *
-   * @param code The code to execute
-   *
-   * @return The result as a future to eventually return
-   */
-  override def submitCode(code: Code): Future[CodeResults] = future {
-    println(s"Executing: '${code.trim}'")
-    val result = kernel.sqlContext.sql(code.trim)
-
-    // TODO: There is an internal method used for show called showString that
-    //       supposedly is only for the Python API, look into why
-    val stringOutput = {
-      val outputStream = new ByteArrayOutputStream()
-      Console.withOut(outputStream) {
-        // TODO: Provide some way to change the number of records shown
-        result.show(10)
-      }
-      outputStream.toString("UTF-8")
-    }
-
-    stringOutput
-  }
-
-  /** Stops the running broker service. */
-  override def stop(): Unit = _isRunning = false
-
-  /** Starts the broker service. */
-  override def start(): Unit = _isRunning = true
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTransformer.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTransformer.scala b/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTransformer.scala
deleted file mode 100644
index 114c97f..0000000
--- a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTransformer.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sql
-
-import com.ibm.spark.interpreter.broker.BrokerTransformer
-
-/**
- * Represents the transformer used by Apache SQL.
- */
-class SqlTransformer extends BrokerTransformer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTypes.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTypes.scala b/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTypes.scala
deleted file mode 100644
index a2fbd10..0000000
--- a/sql-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/sql/SqlTypes.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.sql
-
-import com.ibm.spark.interpreter.broker.BrokerTypesProvider
-
-/**
- * Represents all types associated with the SQL interface.
- */
-object SqlTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Sql.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Sql.scala b/sql-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Sql.scala
deleted file mode 100644
index a8f439c..0000000
--- a/sql-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Sql.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
-import com.ibm.spark.kernel.interpreter.sql.{SqlInterpreter, SqlException}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
-import com.ibm.spark.magic.dependencies.IncludeKernel
-
-/**
- * Represents the magic interface to use the SQL interpreter.
- */
-class Sql extends CellMagic with IncludeKernel {
-  override def execute(code: String): CellMagicOutput = {
-    val sparkR = kernel.interpreter("SQL")
-
-    if (sparkR.isEmpty || sparkR.get == null)
-      throw new SqlException("SQL is not available!")
-
-    sparkR.get match {
-      case sparkRInterpreter: SqlInterpreter =>
-        val (_, output) = sparkRInterpreter.interpret(code)
-        output match {
-          case Left(executeOutput) =>
-            CellMagicOutput(MIMEType.PlainText -> executeOutput)
-          case Right(executeFailure) => executeFailure match {
-            case executeAborted: ExecuteAborted =>
-              throw new SqlException("SQL code was aborted!")
-            case executeError: ExecuteError =>
-              throw new SqlException(executeError.value)
-          }
-        }
-      case otherInterpreter =>
-        val className = otherInterpreter.getClass.getName
-        throw new SqlException(s"Invalid SQL interpreter: $className")
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
new file mode 100644
index 0000000..2c0b4d5
--- /dev/null
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sql
+
+import com.ibm.spark.interpreter.broker.BrokerException
+
+/**
+ * Represents a generic SQL exception.
+ *
+ * @param message The message to associate with the exception
+ */
+class SqlException(message: String) extends BrokerException(message)
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
new file mode 100644
index 0000000..889d4a6
--- /dev/null
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sql
+
+import java.net.URL
+
+import com.ibm.spark.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter}
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+
+import scala.concurrent.duration._
+import scala.concurrent.Await
+import scala.tools.nsc.interpreter.{OutputStream, InputStream}
+
+/**
+ * Represents an interpreter interface to Spark SQL.
+ */
+class SqlInterpreter() extends Interpreter {
+  private var _kernel: KernelLike = _
+  private lazy val sqlService = new SqlService(_kernel)
+  private lazy val sqlTransformer = new SqlTransformer
+
+  override def init(kernel: KernelLike): Interpreter = {
+    _kernel = kernel
+    this
+  }
+
+  /**
+   * Executes the provided code with the option to silence output.
+   * @param code The code to execute
+   * @param silent Whether or not to execute the code silently (no output)
+   * @return The success/failure of the interpretation and the output from the
+   *         execution or the failure
+   */
+  override def interpret(code: String, silent: Boolean):
+    (Result, Either[ExecuteOutput, ExecuteFailure]) =
+  {
+    if (!sqlService.isRunning) sqlService.start()
+
+    val futureResult = sqlTransformer.transformToInterpreterResult(
+      sqlService.submitCode(code)
+    )
+
+    Await.result(futureResult, Duration.Inf)
+  }
+
+  /**
+   * Starts the interpreter, initializing any internal state.
+   * @return A reference to the interpreter
+   */
+  override def start(): Interpreter = {
+    sqlService.start()
+
+    this
+  }
+
+  /**
+   * Stops the interpreter, removing any previous internal state.
+   * @return A reference to the interpreter
+   */
+  override def stop(): Interpreter = {
+    sqlService.stop()
+
+    this
+  }
+
+  /**
+   * Returns the class loader used by this interpreter.
+   *
+   * @return The runtime class loader used by this interpreter
+   */
+  override def classLoader: ClassLoader = this.getClass.getClassLoader
+
+  // Unsupported (but can be invoked)
+  override def lastExecutionVariableName: Option[String] = None
+
+  // Unsupported (but can be invoked)
+  override def read(variableName: String): Option[AnyRef] = None
+
+  // Unsupported (but can be invoked)
+  override def completion(code: String, pos: Int): (Int, List[String]) =
+    (pos, Nil)
+
+  // Unsupported
+  override def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit = ???
+
+  // Unsupported
+  override def classServerURI: String = ""
+
+  // Unsupported (but can be invoked)
+  override def bindSparkContext(sparkContext: SparkContext): Unit = {}
+
+  // Unsupported (but can be invoked)
+  override def bindSqlContext(sqlContext: SQLContext): Unit = {}
+
+  // Unsupported
+  override def interrupt(): Interpreter = ???
+
+  // Unsupported
+  override def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit = ???
+
+  // Unsupported
+  override def addJars(jars: URL*): Unit = ???
+
+  // Unsupported
+  override def doQuietly[T](body: => T): T = ???
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
new file mode 100644
index 0000000..2f2fed6
--- /dev/null
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sql
+
+import com.ibm.spark.kernel.api.KernelLike
+import java.io.ByteArrayOutputStream
+
+import com.ibm.spark.interpreter.broker.BrokerService
+import com.ibm.spark.kernel.interpreter.sql.SqlTypes._
+import org.apache.spark.sql.SQLContext
+
+import scala.concurrent.{Future, future}
+
+/**
+ * Represents the service that provides the high-level interface between the
+ * JVM and Spark SQL.
+ *
+ * @param kernel The SQL Context of Apache Spark to use to perform SQL
+ *                   queries
+ */
+class SqlService(private val kernel: KernelLike) extends BrokerService {
+  import scala.concurrent.ExecutionContext.Implicits.global
+
+  @volatile private var _isRunning: Boolean = false
+  override def isRunning: Boolean = _isRunning
+
+  /**
+   * Submits code to the broker service to be executed and return a result.
+   *
+   * @param code The code to execute
+   *
+   * @return The result as a future to eventually return
+   */
+  override def submitCode(code: Code): Future[CodeResults] = future {
+    println(s"Executing: '${code.trim}'")
+    val result = kernel.sqlContext.sql(code.trim)
+
+    // TODO: There is an internal method used for show called showString that
+    //       supposedly is only for the Python API, look into why
+    val stringOutput = {
+      val outputStream = new ByteArrayOutputStream()
+      Console.withOut(outputStream) {
+        // TODO: Provide some way to change the number of records shown
+        result.show(10)
+      }
+      outputStream.toString("UTF-8")
+    }
+
+    stringOutput
+  }
+
+  /** Stops the running broker service. */
+  override def stop(): Unit = _isRunning = false
+
+  /** Starts the broker service. */
+  override def start(): Unit = _isRunning = true
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
new file mode 100644
index 0000000..114c97f
--- /dev/null
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sql
+
+import com.ibm.spark.interpreter.broker.BrokerTransformer
+
+/**
+ * Represents the transformer used by Apache SQL.
+ */
+class SqlTransformer extends BrokerTransformer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
new file mode 100644
index 0000000..a2fbd10
--- /dev/null
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.sql
+
+import com.ibm.spark.interpreter.broker.BrokerTypesProvider
+
+/**
+ * Represents all types associated with the SQL interface.
+ */
+object SqlTypes extends BrokerTypesProvider



[20/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
new file mode 100644
index 0000000..8db4535
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.utils
+
+import java.util.Calendar
+import java.util.concurrent.atomic.AtomicBoolean
+import java.util.concurrent.{TimeUnit, CountDownLatch}
+
+import org.scalatest.concurrent.Eventually
+import org.scalatest.time.{Milliseconds, Span}
+import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
+
+class ScheduledTaskManagerSpec extends FunSpec with Matchers with BeforeAndAfter
+  with Eventually
+{
+  private val TestTimeInterval = 30
+  private val MaximumChecks = 3
+  private val TimeoutScale = 3
+  private var scheduledTaskManager: ScheduledTaskManager = _
+  private var scheduleVerifier: ScheduleVerifier = _
+
+  implicit override val patienceConfig = PatienceConfig(
+    timeout = scaled(Span(
+      TestTimeInterval * MaximumChecks * TimeoutScale, Milliseconds)),
+    interval = scaled(Span(TestTimeInterval / 2, Milliseconds))
+  )
+
+  private class ScheduleVerifier {
+    @volatile private var checkinTimes: List[Long] = Nil
+    private val taskRun = new AtomicBoolean(false)
+
+    def task() = {
+      if (checkinTimes.length < MaximumChecks)
+        checkinTimes = checkinTimes :+ Calendar.getInstance().getTimeInMillis
+      taskRun.set(true)
+    }
+
+    def shouldNotRunAnymore(milliseconds: Long) = eventually {
+      val offset: Int = (milliseconds * 0.5).toInt
+
+      // Clean the state and wait to see if the task is executed again
+      taskRun.set(false)
+      Thread.sleep(milliseconds + offset)
+
+      taskRun.get() should be (false)
+    }
+
+    def shouldRunEvery(milliseconds: Long) = {
+      // 50% +/-
+      val offset: Int = (milliseconds * 0.5).toInt
+
+      eventually {
+        // Assert we have the desired number of checks
+        checkinTimes.length should be (MaximumChecks)
+
+        checkinTimes.take(checkinTimes.length - 1).zip(
+          checkinTimes.takeRight(checkinTimes.length - 1)
+        ).foreach({ times =>
+          val firstTime = times._1
+          val secondTime = times._2
+          (secondTime - firstTime) should (
+            be >= milliseconds - offset and
+              be <= milliseconds + offset)
+        })
+      }
+    }
+  }
+
+  before {
+    scheduledTaskManager = new ScheduledTaskManager
+    scheduleVerifier = new ScheduleVerifier
+  }
+
+  after {
+    scheduledTaskManager.stop()
+  }
+
+  describe("ScheduledTaskManager") {
+    describe("#addTask") {
+      // TODO: This is failing frequently due to some sort of timing problem
+      ignore("should add a new task to be executed periodically") {
+        scheduledTaskManager.addTask(timeInterval = TestTimeInterval,
+          task = scheduleVerifier.task())
+
+        scheduleVerifier.shouldRunEvery(TestTimeInterval)
+      }
+    }
+
+    describe("#removeTask") {
+      it("should stop and remove the task if it exists") {
+        val taskId = scheduledTaskManager.addTask(
+          timeInterval = TestTimeInterval,
+          task = scheduleVerifier.task()
+        )
+
+        scheduledTaskManager.removeTask(taskId)
+
+        scheduleVerifier.shouldNotRunAnymore(TestTimeInterval)
+      }
+
+      it("should return true if the task was removed") {
+        val taskId = scheduledTaskManager.addTask(
+          timeInterval = TestTimeInterval,
+          task = scheduleVerifier.task()
+        )
+
+        scheduledTaskManager.removeTask(taskId) should be (true)
+      }
+
+      it("should return false if the task does not exist") {
+        scheduledTaskManager.removeTask("") should be (false)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
new file mode 100644
index 0000000..3456d98
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.util.concurrent.{RejectedExecutionException, ExecutionException}
+
+import org.scalatest.concurrent.PatienceConfiguration.Timeout
+import org.scalatest.concurrent.{Timeouts, Eventually, ScalaFutures}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.time.{Milliseconds, Seconds, Span}
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+import test.utils.UncaughtExceptionSuppression
+
+import scala.concurrent.Future
+import scala.runtime.BoxedUnit
+
+class TaskManagerSpec extends FunSpec with Matchers with MockitoSugar
+  with BeforeAndAfter with ScalaFutures with UncaughtExceptionSuppression
+  with Eventually with Timeouts
+{
+  implicit override val patienceConfig = PatienceConfig(
+    timeout = scaled(Span(200, Milliseconds)),
+    interval = scaled(Span(5, Milliseconds))
+  )
+  private val MaxTestTasks = 50000
+  private var taskManager: TaskManager = _
+
+  before {
+    taskManager = new TaskManager
+  }
+
+  after {
+    taskManager = null
+  }
+
+  describe("TaskManager") {
+    describe("#add") {
+      it("should throw an exception if not started") {
+        intercept[AssertionError] {
+          taskManager.add {}
+        }
+      }
+
+      it("should throw an exception if more tasks are added than max task size") {
+        val taskManager = new TaskManager(maximumWorkers = 1, maxTasks = 1)
+
+        taskManager.start()
+
+        // Should fail from having too many tasks added
+        intercept[RejectedExecutionException] {
+          for (i <- 1 to MaxTestTasks) taskManager.add {}
+        }
+      }
+
+      it("should return a Future[_] based on task provided") {
+        taskManager.start()
+
+        // Cannot check inner Future type due to type erasure
+        taskManager.add { } shouldBe an [Future[_]]
+
+        taskManager.stop()
+      }
+
+      it("should work for a task that returns nothing") {
+        taskManager.start()
+
+        val f = taskManager.add { }
+
+        whenReady(f) { result =>
+          result shouldBe a [BoxedUnit]
+          taskManager.stop()
+        }
+      }
+
+      it("should construct a Runnable that invokes a Promise on success") {
+        taskManager.start()
+
+        val returnValue = 3
+        val f = taskManager.add { returnValue }
+
+        whenReady(f) { result =>
+          result should be (returnValue)
+          taskManager.stop()
+        }
+      }
+
+      it("should construct a Runnable that invokes a Promise on failure") {
+        taskManager.start()
+
+        val error = new Throwable("ERROR")
+        val f = taskManager.add { throw error }
+
+        whenReady(f.failed) { result =>
+          result should be (error)
+          taskManager.stop()
+        }
+      }
+
+      it("should not block when adding more tasks than available threads") {
+        val taskManager = new TaskManager(maximumWorkers = 1)
+
+        taskManager.start()
+
+        failAfter(Span(100, Milliseconds)) {
+          taskManager.add { while (true) { Thread.sleep(1) } }
+          taskManager.add { while (true) { Thread.sleep(1) } }
+        }
+      }
+    }
+
+    describe("#size") {
+      it("should be zero when no tasks have been added") {
+        taskManager.size should be (0)
+      }
+
+      it("should reflect queued tasks and executing tasks") {
+        val taskManager = new TaskManager(maximumWorkers = 1)
+        taskManager.start()
+
+        // Fill up the task manager and then add another task to the queue
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+
+        taskManager.size should be (2)
+      }
+
+      it("should be one if there is only one executing task and no queued ones") {
+        taskManager.start()
+
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+
+        // Wait until task is being executed to check if the task is still in
+        // the queue
+        while (!taskManager.isExecutingTask) Thread.sleep(1)
+
+        taskManager.size should be (1)
+
+        taskManager.stop()
+      }
+    }
+
+    describe("#hasTaskInQueue") {
+      it("should be false when no task has been added") {
+        taskManager.hasTaskInQueue should be (false)
+      }
+
+      it("should be true where there are tasks remaining in the queue") {
+        val taskManager = new TaskManager(maximumWorkers = 1)
+        taskManager.start()
+
+        // Fill up the task manager and then add another task to the queue
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+
+        taskManager.hasTaskInQueue should be (true)
+      }
+
+      it("should be false when the only task is currently being executed") {
+        taskManager.start()
+
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+
+        // Wait until task is being executed to check if the task is still in
+        // the queue
+        while (!taskManager.isExecutingTask) Thread.sleep(1)
+
+        taskManager.hasTaskInQueue should be (false)
+
+        taskManager.stop()
+      }
+    }
+
+    describe("#isExecutingTask") {
+      it("should be true when a task is being executed") {
+        taskManager.start()
+        taskManager.add { while (true) { Thread.sleep(1000) } }
+
+        eventually {
+          taskManager.isExecutingTask should be (true)
+        }
+
+        taskManager.stop()
+      }
+
+      it("should be false when no tasks have been added") {
+        taskManager.isExecutingTask should be (false)
+      }
+
+      // TODO: Timing issue on Travis CI needs to be resolved
+      ignore("should be false when all tasks have finished") {
+        taskManager.start()
+        val f = taskManager.add { } // Really fast execution
+
+        // Wait for up to 1 second for the task to finish
+        whenReady(f, Timeout(Span(1, Seconds))) { result =>
+          taskManager.isExecutingTask should be (false)
+          taskManager.stop()
+        }
+      }
+    }
+
+    describe("#await") {
+      it("should block until all tasks are completed") {
+        val taskManager = new TaskManager(
+          maximumWorkers = 1,
+          maxTasks = MaxTestTasks
+        )
+
+        taskManager.start()
+
+        // TODO: Need better way to ensure tasks are still running while
+        // awaiting their return
+        for (x <- 1 to MaxTestTasks) taskManager.add { Thread.sleep(1) }
+
+        assume(taskManager.hasTaskInQueue)
+        taskManager.await()
+
+        taskManager.hasTaskInQueue should be (false)
+        taskManager.isExecutingTask should be (false)
+
+        taskManager.stop()
+      }
+    }
+
+    describe("#start") {
+      it("should create an internal thread pool executor") {
+        taskManager.start()
+
+        taskManager.executor should not be (None)
+
+        taskManager.stop()
+      }
+    }
+
+    describe("#restart") {
+      it("should stop & erase the old internal thread and create a new one") {
+        taskManager.start()
+
+        val oldExecutor = taskManager.executor
+
+        taskManager.restart()
+
+        taskManager.executor should not be (oldExecutor)
+
+        taskManager.stop()
+      }
+    }
+
+    describe("#stop") {
+      it("should attempt to interrupt the currently-running task") {
+        taskManager.start()
+        val f = taskManager.add { while (true) { Thread.sleep(1000) } }
+
+        // Wait for the task to start
+        while (!taskManager.isExecutingTask) Thread.sleep(1)
+
+        // Cancel the task
+        taskManager.stop()
+
+        // Future should return an InterruptedException
+        whenReady(f.failed) { result =>
+          result shouldBe an [ExecutionException]
+          result.getCause shouldBe an [InterruptedException]
+        }
+      }
+
+      // TODO: Refactoring task manager to be parallelizable broke this ability
+      //       so this will need to be reimplemented or abandoned
+      ignore("should kill the thread if interrupts failed and kill enabled") {
+        taskManager.start()
+        val f = taskManager.add { var x = 0; while (true) { x += 1 } }
+
+        // Wait for the task to start
+        while (!taskManager.isExecutingTask) Thread.sleep(1)
+
+        // Kill the task
+        taskManager.stop()
+
+        // Future should return ThreadDeath when killed
+        whenReady(f.failed) { result =>
+          result shouldBe an [ExecutionException]
+          result.getCause shouldBe a [ThreadDeath]
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/SparkKernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/SparkKernel.scala b/kernel/src/main/scala/com/ibm/spark/SparkKernel.scala
deleted file mode 100644
index f532de9..0000000
--- a/kernel/src/main/scala/com/ibm/spark/SparkKernel.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark
-
-import com.ibm.spark.boot.layer._
-import com.ibm.spark.boot.{CommandLineOptions, KernelBootstrap}
-import com.ibm.spark.kernel.BuildInfo
-
-object SparkKernel extends App {
-  private val options = new CommandLineOptions(args)
-
-  if (options.help) {
-    options.printHelpOn(System.out)
-  } else if (options.version) {
-    println(s"Kernel Version:       ${BuildInfo.version}")
-    println(s"Build Date:           ${BuildInfo.buildDate}")
-    println(s"Scala Version:        ${BuildInfo.scalaVersion}")
-    println(s"Apache Spark Version: ${BuildInfo.sparkVersion}")
-  } else {
-    (new KernelBootstrap(options.toConfig)
-      with StandardBareInitialization
-      with StandardComponentInitialization
-      with StandardHandlerInitialization
-      with StandardHookInitialization)
-      .initialize()
-      .waitForTermination()
-      .shutdown()
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/CommandLineOptions.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/CommandLineOptions.scala b/kernel/src/main/scala/com/ibm/spark/boot/CommandLineOptions.scala
deleted file mode 100644
index a5acbc2..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/CommandLineOptions.scala
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.boot
-
-import java.io.{File, OutputStream}
-
-import com.ibm.spark.utils.KeyValuePairUtils
-import com.typesafe.config.{Config, ConfigFactory}
-import joptsimple.util.KeyValuePair
-import joptsimple.{OptionParser, OptionSpec}
-
-import scala.collection.JavaConverters._
-
-class CommandLineOptions(args: Seq[String]) {
-  private val parser = new OptionParser()
-  parser.allowsUnrecognizedOptions()
-
-  /*
-   * Options supported by our kernel.
-   */
-  private val _help =
-    parser.acceptsAll(Seq("help", "h").asJava, "display help information").forHelp()
-
-  private val _version =
-    parser.acceptsAll(Seq("version", "v").asJava, "display version information")
-
-  private val _profile =
-    parser.accepts("profile", "path to IPython JSON connection file")
-      .withRequiredArg().ofType(classOf[File])
-
-  private val _ip =
-    parser.accepts("ip", "ip used to bind sockets")
-      .withRequiredArg().ofType(classOf[String])
-
-  private val _stdin_port = parser.accepts(
-    "stdin-port", "port of the stdin socket"
-  ).withRequiredArg().ofType(classOf[Int])
-
-  private val _shell_port = parser.accepts(
-    "shell-port", "port of the shell socket"
-  ).withRequiredArg().ofType(classOf[Int])
-
-  private val _iopub_port = parser.accepts(
-    "iopub-port", "port of the iopub socket"
-  ).withRequiredArg().ofType(classOf[Int])
-
-  private val _control_port = parser.accepts(
-    "control-port", "port of the control socket"
-  ).withRequiredArg().ofType(classOf[Int])
-
-  private val _heartbeat_port = parser.accepts(
-    "heartbeat-port", "port of the heartbeat socket"
-  ).withRequiredArg().ofType(classOf[Int])
-
-  private val _spark_configuration = parser.acceptsAll(
-    Seq("spark-configuration", "S").asJava,
-    "configuration setting for Apache Spark"
-  ).withRequiredArg().ofType(classOf[KeyValuePair])
-
-  private val _magic_url =
-    parser.accepts("magic-url", "path to a magic jar")
-      .withRequiredArg().ofType(classOf[String])
-
-  private val _max_interpreter_threads = parser.accepts(
-    "max-interpreter-threads",
-    "total number of worker threads to use to execute code"
-  ).withRequiredArg().ofType(classOf[Int])
-
-  private val _jar_dir = parser.accepts(
-    "jar-dir",
-    "directory where user added jars are stored (MUST EXIST)"
-  ).withRequiredArg().ofType(classOf[String])
-
-  private val _default_interpreter =
-    parser.accepts("default-interpreter", "default interpreter for the kernel")
-      .withRequiredArg().ofType(classOf[String])
-
-  private val _nosparkcontext =
-    parser.accepts("nosparkcontext", "kernel should not create a spark context")
-
-  private val _interpreter_plugin = parser.accepts(
-    "interpreter-plugin"
-  ).withRequiredArg().ofType(classOf[String])
-
-  private val options = parser.parse(args.map(_.trim): _*)
-
-  /*
-   * Helpers to determine if an option is provided and the value with which it
-   * was provided.
-   */
-
-  private def has[T](spec: OptionSpec[T]): Boolean =
-    options.has(spec)
-
-  private def get[T](spec: OptionSpec[T]): Option[T] =
-    Some(options.valueOf(spec)).filter(_ != null)
-
-  private def getAll[T](spec: OptionSpec[T]): Option[List[T]] =
-    Some(options.valuesOf(spec).asScala.toList).filter(_ != null)
-
-  /*
-   * Expose options in terms of their existence/value.
-   */
-
-  val help: Boolean = has(_help)
-
-  val version: Boolean = has(_version)
-
-  /*
-   * Config object has 3 levels and fallback in this order
-   * 1. Comandline Args
-   * 2. --profile file
-   * 3. Defaults
-   */
-  def toConfig: Config = {
-    val profileConfig: Config = get(_profile) match {
-      case Some(x) =>
-        ConfigFactory.parseFile(x)
-      case None =>
-        ConfigFactory.empty()
-    }
-
-    val commandLineConfig: Config = ConfigFactory.parseMap(Map(
-      "stdin_port" -> get(_stdin_port),
-      "shell_port" -> get(_shell_port),
-      "iopub_port" -> get(_iopub_port),
-      "control_port" -> get(_control_port),
-      "hb_port" -> get(_heartbeat_port),
-      "ip" -> get(_ip),
-      "interpreter_args" -> interpreterArgs,
-      "magic_urls" -> getAll(_magic_url).map(_.asJava)
-        .flatMap(list => if (list.isEmpty) None else Some(list)),
-      "spark_configuration" -> getAll(_spark_configuration)
-        .map(list => KeyValuePairUtils.keyValuePairSeqToString(list))
-        .flatMap(str => if (str.nonEmpty) Some(str) else None),
-      "max_interpreter_threads" -> get(_max_interpreter_threads),
-      "jar_dir" -> get(_jar_dir),
-      "default_interpreter" -> get(_default_interpreter),
-      "nosparkcontext" -> (if (has(_nosparkcontext)) Some(true) else Some(false)),
-      "interpreter_plugins" -> interpreterPlugins
-    ).flatMap(removeEmptyOptions).asInstanceOf[Map[String, AnyRef]].asJava)
-
-    commandLineConfig.withFallback(profileConfig).withFallback(ConfigFactory.load)
-  }
-
-  private val removeEmptyOptions: ((String, Option[Any])) => Iterable[(String, Any)] = {
-    pair => if (pair._2.isDefined) Some((pair._1, pair._2.get)) else None
-  }
-
-  /**
-   *
-   * @return
-   */
-  private def interpreterArgs: Option[java.util.List[String]] = {
-    args.dropWhile(_ != "--").drop(1).toList match {
-      case Nil => None
-      case list: List[String] => Some(list.asJava)
-    }
-  }
-
-  private def interpreterPlugins: Option[java.util.List[String]] = {
-    //val defaults = getAll(_default_interpreter_plugin).getOrElse(List())
-    //val defaults = List[String](
-    //  "PySpark:com.ibm.spark.kernel.interpreter.pyspark.PySparkInterpreter",
-    //  "SparkR:com.ibm.spark.kernel.interpreter.sparkr.SparkRInterpreter",
-    //  "SQL:com.ibm.spark.kernel.interpreter.sql.SqlInterpreter"
-    //)
-
-    val userDefined = getAll(_interpreter_plugin) match {
-      case Some(l) => l
-      case _ => List[String]()
-    }
-
-    //val p = defaults ++ userDefined
-    Some(userDefined.asJava)
-  }
-
-  /**
-   * Prints the help message to the output stream provided.
-   * @param out The output stream to direct the help message
-   */
-  def printHelpOn(out: OutputStream) =
-    parser.printHelpOn(out)
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/KernelBootstrap.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/KernelBootstrap.scala b/kernel/src/main/scala/com/ibm/spark/boot/KernelBootstrap.scala
deleted file mode 100644
index 1e7927c..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/KernelBootstrap.scala
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.boot
-
-import akka.actor.{ActorRef, ActorSystem}
-import com.ibm.spark.boot.layer._
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.Kernel
-import com.ibm.spark.kernel.protocol.v5.KernelStatusType._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.security.KernelSecurityManager
-import com.ibm.spark.utils.LogLike
-import com.typesafe.config.Config
-import org.apache.spark.SparkContext
-import org.zeromq.ZMQ
-
-import scala.util.Try
-
-class KernelBootstrap(config: Config) extends LogLike {
-  this: BareInitialization with ComponentInitialization
-    with HandlerInitialization with HookInitialization =>
-
-  private val DefaultAppName                    = SparkKernelInfo.banner
-  private val DefaultActorSystemName            = "spark-kernel-actor-system"
-
-  private var actorSystem: ActorSystem          = _
-  private var actorLoader: ActorLoader          = _
-  private var kernelMessageRelayActor: ActorRef = _
-  private var statusDispatch: ActorRef          = _
-  private var kernel: Kernel                    = _
-
-  private var sparkContext: SparkContext        = _
-  private var interpreters: Seq[Interpreter]    = Nil
-
-  /**
-   * Initializes all kernel systems.
-   */
-  def initialize() = {
-    // TODO: Investigate potential to initialize System out/err/in to capture
-    //       Console DynamicVariable initialization (since takes System fields)
-    //       and redirect it to a workable location (like an actor) with the
-    //       thread's current information attached
-    //
-    // E.G. System.setOut(customPrintStream) ... all new threads will have
-    //      customPrintStream as their initial Console.out value
-    //
-
-    displayVersionInfo()
-
-    // Do this first to support shutting down quickly before entire system
-    // is ready
-    initializeShutdownHook()
-
-    // Initialize the bare minimum to report a starting message
-    val (actorSystem, actorLoader, kernelMessageRelayActor, statusDispatch) =
-      initializeBare(
-        config = config,
-        actorSystemName = DefaultActorSystemName
-      )
-
-    this.actorSystem = actorSystem
-    this.actorLoader = actorLoader
-    this.kernelMessageRelayActor = kernelMessageRelayActor
-    this.statusDispatch = statusDispatch
-
-    // Indicate that the kernel is now starting
-    publishStatus(KernelStatusType.Starting)
-
-    // Initialize components needed elsewhere
-    val (commStorage, commRegistrar, commManager, interpreter,
-      kernel, dependencyDownloader,
-      magicLoader, responseMap) =
-      initializeComponents(
-        config      = config,
-        appName     = DefaultAppName,
-        actorLoader = actorLoader
-      )
-    //this.sparkContext = sparkContext
-    this.interpreters ++= Seq(interpreter)
-
-    this.kernel = kernel
-
-    // Initialize our handlers that take care of processing messages
-    initializeHandlers(
-      actorSystem   = actorSystem,
-      actorLoader   = actorLoader,
-      kernel        = kernel,
-      interpreter   = interpreter,
-      commRegistrar = commRegistrar,
-      commStorage   = commStorage,
-      magicLoader   = magicLoader,
-      responseMap   = responseMap
-    )
-
-    // Initialize our non-shutdown hooks that handle various JVM events
-    initializeHooks(
-      interpreter = interpreter
-    )
-
-    logger.debug("Initializing security manager")
-    System.setSecurityManager(new KernelSecurityManager)
-
-    logger.info("Marking relay as ready for receiving messages")
-    kernelMessageRelayActor ! true
-
-    this
-  }
-
-  /**
-   * Shuts down all kernel systems.
-   */
-  def shutdown() = {
-    logger.info("Shutting down Spark Context")
-    Try(kernel.sparkContext.stop()).failed.foreach(
-      logger.error("Failed to shutdown Spark Context", _: Throwable)
-    )
-
-    logger.info("Shutting down interpreters")
-    Try(interpreters.foreach(_.stop())).failed.foreach(
-      logger.error("Failed to shutdown interpreters", _: Throwable)
-    )
-
-    logger.info("Shutting down actor system")
-    Try(actorSystem.shutdown()).failed.foreach(
-      logger.error("Failed to shutdown actor system", _: Throwable)
-    )
-
-    this
-  }
-
-  /**
-   * Waits for the main actor system to terminate.
-   */
-  def waitForTermination() = {
-    logger.debug("Waiting for actor system to terminate")
-    actorSystem.awaitTermination()
-
-    this
-  }
-
-  private def publishStatus(
-    status: KernelStatusType,
-    parentHeader: Option[ParentHeader] = None
-  ): Unit = {
-    parentHeader match {
-      case Some(header) => statusDispatch ! ((status, header))
-      case None         => statusDispatch ! status
-    }
-  }
-
-  @inline private def displayVersionInfo() = {
-    logger.info("Kernel version: " + SparkKernelInfo.implementationVersion)
-    logger.info("Scala version: " + SparkKernelInfo.languageVersion)
-    logger.info("ZeroMQ (JeroMQ) version: " + ZMQ.getVersionString)
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/layer/BareInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/layer/BareInitialization.scala b/kernel/src/main/scala/com/ibm/spark/boot/layer/BareInitialization.scala
deleted file mode 100644
index d2d6ab9..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/layer/BareInitialization.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.boot.layer
-
-import akka.actor.{ActorRef, Props, ActorSystem}
-import com.ibm.spark.kernel.protocol.v5.dispatch.StatusDispatch
-import com.ibm.spark.kernel.protocol.v5.handler.{GenericSocketMessageHandler, ShutdownHandler}
-import com.ibm.spark.kernel.protocol.v5.kernel.{SimpleActorLoader, ActorLoader}
-import com.ibm.spark.communication.security.{SecurityActorType, SignatureManagerActor}
-import com.ibm.spark.kernel.protocol.v5.kernel.socket._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.relay.KernelMessageRelay
-import com.ibm.spark.utils.LogLike
-import com.typesafe.config.Config
-import play.api.libs.json.Json
-
-/**
- * Represents the raw initialization needed to send a "starting" message.
- */
-trait BareInitialization {
-  /**
-   * Initializes and registers all objects needed to get the kernel to send a
-   * "starting" message.
-   *
-   * @param config The config used for initialization
-   * @param actorSystemName The name to use for the actor system
-   */
-  def initializeBare(config: Config, actorSystemName: String):
-    (ActorSystem, ActorLoader, ActorRef, ActorRef)
-}
-
-/**
- * Represents the standard implementation of BareInitialization.
- */
-trait StandardBareInitialization extends BareInitialization { this: LogLike =>
-  /**
-   * Initializes and registers all objects needed to get the kernel to send a
-   * "starting" message.
-   *
-   * @param config The config used for initialization
-   * @param actorSystemName The name to use for the actor system
-   */
-  def initializeBare(config: Config, actorSystemName: String) = {
-    val actorSystem = createActorSystem(actorSystemName)
-    val actorLoader = createActorLoader(actorSystem)
-    val (kernelMessageRelayActor, _, statusDispatch, _, _) =
-      initializeCoreActors(config, actorSystem, actorLoader)
-    createSockets(config, actorSystem, actorLoader)
-
-    (actorSystem, actorLoader, kernelMessageRelayActor, statusDispatch)
-  }
-
-  protected def createActorSystem(actorSystemName: String): ActorSystem = {
-    logger.info("Initializing internal actor system")
-    ActorSystem(actorSystemName)
-  }
-
-  protected def createActorLoader(actorSystem: ActorSystem): ActorLoader = {
-    logger.debug("Creating Simple Actor Loader")
-    SimpleActorLoader(actorSystem)
-  }
-
-  /**
-   * Does minimal setup in order to send the "starting" status message over
-   * the IOPub socket
-   */
-  protected def initializeCoreActors(
-    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader
-  ) = {
-    logger.debug("Creating kernel message relay actor")
-    val kernelMessageRelayActor = actorSystem.actorOf(
-      Props(
-        classOf[KernelMessageRelay], actorLoader, true,
-        Map(
-          CommOpen.toTypeString -> MessageType.Incoming.CommOpen.toString,
-          CommMsg.toTypeString -> MessageType.Incoming.CommMsg.toString,
-          CommClose.toTypeString -> MessageType.Incoming.CommClose.toString
-        ),
-        Map(
-          CommOpen.toTypeString -> MessageType.Outgoing.CommOpen.toString,
-          CommMsg.toTypeString -> MessageType.Outgoing.CommMsg.toString,
-          CommClose.toTypeString -> MessageType.Outgoing.CommClose.toString
-        )
-      ),
-      name = SystemActorType.KernelMessageRelay.toString
-    )
-
-    logger.debug("Creating signature manager actor")
-    val sigKey = config.getString("key")
-    val sigScheme = config.getString("signature_scheme")
-    logger.debug("Key = " + sigKey)
-    logger.debug("Scheme = " + sigScheme)
-    val signatureManagerActor = actorSystem.actorOf(
-      Props(
-        classOf[SignatureManagerActor], sigKey, sigScheme.replace("-", "")
-      ),
-      name = SecurityActorType.SignatureManager.toString
-    )
-
-    logger.debug("Creating status dispatch actor")
-    val statusDispatch = actorSystem.actorOf(
-      Props(classOf[StatusDispatch], actorLoader),
-      name = SystemActorType.StatusDispatch.toString
-    )
-
-    logger.debug("Creating shutdown handler and sender actors")
-    val shutdownHandler = actorSystem.actorOf(
-      Props(classOf[ShutdownHandler], actorLoader),
-      name = MessageType.Incoming.ShutdownRequest.toString
-    )
-    val shutdownSender = actorSystem.actorOf(
-      Props(classOf[GenericSocketMessageHandler], actorLoader, SocketType.Control),
-      name = MessageType.Outgoing.ShutdownReply.toString
-    )
-
-    (kernelMessageRelayActor, signatureManagerActor, statusDispatch, shutdownHandler, shutdownSender)
-  }
-
-  protected def createSockets(
-    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader
-  ): Unit = {
-    logger.debug("Creating sockets")
-
-    val socketConfig: SocketConfig = SocketConfig.fromConfig(config)
-    logger.info("Connection Profile: "
-      + Json.prettyPrint(Json.toJson(socketConfig)))
-
-    logger.debug("Constructing ServerSocketFactory")
-    val socketFactory = new SocketFactory(socketConfig)
-
-    logger.debug("Initializing Heartbeat on port " +
-      socketConfig.hb_port)
-    val heartbeatActor = actorSystem.actorOf(
-      Props(classOf[Heartbeat], socketFactory),
-      name = SocketType.Heartbeat.toString
-    )
-
-    logger.debug("Initializing Stdin on port " +
-      socketConfig.stdin_port)
-    val stdinActor = actorSystem.actorOf(
-      Props(classOf[Stdin], socketFactory, actorLoader),
-      name = SocketType.StdIn.toString
-    )
-
-    logger.debug("Initializing Shell on port " +
-      socketConfig.shell_port)
-    val shellActor = actorSystem.actorOf(
-      Props(classOf[Shell], socketFactory, actorLoader),
-      name = SocketType.Shell.toString
-    )
-
-    logger.debug("Initializing Control on port " +
-      socketConfig.control_port)
-    val controlActor = actorSystem.actorOf(
-      Props(classOf[Control], socketFactory, actorLoader),
-      name = SocketType.Control.toString
-    )
-
-    logger.debug("Initializing IOPub on port " +
-      socketConfig.iopub_port)
-    val ioPubActor = actorSystem.actorOf(
-      Props(classOf[IOPub], socketFactory),
-      name = SocketType.IOPub.toString
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/layer/ComponentInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/com/ibm/spark/boot/layer/ComponentInitialization.scala
deleted file mode 100644
index 939b896..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/layer/ComponentInitialization.scala
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.boot.layer
-
-import java.util
-import java.util.concurrent.ConcurrentHashMap
-
-import akka.actor.ActorRef
-import com.ibm.spark.comm.{CommManager, KernelCommManager, CommRegistrar, CommStorage}
-import com.ibm.spark.dependencies.{DependencyDownloader, IvyDependencyDownloader}
-import com.ibm.spark.global
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.{KernelLike, Kernel}
-import com.ibm.spark.kernel.protocol.v5.KMBuilder
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.magic.builtin.BuiltinLoader
-import com.ibm.spark.magic.dependencies.DependencyMap
-import com.ibm.spark.utils.{MultiClassLoader, TaskManager, KeyValuePairUtils, LogLike}
-import com.typesafe.config.Config
-import org.apache.spark.sql.SQLContext
-import org.apache.spark.{SparkContext, SparkConf}
-
-import scala.collection.JavaConverters._
-
-import scala.util.Try
-
-/**
- * Represents the component initialization. All component-related pieces of the
- * kernel (non-actors) should be created here. Limited items should be exposed.
- */
-trait ComponentInitialization {
-  /**
-   * Initializes and registers all components (not needed by bare init).
-   *
-   * @param config The config used for initialization
-   * @param appName The name of the "application" for Spark
-   * @param actorLoader The actor loader to use for some initialization
-   */
-  def initializeComponents(
-    config: Config, appName: String, actorLoader: ActorLoader
-  ): (CommStorage, CommRegistrar, CommManager, Interpreter,
-    Kernel, DependencyDownloader, MagicLoader,
-    collection.mutable.Map[String, ActorRef])
-}
-
-/**
- * Represents the standard implementation of ComponentInitialization.
- */
-trait StandardComponentInitialization extends ComponentInitialization {
-  this: LogLike =>
-
-  /**
-   * Initializes and registers all components (not needed by bare init).
-   *
-   * @param config The config used for initialization
-   * @param appName The name of the "application" for Spark
-   * @param actorLoader The actor loader to use for some initialization
-   */
-  def initializeComponents(
-    config: Config, appName: String, actorLoader: ActorLoader
-  ) = {
-    val (commStorage, commRegistrar, commManager) =
-      initializeCommObjects(actorLoader)
-
-    val manager =  InterpreterManager(config)
-    val scalaInterpreter = manager.interpreters.get("Scala").orNull
-
-    val dependencyDownloader = initializeDependencyDownloader(config)
-    val magicLoader = initializeMagicLoader(
-      config, scalaInterpreter, dependencyDownloader)
-
-    val kernel = initializeKernel(
-      config, actorLoader, manager, commManager, magicLoader
-    )
-
-    val responseMap = initializeResponseMap()
-
-    initializeSparkContext(config, kernel, appName)
-
-    (commStorage, commRegistrar, commManager,
-      manager.defaultInterpreter.orNull, kernel,
-      dependencyDownloader, magicLoader, responseMap)
-
-  }
-
-
-  def initializeSparkContext(config:Config, kernel:Kernel, appName:String) = {
-    if(!config.getBoolean("nosparkcontext")) {
-      kernel.createSparkContext(config.getString("spark.master"), appName)
-    }
-  }
-
-  private def initializeCommObjects(actorLoader: ActorLoader) = {
-    logger.debug("Constructing Comm storage")
-    val commStorage = new CommStorage()
-
-    logger.debug("Constructing Comm registrar")
-    val commRegistrar = new CommRegistrar(commStorage)
-
-    logger.debug("Constructing Comm manager")
-    val commManager = new KernelCommManager(
-      actorLoader, KMBuilder(), commRegistrar)
-
-    (commStorage, commRegistrar, commManager)
-  }
-
-  private def initializeDependencyDownloader(config: Config) = {
-    val dependencyDownloader = new IvyDependencyDownloader(
-      "http://repo1.maven.org/maven2/", config.getString("ivy_local")
-    )
-
-    dependencyDownloader
-  }
-
-  protected def initializeResponseMap(): collection.mutable.Map[String, ActorRef] =
-    new ConcurrentHashMap[String, ActorRef]().asScala
-
-  private def initializeKernel(
-    config: Config,
-    actorLoader: ActorLoader,
-    interpreterManager: InterpreterManager,
-    commManager: CommManager,
-    magicLoader: MagicLoader
-  ) = {
-    val kernel = new Kernel(
-      config,
-      actorLoader,
-      interpreterManager,
-      commManager,
-      magicLoader
-    )
-    /*
-    interpreter.doQuietly {
-      interpreter.bind(
-        "kernel", "com.ibm.spark.kernel.api.Kernel",
-        kernel, List( """@transient implicit""")
-      )
-    }
-    */
-    magicLoader.dependencyMap.setKernel(kernel)
-
-    kernel
-  }
-
-  private def initializeMagicLoader(
-    config: Config, interpreter: Interpreter,
-    dependencyDownloader: DependencyDownloader
-  ) = {
-    logger.debug("Constructing magic loader")
-
-    logger.debug("Building dependency map")
-    val dependencyMap = new DependencyMap()
-      .setInterpreter(interpreter)
-      .setKernelInterpreter(interpreter) // This is deprecated
-      .setDependencyDownloader(dependencyDownloader)
-      .setConfig(config)
-
-    logger.debug("Creating BuiltinLoader")
-    val builtinLoader = new BuiltinLoader()
-
-    val magicUrlArray = config.getStringList("magic_urls").asScala
-      .map(s => new java.net.URL(s)).toArray
-
-    if (magicUrlArray.isEmpty)
-      logger.warn("No external magics provided to MagicLoader!")
-    else
-      logger.info("Using magics from the following locations: " +
-        magicUrlArray.map(_.getPath).mkString(","))
-
-    val multiClassLoader = new MultiClassLoader(
-      builtinLoader,
-      interpreter.classLoader
-    )
-
-    logger.debug("Creating MagicLoader")
-    val magicLoader = new MagicLoader(
-      dependencyMap = dependencyMap,
-      urls = magicUrlArray,
-      parentLoader = multiClassLoader
-    )
-    magicLoader.dependencyMap.setMagicLoader(magicLoader)
-    magicLoader
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/layer/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/layer/HandlerInitialization.scala b/kernel/src/main/scala/com/ibm/spark/boot/layer/HandlerInitialization.scala
deleted file mode 100644
index 1d16ac4..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/layer/HandlerInitialization.scala
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.boot.layer
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.Kernel
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-import com.ibm.spark.kernel.protocol.v5.SocketType.SocketType
-import com.ibm.spark.kernel.protocol.v5.handler._
-import com.ibm.spark.kernel.protocol.v5.interpreter.InterpreterActor
-import com.ibm.spark.kernel.protocol.v5.interpreter.tasks.InterpreterTaskFactory
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
-import com.ibm.spark.kernel.protocol.v5.relay.ExecuteRequestRelay
-import com.ibm.spark.kernel.protocol.v5.{MessageType, SocketType, SystemActorType}
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.utils.LogLike
-
-/**
- * Represents the Akka handler initialization. All actors (not needed in bare
- * initialization) should be constructed here.
- */
-trait HandlerInitialization {
-  /**
-   * Initializes and registers all handlers.
-   *
-   * @param actorSystem The actor system needed for registration
-   * @param actorLoader The actor loader needed for registration
-   * @param kernel The kernel api needed for registration
-   * @param interpreter The main interpreter needed for registration
-   * @param magicLoader The magic loader needed for registration
-   * @param commRegistrar The comm registrar needed for registration
-   * @param commStorage The comm storage needed for registration
-   */
-  def initializeHandlers(
-    actorSystem: ActorSystem, actorLoader: ActorLoader,
-    kernel: Kernel,
-    interpreter: Interpreter, magicLoader: MagicLoader,
-    commRegistrar: CommRegistrar, commStorage: CommStorage,
-    responseMap: collection.mutable.Map[String, ActorRef]
-  ): Unit
-}
-
-/**
- * Represents the standard implementation of HandlerInitialization.
- */
-trait StandardHandlerInitialization extends HandlerInitialization {
-  this: LogLike =>
-
-  /**
-   * Initializes and registers all handlers.
-   *
-   * @param actorSystem The actor system needed for registration
-   * @param actorLoader The actor loader needed for registration
-   * @param kernel The kernel api needed for registration
-   * @param interpreter The main interpreter needed for registration
-   * @param magicLoader The magic loader needed for registration
-   * @param commRegistrar The comm registrar needed for registration
-   * @param commStorage The comm storage needed for registration
-   */
-  def initializeHandlers(
-    actorSystem: ActorSystem, actorLoader: ActorLoader,
-    kernel: Kernel,
-    interpreter: Interpreter, magicLoader: MagicLoader,
-    commRegistrar: CommRegistrar, commStorage: CommStorage,
-    responseMap: collection.mutable.Map[String, ActorRef]
-  ): Unit = {
-    initializeKernelHandlers(
-      actorSystem, actorLoader, kernel, commRegistrar, commStorage, responseMap
-    )
-    initializeSystemActors(actorSystem, actorLoader, interpreter, magicLoader)
-  }
-
-  private def initializeSystemActors(
-    actorSystem: ActorSystem, actorLoader: ActorLoader,
-    interpreter: Interpreter, magicLoader: MagicLoader
-  ): Unit = {
-    logger.debug("Creating interpreter actor")
-    val interpreterActor = actorSystem.actorOf(
-      Props(classOf[InterpreterActor], new InterpreterTaskFactory(interpreter)),
-      name = SystemActorType.Interpreter.toString
-    )
-
-    logger.debug("Creating execute request relay actor")
-    val postProcessor = new PostProcessor(interpreter)
-    val magicParser = new MagicParser(magicLoader)
-    val executeRequestRelayActor = actorSystem.actorOf(
-      Props(classOf[ExecuteRequestRelay],
-        actorLoader, magicLoader, magicParser, postProcessor
-      ),
-      name = SystemActorType.ExecuteRequestRelay.toString
-    )
-  }
-
-  private def initializeKernelHandlers(
-    actorSystem: ActorSystem, actorLoader: ActorLoader,
-    kernel: Kernel,
-    commRegistrar: CommRegistrar, commStorage: CommStorage,
-    responseMap: collection.mutable.Map[String, ActorRef]
-  ): Unit = {
-    def initializeRequestHandler[T](clazz: Class[T], messageType: MessageType, extraArguments: AnyRef*) = {
-      logger.debug("Creating %s handler".format(messageType.toString))
-      actorSystem.actorOf(
-        Props(clazz, actorLoader +: extraArguments: _*),
-        name = messageType.toString
-      )
-    }
-
-    def initializeInputHandler[T](
-      clazz: Class[T],
-      messageType: MessageType
-    ): Unit = {
-      logger.debug("Creating %s handler".format(messageType.toString))
-      actorSystem.actorOf(
-        Props(clazz, actorLoader, responseMap),
-        name = messageType.toString
-      )
-    }
-
-    // TODO: Figure out how to pass variable number of arguments to actor
-    def initializeCommHandler[T](clazz: Class[T], messageType: MessageType) = {
-      logger.debug("Creating %s handler".format(messageType.toString))
-      actorSystem.actorOf(
-        Props(clazz, actorLoader, commRegistrar, commStorage),
-        name = messageType.toString
-      )
-    }
-
-    def initializeSocketHandler(socketType: SocketType, messageType: MessageType): Unit = {
-      logger.debug("Creating %s to %s socket handler ".format(messageType.toString ,socketType.toString))
-      actorSystem.actorOf(
-        Props(classOf[GenericSocketMessageHandler], actorLoader, socketType),
-        name = messageType.toString
-      )
-    }
-
-    //  These are the handlers for messages coming into the
-    initializeRequestHandler(classOf[ExecuteRequestHandler],
-      MessageType.Incoming.ExecuteRequest, kernel)
-    initializeRequestHandler(classOf[KernelInfoRequestHandler],
-      MessageType.Incoming.KernelInfoRequest)
-    initializeRequestHandler(classOf[CodeCompleteHandler],
-      MessageType.Incoming.CompleteRequest)
-    initializeInputHandler(classOf[InputRequestReplyHandler],
-      MessageType.Incoming.InputReply)
-    initializeCommHandler(classOf[CommOpenHandler],
-      MessageType.Incoming.CommOpen)
-    initializeCommHandler(classOf[CommMsgHandler],
-      MessageType.Incoming.CommMsg)
-    initializeCommHandler(classOf[CommCloseHandler],
-      MessageType.Incoming.CommClose)
-
-    //  These are handlers for messages leaving the kernel through the sockets
-    initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.KernelInfoReply)
-    initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.ExecuteReply)
-    initializeSocketHandler(SocketType.Shell, MessageType.Outgoing.CompleteReply)
-
-    initializeSocketHandler(SocketType.StdIn, MessageType.Outgoing.InputRequest)
-
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.ExecuteResult)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.Stream)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.ExecuteInput)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.Status)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.Error)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.CommOpen)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.CommMsg)
-    initializeSocketHandler(SocketType.IOPub, MessageType.Outgoing.CommClose)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/layer/HookInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/layer/HookInitialization.scala b/kernel/src/main/scala/com/ibm/spark/boot/layer/HookInitialization.scala
deleted file mode 100644
index c590394..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/layer/HookInitialization.scala
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.boot.layer
-
-import com.ibm.spark.boot.KernelBootstrap
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.utils.LogLike
-
-/**
- * Represents the hook (interrupt/shutdown) initialization. All JVM-related
- * hooks should be constructed here.
- */
-trait HookInitialization {
-  /**
-   * Initializes and registers all hooks except shutdown.
-   *
-   * @param interpreter The main interpreter
-   */
-  def initializeHooks(interpreter: Interpreter): Unit
-
-  /**
-   * Initializes the shutdown hook.
-   */
-  def initializeShutdownHook(): Unit
-}
-
-/**
- * Represents the standard implementation of HookInitialization.
- */
-trait StandardHookInitialization extends HookInitialization {
-  this: KernelBootstrap with LogLike =>
-
-  /**
-   * Initializes and registers all hooks.
-   *
-   * @param interpreter The main interpreter
-   */
-  def initializeHooks(interpreter: Interpreter): Unit = {
-    registerInterruptHook(interpreter)
-  }
-
-  /**
-   * Initializes the shutdown hook.
-   */
-  def initializeShutdownHook(): Unit = {
-    registerShutdownHook()
-  }
-
-  private def registerInterruptHook(interpreter: Interpreter): Unit = {
-    val self = this
-
-    import sun.misc.{Signal, SignalHandler}
-
-    // TODO: Signals are not a good way to handle this since JVM only has the
-    // proprietary sun API that is not necessarily available on all platforms
-    Signal.handle(new Signal("INT"), new SignalHandler() {
-      private val MaxSignalTime: Long = 3000 // 3 seconds
-      var lastSignalReceived: Long    = 0
-
-      def handle(sig: Signal) = {
-        val currentTime = System.currentTimeMillis()
-        if (currentTime - lastSignalReceived > MaxSignalTime) {
-          logger.info("Resetting code execution!")
-          interpreter.interrupt()
-
-          // TODO: Cancel group representing current code execution
-          //sparkContext.cancelJobGroup()
-
-          logger.info("Enter Ctrl-C twice to shutdown!")
-          lastSignalReceived = currentTime
-        } else {
-          logger.info("Shutting down kernel")
-          self.shutdown()
-        }
-      }
-    })
-  }
-
-  private def registerShutdownHook(): Unit = {
-    logger.debug("Registering shutdown hook")
-    val self = this
-    val mainThread = Thread.currentThread()
-    Runtime.getRuntime.addShutdownHook(new Thread() {
-      override def run() = {
-        logger.info("Shutting down kernel")
-        self.shutdown()
-        // TODO: Check if you can magically access the spark context to stop it
-        // TODO: inside a different thread
-        if (mainThread.isAlive) mainThread.join()
-      }
-    })
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/boot/layer/InterpreterManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/boot/layer/InterpreterManager.scala b/kernel/src/main/scala/com/ibm/spark/boot/layer/InterpreterManager.scala
deleted file mode 100644
index 520d68c..0000000
--- a/kernel/src/main/scala/com/ibm/spark/boot/layer/InterpreterManager.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.ibm.spark.boot.layer
-
-import com.ibm.spark.kernel.api.KernelLike
-import com.typesafe.config.Config
-import com.ibm.spark.interpreter._
-import scala.collection.JavaConverters._
-
-import org.slf4j.LoggerFactory
-
-case class InterpreterManager(
-  default: String = "Scala",
-  interpreters: Map[String, Interpreter] = Map[String, Interpreter]()
-) {
-
-
-  def initializeInterpreters(kernel: KernelLike): Unit = {
-    interpreters.values.foreach(interpreter =>
-      interpreter.init(kernel)
-    )
-  }
-
-  def addInterpreter(
-    name:String,
-    interpreter: Interpreter
-  ): InterpreterManager = {
-    copy(interpreters = interpreters + (name -> interpreter))
-  }
-
-  def defaultInterpreter: Option[Interpreter] = {
-    interpreters.get(default)
-  }
-}
-
-object InterpreterManager {
-
-  protected val logger = LoggerFactory.getLogger(this.getClass.getName)
-
-  def apply(config: Config): InterpreterManager = {
-    val ip = config.getStringList("interpreter_plugins").asScala ++
-      config.getStringList("default_interpreter_plugin").asScala
-
-    val m = ip.foldLeft(Map[String, Interpreter]())( (acc, v) => {
-      v.split(":") match {
-        case Array(name, className) =>
-          try {
-            val i = Class
-                .forName(className)
-                .newInstance()
-                .asInstanceOf[Interpreter]
-            acc + (name -> i)
-          }
-          catch {
-            case e:Throwable =>
-              logger.error("Error loading interpreter class " + className)
-              logger.error(e.getMessage())
-              acc
-          }
-        case _ => acc
-      }
-    })
-
-    val default = config.getString("default_interpreter")
-
-    InterpreterManager(interpreters = m, default = default)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/comm/KernelCommManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/comm/KernelCommManager.scala b/kernel/src/main/scala/com/ibm/spark/comm/KernelCommManager.scala
deleted file mode 100644
index 9706ce7..0000000
--- a/kernel/src/main/scala/com/ibm/spark/comm/KernelCommManager.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, UUID}
-
-/**
- * Represents a CommManager that uses a KernelCommWriter for its underlying
- * open implementation.
- *
- * @param actorLoader The actor loader to use with the ClientCommWriter
- * @param kmBuilder The KMBuilder to use with the ClientCommWriter
- * @param commRegistrar The registrar to use for callback registration
- */
-@Experimental
-class KernelCommManager(
-  private val actorLoader: ActorLoader,
-  private val kmBuilder: KMBuilder,
-  private val commRegistrar: CommRegistrar
-) extends CommManager(commRegistrar)
-{
-  /**
-   * Creates a new CommWriter instance given the Comm id.
-   *
-   * @param commId The Comm id to use with the Comm writer
-   *
-   * @return The new CommWriter instance
-   */
-  override protected def newCommWriter(commId: UUID): CommWriter =
-    new KernelCommWriter(actorLoader, kmBuilder, commId)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/comm/KernelCommWriter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/comm/KernelCommWriter.scala b/kernel/src/main/scala/com/ibm/spark/comm/KernelCommWriter.scala
deleted file mode 100644
index e494663..0000000
--- a/kernel/src/main/scala/com/ibm/spark/comm/KernelCommWriter.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.content.{CommMsg, CommOpen, CommClose, CommContent}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-
-/**
- * Represents a CommWriter to send messages from the Kernel to the Client.
- *
- * @param actorLoader The actor loader to use for loading actors responsible for
- *                    communication
- * @param kmBuilder The kernel message builder used to construct kernel messages
- * @param commId The comm id associated with this writer (defaults to a
- *               random UUID)
- */
-@Experimental
-class KernelCommWriter(
-  private val actorLoader: ActorLoader,
-  private val kmBuilder: KMBuilder,
-  override private[comm] val commId: v5.UUID
-)  extends CommWriter(commId) {
-  /**
-   * Sends the comm message (open/msg/close) to the actor responsible for
-   * relaying messages.
-   *
-   * @param commContent The message to relay (will be packaged)
-   *
-   * @tparam T Either CommOpen, CommMsg, or CommClose
-   */
-  override protected[comm] def sendCommKernelMessage[
-    T <: KernelMessageContent with CommContent
-  ](commContent: T): Unit = {
-    val messageType = commContent match {
-      case _: CommOpen  => CommOpen.toTypeString
-      case _: CommMsg   => CommMsg.toTypeString
-      case _: CommClose => CommClose.toTypeString
-      case _            => throw new Throwable("Invalid kernel message type!")
-    }
-    actorLoader.load(SystemActorType.KernelMessageRelay) !
-      kmBuilder.withHeader(messageType).withContentString(commContent).build
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/global/ExecuteRequestState.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/global/ExecuteRequestState.scala b/kernel/src/main/scala/com/ibm/spark/global/ExecuteRequestState.scala
deleted file mode 100644
index 389cf82..0000000
--- a/kernel/src/main/scala/com/ibm/spark/global/ExecuteRequestState.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.global
-
-import com.ibm.spark.kernel.api.Kernel
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-
-/**
- * Represents the state of the kernel messages being received containing
- * execute requests.
- */
-object ExecuteRequestState {
-  private var _lastKernelMessage: Option[KernelMessage] = None
-
-  /**
-   * Processes the incoming kernel message and updates any associated state.
-   *
-   * @param kernelMessage The kernel message to process
-   */
-  def processIncomingKernelMessage(kernelMessage: KernelMessage) =
-    _lastKernelMessage = Some(kernelMessage)
-
-  /**
-   * Returns the last kernel message funneled through the KernelMessageRelay
-   * if any.
-   *
-   * @return Some KernelMessage instance if the relay has processed one,
-   *         otherwise None
-   */
-  def lastKernelMessage: Option[KernelMessage] = _lastKernelMessage
-
-  /**
-   * Resets the state of the ExecuteRequestState to the default.
-   */
-  def reset() = _lastKernelMessage = None
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/global/ExecutionCounter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/global/ExecutionCounter.scala b/kernel/src/main/scala/com/ibm/spark/global/ExecutionCounter.scala
deleted file mode 100644
index c00f937..0000000
--- a/kernel/src/main/scala/com/ibm/spark/global/ExecutionCounter.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.global
-
-import com.ibm.spark.kernel.protocol.v5.UUID
-
-import scala.collection.concurrent._
-
-/**
- * A class to keep track of execution counts for sessions.
- */
-object ExecutionCounter {
-  private val executionCounts: Map[UUID, Int] = TrieMap[UUID, Int]()
-
-  /**
-   * This function will increase, by 1, an integer value associated with the given key. The incremented value
-   * will be returned. If the key has no value associated value, 1 will be returned.
-   * @param key The key for incrementing the value.
-   * @return The incremented value
-   */
-  def incr(key: UUID): Int = {
-    (executionCounts += (key -> (executionCounts.getOrElse(key, 0) + 1))) (key)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/global/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/global/ScheduledTaskManager.scala b/kernel/src/main/scala/com/ibm/spark/global/ScheduledTaskManager.scala
deleted file mode 100644
index 83d2cea..0000000
--- a/kernel/src/main/scala/com/ibm/spark/global/ScheduledTaskManager.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.global
-
-import com.ibm.spark.utils
-
-object ScheduledTaskManager {
-  lazy val instance = new utils.ScheduledTaskManager
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/api/FactoryMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/api/FactoryMethods.scala b/kernel/src/main/scala/com/ibm/spark/kernel/api/FactoryMethods.scala
deleted file mode 100644
index 36c5c5c..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/api/FactoryMethods.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.api
-
-import java.io.{InputStream, OutputStream}
-
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
-import com.typesafe.config.Config
-
-/**
- * Represents the methods available to stream data from the kernel to the
- * client.
- *
- * @param config The kernel configuration to use during object creation
- * @param actorLoader The actor loader to use when retrieve actors needed for
- *                    object creation
- * @param parentMessage The parent message to use when needed for object
- *                      creation
- * @param kernelMessageBuilder The builder to use when constructing kernel
- *                             messages inside objects created
- */
-class FactoryMethods(
-  private val config: Config,
-  private val actorLoader: ActorLoader,
-  private val parentMessage: KernelMessage,
-  private val kernelMessageBuilder: KMBuilder
-) extends FactoryMethodsLike {
-  require(parentMessage != null, "Parent message cannot be null!")
-
-  private[api] val kmBuilder = kernelMessageBuilder.withParent(parentMessage)
-
-  /**
-   * Creates a new kernel input stream.
-   *
-   * @param prompt The text to use as a prompt
-   * @param password If true, should treat input as a password field
-   *
-   * @return The new KernelInputStream instance
-   */
-  override def newKernelInputStream(
-    prompt: String = KernelInputStream.DefaultPrompt,
-    password: Boolean = KernelInputStream.DefaultPassword
-  ): InputStream = {
-    new KernelInputStream(
-      actorLoader,
-      kmBuilder.withIds(parentMessage.ids),
-      prompt = prompt,
-      password = password
-    )
-  }
-
-  /**
-   * Creates a new kernel output stream.
-   *
-   * @param streamType The type of output stream (stdout/stderr)
-   * @param sendEmptyOutput If true, will send message even if output is empty
-   *
-   * @return The new KernelOutputStream instance
-   */
-  override def newKernelOutputStream(
-    streamType: String = KernelOutputStream.DefaultStreamType,
-    sendEmptyOutput: Boolean = config.getBoolean("send_empty_output")
-  ): OutputStream = {
-    new v5.stream.KernelOutputStream(
-      actorLoader,
-      kmBuilder,
-      com.ibm.spark.global.ScheduledTaskManager.instance,
-      streamType = streamType,
-      sendEmptyOutput = sendEmptyOutput
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/api/Kernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/api/Kernel.scala b/kernel/src/main/scala/com/ibm/spark/kernel/api/Kernel.scala
deleted file mode 100644
index 219804a..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/api/Kernel.scala
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.api
-
-import java.io.{OutputStream, InputStream, PrintStream}
-import java.util.concurrent.ConcurrentHashMap
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.boot.layer.InterpreterManager
-import com.ibm.spark.comm.CommManager
-import com.ibm.spark.global
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.MagicParser
-import com.ibm.spark.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
-import com.ibm.spark.magic.{MagicLoader, MagicExecutor}
-import com.ibm.spark.utils.{KeyValuePairUtils, LogLike}
-import com.typesafe.config.Config
-import org.apache.spark.api.java.JavaSparkContext
-import org.apache.spark.sql.SQLContext
-import org.apache.spark.{SparkContext, SparkConf}
-import scala.util.{Try, DynamicVariable}
-
-import scala.reflect.runtime.universe._
-
-import scala.language.dynamics
-import com.ibm.spark.global.ExecuteRequestState
-
-/**
- * Represents the main kernel API to be used for interaction.
- *
- * @param _config The configuration used when starting the kernel
- * @param interpreterManager The interpreter manager to expose in this instance
- * @param comm The Comm manager to expose in this instance
- * @param actorLoader The actor loader to use for message relaying
- */
-@Experimental
-class Kernel (
-  private val _config: Config,
-  private val actorLoader: ActorLoader,
-  val interpreterManager: InterpreterManager,
-  val comm: CommManager,
-  val magicLoader: MagicLoader
-) extends KernelLike with LogLike {
-
-  /**
-   * Represents the current input stream used by the kernel for the specific
-   * thread.
-   */
-  private val currentInputStream =
-    new DynamicVariable[InputStream](null)
-  private val currentInputKernelMessage =
-    new DynamicVariable[KernelMessage](null)
-
-  /**
-   * Represents the current output stream used by the kernel for the specific
-   * thread.
-   */
-  private val currentOutputStream =
-    new DynamicVariable[PrintStream](null)
-  private val currentOutputKernelMessage =
-    new DynamicVariable[KernelMessage](null)
-
-  /**
-   * Represents the current error stream used by the kernel for the specific
-   * thread.
-   */
-  private val currentErrorStream =
-    new DynamicVariable[PrintStream](null)
-  private val currentErrorKernelMessage =
-    new DynamicVariable[KernelMessage](null)
-
-  private var _sparkContext:SparkContext = null;
-  private var _sparkConf:SparkConf = null;
-  private var _javaSparkContext:JavaSparkContext = null;
-  private var _sqlContext:SQLContext = null;
-
-  /**
-   * Represents magics available through the kernel.
-   */
-  val magics = new MagicExecutor(magicLoader)
-
-  /**
-   * Represents magic parsing functionality.
-   */
-  val magicParser = new MagicParser(magicLoader)
-
-  /**
-   * Represents the data that can be shared using the kernel as the middleman.
-   *
-   * @note Using Java structure to enable other languages to have easy access!
-   */
-  val data: java.util.Map[String, Any] = new ConcurrentHashMap[String, Any]()
-
-
-  interpreterManager.initializeInterpreters(this)
-
-  val interpreter = interpreterManager.defaultInterpreter.get
-
-  /**
-   * Handles the output of interpreting code.
-   * @param output the output of the interpreter
-   * @return (success, message) or (failure, message)
-   */
-  private def handleInterpreterOutput(
-    output: (Result, Either[ExecuteOutput, ExecuteFailure])
-  ): (Boolean, String) = {
-    val (success, result) = output
-    success match {
-      case Results.Success =>
-        (true, result.left.getOrElse("").asInstanceOf[String])
-      case Results.Error =>
-        (false, result.right.getOrElse("").toString)
-      case Results.Aborted =>
-        (false, "Aborted!")
-      case Results.Incomplete =>
-        // If we get an incomplete it's most likely a syntax error, so
-        // let the user know.
-        (false, "Syntax Error!")
-    }
-  }
-
-  override def config:Config = {
-    _config
-  }
-
-  /**
-   * Executes a block of code represented as a string and returns the result.
-   *
-   * @param code The code as an option to execute
-   * @return A tuple containing the result (true/false) and the output as a
-   *         string
-   */
-  def eval(code: Option[String]): (Boolean, String) = {
-    code.map(c => {
-      magicParser.parse(c) match {
-        case Left(parsedCode) =>
-          val output = interpreter.interpret(parsedCode)
-          handleInterpreterOutput(output)
-        case Right(errMsg) =>
-          (false, errMsg)
-      }
-    }).getOrElse((false, "Error!"))
-  }
-
-  /**
-   * Constructs a new instance of the stream methods using the latest
-   * kernel message instance.
-   *
-   * @return The collection of stream methods
-   */
-  override def stream: StreamMethods = stream()
-
-  /**
-   * Constructs a new instance of the stream methods using the specified
-   * kernel message instance.
-   *
-   * @param parentMessage The message to serve as the parent of outgoing
-   *                      messages sent as a result of using streaming methods
-   *
-   * @return The collection of streaming methods
-   */
-  private[spark] def stream(
-    parentMessage: v5.KernelMessage = lastKernelMessage()
-  ): StreamMethods = {
-    new StreamMethods(actorLoader, parentMessage)
-  }
-
-  /**
-   * Constructs a new instance of the factory methods using the latest
-   * kernel message instance.
-   *
-   * @return The collection of factory methods
-   */
-  override def factory: FactoryMethods = factory()
-
-  /**
-   * Constructs a new instance of the factory methods using the specified
-   * kernel message and kernel message builder.
-   *
-   * @param parentMessage The message to serve as the parent of outgoing
-   *                      messages sent as a result of using an object created
-   *                      by the factory methods
-   * @param kmBuilder The builder to be used by objects created by factory
-   *                  methods
-   *
-   * @return The collection of factory methods
-   */
-  private[spark] def factory(
-    parentMessage: v5.KernelMessage = lastKernelMessage(),
-    kmBuilder: v5.KMBuilder = v5.KMBuilder()
-  ): FactoryMethods = {
-    new FactoryMethods(_config, actorLoader, parentMessage, kmBuilder)
-  }
-
-  /**
-   * Returns a print stream to be used for communication back to clients
-   * via standard out.
-   *
-   * @return The print stream instance or an error if the stream info is
-   *         not found
-   */
-  override def out: PrintStream = {
-    val kernelMessage = lastKernelMessage()
-
-    constructStream(currentOutputStream, currentOutputKernelMessage, kernelMessage, { kernelMessage =>
-      val outputStream = this.factory(parentMessage = kernelMessage)
-        .newKernelOutputStream("stdout")
-
-      new PrintStream(outputStream)
-    })
-  }
-
-  /**
-   * Returns a print stream to be used for communication back to clients
-   * via standard error.
-   *
-   * @return The print stream instance or an error if the stream info is
-   *         not found
-   */
-  override def err: PrintStream = {
-    val kernelMessage = lastKernelMessage()
-
-    constructStream(currentErrorStream, currentErrorKernelMessage, kernelMessage, { kernelMessage =>
-      val outputStream = this.factory(parentMessage = kernelMessage)
-        .newKernelOutputStream("stderr")
-
-      new PrintStream(outputStream)
-    })
-  }
-
-  /**
-   * Returns an input stream to be used to receive information from the client.
-   *
-   * @return The input stream instance or an error if the stream info is
-   *         not found
-   */
-  override def in: InputStream = {
-    val kernelMessage = lastKernelMessage()
-
-    constructStream(currentInputStream, currentInputKernelMessage, kernelMessage, { kernelMessage =>
-      this.factory(parentMessage = kernelMessage).newKernelInputStream()
-    })
-  }
-
-  /**
-   * Constructs or uses an existing stream.
-   *
-   * @param dynamicStream The DynamicVariable containing the stream to modify
-   *                      or use
-   * @param dynamicKernelMessage The DynamicVariable containing the KernelMessage to
-   *                          check against the new KernelMessage
-   * @param newKernelMessage The potentially-new KernelMessage
-   * @param streamConstructionFunc The function used to create a new stream
-   * @param typeTag The type information associated with the stream
-   * @tparam T The stream type
-   * @return The new stream or existing stream
-   */
-  private def constructStream[T](
-    dynamicStream: DynamicVariable[T],
-    dynamicKernelMessage: DynamicVariable[KernelMessage],
-    newKernelMessage: KernelMessage,
-    streamConstructionFunc: (KernelMessage) => T
-  )(implicit typeTag: TypeTag[T]) = {
-    // Update the stream being used only if the information has changed
-    // or if the stream has not been initialized
-    if (updateKernelMessage(dynamicKernelMessage, newKernelMessage) ||
-      dynamicStream.value == null)
-    {
-      logger.trace("Creating new kernel " + typeTag.tpe.toString + "!")
-      dynamicStream.value = streamConstructionFunc(newKernelMessage)
-    }
-
-    dynamicStream.value
-  }
-
-  /**
-   * Updates the last stream info returning the status of whether or not the
-   * new stream info was different than the last stream info.
-   *
-   * @param dynamicKernelMessage The dynamic variable containing the current
-   *                          stream info
-   * @param kernelMessage The new stream info
-   * @return True if the new stream info is different from the last (therefore
-   *         replaced), otherwise false
-   */
-  private def updateKernelMessage(
-    dynamicKernelMessage: DynamicVariable[KernelMessage],
-    kernelMessage: KernelMessage
-  ): Boolean =
-    if (kernelMessage != null && !kernelMessage.equals(dynamicKernelMessage.value)) {
-      dynamicKernelMessage.value = kernelMessage
-      true
-    } else {
-      false
-    }
-
-  /**
-   * Retrieves the last kernel message received by the kernel.
-   *
-   * @throws IllegalArgumentException If no kernel message has been received
-   *
-   * @return The kernel message instance
-   */
-  private def lastKernelMessage() = {
-    val someKernelMessage = ExecuteRequestState.lastKernelMessage
-    require(someKernelMessage.nonEmpty, "No kernel message received!")
-    someKernelMessage.get
-  }
-
-  override def createSparkContext(conf: SparkConf): SparkContext = {
-    _sparkConf = createSparkConf(conf)
-    _sparkContext = initializeSparkContext(sparkConf)
-    _javaSparkContext = new JavaSparkContext(_sparkContext)
-    _sqlContext = initializeSqlContext(_sparkContext)
-
-    val sparkMaster = _sparkConf.getOption("spark.master").getOrElse("not_set")
-    logger.info( s"Connecting to spark.master $sparkMaster")
-
-    updateInterpreterWithSparkContext(interpreter, sparkContext)
-    updateInterpreterWithSqlContext(interpreter, sqlContext)
-
-    magicLoader.dependencyMap =
-      magicLoader.dependencyMap.setSparkContext(_sparkContext)
-
-    _sparkContext
-  }
-
-  override def createSparkContext(
-    master: String, appName: String
-  ): SparkContext = {
-    createSparkContext(new SparkConf().setMaster(master).setAppName(appName))
-  }
-
-  // TODO: Think of a better way to test without exposing this
-  protected[kernel] def createSparkConf(conf: SparkConf) = {
-
-    logger.info("Setting deployMode to client")
-    conf.set("spark.submit.deployMode", "client")
-
-    KeyValuePairUtils.stringToKeyValuePairSeq(
-      _config.getString("spark_configuration")
-    ).foreach { keyValuePair =>
-      logger.info(s"Setting ${keyValuePair.key} to ${keyValuePair.value}")
-      Try(conf.set(keyValuePair.key, keyValuePair.value))
-    }
-
-    // TODO: Move SparkIMain to private and insert in a different way
-    logger.warn("Locked to Scala interpreter with SparkIMain until decoupled!")
-
-    // TODO: Construct class server outside of SparkIMain
-    logger.warn("Unable to control initialization of REPL class server!")
-    logger.info("REPL Class Server Uri: " + interpreter.classServerURI)
-    conf.set("spark.repl.class.uri", interpreter.classServerURI)
-
-    conf
-  }
-
-  // TODO: Think of a better way to test without exposing this
-  protected[kernel] def initializeSparkContext(sparkConf: SparkConf): SparkContext = {
-
-    logger.debug("Constructing new Spark Context")
-    // TODO: Inject stream redirect headers in Spark dynamically
-    var sparkContext: SparkContext = null
-    val outStream = new KernelOutputStream(
-      actorLoader, KMBuilder(), global.ScheduledTaskManager.instance,
-      sendEmptyOutput = _config.getBoolean("send_empty_output")
-    )
-
-    // Update global stream state and use it to set the Console local variables
-    // for threads in the Spark threadpool
-    global.StreamState.setStreams(System.in, outStream, outStream)
-    global.StreamState.withStreams {
-      sparkContext = new SparkContext(sparkConf)
-    }
-
-    sparkContext
-  }
-
-  // TODO: Think of a better way to test without exposing this
-  protected[kernel] def updateInterpreterWithSparkContext(
-    interpreter: Interpreter, sparkContext: SparkContext
-  ) = {
-
-    interpreter.bindSparkContext(sparkContext)
-  }
-
-  protected[kernel] def initializeSqlContext(
-    sparkContext: SparkContext
-  ): SQLContext = {
-    val sqlContext: SQLContext = try {
-      logger.info("Attempting to create Hive Context")
-      val hiveContextClassString =
-        "org.apache.spark.sql.hive.HiveContext"
-
-      logger.debug(s"Looking up $hiveContextClassString")
-      val hiveContextClass = Class.forName(hiveContextClassString)
-
-      val sparkContextClass = classOf[SparkContext]
-      val sparkContextClassName = sparkContextClass.getName
-
-      logger.debug(s"Searching for constructor taking $sparkContextClassName")
-      val hiveContextContructor =
-        hiveContextClass.getConstructor(sparkContextClass)
-
-      logger.debug("Invoking Hive Context constructor")
-      hiveContextContructor.newInstance(sparkContext).asInstanceOf[SQLContext]
-    } catch {
-      case _: Throwable =>
-        logger.warn("Unable to create Hive Context! Defaulting to SQL Context!")
-        new SQLContext(sparkContext)
-    }
-
-    sqlContext
-  }
-
-  protected[kernel] def updateInterpreterWithSqlContext(
-    interpreter: Interpreter, sqlContext: SQLContext
-  ): Unit = {
-    interpreter.bindSqlContext(sqlContext)
-  }
-
-  override def interpreter(name: String): Option[Interpreter] = {
-    interpreterManager.interpreters.get(name)
-  }
-
-  override def sparkContext: SparkContext = _sparkContext
-  override def sparkConf: SparkConf = _sparkConf
-  override def javaSparkContext: JavaSparkContext = _javaSparkContext
-  override def sqlContext: SQLContext = _sqlContext
-}



[11/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
new file mode 100644
index 0000000..1557460
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
@@ -0,0 +1,123 @@
+package com.ibm.spark.kernel.protocol.v5.magic
+
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.magic.{CellMagicOutput, LineMagicOutput}
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers}
+
+class PostProcessorSpec extends FunSpec with Matchers with MockitoSugar{
+  describe("#matchCellMagic") {
+    it("should return the cell magic output when the Left contains a " +
+       "CellMagicOutput") {
+      val processor = new PostProcessor(mock[Interpreter])
+      val codeOutput = "some output"
+      val cmo = CellMagicOutput()
+      val left = Left(cmo)
+      processor.matchCellMagic(codeOutput, left) should be(cmo)
+    }
+
+    it("should package the original code when the Left does not contain a " +
+       "CellMagicOutput") {
+      val processor = new PostProcessor(mock[Interpreter])
+      val codeOutput = "some output"
+      val left = Left("")
+      val data = Data(MIMEType.PlainText -> codeOutput)
+      processor.matchCellMagic(codeOutput, left) should be(data)
+    }
+  }
+
+  describe("#matchLineMagic") {
+    it("should process the code output when the Right contains a " +
+       "LineMagicOutput") {
+      val processor = spy(new PostProcessor(mock[Interpreter]))
+      val codeOutput = "some output"
+      val lmo = LineMagicOutput
+      val right = Right(lmo)
+      processor.matchLineMagic(codeOutput, right)
+      verify(processor).processLineMagic(codeOutput)
+    }
+
+    it("should package the original code when the Right does not contain a " +
+       "LineMagicOutput") {
+      val processor = new PostProcessor(mock[Interpreter])
+      val codeOutput = "some output"
+      val right = Right("")
+      val data = Data(MIMEType.PlainText -> codeOutput)
+      processor.matchLineMagic(codeOutput, right) should be(data)
+    }
+  }
+
+  describe("#processLineMagic") {
+    it("should remove the result of the magic invocation if it is the last " +
+       "line") {
+      val processor = new PostProcessor(mock[Interpreter])
+      val x = "hello world"
+      val codeOutput = s"$x\nsome other output"
+      val data = Data(MIMEType.PlainText -> x)
+      processor.processLineMagic(codeOutput) should be(data)
+    }
+  }
+
+  describe("#process") {
+    it("should call matchCellMagic when the last variable is a Left") {
+      val intp = mock[Interpreter]
+      val left = Left("")
+      // Need to mock lastExecutionVariableName as it is being chained with
+      // the read method
+      doReturn(Some("")).when(intp).lastExecutionVariableName
+      doReturn(Some(left)).when(intp).read(anyString())
+
+      val processor = spy(new PostProcessor(intp))
+      val codeOutput = "hello"
+      processor.process(codeOutput)
+      verify(processor).matchCellMagic(codeOutput, left)
+    }
+
+    it("should call matchLineMagic when the last variable is a Right") {
+      val intp = mock[Interpreter]
+      val right = Right("")
+      // Need to mock lastExecutionVariableName as it is being chained with
+      // the read method
+      doReturn(Some("")).when(intp).lastExecutionVariableName
+      doReturn(Some(right)).when(intp).read(anyString())
+
+      val processor = spy(new PostProcessor(intp))
+      val codeOutput = "hello"
+      processor.process(codeOutput)
+      verify(processor).matchLineMagic(codeOutput, right)
+    }
+
+    it("should package the original code output when the Left is not a " +
+      "Left[CellMagicOutput, Nothing]") {
+      val intp = mock[Interpreter]
+      val left = Left("")
+      // Need to mock lastExecutionVariableName as it is being chained with
+      // the read method
+      doReturn(Some("")).when(intp).lastExecutionVariableName
+      doReturn(Some(left)).when(intp).read(anyString())
+
+      val processor = spy(new PostProcessor(intp))
+      val codeOutput = "hello"
+      val data = Data(MIMEType.PlainText -> codeOutput)
+      processor.process(codeOutput) should be(data)
+    }
+
+    it("should package the original code output when the Right is not a " +
+       "Right[LineMagicOutput, Nothing]") {
+      val intp = mock[Interpreter]
+      val right = Right("")
+      // Need to mock lastExecutionVariableName as it is being chained with
+      // the read method
+      doReturn(Some("")).when(intp).lastExecutionVariableName
+      doReturn(Some(right)).when(intp).read(anyString())
+
+      val processor = spy(new PostProcessor(intp))
+      val codeOutput = "hello"
+      val data = Data(MIMEType.PlainText -> codeOutput)
+      processor.process(codeOutput) should be(data)
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
new file mode 100644
index 0000000..7adf620
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.relay
+
+import java.io.OutputStream
+
+import akka.actor._
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
+import com.ibm.spark.magic.MagicLoader
+import com.ibm.spark.magic.dependencies.DependencyMap
+import com.typesafe.config.ConfigFactory
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+
+object ExecuteRequestRelaySpec {
+  val config = """
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class ExecuteRequestRelaySpec extends TestKit(
+  ActorSystem(
+    "ExecuteRequestRelayActorSystem",
+    ConfigFactory.parseString(ExecuteRequestRelaySpec.config)
+  )
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  var mockActorLoader: ActorLoader      = _
+  var interpreterActorProbe: TestProbe  = _
+
+  before {
+    mockActorLoader = mock[ActorLoader]
+    interpreterActorProbe = new TestProbe(system)
+    val mockInterpreterActorSelection =
+      system.actorSelection(interpreterActorProbe.ref.path.toString)
+    doReturn(mockInterpreterActorSelection).when(mockActorLoader)
+      .load(SystemActorType.Interpreter)
+  }
+
+  describe("ExecuteRequestRelay") {
+    describe("#receive(KernelMessage)") {
+      it("should handle an abort returned by the InterpreterActor") {
+        val executeRequest =
+          ExecuteRequest("%myMagic", false, true, UserExpressions(), true)
+
+        val mockMagicLoader = mock[MagicLoader]
+        val mockPostProcessor = mock[PostProcessor]
+        val mockDependencyMap = mock[DependencyMap]
+        doReturn(mockDependencyMap).when(mockMagicLoader).dependencyMap
+
+        val mockMagicParser = mock[MagicParser]
+        doReturn(Left(executeRequest.code))
+          .when(mockMagicParser).parse(executeRequest.code)
+
+        val executeRequestRelay = system.actorOf(Props(
+          classOf[ExecuteRequestRelay], mockActorLoader,
+          mockMagicLoader, mockMagicParser, mockPostProcessor
+        ))
+
+        // Send the message to the ExecuteRequestRelay
+        executeRequestRelay !
+          ((executeRequest, mock[KernelMessage], mock[OutputStream]))
+
+        // Expected does not actually match real return of magic, which
+        // is a tuple of ExecuteReply and ExecuteResult
+        val expected = new ExecuteAborted()
+        interpreterActorProbe.expectMsgClass(
+          classOf[(ExecuteRequest, KernelMessage, OutputStream)]
+        )
+
+        // Reply with an error
+        interpreterActorProbe.reply(Right(expected))
+
+        expectMsg(
+          (ExecuteReplyAbort(1), ExecuteResult(1, Data(), Metadata()))
+        )
+      }
+
+      it("should handle an error returned by the InterpreterActor") {
+        val executeRequest =
+          ExecuteRequest("%myMagic", false, true, UserExpressions(), true)
+
+        val mockMagicLoader = mock[MagicLoader]
+        val mockPostProcessor = mock[PostProcessor]
+        val mockDependencyMap = mock[DependencyMap]
+        doReturn(mockDependencyMap).when(mockMagicLoader).dependencyMap
+
+        val mockMagicParser = mock[MagicParser]
+        doReturn(Left(executeRequest.code))
+          .when(mockMagicParser).parse(executeRequest.code)
+
+        val executeRequestRelay = system.actorOf(Props(
+          classOf[ExecuteRequestRelay], mockActorLoader,
+          mockMagicLoader, mockMagicParser, mockPostProcessor
+        ))
+
+        // Send the message to the ExecuteRequestRelay
+        executeRequestRelay !
+          ((executeRequest, mock[KernelMessage], mock[OutputStream]))
+
+        // Expected does not actually match real return of magic, which
+        // is a tuple of ExecuteReply and ExecuteResult
+        val expected = ExecuteError("NAME", "MESSAGE", List())
+        interpreterActorProbe.expectMsgClass(
+          classOf[(ExecuteRequest, KernelMessage, OutputStream)]
+        )
+
+        // Reply with an error
+        interpreterActorProbe.reply(Right(expected))
+
+        expectMsg((
+          ExecuteReplyError(1, Some(expected.name), Some(expected.value),
+            Some(expected.stackTrace.map(_.toString).toList)),
+          ExecuteResult(1, Data("text/plain" -> expected.toString), Metadata())
+        ))
+      }
+
+      it("should return an (ExecuteReply, ExecuteResult) on interpreter " +
+         "success") {
+        val expected = "SOME OTHER VALUE"
+        val executeRequest =
+          ExecuteRequest("notAMagic", false, true, UserExpressions(), true)
+
+        val mockMagicLoader = mock[MagicLoader]
+        val mockPostProcessor = mock[PostProcessor]
+        doReturn(Data(MIMEType.PlainText -> expected))
+          .when(mockPostProcessor).process(expected)
+
+        val mockDependencyMap = mock[DependencyMap]
+        doReturn(mockDependencyMap).when(mockMagicLoader).dependencyMap
+
+        val mockMagicParser = mock[MagicParser]
+        doReturn(Left(executeRequest.code))
+          .when(mockMagicParser).parse(executeRequest.code)
+
+        val executeRequestRelay = system.actorOf(Props(
+          classOf[ExecuteRequestRelay], mockActorLoader,
+          mockMagicLoader, mockMagicParser, mockPostProcessor
+        ))
+
+        // Send the message to the ExecuteRequestRelay
+        executeRequestRelay !
+          ((executeRequest, mock[KernelMessage], mock[OutputStream]))
+
+        // Expected does not actually match real return of interpreter, which
+        // is a tuple of ExecuteReply and ExecuteResult
+        interpreterActorProbe.expectMsgClass(
+          classOf[(ExecuteRequest, KernelMessage, OutputStream)]
+        )
+
+        // Reply with a successful interpret
+        interpreterActorProbe.reply(Left(expected))
+
+        expectMsg((
+          ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
+          ExecuteResult(1, Data(MIMEType.PlainText -> expected), Metadata())
+        ))
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
new file mode 100644
index 0000000..63fa50c
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.relay
+
+import akka.actor._
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.communication.security.SecurityActorType
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import Utilities._
+import org.mockito.Mockito._
+import org.scalatest.concurrent.{PatienceConfiguration, ScalaFutures}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.time.{Millis, Seconds, Span}
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import org.mockito.Matchers.{eq => mockEq}
+import org.mockito.AdditionalMatchers.{not => mockNot}
+import scala.concurrent.duration._
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import scala.concurrent._
+import akka.pattern.pipe
+import scala.util.Random
+import ExecutionContext.Implicits.global
+
+class KernelMessageRelaySpec extends TestKit(ActorSystem("RelayActorSystem"))
+  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter with ScalaFutures {
+  private val IncomingMessageType = MessageType.Incoming.CompleteRequest.toString
+  private val OutgoingMessageType = MessageType.Outgoing.CompleteReply.toString
+
+  private val header: Header = Header("<UUID>", "<USER>", "<SESSION>",
+    "<TYPE>", "<VERSION>")
+  private val parentHeader: Header = Header("<PARENT-UUID>", "<PARENT-USER>",
+    "<PARENT-SESSION>", "<PARENT-TYPE>", "<PARENT-VERSION>")
+  private val incomingKernelMessage: KernelMessage = KernelMessage(Seq("<ID>"),
+    "<SIGNATURE>", header.copy(msg_type = IncomingMessageType),
+    parentHeader, Metadata(), "<CONTENT>")
+  private val outgoingKernelMessage: KernelMessage = KernelMessage(Seq("<ID>"),
+    "<SIGNATURE>", header.copy(msg_type = OutgoingMessageType),
+    incomingKernelMessage.header, Metadata(), "<CONTENT>")
+  private val incomingZmqStrings = "1" :: "2" :: "3" :: "4" :: Nil
+
+  private var actorLoader: ActorLoader = _
+  private var signatureProbe: TestProbe = _
+  private var signatureSelection: ActorSelection = _
+  private var captureProbe: TestProbe = _
+  private var captureSelection: ActorSelection = _
+  private var handlerProbe: TestProbe = _
+  private var handlerSelection: ActorSelection = _
+  private var relayWithoutSignatureManager: ActorRef = _
+  private var relayWithSignatureManager: ActorRef = _
+
+  before {
+    // Create a mock ActorLoader for the Relay we are going to test
+    actorLoader = mock[ActorLoader]
+
+    // Create a probe for the signature manager and mock the ActorLoader to
+    // return the associated ActorSelection
+    signatureProbe = TestProbe()
+    signatureSelection = system.actorSelection(signatureProbe.ref.path.toString)
+    when(actorLoader.load(SecurityActorType.SignatureManager))
+      .thenReturn(signatureSelection)
+
+    // Create a probe to capture output from the relay for testing
+    captureProbe = TestProbe()
+    captureSelection = system.actorSelection(captureProbe.ref.path.toString)
+    when(actorLoader.load(mockNot(mockEq(SecurityActorType.SignatureManager))))
+      .thenReturn(captureSelection)
+
+    relayWithoutSignatureManager = system.actorOf(Props(
+      classOf[KernelMessageRelay], actorLoader, false,
+      mock[Map[String, String]], mock[Map[String, String]]
+    ))
+
+    relayWithSignatureManager = system.actorOf(Props(
+      classOf[KernelMessageRelay], actorLoader, true,
+      mock[Map[String, String]], mock[Map[String, String]]
+    ))
+  }
+
+  describe("Relay") {
+    describe("#receive") {
+      describe("when not using the signature manager") {
+        it("should not send anything to SignatureManager for incoming") {
+          relayWithoutSignatureManager ! true // Mark as ready for incoming
+          relayWithoutSignatureManager ! incomingKernelMessage
+          signatureProbe.expectNoMsg(25.millis)
+        }
+
+        it("should not send anything to SignatureManager for outgoing") {
+          relayWithoutSignatureManager ! outgoingKernelMessage
+          signatureProbe.expectNoMsg(25.millis)
+        }
+
+        it("should relay KernelMessage for incoming") {
+          relayWithoutSignatureManager ! true // Mark as ready for incoming
+          relayWithoutSignatureManager !
+            ((incomingZmqStrings, incomingKernelMessage))
+          captureProbe.expectMsg(incomingKernelMessage)
+        }
+
+        it("should relay KernelMessage for outgoing") {
+          relayWithoutSignatureManager ! outgoingKernelMessage
+          captureProbe.expectMsg(outgoingKernelMessage)
+        }
+      }
+
+      describe("when using the signature manager") {
+        it("should verify the signature if the message is incoming") {
+          relayWithSignatureManager ! true // Mark as ready for incoming
+          relayWithSignatureManager ! incomingKernelMessage
+          signatureProbe.expectMsg(incomingKernelMessage)
+        }
+
+        it("should construct the signature if the message is outgoing") {
+          relayWithSignatureManager ! outgoingKernelMessage
+          signatureProbe.expectMsg(outgoingKernelMessage)
+        }
+      }
+
+      describe("when not ready") {
+        it("should not relay the message if it is incoming") {
+          val incomingMessage: ZMQMessage = incomingKernelMessage
+
+          relayWithoutSignatureManager ! incomingMessage
+          captureProbe.expectNoMsg(25.millis)
+        }
+
+        it("should relay the message if it is outgoing") {
+          relayWithoutSignatureManager ! outgoingKernelMessage
+          captureProbe.expectMsg(outgoingKernelMessage)
+        }
+      }
+
+      describe("when ready") {
+        it("should relay the message if it is incoming") {
+          relayWithoutSignatureManager ! true // Mark as ready for incoming
+          relayWithoutSignatureManager !
+            ((incomingZmqStrings, incomingKernelMessage))
+          captureProbe.expectMsg(incomingKernelMessage)
+        }
+
+        it("should relay the message if it is outgoing") {
+          relayWithoutSignatureManager ! true // Mark as ready for incoming
+          relayWithoutSignatureManager ! outgoingKernelMessage
+          captureProbe.expectMsg(outgoingKernelMessage)
+        }
+      }
+
+      describe("multiple messages in order"){
+        it("should relay messages in the order they were received") {
+          //  Setup the base actor system and the relay
+          val actorLoader = mock[ActorLoader]
+          val kernelMessageRelay = system.actorOf(Props(
+            classOf[KernelMessageRelay], actorLoader, true,
+            mock[Map[String, String]], mock[Map[String, String]]
+          ))
+          //  Where all of the messages are relayed to, otherwise NPE
+          val captureProbe = TestProbe()
+          val captureSelection = system.actorSelection(captureProbe.ref.path.toString)
+          when(actorLoader.load(MessageType.Incoming.CompleteRequest))
+            .thenReturn(captureSelection)
+
+
+          val n = 5
+          val chaoticPromise: Promise[String] = Promise()
+          var actual : List[String] = List()
+          val expected = (0 until n).map(_.toString).toList
+
+          // setup a ChaoticActor to accumulate message values
+          // A promise succeeds after n messages have been accumulated
+          val chaoticActor: ActorRef = system.actorOf(Props(
+            classOf[ChaoticActor[Boolean]],
+            (paramVal: Any) => {
+              val tuple = paramVal.asInstanceOf[(String, Seq[_])]
+              actual = actual :+ tuple._1
+              if (actual.length == n) chaoticPromise.success("Done")
+              true
+            }
+          ))
+
+          when(actorLoader.load(SecurityActorType.SignatureManager))
+            .thenReturn(system.actorSelection(chaoticActor.path))
+
+          kernelMessageRelay ! true
+
+          // Sends messages with contents = to values of increasing counter
+          sendKernelMessages(n, kernelMessageRelay)
+          // Message values should be accumulated in the proper order
+          whenReady(chaoticPromise.future,
+            PatienceConfiguration.Timeout(Span(3, Seconds)),
+            PatienceConfiguration.Interval(Span(100, Millis))) {
+            case _: String =>
+              actual should be(expected)
+          }
+
+        }
+      }
+    }
+  }
+  def sendKernelMessages(n: Int, kernelMessageRelay: ActorRef): Unit ={
+    // Sends n messages to the relay
+    (0 until n).foreach (i => {
+      val km = KernelMessage(Seq("<ID>"), s"${i}",
+        header.copy(msg_type = IncomingMessageType), parentHeader,
+        Metadata(), s"${i}")
+      kernelMessageRelay ! Tuple2(Seq("SomeString"), km)
+    })
+
+  }
+}
+
+
+case class ChaoticActor[U](receiveFunc : Any => U) extends Actor {
+  override def receive: Receive = {
+    case fVal: Any =>
+      //  The test actor system runs the actors on a single thread, so we must
+      //  simulate asynchronous behaviour by staring a new thread
+      val promise = Promise[U]()
+      promise.future pipeTo sender
+      new Thread(new Runnable {
+        override def run(): Unit = {
+          Thread.sleep(Random.nextInt(30) * 10)
+          promise.success(receiveFunc(fVal))
+        }
+      }).start()
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
new file mode 100644
index 0000000..5d06cb6
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.stream
+
+import akka.actor.{ActorRef, Actor, ActorSystem}
+import akka.testkit.{TestActorRef, TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.InputRequest
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.mockito.Mockito._
+import org.scalatest._
+import org.scalatest.mock.MockitoSugar
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+
+class KernelInputStreamSpec
+  extends TestKit(ActorSystem("KernelInputStreamActorSystem"))
+  with FunSpecLike with Matchers with GivenWhenThen with BeforeAndAfter
+  with MockitoSugar
+{
+
+  private var mockActorLoader: ActorLoader = _
+  private var mockKMBuilder: KMBuilder = _
+  private var kernelInputOutputHandlerProbe: TestProbe = _
+  private var kernelInputStream: KernelInputStream = _
+  private var fakeInputOutputHandlerActor: ActorRef = _
+
+  private val TestReplyString = "some reply"
+
+  before {
+    mockActorLoader = mock[ActorLoader]
+    mockKMBuilder = KMBuilder() // No need to really mock this
+
+    kernelInputStream = new KernelInputStream(mockActorLoader, mockKMBuilder)
+
+    kernelInputOutputHandlerProbe = TestProbe()
+    fakeInputOutputHandlerActor = TestActorRef(new Actor {
+      override def receive: Receive = {
+        // Handle case for getting an input_request
+        case kernelMessage: KernelMessage =>
+          val messageType = kernelMessage.header.msg_type
+          kernelInputOutputHandlerProbe.ref ! kernelMessage
+          if (messageType == MessageType.Outgoing.InputRequest.toString)
+            sender ! TestReplyString
+      }
+    })
+
+    // Add the actor that routes to our test probe and responds with a fake
+    // set of data
+    doReturn(system.actorSelection(fakeInputOutputHandlerActor.path.toString))
+      .when(mockActorLoader).load(MessageType.Incoming.InputReply)
+  }
+
+  describe("KernelInputStream") {
+    describe("#available") {
+      it("should be zero when no input has been read") {
+        kernelInputStream.available() should be (0)
+      }
+
+      it("should match the bytes remaining internally") {
+        kernelInputStream.read()
+
+        kernelInputStream.available() should be (TestReplyString.length - 1)
+      }
+    }
+
+    describe("#read") {
+      it("should send a request for more data if the buffer is empty") {
+        // Fresh input stream has nothing in its buffer
+        kernelInputStream.read()
+
+        // Verify that a message was sent out requesting data
+        kernelInputOutputHandlerProbe.expectMsgPF() {
+          case KernelMessage(_, _, header, _, _, _)
+            if header.msg_type == MessageType.Outgoing.InputRequest.toString =>
+              true
+        }
+      }
+
+      it("should use the provided prompt in its requests") {
+        val expected = KernelInputStream.DefaultPrompt
+
+        // Fresh input stream has nothing in its buffer
+        kernelInputStream.read()
+
+        // Verify that a message was sent out requesting data with the
+        // specific prompt
+        kernelInputOutputHandlerProbe.expectMsgPF() {
+          case KernelMessage(_, _, header, _, _, contentString)
+            if header.msg_type == MessageType.Outgoing.InputRequest.toString =>
+            Json.parse(contentString).as[InputRequest].prompt should be (expected)
+        }
+      }
+
+      it("should use the provided password flag in its requests") {
+        val expected = KernelInputStream.DefaultPassword
+
+        // Fresh input stream has nothing in its buffer
+        kernelInputStream.read()
+
+        // Verify that a message was sent out requesting data with the
+        // specific prompt
+        kernelInputOutputHandlerProbe.expectMsgPF() {
+          case KernelMessage(_, _, header, _, _, contentString)
+            if header.msg_type == MessageType.Outgoing.InputRequest.toString =>
+            Json.parse(contentString).as[InputRequest].password should be (expected)
+        }
+      }
+
+      it("should return the next byte from the current buffer") {
+        kernelInputStream.read() should be (TestReplyString.head)
+      }
+
+      it("should not send a request for more data if data is in the buffer") {
+        // Run read for length of message (avoiding sending out a second
+        // request)
+        val readLength = TestReplyString.length
+
+        for (i <- 1 to readLength)
+          kernelInputStream.read() should be (TestReplyString.charAt(i - 1))
+
+        kernelInputOutputHandlerProbe.expectMsgClass(classOf[KernelMessage])
+        kernelInputOutputHandlerProbe.expectNoMsg(300.milliseconds)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
new file mode 100644
index 0000000..cb4f158
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
@@ -0,0 +1,283 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.stream
+
+import java.util.UUID
+
+import akka.actor.{ActorSelection, ActorSystem}
+import akka.testkit.{TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.utils.ScheduledTaskManager
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest._
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5.content.StreamContent
+
+import scala.concurrent.duration._
+
+class KernelOuputStreamSpec
+  extends TestKit(ActorSystem("KernelOutputStreamActorSystem"))
+  with FunSpecLike with Matchers with GivenWhenThen with BeforeAndAfter
+  with MockitoSugar
+{
+
+  private var mockActorLoader: ActorLoader = _
+  private var mockScheduledTaskManager: MockScheduledTaskManager = _
+  private var kernelOutputRelayProbe: TestProbe = _
+
+  //
+  // SHARED ELEMENTS BETWEEN TESTS
+  //
+
+  private val ExecutionCount = 3
+
+  private val MaxMessageTimeout = 1.second
+  private val MaxNoMessageTimeout = 200.milliseconds
+
+  private val GeneratedTaskId = UUID.randomUUID().toString
+
+  private val skeletonBuilder = KMBuilder()
+    .withIds(Nil).withSignature("").withContentString("")
+    .withParentHeader(Header("", "", "", "", "5.0"))
+
+  /**
+   * This stubs out the methods of the scheduled task manager and provides a
+   * form of verification, which is not (easily) doable with Mockito due to the
+   * call-by-name argument in addTask.
+   */
+  private class MockScheduledTaskManager extends ScheduledTaskManager {
+    private var addTaskCalled = false
+    private var removeTaskCalled = false
+    private var stopCalled = false
+
+    def verifyAddTaskCalled(): Unit = addTaskCalled should be (true)
+    def verifyRemoveTaskCalled(): Unit = removeTaskCalled should be (true)
+    def verifyStopCalled(): Unit = stopCalled should be (true)
+    def verifyAddTaskNotCalled(): Unit = addTaskCalled should be (false)
+    def verifyRemoveTaskNotCalled(): Unit = removeTaskCalled should be (false)
+    def verifyStopNotCalled(): Unit = stopCalled should be (false)
+    def resetVerify(): Unit = {
+      addTaskCalled = false
+      removeTaskCalled = false
+      stopCalled = false
+    }
+
+    override def addTask[T](executionDelay: Long, timeInterval: Long, task: => T): String =
+    { addTaskCalled = true; GeneratedTaskId }
+
+    override def removeTask(taskId: String): Boolean =
+    { removeTaskCalled = true; true }
+
+    override def stop(): Unit = stopCalled = true
+
+    def teardown(): Unit = super.stop()
+  }
+
+  before {
+    // Create a mock ActorLoader for the KernelOutputStream we are testing
+    mockActorLoader = mock[ActorLoader]
+
+    mockScheduledTaskManager = new MockScheduledTaskManager
+
+    // Create a probe for the relay and mock the ActorLoader to return the
+    // associated ActorSelection
+    kernelOutputRelayProbe = TestProbe()
+    val kernelOutputRelaySelection: ActorSelection =
+      system.actorSelection(kernelOutputRelayProbe.ref.path.toString)
+    doReturn(kernelOutputRelaySelection)
+      .when(mockActorLoader).load(SystemActorType.KernelMessageRelay)
+  }
+
+  after {
+    mockScheduledTaskManager.teardown()
+  }
+
+  describe("KernelOutputStream") {
+    describe("#write(Int)") {
+      it("should add a new byte to the internal list") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("a byte is written to the stream")
+        val expected = 'a'
+        kernelOutputStream.write(expected)
+
+        Then("it should be appended to the internal list")
+        kernelOutputStream.flush()
+        val message = kernelOutputRelayProbe
+          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
+        val executeResult = Json.parse(message.contentString).as[StreamContent]
+        executeResult.text should be (expected.toString)
+      }
+
+      it("should enable periodic flushing") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("a byte is written to the stream")
+        val expected = 'a'
+        kernelOutputStream.write(expected)
+
+        Then("it should add a task to periodically flush")
+        mockScheduledTaskManager.verifyAddTaskCalled()
+      }
+
+      it("should not enable periodic flushing if already enabled") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        And("periodic flushing is already enabled")
+        kernelOutputStream.write('a')
+        mockScheduledTaskManager.verifyAddTaskCalled()
+        mockScheduledTaskManager.resetVerify()
+
+        When("a byte is written to the stream")
+        kernelOutputStream.write('b')
+
+        Then("it should not add a task to periodically flush")
+        mockScheduledTaskManager.verifyAddTaskNotCalled()
+      }
+    }
+    describe("#flush") {
+      it("should disable periodic flushing") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("a byte is written to the stream")
+        val expected = 'a'
+        kernelOutputStream.write(expected)
+
+        And("flush is invoked")
+        kernelOutputStream.flush()
+
+        Then("it should remove the task to periodically flush")
+        mockScheduledTaskManager.verifyRemoveTaskCalled()
+      }
+
+      it("should not disable periodic flushing if not enabled") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("flush is invoked")
+        kernelOutputStream.flush()
+
+        Then("it should not remove the task to periodically flush")
+        mockScheduledTaskManager.verifyRemoveTaskNotCalled()
+      }
+
+      it("should not send empty (whitespace) messages if flag is false") {
+        Given("a kernel output stream with send empty output set to false")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager,
+          sendEmptyOutput = false
+        )
+
+        When("whitespace is created and flushed")
+        val expected = "\r \r \n \t"
+        kernelOutputStream.write(expected.getBytes)
+        kernelOutputStream.flush()
+
+        Then("no message should be sent")
+        kernelOutputRelayProbe.expectNoMsg(MaxNoMessageTimeout)
+      }
+
+      it("should send empty (whitespace) messages if flag is true") {
+        Given("a kernel output stream with send empty output set to false")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager,
+          sendEmptyOutput = true
+        )
+
+        When("whitespace is created and flushed")
+        val expected = "\r \r \n \t"
+        kernelOutputStream.write(expected.getBytes)
+        kernelOutputStream.flush()
+
+        Then("the whitespace message should have been sent")
+        val message = kernelOutputRelayProbe
+          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
+        val actual = Json.parse(message.contentString).as[StreamContent].text
+
+        actual should be (expected)
+      }
+
+      it("should set the ids of the kernel message") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("a string is written as the result and flushed")
+        val expected = "some string"
+        kernelOutputStream.write(expected.getBytes)
+        kernelOutputStream.flush()
+
+        Then("the ids should be set to execute_result")
+        val message = kernelOutputRelayProbe
+          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
+        message.ids should be (Seq(MessageType.Outgoing.Stream.toString))
+      }
+
+      it("should set the message type in the header of the kernel message to an execute_result") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("a string is written as the result and flushed")
+        val expected = "some string"
+        kernelOutputStream.write(expected.getBytes)
+        kernelOutputStream.flush()
+
+        Then("the msg_type in the header should be execute_result")
+        val message = kernelOutputRelayProbe
+          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
+        message.header.msg_type should be (MessageType.Outgoing.Stream.toString)
+      }
+
+      it("should set the content string of the kernel message") {
+        Given("a kernel output stream with a skeleton kernel builder")
+        val kernelOutputStream = new KernelOutputStream(
+          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
+        )
+
+        When("a string is written as the result and flushed")
+        val expected = "some string"
+        kernelOutputStream.write(expected.getBytes)
+        kernelOutputStream.flush()
+
+        Then("the content string should have text/plain set to the string")
+        val message = kernelOutputRelayProbe
+          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
+        val executeResult = Json.parse(message.contentString).as[StreamContent]
+        executeResult.text should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
new file mode 100644
index 0000000..956088c
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.{ByteArrayOutputStream, OutputStream}
+import java.net.URL
+
+import com.ibm.spark.dependencies.DependencyDownloader
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.utils.ArgumentParsingSupport
+import org.apache.spark.SparkContext
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{GivenWhenThen, Matchers, FunSpec}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+import com.ibm.spark.magic._
+import com.ibm.spark.magic.dependencies._
+
+class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
+  with GivenWhenThen
+{
+  describe("AddDeps"){
+    describe("#execute") {
+      it("should print out the help message if the input is invalid") {
+        val byteArrayOutputStream = new ByteArrayOutputStream()
+        val mockIntp = mock[Interpreter]
+        val mockSC = mock[SparkContext]
+        val mockDownloader = mock[DependencyDownloader]
+        var printHelpWasRun = false
+
+        val addDepsMagic = new AddDeps
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeDependencyDownloader
+          with ArgumentParsingSupport
+        {
+          override val sparkContext: SparkContext = mockSC
+          override val interpreter: Interpreter = mockIntp
+          override val dependencyDownloader: DependencyDownloader =
+            mockDownloader
+          override val outputStream: OutputStream = byteArrayOutputStream
+
+          override def printHelp(
+            outputStream: OutputStream, usage: String
+          ): Unit = printHelpWasRun = true
+        }
+
+        val expected = LineMagicOutput
+        val actual = addDepsMagic.execute("notvalid")
+
+        printHelpWasRun should be (true)
+        verify(mockIntp, times(0)).addJars(any())
+        verify(mockIntp, times(0)).bind(any(), any(), any(), any())
+        verify(mockSC, times(0)).addJar(any())
+        verify(mockDownloader, times(0)).retrieve(
+          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
+        actual should be (expected)
+      }
+
+      it("should set the retrievals transitive to true if provided") {
+        val mockDependencyDownloader = mock[DependencyDownloader]
+        doReturn(Nil).when(mockDependencyDownloader).retrieve(
+          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
+
+        val addDepsMagic = new AddDeps
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeDependencyDownloader
+          with ArgumentParsingSupport
+        {
+          override val sparkContext: SparkContext = mock[SparkContext]
+          override val interpreter: Interpreter = mock[Interpreter]
+          override val dependencyDownloader: DependencyDownloader =
+            mockDependencyDownloader
+          override val outputStream: OutputStream = mock[OutputStream]
+        }
+
+        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: "--transitive" :: Nil
+        addDepsMagic.execute(expected.mkString(" "))
+
+        verify(mockDependencyDownloader).retrieve(
+          expected(0), expected(1), expected(2), true)
+      }
+
+      it("should set the retrieval's transitive to false if not provided") {
+        val mockDependencyDownloader = mock[DependencyDownloader]
+        doReturn(Nil).when(mockDependencyDownloader).retrieve(
+          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
+
+        val addDepsMagic = new AddDeps
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeDependencyDownloader
+          with ArgumentParsingSupport
+        {
+          override val sparkContext: SparkContext = mock[SparkContext]
+          override val interpreter: Interpreter = mock[Interpreter]
+          override val dependencyDownloader: DependencyDownloader =
+            mockDependencyDownloader
+          override val outputStream: OutputStream = mock[OutputStream]
+        }
+
+        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
+        addDepsMagic.execute(expected.mkString(" "))
+
+        verify(mockDependencyDownloader).retrieve(
+          expected(0), expected(1), expected(2), false)
+      }
+
+      it("should add retrieved artifacts to the interpreter") {
+        val mockDependencyDownloader = mock[DependencyDownloader]
+        doReturn(Nil).when(mockDependencyDownloader).retrieve(
+          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
+        val mockInterpreter = mock[Interpreter]
+
+        val addDepsMagic = new AddDeps
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeDependencyDownloader
+          with ArgumentParsingSupport
+        {
+          override val sparkContext: SparkContext = mock[SparkContext]
+          override val interpreter: Interpreter = mockInterpreter
+          override val dependencyDownloader: DependencyDownloader =
+            mockDependencyDownloader
+          override val outputStream: OutputStream = mock[OutputStream]
+        }
+
+        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
+        addDepsMagic.execute(expected.mkString(" "))
+
+        verify(mockInterpreter).addJars(any[URL])
+      }
+
+      it("should add retrieved artifacts to the spark context") {
+        val mockDependencyDownloader = mock[DependencyDownloader]
+        val fakeUrl = new URL("file:/foo")
+        doReturn(fakeUrl :: fakeUrl :: fakeUrl :: Nil)
+          .when(mockDependencyDownloader).retrieve(
+            anyString(), anyString(), anyString(), anyBoolean(), anyBoolean()
+          )
+        val mockSparkContext = mock[SparkContext]
+
+        val addDepsMagic = new AddDeps
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeDependencyDownloader
+          with ArgumentParsingSupport
+        {
+          override val sparkContext: SparkContext = mockSparkContext
+          override val interpreter: Interpreter = mock[Interpreter]
+          override val dependencyDownloader: DependencyDownloader =
+            mockDependencyDownloader
+          override val outputStream: OutputStream = mock[OutputStream]
+        }
+
+        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
+        addDepsMagic.execute(expected.mkString(" "))
+
+        verify(mockSparkContext, times(3)).addJar(anyString())
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
new file mode 100644
index 0000000..5612c8a
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import java.io.OutputStream
+import java.net.URL
+import java.nio.file.{FileSystems, Files}
+
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.magic.dependencies.{IncludeConfig, IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
+import com.typesafe.config.ConfigFactory
+import org.apache.spark.SparkContext
+import org.scalatest.{Matchers, FunSpec}
+import org.scalatest.mock.MockitoSugar
+
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import com.ibm.spark.magic.MagicLoader
+
+class AddJarSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("AddJar"){
+    describe("#execute") {
+      it("should call addJar on the provided SparkContext and addJars on the " +
+         "provided interpreter") {
+        val mockSparkContext = mock[SparkContext]
+        val mockInterpreter = mock[Interpreter]
+        val mockOutputStream = mock[OutputStream]
+        val mockMagicLoader = mock[MagicLoader]
+        val testConfig = ConfigFactory.load()
+
+        val addJarMagic = new AddJar
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeConfig
+        {
+          override val sparkContext: SparkContext = mockSparkContext
+          override val interpreter: Interpreter = mockInterpreter
+          override val outputStream: OutputStream = mockOutputStream
+          override lazy val magicLoader: MagicLoader = mockMagicLoader
+          override val config = testConfig
+          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL =
+            new URL("file://someFile") // Cannot mock URL
+        }
+
+        addJarMagic.execute("""http://www.example.com/someJar.jar""")
+
+        verify(mockSparkContext).addJar(anyString())
+        verify(mockInterpreter).addJars(any[URL])
+        verify(mockMagicLoader, times(0)).addJar(any())
+      }
+
+      it("should raise exception if jar file does not end in .jar or .zip") {
+        val mockOutputStream = mock[OutputStream]
+
+        val addJarMagic = new AddJar
+          with IncludeOutputStream
+        {
+          override val outputStream: OutputStream = mockOutputStream
+        }
+
+        intercept[IllegalArgumentException] {
+          addJarMagic.execute("""http://www.example.com/""")
+        }
+        intercept[IllegalArgumentException] {
+          addJarMagic.execute("""http://www.example.com/not_a_jar""")
+        }
+      }
+
+      it("should extract jar file name from jar URL") {
+        val mockOutputStream = mock[OutputStream]
+
+        val addJarMagic = new AddJar
+          with IncludeOutputStream
+        {
+          override val outputStream: OutputStream = mockOutputStream
+        }
+
+        var url = """http://www.example.com/someJar.jar"""
+        var jarName = addJarMagic.getFileFromLocation(url)
+        assert(jarName == "someJar.jar")
+
+        url = """http://www.example.com/remotecontent?filepath=/path/to/someJar.jar"""
+        jarName = addJarMagic.getFileFromLocation(url)
+        assert(jarName == "someJar.jar")
+
+        url = """http://www.example.com/"""
+        jarName = addJarMagic.getFileFromLocation(url)
+        assert(jarName == "")
+      }
+
+      it("should use a cached jar if the force option is not provided") {
+        val mockSparkContext = mock[SparkContext]
+        val mockInterpreter = mock[Interpreter]
+        val mockOutputStream = mock[OutputStream]
+        var downloadFileCalled = false  // Used to verify that downloadFile
+                                        // was or was not called in this test
+        val testConfig = ConfigFactory.load()
+
+        val addJarMagic = new AddJar
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeConfig
+        {
+          override val sparkContext: SparkContext = mockSparkContext
+          override val interpreter: Interpreter = mockInterpreter
+          override val outputStream: OutputStream = mockOutputStream
+          override val config = testConfig
+          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL = {
+            downloadFileCalled = true
+            new URL("file://someFile") // Cannot mock URL
+          }
+        }
+
+        // Create a temporary file representing our jar to fake the cache
+        val tmpFilePath = Files.createTempFile(
+          FileSystems.getDefault.getPath(AddJar.getJarDir(testConfig)),
+          "someJar",
+          ".jar"
+        )
+
+        addJarMagic.execute(
+          """http://www.example.com/""" + tmpFilePath.getFileName)
+
+        tmpFilePath.toFile.delete()
+
+        downloadFileCalled should be (false)
+        verify(mockSparkContext).addJar(anyString())
+        verify(mockInterpreter).addJars(any[URL])
+      }
+
+      it("should not use a cached jar if the force option is provided") {
+        val mockSparkContext = mock[SparkContext]
+        val mockInterpreter = mock[Interpreter]
+        val mockOutputStream = mock[OutputStream]
+        var downloadFileCalled = false  // Used to verify that downloadFile
+                                        // was or was not called in this test
+        val testConfig = ConfigFactory.load()
+
+        val addJarMagic = new AddJar
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeConfig
+        {
+          override val sparkContext: SparkContext = mockSparkContext
+          override val interpreter: Interpreter = mockInterpreter
+          override val outputStream: OutputStream = mockOutputStream
+          override val config = testConfig
+          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL = {
+            downloadFileCalled = true
+            new URL("file://someFile") // Cannot mock URL
+          }
+        }
+
+        // Create a temporary file representing our jar to fake the cache
+        val tmpFilePath = Files.createTempFile(
+          FileSystems.getDefault.getPath(AddJar.getJarDir(testConfig)),
+          "someJar",
+          ".jar"
+        )
+
+        addJarMagic.execute(
+          """-f http://www.example.com/""" + tmpFilePath.getFileName)
+
+        tmpFilePath.toFile.delete()
+
+        downloadFileCalled should be (true)
+        verify(mockSparkContext).addJar(anyString())
+        verify(mockInterpreter).addJars(any[URL])
+      }
+
+      it("should add magic jar to magicloader and not to interpreter and spark"+
+         "context") {
+        val mockSparkContext = mock[SparkContext]
+        val mockInterpreter = mock[Interpreter]
+        val mockOutputStream = mock[OutputStream]
+        val mockMagicLoader = mock[MagicLoader]
+        val testConfig = ConfigFactory.load()
+
+        val addJarMagic = new AddJar
+          with IncludeSparkContext
+          with IncludeInterpreter
+          with IncludeOutputStream
+          with IncludeConfig
+        {
+          override val sparkContext: SparkContext = mockSparkContext
+          override val interpreter: Interpreter = mockInterpreter
+          override val outputStream: OutputStream = mockOutputStream
+          override lazy val magicLoader: MagicLoader = mockMagicLoader
+          override val config = testConfig
+          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL =
+            new URL("file://someFile") // Cannot mock URL
+        }
+
+        addJarMagic.execute(
+          """--magic http://www.example.com/someJar.jar""")
+
+        verify(mockMagicLoader).addJar(any())
+        verify(mockSparkContext, times(0)).addJar(anyString())
+        verify(mockInterpreter, times(0)).addJars(any[URL])
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
new file mode 100644
index 0000000..d2abde7
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpec}
+
+class BuiltinLoaderSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("BuiltinLoader") {
+    describe("#getClasses") {
+      it("should return classes in a package") {
+        val pkg = this.getClass.getPackage.getName
+        val classes = new BuiltinLoader().getClasses(pkg)
+        classes.size shouldNot be(0)
+      }
+    }
+
+    describe("#loadClasses") {
+      it("should return class objects for classes in a package") {
+        val pkg = this.getClass.getPackage.getName
+        val classes = new BuiltinLoader().loadClasses(pkg).toList
+        classes.contains(this.getClass) should be (true)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
new file mode 100644
index 0000000..541cfcd
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic.CellMagicOutput
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers}
+
+class HtmlSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("Html"){
+    describe("#execute") {
+      it("should return the entire cell's contents with the MIME type of " +
+         "text/html") {
+        val htmlMagic = new Html
+
+        val code = "some code on a line\nanother line"
+        val expected = CellMagicOutput(MIMEType.TextHtml -> code)
+        htmlMagic.execute(code) should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
new file mode 100644
index 0000000..33dfbd5
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers}
+import com.ibm.spark.magic.CellMagicOutput
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+
+class JavaScriptSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("JavaScript"){
+    describe("#execute") {
+      it("should return the entire cell's contents with the MIME type of text/javascript") {
+        val javaScriptMagic = new JavaScript
+
+        val code = "some code on a line\nmore code on another line"
+        val expected = CellMagicOutput(MIMEType.ApplicationJavaScript -> code)
+        javaScriptMagic.execute(code) should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
new file mode 100644
index 0000000..60b4a6a
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
@@ -0,0 +1,65 @@
+package com.ibm.spark.magic.builtin
+
+import java.io.OutputStream
+import java.net.URL
+
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.magic.dependencies.{IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
+import com.ibm.spark.magic.{CellMagic, LineMagic}
+import org.apache.spark.SparkContext
+import org.scalatest.{Matchers, FunSpec}
+import org.scalatest.mock.MockitoSugar
+
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+class TestLSMagic(sc: SparkContext, intp: Interpreter, os: OutputStream)
+  extends LSMagic
+  with IncludeSparkContext
+  with IncludeInterpreter
+  with IncludeOutputStream
+  {
+    override val sparkContext: SparkContext = sc
+    override val interpreter: Interpreter = intp
+    override val outputStream: OutputStream = os
+  }
+
+class LSMagicSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("LSMagic") {
+
+    describe("#execute") {
+      it("should call println with a magics message") {
+        val lsm = spy(new TestLSMagic(
+          mock[SparkContext], mock[Interpreter], mock[OutputStream])
+        )
+        val classList = new BuiltinLoader().loadClasses()
+        lsm.execute("")
+        verify(lsm).magicNames("%", classOf[LineMagic], classList)
+        verify(lsm).magicNames("%%", classOf[CellMagic], classList)
+      }
+    }
+
+    describe("#magicNames") {
+      it("should filter classnames by interface") {
+        val prefix = "%"
+        val interface = classOf[LineMagic]
+        val classes : List[Class[_]] = List(classOf[LSMagic], classOf[Integer])
+        val lsm = new TestLSMagic(
+          mock[SparkContext], mock[Interpreter], mock[OutputStream])
+        lsm.magicNames(prefix, interface, classes).length should be(1)
+      }
+      it("should prepend prefix to each name"){
+        val prefix = "%"
+        val className = classOf[LSMagic].getSimpleName
+        val interface = classOf[LineMagic]
+        val expected = s"${prefix}${className}"
+        val classes : List[Class[_]] = List(classOf[LSMagic], classOf[Integer])
+        val lsm = new TestLSMagic(
+          mock[SparkContext], mock[Interpreter], mock[OutputStream])
+        lsm.magicNames(prefix, interface, classes) should be(List(expected))
+      }
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
new file mode 100644
index 0000000..56b4cb7
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.interpreter.{Results, ExecuteAborted, ExecuteError, Interpreter}
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
+import org.apache.spark.sql.DataFrame
+import org.apache.spark.sql.types.StructType
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+import play.api.libs.json.Json
+
+class RDDSpec extends FunSpec with Matchers with MockitoSugar with BeforeAndAfter {
+
+  val resOutput = "res1: org.apache.spark.sql.SchemaRDD ="
+
+  val mockInterpreter = mock[Interpreter]
+  val mockDataFrame = mock[DataFrame]
+  val mockRdd = mock[org.apache.spark.rdd.RDD[Any]]
+  val mockStruct = mock[StructType]
+  val columns = Seq("foo", "bar").toArray
+  val rows = Array( Array("a", "b"), Array("c", "d") )
+
+  doReturn(mockStruct).when(mockDataFrame).schema
+  doReturn(columns).when(mockStruct).fieldNames
+  doReturn(mockRdd).when(mockDataFrame).map(any())(any())
+  doReturn(rows).when(mockRdd).take(anyInt())
+
+  val rddMagic = new RDD with IncludeKernelInterpreter {
+    override val kernelInterpreter: Interpreter = mockInterpreter
+  }
+
+  before {
+    doReturn(Some("someRDD")).when(mockInterpreter).lastExecutionVariableName
+    doReturn(Some(mockDataFrame)).when(mockInterpreter).read(anyString())
+    doReturn((Results.Success, Left(resOutput)))
+      .when(mockInterpreter).interpret(anyString(), anyBoolean())
+  }
+
+  describe("RDD") {
+    describe("#execute") {
+      it("should return valid JSON when the executed code evaluates to a " +
+         "SchemaRDD") {
+        val magicOutput = rddMagic.execute("schemaRDD")
+        magicOutput.contains(MIMEType.ApplicationJson) should be (true)
+        Json.parse(magicOutput(MIMEType.ApplicationJson))
+      }
+
+      it("should return normally when the executed code does not evaluate to " +
+         "a SchemaRDD") {
+        doReturn((mock[Result], Left("foo"))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+        val magicOutput = rddMagic.execute("")
+        magicOutput.contains(MIMEType.PlainText) should be (true)
+      }
+
+      it("should return error message when the interpreter does not return " +
+         "SchemaRDD as expected") {
+        doReturn(Some("foo")).when(mockInterpreter).read(anyString())
+        val magicOutput = rddMagic.execute("")
+        magicOutput.contains(MIMEType.PlainText) should be (true)
+      }
+
+      it("should throw a Throwable if the interpreter returns an ExecuteError"){
+        val expected = "some error message"
+        val mockExecuteError = mock[ExecuteError]
+        doReturn(expected).when(mockExecuteError).value
+
+        doReturn((mock[Result], Right(mockExecuteError))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+        val actual = {
+          val exception = intercept[Throwable] {
+            rddMagic.execute("")
+          }
+          exception.getLocalizedMessage
+        }
+
+        actual should be (expected)
+      }
+
+      it("should throw a Throwable if the interpreter returns an " +
+         "ExecuteAborted") {
+        val expected = "RDD magic aborted!"
+        val mockExecuteAborted = mock[ExecuteAborted]
+
+        doReturn((mock[Result], Right(mockExecuteAborted)))
+          .when(mockInterpreter).interpret(anyString(), anyBoolean())
+        val actual = {
+          val exception = intercept[Throwable] {
+            rddMagic.execute("")
+          }
+          exception.getLocalizedMessage
+        }
+
+        actual should be (expected)
+      }
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala b/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
new file mode 100644
index 0000000..121d35e
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils.json
+
+import org.apache.spark.rdd.RDD
+import org.apache.spark.sql.DataFrame
+import org.apache.spark.sql.types.StructType
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpec}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import play.api.libs.json.{JsArray, JsString, Json}
+
+class RddToJsonSpec extends FunSpec with MockitoSugar with Matchers {
+
+  val mockDataFrame = mock[DataFrame]
+  val mockRdd = mock[RDD[Any]]
+  val mockStruct = mock[StructType]
+  val columns = Seq("foo", "bar").toArray
+  val rows = Array( Array("a", "b"), Array("c", "d") )
+
+  doReturn(mockStruct).when(mockDataFrame).schema
+  doReturn(columns).when(mockStruct).fieldNames
+  doReturn(mockRdd).when(mockDataFrame).map(any())(any())
+  doReturn(rows).when(mockRdd).take(anyInt())
+
+  describe("RddToJson") {
+    describe("#convert(SchemaRDD)") {
+      it("should convert to valid JSON object") {
+
+        val json = RddToJson.convert(mockDataFrame)
+        val jsValue = Json.parse(json)
+
+        jsValue \ "columns" should be (JsArray(Seq(JsString("foo"), JsString("bar"))))
+        jsValue \ "rows" should be (JsArray(Seq(
+          JsArray(Seq(JsString("a"), JsString("b"))),
+          JsArray(Seq(JsString("c"), JsString("d"))))))
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/macros/src/main/scala/com/ibm/spark/annotations/Experimental.scala
----------------------------------------------------------------------
diff --git a/macros/src/main/scala/com/ibm/spark/annotations/Experimental.scala b/macros/src/main/scala/com/ibm/spark/annotations/Experimental.scala
deleted file mode 100644
index 241cdc6..0000000
--- a/macros/src/main/scala/com/ibm/spark/annotations/Experimental.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.annotations
-
-import scala.language.experimental.macros
-import scala.annotation.{StaticAnnotation, Annotation}
-
-/**
- * Marks as experimental, indicating that the API is subject to change between
- * minor versions.
- */
-class Experimental extends Annotation with StaticAnnotation

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
----------------------------------------------------------------------
diff --git a/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala b/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
new file mode 100644
index 0000000..241cdc6
--- /dev/null
+++ b/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.annotations
+
+import scala.language.experimental.macros
+import scala.annotation.{StaticAnnotation, Annotation}
+
+/**
+ * Marks as experimental, indicating that the API is subject to change between
+ * minor versions.
+ */
+class Experimental extends Annotation with StaticAnnotation

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/comm/CommCallbacks.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/comm/CommCallbacks.scala b/protocol/src/main/scala/com/ibm/spark/comm/CommCallbacks.scala
deleted file mode 100644
index d462874..0000000
--- a/protocol/src/main/scala/com/ibm/spark/comm/CommCallbacks.scala
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5._
-
-import scala.util.Try
-
-@Experimental
-object CommCallbacks {
-  type OpenCallback = (CommWriter, UUID, String, MsgData) => Unit
-  type MsgCallback = (CommWriter, UUID, MsgData) => Unit
-  type CloseCallback = (CommWriter, UUID, MsgData) => Unit
-}
-
-import com.ibm.spark.comm.CommCallbacks._
-
-/**
- * Represents available callbacks to be triggered when various Comm events
- * are triggered.
- *
- * @param openCallbacks The sequence of open callbacks
- * @param msgCallbacks The sequence of msg callbacks
- * @param closeCallbacks The sequence of close callbacks
- */
-@Experimental
-class CommCallbacks(
-  val openCallbacks: Seq[CommCallbacks.OpenCallback] = Nil,
-  val msgCallbacks: Seq[CommCallbacks.MsgCallback] = Nil,
-  val closeCallbacks: Seq[CommCallbacks.CloseCallback] = Nil
-) {
-
-  /**
-   * Adds a new open callback to be triggered.
-   *
-   * @param openCallback The open callback to add
-   *
-   * @return The updated CommCallbacks instance
-   */
-  def addOpenCallback(openCallback: OpenCallback): CommCallbacks =
-    new CommCallbacks(
-      openCallbacks :+ openCallback,
-      msgCallbacks,
-      closeCallbacks
-    )
-
-  /**
-   * Adds a new msg callback to be triggered.
-   *
-   * @param msgCallback The msg callback to add
-   *
-   * @return The updated CommCallbacks instance
-   */
-  def addMsgCallback(msgCallback: MsgCallback): CommCallbacks =
-    new CommCallbacks(
-      openCallbacks,
-      msgCallbacks :+ msgCallback,
-      closeCallbacks
-    )
-
-  /**
-   * Adds a new close callback to be triggered.
-   *
-   * @param closeCallback The close callback to add
-   *
-   * @return The updated CommCallbacks instance
-   */
-  def addCloseCallback(closeCallback: CloseCallback): CommCallbacks =
-    new CommCallbacks(
-      openCallbacks,
-      msgCallbacks,
-      closeCallbacks :+ closeCallback
-    )
-
-  /**
-   * Removes the specified open callback from the collection of callbacks.
-   *
-   * @param openCallback The open callback to remove
-   *
-   * @return The updated CommCallbacks instance
-   */
-  def removeOpenCallback(openCallback: OpenCallback): CommCallbacks =
-    new CommCallbacks(
-      openCallbacks.filterNot(_ == openCallback),
-      msgCallbacks,
-      closeCallbacks
-    )
-
-  /**
-   * Removes the specified msg callback from the collection of callbacks.
-   *
-   * @param msgCallback The msg callback to remove
-   *
-   * @return The updated CommCallbacks instance
-   */
-  def removeMsgCallback(msgCallback: MsgCallback): CommCallbacks =
-    new CommCallbacks(
-      openCallbacks,
-      msgCallbacks.filterNot(_ == msgCallback),
-      closeCallbacks
-    )
-
-  /**
-   * Removes the specified close callback from the collection of callbacks.
-   *
-   * @param closeCallback The close callback to remove
-   *
-   * @return The updated CommCallbacks instance
-   */
-  def removeCloseCallback(closeCallback: CloseCallback): CommCallbacks =
-    new CommCallbacks(
-      openCallbacks,
-      msgCallbacks,
-      closeCallbacks.filterNot(_ == closeCallback)
-    )
-
-  /**
-   * Executes all registered open callbacks and returns a sequence of results.
-   *
-   * @param commWriter The Comm Writer that can be used for responses
-   * @param commId The Comm Id to pass to all open callbacks
-   * @param targetName The Comm Target Name to pass to all open callbacks
-   * @param data The data to pass to all open callbacks
-   *
-   * @return The sequence of results from trying to execute callbacks
-   */
-  def executeOpenCallbacks(
-    commWriter: CommWriter, commId: UUID, targetName: String, data: MsgData
-  ) = openCallbacks.map(f => Try(f(commWriter, commId, targetName, data)))
-
-  /**
-   * Executes all registered msg callbacks and returns a sequence of results.
-   *
-   * @param commWriter The Comm Writer that can be used for responses
-   * @param commId The Comm Id to pass to all msg callbacks
-   * @param data The data to pass to all msg callbacks
-   *
-   * @return The sequence of results from trying to execute callbacks
-   */
-  def executeMsgCallbacks(commWriter: CommWriter, commId: UUID, data: MsgData) =
-    msgCallbacks.map(f => Try(f(commWriter, commId, data)))
-
-  /**
-   * Executes all registered close callbacks and returns a sequence of results.
-   *
-   * @param commWriter The Comm Writer that can be used for responses
-   * @param commId The Comm Id to pass to all close callbacks
-   * @param data The data to pass to all close callbacks
-   *
-   * @return The sequence of results from trying to execute callbacks
-   */
-  def executeCloseCallbacks(commWriter: CommWriter, commId: UUID, data: MsgData) =
-    closeCallbacks.map(f => Try(f(commWriter, commId, data)))
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/comm/CommManager.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/comm/CommManager.scala b/protocol/src/main/scala/com/ibm/spark/comm/CommManager.scala
deleted file mode 100644
index c15f1a5..0000000
--- a/protocol/src/main/scala/com/ibm/spark/comm/CommManager.scala
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import java.util.UUID
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.comm.CommCallbacks.{CloseCallback, OpenCallback}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.CommContent
-
-/**
- * Represents a manager for Comm connections that facilitates and maintains
- * connections started and received through this service.
- *
- * @param commRegistrar The registrar to use for callback registration
- */
-@Experimental
-abstract class CommManager(private val commRegistrar: CommRegistrar) {
-  /**
-   * The base function to call that performs a link given the target name and
-   * the Comm id for the specific instance.
-   */
-  private val linkFunc: OpenCallback =
-    (_, commId, targetName, _) => commRegistrar.link(targetName, commId)
-
-  /**
-   * The base function to call that performs an unlink given the Comm id for
-   * the specific instance.
-   */
-  private val unlinkFunc: CloseCallback =
-    (_, commId, _) => commRegistrar.unlink(commId)
-
-  // TODO: This is potentially bad design considering appending methods to
-  //       CommWriter will not require this class to be updated!
-  /**
-   * Represents a wrapper for a CommWriter instance that links and unlinks
-   * when invoked.
-   *
-   * @param commWriter The CommWriter instance to wrap
-   */
-  private class WrapperCommWriter(private val commWriter: CommWriter)
-    extends CommWriter(commWriter.commId)
-  {
-    override protected[comm] def sendCommKernelMessage[
-      T <: KernelMessageContent with CommContent
-    ](commContent: T): Unit = commWriter.sendCommKernelMessage(commContent)
-
-    // Overridden to unlink before sending close message
-    override def writeClose(data: MsgData): Unit = {
-      unlinkFunc(this, this.commId, data)
-      commWriter.writeClose(data)
-    }
-
-    // Overridden to unlink before sending close message
-    override def close(): Unit = {
-      unlinkFunc(this, this.commId, null)
-      commWriter.close()
-    }
-
-    // Overriden to link before sending open message
-    override def writeOpen(targetName: String, data: MsgData): Unit = {
-      linkFunc(this, this.commId, targetName, data)
-      commWriter.writeOpen(targetName, data)
-    }
-
-    override def writeMsg(data: MsgData): Unit = commWriter.writeMsg(data)
-    override def write(cbuf: Array[Char], off: Int, len: Int): Unit =
-      commWriter.write(cbuf, off, len)
-    override def flush(): Unit = commWriter.flush()
-  }
-
-  /**
-   * Loads the specified target and provides a registrar pointing to the target.
-   *
-   * @param targetName The name of the target to load
-   *
-   * @return The CommRegistrar pointing to the target
-   */
-  def withTarget(targetName: String):  CommRegistrar = {
-    commRegistrar.withTarget(targetName)
-  }
-
-  /**
-   * Registers a new Comm for use on the kernel. Establishes default callbacks
-   * to link and unlink specific Comm instances for the new target.
-   *
-   * @param targetName The name of the target to register
-   *
-   * @return The new CommRegistrar set to the provided target
-   */
-  def register(targetName: String): CommRegistrar = {
-    commRegistrar.register(targetName)
-      .addOpenHandler(linkFunc)
-      .addCloseHandler(unlinkFunc)
-  }
-
-  /**
-   * Unregisters the specified target used for Comm messages.
-   *
-   * @param targetName The name of the target to unregister
-   *
-   * @return Some collection of callbacks associated with the target if it was
-   *         registered, otherwise None
-   */
-  def unregister(targetName: String): Option[CommCallbacks] = {
-    commRegistrar.unregister(targetName)
-  }
-
-  /**
-   * Indicates whether or not the specified target is currently registered with
-   * this Comm manager.
-   *
-   * @param targetName The name of the target
-   *
-   * @return True if the target is registered, otherwise false
-   */
-  def isRegistered(targetName: String): Boolean =
-    commRegistrar.isRegistered(targetName)
-
-  /**
-   * Opens a new Comm connection. Establishes a new link between the specified
-   * target and the generated Comm id.
-   *
-   * @param targetName The name of the target to connect
-   * @param data The optional data to send
-   *
-   * @return The new CommWriter representing the connection
-   */
-  def open(targetName: String, data: v5.MsgData = v5.MsgData.Empty): CommWriter = {
-    val commId = UUID.randomUUID().toString
-
-    // Create our CommWriter and wrap it to establish links and unlink on close
-    val commWriter = new WrapperCommWriter(newCommWriter(commId))
-
-    // Establish the actual connection
-    commWriter.writeOpen(targetName, data)
-
-    commWriter
-  }
-
-  /**
-   * Creates a new CommWriter instance given the Comm id.
-   *
-   * @param commId The Comm id to use with the Comm writer
-   *
-   * @return The new CommWriter instance
-   */
-  protected def newCommWriter(commId: v5.UUID): CommWriter
-}



[33/51] [abbrv] incubator-toree git commit: Renamed com.ibm.spark to org.apache.toree

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
index 49582f8..77f0120 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
@@ -14,17 +14,17 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import java.util.UUID
 
 import akka.actor.{Props, ActorRef, ActorSystem}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.content.{ClearOutput, CommClose}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SystemActorType, KMBuilder}
-import com.ibm.spark.comm.{CommRegistrar, CommWriter, CommCallbacks, CommStorage}
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.content.{ClearOutput, CommClose}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, SystemActorType, KMBuilder}
+import org.apache.toree.comm.{CommRegistrar, CommWriter, CommCallbacks, CommStorage}
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
index 582a08e..29e8dcf 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
@@ -14,17 +14,17 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import java.util.UUID
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.comm._
-import com.ibm.spark.kernel.protocol.v5.content.{CommMsg, ClearOutput, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.comm._
+import org.apache.toree.kernel.protocol.v5.content.{CommMsg, ClearOutput, CommOpen}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import org.mockito.Matchers._
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
index 64013e9..ddf1893 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
@@ -14,18 +14,18 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import java.util.UUID
 
-import com.ibm.spark.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5
 
 import akka.actor.{Props, ActorRef, ActorSystem}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, ClearOutput, CommOpen}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.comm._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.content.{CommClose, ClearOutput, CommOpen}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.comm._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import org.mockito.Mockito._
 import org.mockito.Matchers._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
index c22bc41..f8532bd 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
@@ -14,18 +14,18 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import java.io.OutputStream
 import java.util.concurrent.atomic.AtomicInteger
 
 import akka.actor._
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.api.{FactoryMethods, FactoryMethodsLike, Kernel}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5Test._
+import org.apache.toree.kernel.api.{FactoryMethods, FactoryMethodsLike, Kernel}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5Test._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
 import play.api.libs.json.Json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
index 54ebdc8..2df1c39 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.actor.{ActorSystem, Props, ActorRef, ActorSelection}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5Test._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5Test._
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{Matchers, FunSpecLike, FunSpec}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
index 57114bb..45bc197 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
@@ -14,16 +14,16 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import java.util.UUID
 import java.util.concurrent.ConcurrentHashMap
 
 import akka.actor.{Props, ActorRef, ActorSystem}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5.content.InputReply
-import com.ibm.spark.kernel.protocol.v5.{HeaderBuilder, MessageType, KMBuilder, SystemActorType}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.content.InputReply
+import org.apache.toree.kernel.protocol.v5.{HeaderBuilder, MessageType, KMBuilder, SystemActorType}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import org.scalatest.concurrent.Eventually
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.time.{Milliseconds, Span}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
index af44443..23558b4 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.actor.{ActorRef, ActorSelection, ActorSystem, Props}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5.content.KernelInfoReply
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{SystemActorType, Header, KernelMessage}
+import org.apache.toree.kernel.protocol.v5.content.KernelInfoReply
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{SystemActorType, Header, KernelMessage}
 import org.mockito.AdditionalMatchers.{not => mockNot}
 import org.mockito.Matchers.{eq => mockEq}
 import com.typesafe.config.ConfigFactory

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
index be982cb..98824ab 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.interpreter.tasks
+package org.apache.toree.kernel.protocol.v5.interpreter.tasks
 
 import java.io.OutputStream
 
 import akka.actor.{ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit}
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
 import com.typesafe.config.ConfigFactory
 import org.mockito.Mockito._
 import org.mockito.Matchers.{eq => mockEq, anyString, anyBoolean}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
index 8bb5f40..bc7d79d 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel
+package org.apache.toree.kernel.protocol.v5.kernel
 
 import akka.actor.{ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5.{MessageType, SocketType}
+import org.apache.toree.kernel.protocol.v5.{MessageType, SocketType}
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpecLike, Matchers}
 import test.utils.TestProbeProxyActor

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
index 65f0990..d4a1f40 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel
+package org.apache.toree.kernel.protocol.v5.kernel
 
 import akka.actor.{ActorSelection, ActorSystem, Props}
 import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5.MessageType
+import org.apache.toree.kernel.protocol.v5.MessageType
 import org.scalatest.{FunSpecLike, Matchers}
 import test.utils.TestProbeProxyActor
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
index 67c6eeb..907d822 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel
+package org.apache.toree.kernel.protocol.v5.kernel
 
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{FunSpec, Matchers}
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
index 388f466..0d5f3ac 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
+import org.apache.toree.communication.ZMQMessage
 import com.typesafe.config.ConfigFactory
 import org.mockito.Matchers._
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
index 6e6fdb3..d8c035a 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import akka.actor.{ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities
-import com.ibm.spark.kernel.protocol.v5Test._
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.kernel.Utilities
+import org.apache.toree.kernel.protocol.v5Test._
 import Utilities._
 import com.typesafe.config.ConfigFactory
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
index d28a5ae..e87fb80 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import java.nio.charset.Charset
 
 import akka.actor.{ActorSelection, ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5Test._
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5Test._
 import Utilities._
 import com.typesafe.config.ConfigFactory
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
index b36f734..af9a4dd 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import com.typesafe.config.ConfigFactory
 import org.scalatest.{FunSpec, Matchers}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
index f33ddc0..a922684 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import org.scalatest.{FunSpec, Matchers}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
index abefdb3..bd034ce 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import org.scalatest.{FunSpec, Matchers}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
index 2103904..a9830d8 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
@@ -14,18 +14,18 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import java.nio.charset.Charset
 
 import akka.actor.{Props, ActorSelection, ActorRef, ActorSystem}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities._
-import com.ibm.spark.kernel.protocol.v5Test._
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SystemActorType}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.kernel.Utilities._
+import org.apache.toree.kernel.protocol.v5Test._
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, SystemActorType}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import com.typesafe.config.ConfigFactory
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{Matchers, FunSpecLike}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
index ba3415f..2a1d46c 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
@@ -1,6 +1,6 @@
-package com.ibm.spark.kernel.protocol.v5.magic
+package org.apache.toree.kernel.protocol.v5.magic
 
-import com.ibm.spark.magic.MagicLoader
+import org.apache.toree.magic.MagicLoader
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpec, Matchers}
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
index 1557460..f3be08d 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
@@ -1,8 +1,8 @@
-package com.ibm.spark.kernel.protocol.v5.magic
+package org.apache.toree.kernel.protocol.v5.magic
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.magic.{CellMagicOutput, LineMagicOutput}
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.magic.{CellMagicOutput, LineMagicOutput}
 import org.mockito.Matchers._
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
index 7adf620..296cbe0 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.relay
+package org.apache.toree.kernel.protocol.v5.relay
 
 import java.io.OutputStream
 
 import akka.actor._
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.magic.dependencies.DependencyMap
+import org.apache.toree.interpreter.{ExecuteAborted, ExecuteError}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
+import org.apache.toree.magic.MagicLoader
+import org.apache.toree.magic.dependencies.DependencyMap
 import com.typesafe.config.ConfigFactory
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
index 63fa50c..66dc0d4 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.relay
+package org.apache.toree.kernel.protocol.v5.relay
 
 import akka.actor._
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.communication.security.SecurityActorType
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
 import Utilities._
 import org.mockito.Mockito._
 import org.scalatest.concurrent.{PatienceConfiguration, ScalaFutures}
@@ -31,7 +31,7 @@ import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
 import org.mockito.Matchers.{eq => mockEq}
 import org.mockito.AdditionalMatchers.{not => mockNot}
 import scala.concurrent.duration._
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.protocol.v5.KernelMessage
 import scala.concurrent._
 import akka.pattern.pipe
 import scala.util.Random

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
index 5d06cb6..0686dc5 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.stream
+package org.apache.toree.kernel.protocol.v5.stream
 
 import akka.actor.{ActorRef, Actor, ActorSystem}
 import akka.testkit.{TestActorRef, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.InputRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.InputRequest
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import org.mockito.Mockito._
 import org.scalatest._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
index cb4f158..be71728 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
@@ -14,20 +14,20 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.stream
+package org.apache.toree.kernel.protocol.v5.stream
 
 import java.util.UUID
 
 import akka.actor.{ActorSelection, ActorSystem}
 import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.ScheduledTaskManager
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.ScheduledTaskManager
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest._
 import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5.content.StreamContent
+import org.apache.toree.kernel.protocol.v5.content.StreamContent
 
 import scala.concurrent.duration._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
index 956088c..c13d4bb 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
@@ -14,22 +14,22 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.{ByteArrayOutputStream, OutputStream}
 import java.net.URL
 
-import com.ibm.spark.dependencies.DependencyDownloader
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.utils.ArgumentParsingSupport
+import org.apache.toree.dependencies.DependencyDownloader
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.utils.ArgumentParsingSupport
 import org.apache.spark.SparkContext
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{GivenWhenThen, Matchers, FunSpec}
 import org.mockito.Mockito._
 import org.mockito.Matchers._
 
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies._
+import org.apache.toree.magic._
+import org.apache.toree.magic.dependencies._
 
 class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
   with GivenWhenThen
@@ -92,7 +92,7 @@ class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
           override val outputStream: OutputStream = mock[OutputStream]
         }
 
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: "--transitive" :: Nil
+        val expected = "org.apache.toree" :: "kernel" :: "1.0" :: "--transitive" :: Nil
         addDepsMagic.execute(expected.mkString(" "))
 
         verify(mockDependencyDownloader).retrieve(
@@ -118,7 +118,7 @@ class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
           override val outputStream: OutputStream = mock[OutputStream]
         }
 
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
+        val expected = "org.apache.toree" :: "kernel" :: "1.0" :: Nil
         addDepsMagic.execute(expected.mkString(" "))
 
         verify(mockDependencyDownloader).retrieve(
@@ -145,7 +145,7 @@ class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
           override val outputStream: OutputStream = mock[OutputStream]
         }
 
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
+        val expected = "org.apache.toree" :: "kernel" :: "1.0" :: Nil
         addDepsMagic.execute(expected.mkString(" "))
 
         verify(mockInterpreter).addJars(any[URL])
@@ -174,7 +174,7 @@ class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
           override val outputStream: OutputStream = mock[OutputStream]
         }
 
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
+        val expected = "org.apache.toree" :: "kernel" :: "1.0" :: Nil
         addDepsMagic.execute(expected.mkString(" "))
 
         verify(mockSparkContext, times(3)).addJar(anyString())

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
index 5612c8a..5489de3 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.OutputStream
 import java.net.URL
 import java.nio.file.{FileSystems, Files}
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.dependencies.{IncludeConfig, IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.magic.dependencies.{IncludeConfig, IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
 import com.typesafe.config.ConfigFactory
 import org.apache.spark.SparkContext
 import org.scalatest.{Matchers, FunSpec}
@@ -29,7 +29,7 @@ import org.scalatest.mock.MockitoSugar
 
 import org.mockito.Mockito._
 import org.mockito.Matchers._
-import com.ibm.spark.magic.MagicLoader
+import org.apache.toree.magic.MagicLoader
 
 class AddJarSpec extends FunSpec with Matchers with MockitoSugar {
   describe("AddJar"){

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
index d2abde7..7b08db3 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{Matchers, FunSpec}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
index 541cfcd..20856af 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.CellMagicOutput
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.CellMagicOutput
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpec, Matchers}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
index 33dfbd5..e7ad7b4 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpec, Matchers}
-import com.ibm.spark.magic.CellMagicOutput
-import com.ibm.spark.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.CellMagicOutput
+import org.apache.toree.kernel.protocol.v5.MIMEType
 
 class JavaScriptSpec extends FunSpec with Matchers with MockitoSugar {
   describe("JavaScript"){

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
index 60b4a6a..3447cbb 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
@@ -1,11 +1,11 @@
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.OutputStream
 import java.net.URL
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.dependencies.{IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
-import com.ibm.spark.magic.{CellMagic, LineMagic}
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.magic.dependencies.{IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
+import org.apache.toree.magic.{CellMagic, LineMagic}
 import org.apache.spark.SparkContext
 import org.scalatest.{Matchers, FunSpec}
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
index 56b4cb7..7c0e435 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter.{Results, ExecuteAborted, ExecuteError, Interpreter}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.interpreter.{Results, ExecuteAborted, ExecuteError, Interpreter}
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
 import org.apache.spark.sql.DataFrame
 import org.apache.spark.sql.types.StructType
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala b/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
index 121d35e..0f6c277 100644
--- a/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils.json
+package org.apache.toree.utils.json
 
 import org.apache.spark.rdd.RDD
 import org.apache.spark.sql.DataFrame

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/system/KernelCommSpecForSystem.scala b/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
index 5b2269d..4866896 100644
--- a/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
+++ b/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
@@ -17,12 +17,12 @@
 package system
 
 import akka.testkit.{TestProbe}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
 import Utilities._
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SocketType, KMBuilder}
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, SocketType, KMBuilder}
+import org.apache.toree.kernel.protocol.v5.content._
 import org.scalatest._
 import play.api.libs.json.Json
 import scala.concurrent.duration._
@@ -43,7 +43,7 @@ class KernelCommSpecForSystem
 {
   private val MaxFishTime = 5.seconds
 
-  import com.ibm.spark.boot.layer.SparkKernelDeployer._
+  import org.apache.toree.boot.layer.SparkKernelDeployer._
 
   private def waitForExecuteReply(
     shell: TestProbe, headerId: v5.UUID, maxTime: Duration = MaxFishTime
@@ -202,7 +202,7 @@ class KernelCommSpecForSystem
             s"""
               |val commWriter = kernel.comm.open("$testTargetName")
               |commWriter.writeMsg(
-              |   com.ibm.spark.kernel.protocol.v5.MsgData("key" -> "value")
+              |   org.apache.toree.kernel.protocol.v5.MsgData("key" -> "value")
               |)
             """.stripMargin.trim
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/system/SuiteForSystem.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/system/SuiteForSystem.scala b/kernel/src/test/scala/system/SuiteForSystem.scala
index 5ed10b0..1fe94fa 100644
--- a/kernel/src/test/scala/system/SuiteForSystem.scala
+++ b/kernel/src/test/scala/system/SuiteForSystem.scala
@@ -1,6 +1,6 @@
 package system
 
-import com.ibm.spark.boot.layer.SparkKernelDeployer
+import org.apache.toree.boot.layer.SparkKernelDeployer
 import org.scalatest.{BeforeAndAfterAll, Suites}
 
 class SuiteForSystem extends Suites(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/system/TruncationTests.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/system/TruncationTests.scala b/kernel/src/test/scala/system/TruncationTests.scala
index 9d4fbd8..39ca1ce 100644
--- a/kernel/src/test/scala/system/TruncationTests.scala
+++ b/kernel/src/test/scala/system/TruncationTests.scala
@@ -17,17 +17,17 @@
 package system
 
 import akka.testkit.TestProbe
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
 import Utilities._
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SocketType, KMBuilder}
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, SocketType, KMBuilder}
+import org.apache.toree.kernel.protocol.v5.content._
 import org.scalatest._
 import play.api.libs.json.Json
 import scala.concurrent.duration._
 import test.utils.NoArgSparkKernelTestKit
-import com.ibm.spark.boot.layer.SparkKernelDeployer
+import org.apache.toree.boot.layer.SparkKernelDeployer
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/test/utils/DummyInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/DummyInterpreter.scala b/kernel/src/test/scala/test/utils/DummyInterpreter.scala
index aec9635..016eee2 100644
--- a/kernel/src/test/scala/test/utils/DummyInterpreter.scala
+++ b/kernel/src/test/scala/test/utils/DummyInterpreter.scala
@@ -2,9 +2,9 @@ package test.utils
 
 import java.net.URL
 
-import com.ibm.spark.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter}
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter}
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala b/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
index ed3800f..e19036b 100644
--- a/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
+++ b/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
@@ -17,7 +17,7 @@
 package test.utils
 
 import akka.testkit.TestKit
-import com.ibm.spark.boot.layer.SparkKernelDeployer
+import org.apache.toree.boot.layer.SparkKernelDeployer
 
 class NoArgSparkKernelTestKit
   extends TestKit(SparkKernelDeployer.getNoArgSparkKernelActorSystem)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala b/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
index 877b162..a4b6189 100644
--- a/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
+++ b/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
@@ -14,27 +14,27 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.boot.layer
+package org.apache.toree.boot.layer
 
 import java.io.OutputStream
 
 import akka.actor.{Actor, Props, ActorRef, ActorSystem}
 import akka.testkit.TestProbe
-import com.ibm.spark.boot.{CommandLineOptions, KernelBootstrap}
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.kernel.interpreter.scala.{StandardTaskManagerProducer, StandardSparkIMainProducer, StandardSettingsProducer, ScalaInterpreter}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, SocketType}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.kernel.socket._
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.boot.{CommandLineOptions, KernelBootstrap}
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.kernel.interpreter.scala.{StandardTaskManagerProducer, StandardSparkIMainProducer, StandardSettingsProducer, ScalaInterpreter}
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, SocketType}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.kernel.socket._
+import org.apache.toree.utils.LogLike
 import com.typesafe.config.Config
 import org.scalatest.mock.MockitoSugar
 import play.api.libs.json.Json
 import scala.collection.JavaConverters._
 import test.utils.SparkContextProvider
 import org.apache.spark.{SparkContext, SparkConf}
-import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
-import com.ibm.spark.global
+import org.apache.toree.kernel.protocol.v5.stream.KernelOutputStream
+import org.apache.toree.global
 
 /**
  * Represents an object that can deploy a singleton Spark Kernel for tests,

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
----------------------------------------------------------------------
diff --git a/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala b/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
index 241cdc6..8f51434 100644
--- a/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
+++ b/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.annotations
+package org.apache.toree.annotations
 
 import scala.language.experimental.macros
 import scala.annotation.{StaticAnnotation, Annotation}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/project/Build.scala
----------------------------------------------------------------------
diff --git a/project/Build.scala b/project/Build.scala
index ffea504..1ecba1d 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -186,7 +186,7 @@ trait SubProjects extends Settings with TestTasks {
         simpleDateFormat.format(now)
       }
     ),
-    buildInfoPackage := "com.ibm.spark.kernel"
+    buildInfoPackage := "org.apache.toree.kernel"
   )
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/project/Common.scala
----------------------------------------------------------------------
diff --git a/project/Common.scala b/project/Common.scala
index 337b620..a409de8 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -32,7 +32,7 @@ object Common {
   val repoUrl                   = Properties.envOrElse("REPO_URL", s"http://${repoHost}:${repoPort}${repoEndpoint}")
 
 
-  private val buildOrganization = "com.ibm.spark"
+  private val buildOrganization = "org.apache.toree"
   private val buildVersion      =
     if (snapshot) s"$versionNumber-SNAPSHOT"
     else versionNumber

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala b/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
index d462874..8f3f560 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
@@ -13,10 +13,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5._
 
 import scala.util.Try
 
@@ -27,7 +27,7 @@ object CommCallbacks {
   type CloseCallback = (CommWriter, UUID, MsgData) => Unit
 }
 
-import com.ibm.spark.comm.CommCallbacks._
+import org.apache.toree.comm.CommCallbacks._
 
 /**
  * Represents available callbacks to be triggered when various Comm events

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala b/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
index c15f1a5..536d69a 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
@@ -14,15 +14,15 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
 import java.util.UUID
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.comm.CommCallbacks.{CloseCallback, OpenCallback}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.CommContent
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.comm.CommCallbacks.{CloseCallback, OpenCallback}
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.CommContent
 
 /**
  * Represents a manager for Comm connections that facilitates and maintains

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala b/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
index 84df054..0495b34 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.comm.CommCallbacks._
-import com.ibm.spark.kernel.protocol.v5
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.comm.CommCallbacks._
+import org.apache.toree.kernel.protocol.v5
 
 import scala.annotation.tailrec
 import scala.collection.immutable

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
index 0aaff9a..5d0be8f 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
@@ -14,10 +14,10 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5
 
 import scala.collection.immutable
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
index 772e582..e16b2fe 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
 
 import java.io.Writer
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
index 284b2bc..c382ba4 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 import play.api.libs.json._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
index 4061ffe..61004a2 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 object HeaderBuilder {
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
index 4ed4ab5..e49a5cc 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 import java.util.Calendar
 
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
+import org.apache.toree.kernel.protocol.v5.MessageType.MessageType
 
 /**
   * A class for building KernelMessages.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
index 5663933..5490670 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 case class KernelMessage(
   ids: Seq[String],

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
index ed7af7c..ffe0b0c 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 trait KernelMessageContent {
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
index 1794c93..a3e7e50 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
-import com.ibm.spark.kernel.BuildInfo
+import org.apache.toree.kernel.BuildInfo
 
 object SparkKernelInfo {
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
index 9b7eabe..85e961c 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.functional.syntax._
 import play.api.libs.json._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
index e74ea72..0b69fdf 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 import play.api.libs.json.Json
 
 case class CommClose(comm_id: UUID, data: MsgData)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
index 5e98e08..a910ed4 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 
 /**
  * Represents a series of subclasses of KernelMessageContent that embodies the

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
index e85e1f0..16d47f9 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.{MsgData, KernelMessageContent, UUID}
+import org.apache.toree.kernel.protocol.v5.{MsgData, KernelMessageContent, UUID}
 import play.api.libs.json.Json
 
 case class CommMsg(comm_id: UUID, data: MsgData)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
index b83d7ff..dfee897 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 import play.api.libs.json.Json
 
 case class CommOpen(comm_id: UUID, target_name: String, data: MsgData)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
index 2edcfa7..91faed9 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Metadata}
+import org.apache.toree.kernel.protocol.v5.{KernelMessageContent, Metadata}
 import play.api.libs.json.Json
 
 case class CompleteReply (

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
index 33d7e68..a5d24b8 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 case class CompleteRequest(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
index 18ce82f..3b5c3cf 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 case class ConnectReply(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
index 1c9e4a6..6da6527 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class ConnectRequest() extends KernelMessageContent {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
index 7a959fa..436c68f 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
+import org.apache.toree.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
 import play.api.libs.json._
 
 case class DisplayData(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
index 4ba6888..2e649a7 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 import scala.language.implicitConversions

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
index a1ec262..4eac017 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class ExecuteInput(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
index 3462e73..e640861 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 // External libraries
 
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, UserExpressions, Payloads}
+import org.apache.toree.kernel.protocol.v5.{KernelMessageContent, UserExpressions, Payloads}
 import play.api.libs.json._
 
 // Internal libraries

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
index 544e4c9..3dc25b5 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, UserExpressions}
+import org.apache.toree.kernel.protocol.v5.{KernelMessageContent, UserExpressions}
 import play.api.libs.json._
 
 case class ExecuteRequest(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
index 984b4a4..a116d0a 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
+import org.apache.toree.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
 import play.api.libs.json.Json
 
 case class ExecuteResult (

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
index 5f2b987..17e8819 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
index 4a0a21a..6a8bc1b 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 case class HistoryRequest(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
index bf6313e..985d3c4 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
@@ -14,9 +14,9 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class InputReply(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
index 0190f17..d673b0d 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
@@ -14,9 +14,9 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class InputRequest(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
index 506a869..8847ff3 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 // External libraries
 import play.api.libs.json._
 
 // Internal libraries
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 case class InspectReply(
   status: String,

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
index c47ed11..4a8dc12 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class InspectRequest(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
index cf45bb7..0f23aa5 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 case class KernelInfoReply (

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
index 0d18dd5..a217ef1 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class KernelInfoRequest() extends KernelMessageContent {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
index 2a28451..dcd7ad5 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class KernelStatus (



[25/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
new file mode 100644
index 0000000..90c509c
--- /dev/null
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
@@ -0,0 +1,259 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.scalatest.concurrent.Eventually
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.time.{Milliseconds, Span}
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+import org.zeromq.ZMQ
+import org.zeromq.ZMQ.{Socket, Context}
+
+import scala.util.Try
+
+class ZeroMQSocketRunnableSpec extends FunSpec with Matchers
+  with MockitoSugar with Eventually with BeforeAndAfter {
+
+  implicit override val patienceConfig = PatienceConfig(
+    timeout = scaled(Span(2000, Milliseconds)),
+    interval = scaled(Span(5, Milliseconds))
+  )
+
+  private val TestAddress = "inproc://test-address"
+  private var mockSocketType: SocketType = _
+  private var zmqContext: ZMQ.Context = _
+  private var pubSocket: ZMQ.Socket = _
+
+  private class TestRunnable(
+    private val socket: ZMQ.Socket,
+    private val context: Context,
+    private val socketType: SocketType,
+    private val inboundMessageCallback: Option[(Seq[String]) => Unit],
+    private val socketOptions: SocketOption*
+  ) extends ZeroMQSocketRunnable(
+    context,
+    socketType,
+    inboundMessageCallback,
+    socketOptions: _*
+  ) {
+    override protected def newZmqSocket(zmqContext: Context, socketType: Int): Socket = socket
+  }
+
+  before {
+    mockSocketType = mock[SocketType]
+    zmqContext = ZMQ.context(1)
+    pubSocket = zmqContext.socket(PubSocket.`type`)
+  }
+
+  after {
+    Try(zmqContext.close())
+  }
+
+  describe("ZeroMQSocketRunnable") {
+    describe("constructor") {
+      it("should throw an exception if there is no bind or connect") {
+        intercept[IllegalArgumentException] {
+          new ZeroMQSocketRunnable(zmqContext, mockSocketType, None)
+        }
+        pubSocket.close()
+      }
+
+      it("should throw an exception if there is more than one connect") {
+        intercept[IllegalArgumentException] {
+          new ZeroMQSocketRunnable(
+            zmqContext,
+            mockSocketType,
+            None,
+            Connect(TestAddress),
+            Connect(TestAddress)
+          )
+        }
+        pubSocket.close()
+      }
+
+      it("should throw an exception if there is more than one bind") {
+        intercept[IllegalArgumentException] {
+          new ZeroMQSocketRunnable(
+            zmqContext,
+            mockSocketType,
+            None,
+            Bind(TestAddress),
+            Bind(TestAddress)
+          )
+        }
+        pubSocket.close()
+      }
+
+      it("should throw an exception if there is a connect and bind") {
+        intercept[IllegalArgumentException] {
+          new ZeroMQSocketRunnable(
+            zmqContext,
+            mockSocketType,
+            None,
+            Connect(""),
+            Bind("")
+          )
+        }
+        pubSocket.close()
+      }
+    }
+
+    describe("#run"){
+      it("should set the linger option when provided") {
+        val expected = 999
+
+        val runnable: TestRunnable = new TestRunnable(
+          pubSocket,
+          zmqContext,
+          PubSocket,
+          None,
+          Connect(TestAddress),
+          Linger(expected)
+        )
+        val thread = new Thread(runnable)
+
+        thread.start()
+
+        eventually {
+          val actual = pubSocket.getLinger
+          actual should be (expected)
+        }
+
+        runnable.close()
+      }
+
+      it("should set the identity option when provided") {
+        val expected = "my identity".getBytes(ZMQ.CHARSET)
+
+        val runnable: TestRunnable = new TestRunnable(
+          pubSocket,
+          zmqContext,
+          PubSocket,
+          None,
+          Connect(TestAddress),
+          Identity(expected)
+        )
+        val thread = new Thread(runnable)
+
+        thread.start()
+
+        eventually {
+          val actual = pubSocket.getIdentity
+          actual should be (expected)
+        }
+
+        runnable.close()
+      }
+
+      it("should close the thread when closed"){
+        val runnable = new TestRunnable(
+          pubSocket,
+          zmqContext,
+          PubSocket,
+          None,
+          Connect(TestAddress)
+        )
+
+        val thread = new Thread(runnable)
+
+        thread.start()
+
+        eventually {
+          runnable.isProcessing should be (true)
+        }
+
+        runnable.close()
+
+        eventually{
+          thread.isAlive should be (false)
+        }
+      }
+    }
+
+    describe("#isProcessing") {
+      it("should be false when the runnable is closed") {
+        val runnable = new TestRunnable(
+          pubSocket,
+          zmqContext,
+          PubSocket,
+          None,
+          Connect(TestAddress)
+        )
+
+        val thread = new Thread(runnable)
+
+        thread.start()
+
+        eventually {
+          runnable.isProcessing should be (true)
+        }
+
+        runnable.close()
+
+        eventually {
+          runnable.isProcessing should be (false)
+        }
+      }
+
+      it("should eventually be true when the runnable is started") {
+        val runnable = new TestRunnable(
+          pubSocket,
+          zmqContext,
+          PubSocket,
+          None,
+          Connect(TestAddress)
+        )
+
+        val thread = new Thread(runnable)
+
+        thread.start()
+
+        eventually{
+          runnable.isProcessing should be (true)
+        }
+
+        runnable.close()
+      }
+    }
+
+    describe("#close"){
+      it("should close the thread"){
+          val runnable = new TestRunnable(
+            pubSocket,
+            zmqContext,
+            PubSocket,
+            None,
+            Connect(TestAddress)
+          )
+
+          val thread = new Thread(runnable)
+
+          thread.start()
+
+          eventually {
+            runnable.isProcessing should be (true)
+          }
+
+          runnable.close()
+
+          eventually{
+            thread.isAlive should be(false)
+          }
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala b/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
new file mode 100644
index 0000000..b10d4cb
--- /dev/null
+++ b/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.utils
+
+import akka.actor._
+import akka.testkit.{ImplicitSender, TestKit}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+
+case class OrderedType()
+case class NotOrderedType()
+case class FinishProcessingMessage()
+case class ReceiveMessageCount(count: Int)
+
+class TestOrderedSupport extends OrderedSupport {
+  var receivedCounter = 0
+  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[OrderedType])
+
+  override def receive: Receive = {
+    case OrderedType() =>
+      startProcessing()
+      receivedCounter = receivedCounter + 1
+      sender ! ReceiveMessageCount(receivedCounter)
+    case NotOrderedType() =>
+      receivedCounter = receivedCounter + 1
+      sender ! ReceiveMessageCount(receivedCounter)
+    case FinishProcessingMessage() =>
+      finishedProcessing()
+  }
+}
+
+class OrderedSupportSpec extends TestKit(ActorSystem("OrderedSupportSystem"))
+  with ImplicitSender with Matchers with FunSpecLike
+  with MockitoSugar  {
+
+  describe("OrderedSupport"){
+    describe("#waiting"){
+      it("should wait for types defined in orderedTypes"){
+      val testOrderedSupport = system.actorOf(Props[TestOrderedSupport])
+
+        // Send a message having a type in orderedTypes
+        // Starts processing and is handled with receive()
+        testOrderedSupport ! new OrderedType
+        // This message should be handled with waiting()
+        testOrderedSupport ! new OrderedType
+
+        // Verify receive was not called for the second OrderedType
+        expectMsg(ReceiveMessageCount(1))
+
+      }
+
+      it("should process types not defined in orderedTypes"){
+        val testOrderedSupport = system.actorOf(Props[TestOrderedSupport])
+
+        // Send a message that starts the processing
+        testOrderedSupport ! new OrderedType
+
+        // Send a message having a type not in orderedTypes
+        testOrderedSupport ! new NotOrderedType
+
+        // Verify receive did get called for NotOrderedType
+        expectMsg(ReceiveMessageCount(1))
+        expectMsg(ReceiveMessageCount(2))
+      }
+    }
+    describe("#finishedProcessing"){
+      it("should switch actor to receive method"){
+        val testOrderedSupport = system.actorOf(Props[TestOrderedSupport])
+        
+        //  Switch actor to waiting mode
+        testOrderedSupport ! new OrderedType
+
+        //  Call finishedProcessing
+        testOrderedSupport ! new FinishProcessingMessage
+
+        //  Sending something that would match in receive, and is in orderedTypes
+        testOrderedSupport ! new OrderedType
+
+        expectMsg(ReceiveMessageCount(1))
+        expectMsg(ReceiveMessageCount(2))
+
+      }
+
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/dependencies/DependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/dependencies/DependencyDownloader.scala b/kernel-api/src/main/scala/com/ibm/spark/dependencies/DependencyDownloader.scala
deleted file mode 100644
index 2f31cbe..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/dependencies/DependencyDownloader.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.dependencies
-
-import java.io.PrintStream
-import java.net.URL
-
-abstract class DependencyDownloader(repositoryUrl: String, baseDir: String) {
-
-  /**
-   * Retrieves the dependency and all of its dependencies as jars.
-   *
-   * @param groupId The group id associated with the main dependency
-   * @param artifactId The id of the dependency artifact
-   * @param version The version of the main dependency
-   * @param transitive If true, downloads all dependencies of the specified
-   *                   dependency
-   * @param excludeBaseDependencies If true, will exclude any dependencies
-   *                                included in the build of the kernel
-   *
-   * @return The sequence of strings pointing to the retrieved dependency jars
-   */
-  def retrieve(
-    groupId: String, artifactId: String, version: String,
-    transitive: Boolean = true, excludeBaseDependencies: Boolean = true
-  ): Seq[URL]
-
-  /**
-   * Sets the printstream to log to.
-   *
-   * @param printStream The new print stream to use for output logging
-   */
-  def setPrintStream(printStream: PrintStream): Unit
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/dependencies/IvyDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/com/ibm/spark/dependencies/IvyDependencyDownloader.scala
deleted file mode 100644
index 2465b0e..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/dependencies/IvyDependencyDownloader.scala
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.dependencies
-
-import java.io.{File, PrintStream}
-import java.net.URL
-
-import org.apache.ivy.Ivy
-import org.apache.ivy.core.module.descriptor._
-import org.apache.ivy.core.module.id.{ArtifactId, ModuleId, ModuleRevisionId}
-import org.apache.ivy.core.resolve.ResolveOptions
-import org.apache.ivy.core.retrieve.RetrieveOptions
-import org.apache.ivy.core.settings.IvySettings
-import org.apache.ivy.plugins.matcher.RegexpPatternMatcher
-import org.apache.ivy.plugins.parser.xml.{XmlModuleDescriptorParser, XmlModuleDescriptorWriter}
-import org.apache.ivy.plugins.resolver.IBiblioResolver
-import org.apache.ivy.util.{DefaultMessageLogger, Message}
-import org.springframework.core.io.support._
-
-
-class IvyDependencyDownloader(repositoryUrl: String, baseDirectory: String)
-  extends DependencyDownloader(repositoryUrl, baseDirectory)
-{
-  private val ivySettings = new IvySettings()
-  private val resolver = new IBiblioResolver
-
-  resolver.setUsepoms(true)
-  resolver.setM2compatible(true)
-  resolver.setName("central")
-
-  // Add our resolver as the main resolver (IBiblio goes to Maven Central)
-  ivySettings.addResolver(resolver)
-
-  // Mark our resolver as the default one to use
-  ivySettings.setDefaultResolver(resolver.getName)
-
-  // Set the destination
-  ivySettings.setBaseDir(new File(baseDirectory))
-  ivySettings.setDefaultResolutionCacheBasedir(baseDirectory)
-  ivySettings.setDefaultRepositoryCacheBasedir(baseDirectory)
-
-  //creates an Ivy instance with settings
-  val ivy = Ivy.newInstance(ivySettings)
-
-  private def getBaseDependencies: Iterable[DependencyDescriptor] = {
-    val xmlModuleDescriptor = XmlModuleDescriptorParser.getInstance()
-    val getDependencies = (url: URL) => xmlModuleDescriptor.parseDescriptor(
-      new IvySettings(), url, false
-    ).getDependencies
-
-    // Find all of the *ivy.xml files on the classpath.
-    val ivyFiles = new PathMatchingResourcePatternResolver().getResources(
-      "classpath*:**/*ivy.xml"
-    )
-    val classpathURLs = ivyFiles.map(_.getURI.toURL)
-
-    // Get all of the dependencies from the *ivy.xml files
-    val dependencies = classpathURLs.map(getDependencies).flatten
-
-    // Remove duplicates based on artifact name
-    val distinctDependencies =
-      dependencies.groupBy(_.getDependencyId.getName).map(_._2.head)
-
-    distinctDependencies
-  }
-
-  override def retrieve(
-    groupId: String, artifactId: String, version: String,
-    transitive: Boolean = true, excludeBaseDependencies: Boolean = true
-  ): Seq[URL] = {
-    // Start building the ivy.xml file
-    val ivyFile = File.createTempFile("ivy-custom", ".xml")
-    ivyFile.deleteOnExit()
-
-    val md = DefaultModuleDescriptor.newDefaultInstance(
-      ModuleRevisionId.newInstance("com.ibm.spark", "spark-kernel", "working")
-    )
-
-    // Exclude all sources artifacts i.e. artifactId-version-sources.jar
-    val moduleId = new ModuleId("*", "*")
-    val sourcesArtifactId = new ArtifactId(moduleId, "*", "source", "*")
-    val sourcesExclusion = new DefaultExcludeRule(
-      sourcesArtifactId, new RegexpPatternMatcher(), null
-    )
-
-    // Exclude all javadoc artifacts i.e. artifactId-version-javadoc.jar
-    val javadocArtifactId = new ArtifactId(moduleId, "*", "javadoc", "*")
-    val javadocExclusion = new DefaultExcludeRule(
-      javadocArtifactId, new RegexpPatternMatcher(), null
-    )
-
-    // TODO: figure out why this is not excluded. It's in our build.sbt file
-    // TODO: and we exclude all deps there. Need to get rid of this hard-code
-    val scalaCompilerModuleId = new ModuleId("org.scala-lang", "*")
-    val scalaCompilerArtifactId = new ArtifactId(
-      scalaCompilerModuleId, "*", "*", "*"
-    )
-    val scalaCompilerExclusion = new DefaultExcludeRule(
-      scalaCompilerArtifactId, new RegexpPatternMatcher(), null
-    )
-
-    // Create our dependency descriptor
-    val dependencyDescriptor = new DefaultDependencyDescriptor(
-      md, ModuleRevisionId.newInstance(groupId, artifactId, version),
-      false, false, true
-    )
-
-    md.addDependency(dependencyDescriptor)
-
-    // Add any and all exclusions
-    md.addExcludeRule(sourcesExclusion)
-    md.addExcludeRule(javadocExclusion)
-    md.addExcludeRule(scalaCompilerExclusion)
-
-    // Exclude our base dependencies if marked to do so
-    if (excludeBaseDependencies) {
-      getBaseDependencies.foreach(dep => {
-        val depRevId = dep.getDependencyRevisionId
-        val moduleId = new ModuleId(depRevId.getOrganisation, depRevId.getName)
-        val artifactId = new ArtifactId(moduleId, "*", "*", "*")
-        val excludeRule = new DefaultExcludeRule(
-          artifactId, new RegexpPatternMatcher(), null)
-        md.addExcludeRule(excludeRule)
-      })
-    }
-
-    // Creates our ivy configuration file
-    XmlModuleDescriptorWriter.write(md, ivyFile)
-
-    // Grab our dependencies (and theirs, etc) recursively
-    val resolveOptions = new ResolveOptions()
-      .setTransitive(transitive)
-      .setDownload(true)
-
-    // Init resolve report (has what was downloaded, etc)
-    val report = ivy.resolve(ivyFile.toURI.toURL, resolveOptions)
-
-    // Get the jar libraries
-    val artifactURLs = report.getAllArtifactsReports
-      .map(report => new URL("file:" + report.getLocalFile.getCanonicalPath))
-
-    val moduleDescriptor = report.getModuleDescriptor
-    ivy.retrieve(
-      moduleDescriptor.getModuleRevisionId,
-      baseDirectory + "/[artifact](-[classifier]).[ext]",
-      new RetrieveOptions().setConfs(Seq("default").toArray)
-    )
-
-    artifactURLs
-  }
-
-  /**
-   * Uses our printstream in Ivy's LoggingEngine
-   * @param printStream the print stream to use
-   */
-  override def setPrintStream(printStream: PrintStream): Unit = {
-    ivy.getLoggerEngine.setDefaultLogger(
-      new DefaultMessageLogger(Message.MSG_INFO) {
-        override def doEndProgress(msg: String): Unit =
-          printStream.println(msg)
-
-        override def doProgress(): Unit =
-          printStream.print(".")
-
-        override def log(msg: String, level: Int): Unit =
-          if (level <= this.getLevel)
-            printStream.println(msg)
-      }
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/global/StreamState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/global/StreamState.scala b/kernel-api/src/main/scala/com/ibm/spark/global/StreamState.scala
deleted file mode 100644
index 973c000..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/global/StreamState.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.global
-
-import java.io.{InputStream, OutputStream, PrintStream}
-
-/**
- * Represents the global state for input and output streams used to communicate
- * standard input and output.
- */
-object StreamState {
-  private val _baseInputStream = System.in
-  private val _baseOutputStream = System.out
-  private val _baseErrorStream = System.err
-
-  @volatile private var _inputStream = _baseInputStream
-  @volatile private var _outputStream = _baseOutputStream
-  @volatile private var _errorStream = _baseErrorStream
-
-  private def init(in: InputStream, out: OutputStream, err: OutputStream) =
-    synchronized {
-      System.setIn(in)
-      Console.setIn(in)
-
-      System.setOut(new PrintStream(out))
-      Console.setOut(out)
-
-      System.setErr(new PrintStream(err))
-      Console.setErr(err)
-    }
-
-  private def reset(): Unit = synchronized {
-    System.setIn(_baseInputStream)
-    Console.setIn(_baseInputStream)
-
-    System.setOut(_baseOutputStream)
-    Console.setOut(_baseOutputStream)
-
-    System.setErr(_baseErrorStream)
-    Console.setErr(_baseErrorStream)
-  }
-
-  /**
-   * Sets the internal streams to be used with the stream block.
-   *
-   * @param inputStream The input stream to map standard in
-   * @param outputStream The output stream to map standard out
-   * @param errorStream The output stream to map standard err
-   */
-  def setStreams(
-    inputStream: InputStream = _inputStream,
-    outputStream: OutputStream = _outputStream,
-    errorStream: OutputStream = _errorStream
-  ) = {
-    _inputStream = inputStream
-    _outputStream = new PrintStream(outputStream)
-    _errorStream = new PrintStream(errorStream)
-  }
-
-  /**
-   * Execute code block, mapping all input and output to the provided streams.
-   */
-  def withStreams[T](thunk: => T): T = {
-    init(_inputStream, _outputStream, _errorStream)
-
-    val returnValue = thunk
-
-    reset()
-
-    returnValue
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/ExecuteFailure.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/ExecuteFailure.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/ExecuteFailure.scala
deleted file mode 100644
index 8103536..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/ExecuteFailure.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter
-
-/**
- * Represents a generic failure in execution.
- */
-sealed abstract class ExecuteFailure
-
-/**
- * Represents an error resulting from interpret execution.
- * @param name The name of the error
- * @param value The message provided from the error
- * @param stackTrace The stack trace as a list of strings representing lines
- *                   in the stack trace
- */
-case class ExecuteError(
-  name: String, value: String, stackTrace: List[String]
-) extends ExecuteFailure {
-  override def toString: String =
-    "Name: " + name + "\n" +
-    "Message: " + value + "\n" +
-    "StackTrace: " + stackTrace.mkString("\n")
-}
-
-// TODO: Replace with object?
-/**
- * Represents an aborted execution.
- */
-class ExecuteAborted extends ExecuteFailure

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/Interpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/Interpreter.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/Interpreter.scala
deleted file mode 100644
index 6200b9b..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/Interpreter.scala
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter
-
-import java.net.URL
-
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
-
-import scala.tools.nsc.interpreter._
-
-trait Interpreter {
-
-  /**
-   * Initializes the interpreter.
-   * @param kernel The kernel
-   * @return The newly initialized interpreter
-   */
-  def init(kernel: KernelLike): Interpreter
-
-  /**
-   * Starts the interpreter, initializing any internal state.
-   * @return A reference to the interpreter
-   */
-  def start(): Interpreter
-
-  /**
-   * Interrupts the current code being interpreted.
-   * @return A reference to the interpreter
-   */
-  def interrupt(): Interpreter
-
-  /**
-   * Stops the interpreter, removing any previous internal state.
-   * @return A reference to the interpreter
-   */
-  def stop(): Interpreter
-
-  /**
-   * Adds external jars to the internal classpaths of the interpreter.
-   * @param jars The list of jar locations
-   */
-  def addJars(jars: URL*): Unit
-
-  /**
-   * Executes the provided code with the option to silence output.
-   * @param code The code to execute
-   * @param silent Whether or not to execute the code silently (no output)
-   * @return The success/failure of the interpretation and the output from the
-   *         execution or the failure
-   */
-  def interpret(code: String, silent: Boolean = false):
-    (Results.Result, Either[ExecuteOutput, ExecuteFailure])
-
-  /**
-   * @return Returns a string to reference the URI of where the interpreted class files are created
-   */
-  def classServerURI: String
-
-  /**
-   * Executes body and will not print anything to the console during the execution
-   * @param body The function to execute
-   * @tparam T The return type of body
-   * @return The return value of body
-   */
-  def doQuietly[T](body: => T): T
-
-  /**
-   * Binds the SparkContext instance to the interpreter's namespace.
-   *
-   * @param sparkContext The SparkContext to bind
-   */
-  def bindSparkContext(sparkContext: SparkContext): Unit
-
-  /**
-   * Binds the SQLContext instance to the interpreter's namespace.
-   *
-   * @param sqlContext The SQLContext to bind
-   */
-  def bindSqlContext(sqlContext: SQLContext): Unit
-
-  /**
-   * Binds a variable in the interpreter to a value.
-   * @param variableName The name to expose the value in the interpreter
-   * @param typeName The type of the variable, must be the fully qualified class name
-   * @param value The value of the variable binding
-   * @param modifiers Any annotation, scoping modifiers, etc on the variable
-   */
-  def bind(variableName: String, typeName: String, value: Any, modifiers: List[String])
-
-  /**
-   * Retrieves the contents of the variable with the provided name from the
-   * interpreter.
-   * @param variableName The name of the variable whose contents to read
-   * @return An option containing the variable contents or None if the
-   *         variable does not exist
-   */
-  def read(variableName: String): Option[AnyRef]
-
-  /**
-   * Mask the Console and System objects with our wrapper implementations
-   * and dump the Console methods into the public namespace (similar to
-   * the Predef approach).
-   * @param in The new input stream
-   * @param out The new output stream
-   * @param err The new error stream
-   */
-  def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream)
-
-  /**
-   * Attempts to perform code completion via the <TAB> command.
-   * @param code The current cell to complete
-   * @param pos The cursor position
-   * @return The cursor position and list of possible completions
-   */
-  def completion(code: String, pos: Int): (Int, List[String] )
-
-  /**
-   * Returns the name of the variable created from the last execution.
-   * @return Some String name if a variable was created, otherwise None
-   */
-  def lastExecutionVariableName: Option[String]
-
-  /**
-   * Returns the class loader used by this interpreter.
-   * @return The runtime class loader used by this interpreter
-   */
-  def classLoader: ClassLoader
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/InterpreterTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/InterpreterTypes.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/InterpreterTypes.scala
deleted file mode 100644
index 7ecee65..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/InterpreterTypes.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter
-
-/**
- * Contains all types associated with the interpreter interface.
- */
-object InterpreterTypes {
-  /**
-   * Represents the output from an interpret execution.
-   */
-  type ExecuteOutput = String
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/Results.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/Results.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/Results.scala
deleted file mode 100644
index 8bd12d0..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/Results.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter
-
-/**
- * Represents interpreter results, mostly taken from the
- * tools.nsc.interpreter.Results object.
- */
-object Results {
-  abstract sealed class Result
-
-  /** The line was interpreted successfully. */
-  case object Success extends Result { override def toString = "success" }
-
-  /** The line was erroneous in some way. */
-  case object Error extends Result { override def toString = "error" }
-
-  /** The input was incomplete.  The caller should request more input. */
-  case object Incomplete extends Result { override def toString = "incomplete" }
-
-  /** The line was aborted before completed. */
-  case object Aborted extends Result { override def toString = "aborted" }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerBridge.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerBridge.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerBridge.scala
deleted file mode 100644
index 94b9a24..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerBridge.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import com.ibm.spark.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.api.java.JavaSparkContext
-import org.apache.spark.sql.SQLContext
-import org.apache.spark.{SparkConf, SparkContext}
-
-/**
- * Represents the API available to the broker to act as the bridge for data
- * between the JVM and some external process.
- *
- * @param _brokerState The container of broker state to expose
- * @param _kernel The kernel API to expose through the bridge
- */
-class BrokerBridge(
-  private val _brokerState: BrokerState,
-  private val _kernel: KernelLike
-) extends BrokerName {
-  /**
-   * Represents the current state of the broker.
-   */
-  val state: BrokerState = _brokerState
-
-  /**
-   * Represents the kernel API available.
-   */
-  val kernel: KernelLike = _kernel
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerCode.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerCode.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerCode.scala
deleted file mode 100644
index e480aa8..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerCode.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import BrokerTypes._
-
-/**
- * Represents a block of code to be evaluated.
- *
- * @param codeId The id to associate with the code to be executed
- * @param code The code to evaluate using the broker
- */
-case class BrokerCode(codeId: CodeId, code: Code)
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerException.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerException.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerException.scala
deleted file mode 100644
index b059552..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerException.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-/**
- * Represents a generic broker exception.
- *
- * @param message The message to associate with the exception
- */
-class BrokerException(message: String) extends Throwable(message)
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerName.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerName.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerName.scala
deleted file mode 100644
index 1482ade..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerName.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-/**
- * Represents the interface that associates a name with a broker. Can be
- * overridden to change name of broker in subclassing.
- */
-trait BrokerName {
-  /** The name of the broker. */
-  val brokerName: String = "broker"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcess.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcess.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcess.scala
deleted file mode 100644
index 5072b92..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcess.scala
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import java.io.{OutputStream, InputStream, File, FileOutputStream}
-
-import org.apache.commons.exec._
-import org.apache.commons.exec.environment.EnvironmentUtils
-import org.apache.commons.io.{FilenameUtils, IOUtils}
-import org.slf4j.LoggerFactory
-import scala.collection.JavaConverters._
-
-/**
- * Represents the process used to evaluate broker code.
- *
- * @param processName The name of the process to invoke
- * @param entryResource The resource to be copied and fed as the first argument
- *                      to the process
- * @param otherResources Other resources to be included in the same directory
- *                       as the main resource
- * @param brokerBridge The bridge to use to retrieve kernel output streams
- *                      and the Spark version to be verified
- * @param brokerProcessHandler The handler to use when the process fails or
- *                             completes
- * @param arguments The collection of additional arguments to pass to the
- *                  process after the main entrypoint
- */
-class BrokerProcess(
-  private val processName: String,
-  private val entryResource: String,
-  private val otherResources: Seq[String],
-  private val brokerBridge: BrokerBridge,
-  private val brokerProcessHandler: BrokerProcessHandler,
-  private val arguments: Seq[String] = Nil
-) extends BrokerName {
-  require(processName != null && processName.trim.nonEmpty,
-    "Process name cannot be null or pure whitespace!")
-  require(entryResource != null && entryResource.trim.nonEmpty,
-    "Entry resource cannot be null or pure whitespace!")
-
-  private val logger = LoggerFactory.getLogger(this.getClass)
-  private val classLoader = this.getClass.getClassLoader
-  private val outputDir =
-    s"kernel-$brokerName-" + java.util.UUID.randomUUID().toString
-
-  /** Represents the current process being executed. */
-  @volatile private[broker] var currentExecutor: Option[Executor] = None
-
-  /**
-   * Returns the temporary directory to place any files needed for the process.
-   *
-   * @return The directory path as a string
-   */
-  protected def getTmpDirectory: String = System.getProperty("java.io.tmpdir")
-
-  /**
-   * Returns the subdirectory to use to place any files needed for the process.
-   *
-   * @return The directory path as a string
-   */
-  protected lazy val getSubDirectory: String =
-    s"kernel-$brokerName-" + java.util.UUID.randomUUID().toString
-
-  /**
-   * Copies a resource from an input stream to an output stream.
-   *
-   * @param inputStream The input stream to copy from
-   * @param outputStream The output stream to copy to
-   *
-   * @return The result of the copy operation
-   */
-  protected def copy(inputStream: InputStream, outputStream: OutputStream) =
-    IOUtils.copy(inputStream, outputStream)
-
-  /**
-   * Copies a file from the kernel resources to the temporary directory.
-   *
-   * @param resource The resource to copy
-   *
-   * @return The string path pointing to the resource's destination
-   */
-  protected def copyResourceToTmp(resource: String): String = {
-    val brokerRunnerResourceStream = classLoader.getResourceAsStream(resource)
-
-    val tmpDirectory = Option(getTmpDirectory)
-      .getOrElse(throw new BrokerException("java.io.tmpdir is not set!"))
-    val subDirectory = Option(getSubDirectory).getOrElse("")
-    val outputName = FilenameUtils.getName(resource)
-
-    val outputDir = Seq(tmpDirectory, subDirectory)
-      .filter(_.trim.nonEmpty).mkString("/")
-    val outputScript = new File(FilenameUtils.concat(outputDir, outputName))
-
-    // If our script destination is a directory, we cannot copy the script
-    if (outputScript.exists() && outputScript.isDirectory)
-      throw new BrokerException(s"Failed to create script: $outputScript")
-
-    // Ensure that all of the directories leading up to the script exist
-    val outputDirFile = new File(outputDir)
-    if (!outputDirFile.exists()) outputDirFile.mkdirs()
-
-    // Copy the script to the specified temporary destination
-    val outputScriptStream = new FileOutputStream(outputScript)
-    copy(
-      brokerRunnerResourceStream,
-      outputScriptStream
-    )
-    outputScriptStream.close()
-
-    // Return the destination of the script
-    val destination = outputScript.getPath
-    logger.debug(s"Successfully copied $resource to $destination")
-    destination
-  }
-
-  /**
-   * Creates a new process environment to be used for environment variable
-   * retrieval by the new process.
-   *
-   * @return The map of environment variables and their respective values
-   */
-  protected def newProcessEnvironment(): Map[String, String] = {
-    val procEnvironment = EnvironmentUtils.getProcEnvironment
-
-    procEnvironment.asScala.toMap
-  }
-
-  /**
-   * Creates a new executor to be used to launch the process.
-   *
-   * @return The executor to start and manage the process
-   */
-  protected def newExecutor(): Executor = new DefaultExecutor
-
-  /**
-   * Starts the Broker process.
-   */
-  def start(): Unit = currentExecutor.synchronized {
-    assert(currentExecutor.isEmpty, "Process has already been started!")
-
-    val capitalizedBrokerName = brokerName.capitalize
-
-    val script = copyResourceToTmp(entryResource)
-    logger.debug(s"New $brokerName script created: $script")
-
-    val createdResources = otherResources.map(copyResourceToTmp)
-
-    // Verify that all files were successfully created
-    val createdResult = (script +: createdResources).map(new File(_)).map(f => {
-      if (f.exists()) true
-      else {
-        val resource = f.getPath
-        logger.warn(s"Failed to create resource: $resource")
-        false
-      }
-    }).forall(_ == true)
-    if (!createdResult) throw new BrokerException(
-      s"Failed to create resources for $capitalizedBrokerName"
-    )
-
-    val commandLine = CommandLine
-      .parse(processName)
-      .addArgument(script)
-    arguments.foreach(commandLine.addArgument)
-
-    logger.debug(s"$capitalizedBrokerName command: ${commandLine.toString}")
-
-    val executor = newExecutor()
-
-    // TODO: Figure out how to dynamically update the output stream used
-    //       to use kernel.out, kernel.err, and kernel.in
-    // NOTE: Currently mapping to standard output/input, which will be caught
-    //       by our system and redirected through the kernel to the client
-    executor.setStreamHandler(new PumpStreamHandler(
-      System.out,
-      System.err,
-      System.in
-    ))
-
-    // Marking exit status of 1 as successful exit
-    executor.setExitValue(1)
-
-    // Prevent the runner from being killed due to run time as it is a
-    // long-term process
-    executor.setWatchdog(new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT))
-
-    val processEnvironment = newProcessEnvironment().asJava
-    logger.debug(s"$capitalizedBrokerName environment: $processEnvironment")
-
-    // Start the process using the environment provided to the parent
-    executor.execute(commandLine, processEnvironment, brokerProcessHandler)
-
-    currentExecutor = Some(executor)
-  }
-
-  /**
-   * Stops the Broker process.
-   */
-  def stop(): Unit = currentExecutor.synchronized {
-    currentExecutor.foreach(executor => {
-      logger.debug(s"Stopping $brokerName process")
-      executor.getWatchdog.destroyProcess()
-    })
-    currentExecutor = None
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandler.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandler.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandler.scala
deleted file mode 100644
index 704f974..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandler.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import org.apache.commons.exec.{ExecuteException, ExecuteResultHandler}
-import org.slf4j.LoggerFactory
-
-/**
- * Represents the handler for events triggered by the broker process.
- *
- * @param brokerBridge The bridge to reset when the process fails or completes
- * @param restartOnFailure If true, restarts the process if it fails
- * @param restartOnCompletion If true, restarts the process if it completes
- */
-class BrokerProcessHandler(
-  private val brokerBridge: BrokerBridge,
-  private val restartOnFailure: Boolean,
-  private val restartOnCompletion: Boolean
-) extends ExecuteResultHandler with BrokerName {
-  private val logger = LoggerFactory.getLogger(this.getClass)
-  private val capitalizedBrokerName = brokerName.capitalize
-  private val resetMessage = s"$capitalizedBrokerName was reset!"
-
-  private var performReset: String => Unit = (_) => {}
-  private var performRestart: () => Unit = () => {}
-
-  /**
-   * Sets the reset method used when a reset of the process is asked.
-   *
-   * @param resetMethod The method to use for resetting the process
-   */
-  def setResetMethod(resetMethod: String => Unit): Unit =
-    performReset = resetMethod
-
-  /**
-   * Sets the restart method used when a restart of the process is asked.
-   *
-   * @param restartMethod The method to use for restarting the process
-   */
-  def setRestartMethod(restartMethod: () => Unit): Unit =
-    performRestart = restartMethod
-
-  override def onProcessFailed(ex: ExecuteException): Unit = {
-    logger.error(s"$capitalizedBrokerName process failed: $ex")
-    performReset(resetMessage)
-
-    if (restartOnFailure) performRestart()
-  }
-
-  override def onProcessComplete(exitValue: Int): Unit = {
-    logger.error(s"$capitalizedBrokerName process exited: $exitValue")
-    performReset(resetMessage)
-
-    if (restartOnCompletion) performRestart()
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerPromise.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerPromise.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerPromise.scala
deleted file mode 100644
index 3fe96bf..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerPromise.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import com.ibm.spark.interpreter.broker.BrokerTypes.{CodeResults, CodeId}
-
-import scala.concurrent.Promise
-
-/**
- * Represents a promise made regarding the completion of broker code execution.
- *
- * @param codeId The id of the code that was executed
- * @param promise The promise to be fulfilled when the code finishes executing
- */
-case class BrokerPromise(codeId: CodeId, promise: Promise[CodeResults])

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerService.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerService.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerService.scala
deleted file mode 100644
index 27430af..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerService.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import com.ibm.spark.interpreter.broker.BrokerTypes.{Code, CodeResults}
-import scala.concurrent.Future
-
-/**
- * Represents the service that provides the high-level interface between the
- * JVM and another process.
- */
-trait BrokerService {
-  /** Starts the broker service. */
-  def start(): Unit
-
-  /**
-   * Indicates whether or not the service is running.
-   *
-   * @return True if running, otherwise false
-   */
-  def isRunning: Boolean
-
-  /**
-   * Submits code to the broker service to be executed and return a result.
-   *
-   * @param code The code to execute
-   *
-   * @return The result as a future to eventually return
-   */
-  def submitCode(code: Code): Future[CodeResults]
-
-  /** Stops the running broker service. */
-  def stop(): Unit
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerState.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerState.scala
deleted file mode 100644
index 409d789..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerState.scala
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import java.util.concurrent.ConcurrentHashMap
-
-import com.ibm.spark.interpreter.broker.BrokerTypes._
-import org.slf4j.LoggerFactory
-
-import scala.concurrent.{Future, promise}
-
-/**
- * Represents the state structure of broker.
- *
- * @param maxQueuedCode The maximum amount of code to support being queued
- *                      at the same time for broker execution
- *
- */
-class BrokerState(private val maxQueuedCode: Int) {
-  private val logger = LoggerFactory.getLogger(this.getClass)
-
-  import scala.collection.JavaConverters._
-
-  private var _isReady: Boolean = false
-  protected val codeQueue: java.util.Queue[BrokerCode] =
-    new java.util.concurrent.ConcurrentLinkedQueue[BrokerCode]()
-  protected val promiseMap: collection.mutable.Map[CodeId, BrokerPromise] =
-    new ConcurrentHashMap[CodeId, BrokerPromise]().asScala
-
-  /**
-   * Adds new code to eventually be executed.
-   *
-   * @param code The snippet of code to execute
-   *
-   * @return The future containing the results of the execution
-   */
-  def pushCode(code: Code): Future[CodeResults] = synchronized {
-    // Throw the standard error if our maximum limit has been reached
-    if (codeQueue.size() >= maxQueuedCode)
-      throw new IllegalStateException(
-        s"Code limit of $maxQueuedCode has been reached!")
-
-    // Generate our promise that will be fulfilled when the code is executed
-    // and the results are sent back
-    val codeExecutionPromise = promise[CodeResults]()
-
-    // Build the code representation to send to Broker
-    val uniqueId = java.util.UUID.randomUUID().toString
-    val brokerCode = BrokerCode(uniqueId, code)
-    val brokerPromise = BrokerPromise(uniqueId, codeExecutionPromise)
-
-    logger.debug(s"Queueing '$code' with id '$uniqueId' to run with broker")
-
-    // Add the code to be executed to our queue and the promise to our map
-    codeQueue.add(brokerCode)
-    promiseMap.put(brokerPromise.codeId, brokerPromise)
-
-    codeExecutionPromise.future
-  }
-
-  /**
-   * Returns the total code currently queued to be executed.
-   *
-   * @return The total number of code instances queued to be executed
-   */
-  def totalQueuedCode(): Int = codeQueue.size()
-
-  /**
-   * Retrieves (and removes) the next piece of code to be executed.
-   *
-   * @note This should only be invoked by the broker process!
-   *
-   * @return The next code to execute if available, otherwise null
-   */
-  def nextCode(): BrokerCode = {
-    val brokerCode = codeQueue.poll()
-
-    if (brokerCode != null)
-      logger.trace(s"Sending $brokerCode to Broker runner")
-
-    brokerCode
-  }
-
-  /**
-   * Indicates whether or not the broker instance is ready for code.
-   *
-   * @return True if it is ready, otherwise false
-   */
-  def isReady: Boolean = _isReady
-
-  /**
-   * Marks the state of broker as ready.
-   */
-  def markReady(): Unit = _isReady = true
-
-  /**
-   * Marks the specified code as successfully completed using its id.
-   *
-   * @param codeId The id of the code to mark as a success
-   * @param output The output from the execution to be used as the result
-   */
-  def markSuccess(codeId: CodeId, output: CodeResults): Unit = {
-    logger.debug(s"Received success for code with id '$codeId': $output")
-    promiseMap.remove(codeId).foreach(_.promise.success(output))
-  }
-
-  /**
-   * Marks the specified code as successfully completed using its id. Output
-   * from success is treated as an empty string.
-   *
-   * @param codeId The id of the code to mark as a success
-   */
-  def markSuccess(codeId: CodeId): Unit = markSuccess(codeId, "")
-
-  /**
-   * Marks the specified code as unsuccessful using its id.
-   *
-   * @param codeId The id of the code to mark as a failure
-   * @param output The output from the error to be used as the description
-   *               of the exception
-   */
-  def markFailure(codeId: CodeId, output: CodeResults): Unit = {
-    logger.debug(s"Received failure for code with id '$codeId': $output")
-    promiseMap.remove(codeId).foreach(
-      _.promise.failure(new BrokerException(output)))
-  }
-
-  /**
-   * Marks the specified code as unsuccessful using its id. Output from failure
-   * is treated as an empty string.
-   *
-   * @param codeId The id of the code to mark as a failure
-   */
-  def markFailure(codeId: CodeId): Unit = markFailure(codeId, "")
-
-  /**
-   * Resets the state by clearing any pending code executions and marking all
-   * pending executions as failures (or success if specified).
-   *
-   * @param message The message to present through the interrupted promises
-   * @param markAllAsFailure If true, marks all pending executions as failures,
-   *                         otherwise marks all as success
-   */
-  def reset(message: String, markAllAsFailure: Boolean = true): Unit = {
-    codeQueue.synchronized {
-      promiseMap.synchronized {
-        codeQueue.clear()
-
-        // Use map contents for reset as it should contain non-executing
-        // code as well as executing code
-        promiseMap.foreach { case (codeId, codePromise) =>
-          if (markAllAsFailure)
-            codePromise.promise.failure(new BrokerException(message))
-          else
-            codePromise.promise.success(message)
-        }
-        promiseMap.clear()
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTransformer.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTransformer.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTransformer.scala
deleted file mode 100644
index aa18648..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTransformer.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import com.ibm.spark.interpreter.InterpreterTypes.ExecuteOutput
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter.broker.BrokerTypes.CodeResults
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteFailure, Results}
-
-import scala.concurrent.Future
-
-/**
- * Represents a utility that can transform raw broker information to
- * kernel information.
- */
-class BrokerTransformer {
-  /**
-   * Transforms a pure result containing output information into a form that
-   * the interpreter interface expects.
-   *
-   * @param futureResult The raw result as a future
-   *
-   * @return The transformed result as a future
-   */
-  def transformToInterpreterResult(futureResult: Future[CodeResults]):
-    Future[(Result, Either[ExecuteOutput, ExecuteFailure])] =
-  {
-    import scala.concurrent.ExecutionContext.Implicits.global
-
-    futureResult
-      .map(results => (Results.Success, Left(results)))
-      .recover({ case ex: BrokerException =>
-        (Results.Error, Right(ExecuteError(
-          name = ex.getClass.getName,
-          value = ex.getLocalizedMessage,
-          stackTrace = ex.getStackTrace.map(_.toString).toList
-        )))
-      })
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypes.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypes.scala
deleted file mode 100644
index 71e4d3d..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypes.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-/**
- * Represents all types associated with the broker interface.
- */
-object BrokerTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypesProvider.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypesProvider.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypesProvider.scala
deleted file mode 100644
index 2af47e4..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/BrokerTypesProvider.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-/**
- * Provides broker types to the class/trait that implements this trait.
- */
-trait BrokerTypesProvider {
-  /** Represents the id used to keep track of executing code. */
-  type CodeId = String
-
-  /** Represents the code to execute. */
-  type Code = String
-
-  /** Represents the results of code execution or the failure message. */
-  type CodeResults = String
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/JavaSparkContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/JavaSparkContextProducerLike.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/JavaSparkContextProducerLike.scala
deleted file mode 100644
index cda61f3..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/JavaSparkContextProducerLike.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker.producer
-
-import org.apache.spark.SparkContext
-import org.apache.spark.api.java.JavaSparkContext
-
-/**
- * Represents a producer for a JavaSparkContext.
- */
-trait JavaSparkContextProducerLike {
-  /**
-   * Creates a new JavaSparkContext instance.
-   *
-   * @param sparkContext The SparkContext instance to use to create the Java one
-   *
-   * @return The new JavaSparkContext
-   */
-  def newJavaSparkContext(sparkContext: SparkContext): JavaSparkContext
-}
-
-/**
- * Represents the standard producer for a JavaSparkContext.
- */
-trait StandardJavaSparkContextProducer extends JavaSparkContextProducerLike {
-  def newJavaSparkContext(sparkContext: SparkContext): JavaSparkContext =
-    new JavaSparkContext(sparkContext)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/SQLContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/SQLContextProducerLike.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/SQLContextProducerLike.scala
deleted file mode 100644
index fd46268..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/broker/producer/SQLContextProducerLike.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker.producer
-
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
-
-/**
- * Represents a producer for a SQLContext.
- */
-trait SQLContextProducerLike {
-  /**
-   * Creates a new SQLContext instance.
-   *
-   * @param sparkContext The SparkContext instance to use to create the SQL one
-   *
-   * @return The new SQLContext
-   */
-  def newSQLContext(sparkContext: SparkContext): SQLContext
-}
-
-/**
- * Represents the standard producer for a SQLContext.
- */
-trait StandardSQLContextProducer extends SQLContextProducerLike {
-  def newSQLContext(sparkContext: SparkContext): SQLContext =
-    new SQLContext(sparkContext)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperConsole.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperConsole.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperConsole.scala
deleted file mode 100644
index 42c5616..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperConsole.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.imports.printers
-
-import java.io._
-
-import com.ibm.spark.utils.DynamicReflectionSupport
-
-/**
- * Represents a wrapper for the scala.Console for Scala 2.10.4 implementation.
- * @param in The input stream used for standard in
- * @param out The output stream used for standard out
- * @param err The output stream used for standard error
- */
-class WrapperConsole(
-  val in: BufferedReader,
-  val out: PrintStream,
-  val err: PrintStream
-) extends DynamicReflectionSupport(Class.forName("scala.Console$"), scala.Console) {
-  require(in != null)
-  require(out != null)
-  require(err != null)
-
-  //
-  // SUPPORTED PRINT OPERATIONS
-  //
-
-  def print(obj: Any): Unit = out.print(obj)
-  def printf(text: String, args: Any*): Unit =
-    out.print(text.format(args: _*))
-  def println(x: Any): Unit = out.println(x)
-  def println(): Unit = out.println()
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperSystem.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperSystem.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperSystem.scala
deleted file mode 100644
index 4583680..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/imports/printers/WrapperSystem.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.imports.printers
-
-import java.io._
-
-import com.ibm.spark.utils.DynamicReflectionSupport
-
-/**
- * Represents a wrapper for java.lang.System.
- * @param inStream The input stream used for standard in
- * @param outStream The output stream used for standard out
- * @param errStream The output stream used for standard error
- */
-class WrapperSystem(
-  private val inStream: InputStream,
-  private val outStream: OutputStream,
-  private val errStream: OutputStream
-) extends DynamicReflectionSupport(Class.forName("java.lang.System"), null){
-  require(inStream != null)
-  require(outStream != null)
-  require(errStream != null)
-
-  private val outPrinter = new PrintStream(outStream)
-  private val errPrinter = new PrintStream(errStream)
-
-  //
-  // MASKED METHODS
-  //
-
-  def in = inStream
-  def out = outPrinter
-  def err = errPrinter
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/interpreter/package.scala b/kernel-api/src/main/scala/com/ibm/spark/interpreter/package.scala
deleted file mode 100644
index 451316d..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/interpreter/package.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark
-
-// TODO: Deprecate and remove this package object as it is difficult to
-//       remember where this type comes from
-package object interpreter {
-  /**
-   * Represents the output from an interpret execution.
-   */
-  type ExecuteOutput = String
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/kernel/api/FactoryMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/FactoryMethodsLike.scala b/kernel-api/src/main/scala/com/ibm/spark/kernel/api/FactoryMethodsLike.scala
deleted file mode 100644
index 1642e1b..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/FactoryMethodsLike.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.ibm.spark.kernel.api
-
-import java.io.{InputStream, OutputStream}
-
-/**
- * Represents the methods available to create objects related to the kernel.
- */
-trait FactoryMethodsLike {
-  /**
-   * Creates a new kernel output stream.
-   *
-   * @param streamType The type of output stream (stdout/stderr)
-   * @param sendEmptyOutput If true, will send message even if output is empty
-   *
-   * @return The new KernelOutputStream instance
-   */
-  def newKernelOutputStream(
-    streamType: String,
-    sendEmptyOutput: Boolean
-  ): OutputStream
-
-  /**
-   * Creates a new kernel input stream.
-   *
-   * @param prompt The text to use as a prompt
-   * @param password If true, should treat input as a password field
-   *
-   * @return The new KernelInputStream instance
-   */
-  def newKernelInputStream(
-    prompt: String,
-    password: Boolean
-  ): InputStream
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelLike.scala b/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelLike.scala
deleted file mode 100644
index c9442aa..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelLike.scala
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.api
-
-import java.io.{PrintStream, InputStream, OutputStream}
-
-import com.typesafe.config.Config
-import org.apache.spark.api.java.JavaSparkContext
-import org.apache.spark.{SparkConf, SparkContext}
-import org.apache.spark.sql.SQLContext
-
-/**
- * Interface for the kernel API. This does not include exposed variables.
- */
-trait KernelLike {
-
-  def createSparkContext(conf: SparkConf): SparkContext
-
-  def createSparkContext(master: String, appName: String): SparkContext
-
-  /**
-   * Executes a block of code represented as a string and returns the result.
-   *
-   * @param code The code as an option to execute
-   *
-   * @return A tuple containing the result (true/false) and the output as a
-   *         string
-   */
-  def eval(code: Option[String]): (Boolean, String)
-
-  /**
-   * Returns a collection of methods that can be used to generate objects
-   * related to the kernel.
-   *
-   * @return The collection of factory methods
-   */
-  def factory: FactoryMethodsLike
-
-  /**
-   * Returns a collection of methods that can be used to stream data from the
-   * kernel to the client.
-   *
-   * @return The collection of stream methods
-   */
-  def stream: StreamMethodsLike
-
-  /**
-   * Returns a print stream to be used for communication back to clients
-   * via standard out.
-   *
-   * @return The print stream instance or an error if the stream info is
-   *         not found
-   */
-  def out: PrintStream
-
-  /**
-   * Returns a print stream to be used for communication back to clients
-   * via standard error.
-   *
-   * @return The print stream instance or an error if the stream info is
-   *         not found
-   */
-  def err: PrintStream
-
-  /**
-   * Returns an input stream to be used to receive information from the client.
-   *
-   * @return The input stream instance or an error if the stream info is
-   *         not found
-   */
-  def in: InputStream
-
-  /**
-   * Represents data to be shared using the kernel as the middleman.
-   *
-   * @note Using Java structure to enable other languages to have easy access!
-   */
-  val data: java.util.Map[String, Any]
-
-
-  def interpreter(name: String): Option[com.ibm.spark.interpreter.Interpreter]
-
-  def config: Config
-
-  def sparkContext: SparkContext
-
-  def sparkConf: SparkConf
-
-  def javaSparkContext: JavaSparkContext
-
-  def sqlContext: SQLContext
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelOptions.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelOptions.scala b/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelOptions.scala
deleted file mode 100644
index 00d00c9..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/KernelOptions.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.api
-
-
-object KernelOptions {
-  var showTypes: Boolean = false
-  var noTruncation: Boolean = false
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamInfo.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamInfo.scala b/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamInfo.scala
deleted file mode 100644
index 24cef4c..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamInfo.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.api
-
-/**
- * Represents a "wrapper" for information needed to stream stdout/stderr from
- * the kernel to a client.
- *
- * @note This exists because the KernelMessage instance is defined in the
- *       protocol project, which is not brought into this project. Furthermore,
- *       it is better practice to provide an explicit wrapper type rather than
- *       a more common type for implicit use.
- */
-trait StreamInfo

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamMethodsLike.scala b/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamMethodsLike.scala
deleted file mode 100644
index 4e7d9d8..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/kernel/api/StreamMethodsLike.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ibm.spark.kernel.api
-
-/**
- * Represents the methods available to stream data from the kernel to the
- * client.
- */
-trait StreamMethodsLike {
-  /**
-   * Sends all text provided as one stream message to the client.
-   * @param text The text to wrap in a stream message
-   */
-  def sendAll(text: String): Unit
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/CellMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/CellMagic.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/CellMagic.scala
deleted file mode 100644
index 3da1f04..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/CellMagic.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.ibm.spark.magic
-
-/**
- * Cell Magics change the output of a cell in IPython
- */
-trait CellMagic extends Magic {
-  override def execute(code: String): CellMagicOutput
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/InternalClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/InternalClassLoader.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/InternalClassLoader.scala
deleted file mode 100644
index 349efa6..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/InternalClassLoader.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic
-
-/**
- * Represents a classloader that can load classes from within.
- *
- * @param classLoader The classloader to use for internal retrieval
- *                    (defaults to self's classloader)
- */
-class InternalClassLoader(
-  classLoader: ClassLoader = classOf[InternalClassLoader].getClassLoader
-) extends ClassLoader(classLoader) {
-
-  // TODO: Provides an exposed reference to the super loadClass to be stubbed
-  // out in tests.
-  private[magic] def parentLoadClass(name: String, resolve: Boolean) =
-    super.loadClass(name, resolve)
-
-  /**
-   * Attempts to load the class using the local package of the builtin loader
-   * as the base of the name if unable to load normally.
-   *
-   * @param name The name of the class to load
-   * @param resolve If true, then resolve the class
-   *
-   * @return The class instance of a ClassNotFoundException
-   */
-  override def loadClass(name: String, resolve: Boolean): Class[_] =
-    try {
-      val packageName = this.getClass.getPackage.getName
-      val className = name.split('.').last
-
-      parentLoadClass(packageName + "." + className, resolve)
-    } catch {
-      case ex: ClassNotFoundException =>
-        parentLoadClass(name, resolve)
-    }
-}



[06/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequestSpec.scala
deleted file mode 100644
index 7b5b3db..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequestSpec.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class InputRequestSpec extends FunSpec with Matchers {
-  val inputRequestJson: JsValue = Json.parse("""
-  {
-    "prompt": "<STRING>",
-    "password": true
-  }
-  """)
-
-  val inputRequest = InputRequest(
-    "<STRING>", true
-  )
-
-  describe("InputRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        InputRequest.toTypeString should be ("input_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a InputRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        inputRequestJson.as[InputRequest] should be (inputRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = inputRequestJson.asOpt[InputRequest]
-
-        newCompleteRequest.get should be (inputRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = inputRequestJson.validate[InputRequest]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: InputRequest) => valid
-        ) should be (inputRequest)
-      }
-
-      it("should implicitly convert from a InputRequest instance to valid json") {
-        Json.toJson(inputRequest) should be (inputRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
deleted file mode 100644
index b88a39a..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class InspectReplyErrorSpec extends FunSpec with Matchers {
-  val inspectReplyErrorJson: JsValue = Json.parse("""
-  {
-    "status": "error",
-    "data": {},
-    "metadata": {},
-    "ename": "<STRING>",
-    "evalue": "<STRING>",
-    "traceback": []
-  }
-  """)
-
-  val inspectReplyError: InspectReplyError = InspectReplyError(
-    Data(), Metadata(), Some("<STRING>"), Some("<STRING>"), Some(List())
-  )
-
-  describe("InspectReplyError") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a InspectReplyError instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        inspectReplyErrorJson.as[InspectReplyError] should be (inspectReplyError)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newInspectReplyError = inspectReplyErrorJson.asOpt[InspectReplyError]
-
-        newInspectReplyError.get should be (inspectReplyError)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val InspectReplyErrorResults = inspectReplyErrorJson.validate[InspectReplyError]
-
-        InspectReplyErrorResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: InspectReplyError) => valid
-        ) should be (inspectReplyError)
-      }
-
-      it("should implicitly convert from a InspectReplyError instance to valid json") {
-        Json.toJson(inspectReplyError) should be (inspectReplyErrorJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyOkSpec.scala
deleted file mode 100644
index fcea013..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplyOkSpec.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-import com.ibm.spark.kernel.protocol.v5._
-
-class InspectReplyOkSpec extends FunSpec with Matchers {
-  val inspectReplyOkJson: JsValue = Json.parse("""
-  {
-    "status": "ok",
-    "data": {},
-    "metadata": {}
-  }
-  """)
-
-  val inspectReplyOk: InspectReplyOk = InspectReplyOk(
-    Data(), Metadata()
-  )
-
-  describe("InspectReplyOk") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a InspectReplyOk instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        inspectReplyOkJson.as[InspectReplyOk] should be (inspectReplyOk)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newInspectReplyOk = inspectReplyOkJson.asOpt[InspectReplyOk]
-
-        newInspectReplyOk.get should be (inspectReplyOk)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val InspectReplyOkResults = inspectReplyOkJson.validate[InspectReplyOk]
-
-        InspectReplyOkResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: InspectReplyOk) => valid
-        ) should be (inspectReplyOk)
-      }
-
-      it("should implicitly convert from a InspectReplyOk instance to valid json") {
-        Json.toJson(inspectReplyOk) should be (inspectReplyOkJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplySpec.scala
deleted file mode 100644
index 0ad56e9..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReplySpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class InspectReplySpec extends FunSpec with Matchers {
-  val inspectReplyJson: JsValue = Json.parse("""
-  {
-    "status": "<STRING>",
-    "data": {},
-    "metadata": {}
-  }
-  """)
-
-  val inspectReply: InspectReply = InspectReply(
-    "<STRING>", Map(), Map(), None, None, None
-  )
-
-  describe("InspectReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        InspectReply.toTypeString should be ("inspect_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a InspectReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        inspectReplyJson.as[InspectReply] should be (inspectReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newInspectReply = inspectReplyJson.asOpt[InspectReply]
-
-        newInspectReply.get should be (inspectReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val InspectReplyResults = inspectReplyJson.validate[InspectReply]
-
-        InspectReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: InspectReply) => valid
-        ) should be (inspectReply)
-      }
-
-      it("should implicitly convert from a InspectReply instance to valid json") {
-        Json.toJson(inspectReply) should be (inspectReplyJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequestSpec.scala
deleted file mode 100644
index 2ff561d..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequestSpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class InspectRequestSpec extends FunSpec with Matchers {
-  val inspectRequestJson: JsValue = Json.parse("""
-  {
-    "code": "<STRING>",
-    "cursor_pos": 999,
-    "detail_level": 1
-  }
-  """)
-
-  val inspectRequest: InspectRequest = InspectRequest(
-    "<STRING>", 999, 1
-  )
-
-  describe("InspectRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        InspectRequest.toTypeString should be ("inspect_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a InspectRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        inspectRequestJson.as[InspectRequest] should be (inspectRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newInspectRequest = inspectRequestJson.asOpt[InspectRequest]
-
-        newInspectRequest.get should be (inspectRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val InspectRequestResults = inspectRequestJson.validate[InspectRequest]
-
-        InspectRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: InspectRequest) => valid
-        ) should be (inspectRequest)
-      }
-
-      it("should implicitly convert from a InspectRequest instance to valid json") {
-        Json.toJson(inspectRequest) should be (inspectRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReplySpec.scala
deleted file mode 100644
index 7d704e2..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReplySpec.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class KernelInfoReplySpec extends FunSpec with Matchers {
-  val kernelInfoReplyJson: JsValue = Json.parse("""
-  {
-    "protocol_version": "x.y.z",
-    "implementation": "<name>",
-    "implementation_version": "z.y.x",
-    "language_info": { "name": "<some language>" },
-    "language_version": "a.b.c",
-    "banner": "<some banner>"
-  }
-  """)
-
-  val kernelInfoReply: KernelInfoReply = KernelInfoReply(
-    "x.y.z", "<name>", "z.y.x", Map("name" -> "<some language>"), "a.b.c", "<some banner>"
-  )
-
-  describe("KernelInfoReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        KernelInfoReply.toTypeString should be ("kernel_info_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a kernelInfoReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        kernelInfoReplyJson.as[KernelInfoReply] should be (kernelInfoReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newKernelInfoReply = kernelInfoReplyJson.asOpt[KernelInfoReply]
-
-        newKernelInfoReply.get should be (kernelInfoReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val kernelInfoReplyResults = kernelInfoReplyJson.validate[KernelInfoReply]
-
-        kernelInfoReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: KernelInfoReply) => valid
-        ) should be (kernelInfoReply)
-      }
-
-      it("should implicitly convert from a kernelInfoReply instance to valid json") {
-        Json.toJson(kernelInfoReply) should be (kernelInfoReplyJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
deleted file mode 100644
index e63b4c3..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class KernelInfoRequestSpec extends FunSpec with Matchers {
-  val kernelInfoRequestJson: JsValue = Json.parse("""
-  {}
-  """)
-
-  val kernelInfoRequest: KernelInfoRequest = KernelInfoRequest()
-
-  describe("KernelInfoRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        KernelInfoRequest.toTypeString should be ("kernel_info_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a KernelInfoRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        // This is the least safe way to convert as an error is thrown if it fails
-        kernelInfoRequestJson.as[KernelInfoRequest] should be (kernelInfoRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newKernelInfoRequest = kernelInfoRequestJson.asOpt[KernelInfoRequest]
-
-        newKernelInfoRequest.get should be (kernelInfoRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val KernelInfoRequestResults = kernelInfoRequestJson.validate[KernelInfoRequest]
-
-        KernelInfoRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: KernelInfoRequest) => valid
-        ) should be (kernelInfoRequest)
-      }
-
-      it("should implicitly convert from a KernelInfoRequest instance to valid json") {
-        Json.toJson(kernelInfoRequest) should be (kernelInfoRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatusSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatusSpec.scala
deleted file mode 100644
index 4663d98..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatusSpec.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, JsValue, Json}
-
-class KernelStatusSpec extends FunSpec with Matchers {
-  val kernelStatusJson: JsValue = Json.parse("""
-  {
-    "execution_state": "<STRING>"
-  }
-  """)
-
-  val kernelStatus: KernelStatus = KernelStatus("<STRING>")
-
-  describe("KernelStatus") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        KernelStatus.toTypeString should be ("status")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a kernelStatus instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        kernelStatusJson.as[KernelStatus] should be (kernelStatus)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newKernelStatus = kernelStatusJson.asOpt[KernelStatus]
-
-        newKernelStatus.get should be (kernelStatus)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val kernelStatusResults = kernelStatusJson.validate[KernelStatus]
-
-        kernelStatusResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: KernelStatus) => valid
-        ) should be (kernelStatus)
-      }
-
-      it("should implicitly convert from a kernelStatus instance to valid json") {
-        Json.toJson(kernelStatus) should be (kernelStatusJson)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReplySpec.scala
deleted file mode 100644
index 15e8eba..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReplySpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ShutdownReplySpec extends FunSpec with Matchers {
-  val shutdownReplyJson: JsValue = Json.parse("""
-  {
-    "restart": true
-  }
-  """)
-
-  val shutdownReply: ShutdownReply = ShutdownReply(
-    true
-  )
-
-  describe("ShutdownReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ShutdownReply.toTypeString should be ("shutdown_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ShutdownReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        shutdownReplyJson.as[ShutdownReply] should be (shutdownReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newShutdownReply = shutdownReplyJson.asOpt[ShutdownReply]
-
-        newShutdownReply.get should be (shutdownReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val ShutdownReplyResults = shutdownReplyJson.validate[ShutdownReply]
-
-        ShutdownReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ShutdownReply) => valid
-        ) should be (shutdownReply)
-      }
-
-      it("should implicitly convert from a ShutdownReply instance to valid json") {
-        Json.toJson(shutdownReply) should be (shutdownReplyJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequestSpec.scala
deleted file mode 100644
index fdc063d..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequestSpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ShutdownRequestSpec extends FunSpec with Matchers {
-  val shutdownRequestJson: JsValue = Json.parse("""
-  {
-    "restart": true
-  }
-  """)
-
-  val shutdownRequest: ShutdownRequest = ShutdownRequest(
-    true
-  )
-
-  describe("ShutdownRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ShutdownRequest.toTypeString should be ("shutdown_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ShutdownRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        shutdownRequestJson.as[ShutdownRequest] should be (shutdownRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newShutdownRequest = shutdownRequestJson.asOpt[ShutdownRequest]
-
-        newShutdownRequest.get should be (shutdownRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val ShutdownRequestResults = shutdownRequestJson.validate[ShutdownRequest]
-
-        ShutdownRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ShutdownRequest) => valid
-        ) should be (shutdownRequest)
-      }
-
-      it("should implicitly convert from a ShutdownRequest instance to valid json") {
-        Json.toJson(shutdownRequest) should be (shutdownRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContentSpec.scala
deleted file mode 100644
index 5c435a8..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContentSpec.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class StreamContentSpec extends FunSpec with Matchers {
-  val streamJson: JsValue = Json.parse("""
-  {
-    "text": "<STRING>",
-    "name": "<STRING>"
-  }
-  """)
-
-  val stream = StreamContent("<STRING>", "<STRING>")
-
-  describe("StreamContent") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        StreamContent.toTypeString should be ("stream")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a StreamContent instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        streamJson.as[StreamContent] should be (stream)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = streamJson.asOpt[StreamContent]
-
-        newCompleteRequest.get should be (stream)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = streamJson.validate[StreamContent]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: StreamContent) => valid
-        ) should be (stream)
-      }
-
-      it("should implicitly convert from a StreamContent instance to valid json") {
-        Json.toJson(stream) should be (streamJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/package.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/package.scala
deleted file mode 100644
index 0174f9b..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/package.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol
-
-//import akka.zeromq.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.{CompleteRequest, ExecuteRequest}
-import play.api.libs.json.Json
-
-package object v5Test {
-  //  The header for the message
-  val MockHeader : Header = Header("<UUID>","<USER>","<SESSION>",
-    MessageType.Outgoing.ClearOutput.toString, "<VERSION>")
-  //  The parent header for the message
-  val MockParenHeader: Header = Header("<PARENT-UUID>","<PARENT-USER>","<PARENT-SESSION>",
-    MessageType.Outgoing.ClearOutput.toString, "<PARENT-VERSION>")
-  //  The actual kernel message
-  val MockKernelMessage : KernelMessage = KernelMessage(Seq("<ID>"), "<SIGNATURE>", MockHeader,
-    MockParenHeader, Metadata(), "<CONTENT>")
-  //  Use the implicit to convert the KernelMessage to ZMQMessage
-  //val MockZMQMessage : ZMQMessage = MockKernelMessage
-
-  val MockExecuteRequest: ExecuteRequest =
-    ExecuteRequest("spark code", false, true, Map(), false)
-  val MockExecuteRequestKernelMessage = MockKernelMessage.copy(
-    contentString =  Json.toJson(MockExecuteRequest).toString
-  )
-  val MockKernelMessageWithBadExecuteRequest = new KernelMessage(
-    Seq[String](), "test message", MockHeader, MockParenHeader, Map[String, String](),
-    """
-        {"code" : 124 }
-    """
-  )
-  val MockCompleteRequest: CompleteRequest = CompleteRequest("", 0)
-  val MockCompleteRequestKernelMessage: KernelMessage = MockKernelMessage.copy(contentString = Json.toJson(MockCompleteRequest).toString)
-  val MockKernelMessageWithBadJSON: KernelMessage = MockKernelMessage.copy(contentString = "inval1d")
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
new file mode 100644
index 0000000..a84a51d
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+// TODO: Move duplicate code to separate project (kernel and client)
+
+import com.ibm.spark.comm.CommCallbacks._
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+
+class CommCallbacksSpec extends FunSpec with Matchers {
+
+  private val testOpenCallback: OpenCallback = (_, _, _, _) => {}
+  private val testMsgCallback: MsgCallback = (_, _, _) => {}
+  private val testCloseCallback: CloseCallback = (_, _, _) => {}
+
+  private val failOpenCallback: OpenCallback =
+    (_, _, _, _) => throw new Throwable()
+  private val failMsgCallback: MsgCallback =
+    (_, _, _) => throw new Throwable()
+  private val failCloseCallback: CloseCallback =
+    (_, _, _) => throw new Throwable()
+
+  describe("CommCallbacks") {
+    describe("#addOpenCallback") {
+      it("should append the provided callback to the internal list") {
+        val commCallbacks = new CommCallbacks()
+          .addOpenCallback(testOpenCallback)
+
+        commCallbacks.openCallbacks should contain (testOpenCallback)
+      }
+    }
+
+    describe("#addMsgCallback") {
+      it("should append the provided callback to the internal list") {
+        val commCallbacks = new CommCallbacks()
+          .addMsgCallback(testMsgCallback)
+
+        commCallbacks.msgCallbacks should contain (testMsgCallback)
+      }
+    }
+
+    describe("#addCloseCallback") {
+      it("should append the provided callback to the internal list") {
+        val commCallbacks = new CommCallbacks()
+          .addCloseCallback(testCloseCallback)
+
+        commCallbacks.closeCallbacks should contain (testCloseCallback)
+      }
+    }
+
+    describe("#removeOpenCallback") {
+      it("should remove the callback from the internal list") {
+        val commCallbacks = new CommCallbacks()
+          .addOpenCallback(testOpenCallback)
+          .removeOpenCallback(testOpenCallback)
+
+        commCallbacks.openCallbacks should not contain (testOpenCallback)
+      }
+    }
+
+    describe("#removeMsgCallback") {
+      it("should remove the callback from the internal list") {
+        val commCallbacks = new CommCallbacks()
+          .addMsgCallback(testMsgCallback)
+          .removeMsgCallback(testMsgCallback)
+
+        commCallbacks.msgCallbacks should not contain (testMsgCallback)
+      }
+    }
+
+    describe("#removeCloseCallback") {
+      it("should remove the callback from the internal list") {
+        val commCallbacks = new CommCallbacks()
+          .addCloseCallback(testCloseCallback)
+          .removeCloseCallback(testCloseCallback)
+
+        commCallbacks.closeCallbacks should not contain (testCloseCallback)
+      }
+    }
+
+    describe("#executeOpenCallbacks") {
+      it("should return an empty sequence of results if no callbacks exist") {
+        new CommCallbacks()
+          .executeOpenCallbacks(null, "", "", MsgData.Empty) shouldBe empty
+      }
+
+      it("should return a sequence of try results if callbacks exist") {
+        val commCallbacks = new CommCallbacks()
+          .addOpenCallback(testOpenCallback)
+
+        val results = commCallbacks.executeOpenCallbacks(null, "", "", MsgData.Empty)
+
+        results.head.isSuccess should be (true)
+      }
+
+      it("should return a sequence with failures if callbacks fail") {
+        val commCallbacks = new CommCallbacks()
+          .addOpenCallback(failOpenCallback)
+
+        val results = commCallbacks.executeOpenCallbacks(null, "", "", MsgData.Empty)
+
+        results.head.isFailure should be (true)
+      }
+    }
+
+    describe("#executeMsgCallbacks") {
+      it("should return an empty sequence of results if no callbacks exist") {
+        new CommCallbacks()
+          .executeMsgCallbacks(null, "", MsgData.Empty) shouldBe empty
+      }
+
+      it("should return a sequence of try results if callbacks exist") {
+        val commCallbacks = new CommCallbacks()
+          .addMsgCallback(testMsgCallback)
+
+        val results = commCallbacks.executeMsgCallbacks(null, "", MsgData.Empty)
+
+        results.head.isSuccess should be (true)
+      }
+
+      it("should return a sequence with failures if callbacks fail") {
+        val commCallbacks = new CommCallbacks()
+          .addMsgCallback(failMsgCallback)
+
+        val results = commCallbacks.executeMsgCallbacks(null, "", MsgData.Empty)
+
+        results.head.isFailure should be (true)
+      }
+    }
+
+    describe("#executeCloseCallbacks") {
+      it("should return an empty sequence of results if no callbacks exist") {
+        new CommCallbacks()
+          .executeCloseCallbacks(null, "", MsgData.Empty) shouldBe empty
+      }
+
+      it("should return a sequence of try results if callbacks exist") {
+        val commCallbacks = new CommCallbacks()
+          .addCloseCallback(testCloseCallback)
+
+        val results = commCallbacks.executeCloseCallbacks(null, "", MsgData.Empty)
+
+        results.head.isSuccess should be (true)
+      }
+
+      it("should return a sequence with failures if callbacks fail") {
+        val commCallbacks = new CommCallbacks()
+          .addCloseCallback(failCloseCallback)
+
+        val results = commCallbacks.executeCloseCallbacks(null, "", MsgData.Empty)
+
+        results.head.isFailure should be (true)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
new file mode 100644
index 0000000..f02333e
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.comm.CommCallbacks.{CloseCallback, OpenCallback}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.UUID
+import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommOpen}
+import org.mockito.invocation.InvocationOnMock
+import org.mockito.stubbing.Answer
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
+import org.mockito.Mockito._
+import org.mockito.Matchers.{eq => mockEq, _}
+
+class CommManagerSpec extends FunSpec with Matchers with BeforeAndAfter
+  with MockitoSugar
+{
+  private val TestTargetName = "some target"
+  private val TestCommId = java.util.UUID.randomUUID().toString
+
+  /** Creates a new Comm Manager, filling in the Comm writer method. */
+  private def newCommManager(
+    commRegistrar: CommRegistrar,
+    commWriter: CommWriter
+  ): CommManager = new CommManager(commRegistrar) {
+    override protected def newCommWriter(commId: UUID): CommWriter = commWriter
+  }
+
+  private var mockCommWriter: CommWriter = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var commManager: CommManager = _
+
+  before {
+    mockCommWriter = mock[CommWriter]
+    mockCommRegistrar = mock[CommRegistrar]
+    doReturn(mockCommRegistrar).when(mockCommRegistrar)
+      .register(anyString())
+    doReturn(mockCommRegistrar).when(mockCommRegistrar)
+      .addOpenHandler(any(classOf[OpenCallback]))
+    doReturn(mockCommRegistrar).when(mockCommRegistrar)
+      .addCloseHandler(any(classOf[CloseCallback]))
+    doReturn(mockCommRegistrar).when(mockCommRegistrar)
+      .withTarget(anyString())
+
+    commManager = newCommManager(mockCommRegistrar, mockCommWriter)
+  }
+
+  describe("CommManager") {
+    describe("#withTarget") {
+      it("should return a registrar using the target name provided") {
+        val commRegistrar = commManager.withTarget(TestTargetName)
+
+        verify(commRegistrar).withTarget(TestTargetName)
+      }
+    }
+
+    describe("#register") {
+      it("should register the target name provided") {
+        commManager.register(TestTargetName)
+
+        verify(mockCommRegistrar).register(TestTargetName)
+      }
+
+      // TODO: Is there a better/cleaner way to assert the contents of the callback?
+      it("should add a link callback to the received open events") {
+        var linkFunc: OpenCallback = null
+
+        // Setup used to extract the function of the callback
+        doAnswer(new Answer[CommRegistrar]() {
+          override def answer(p1: InvocationOnMock): CommRegistrar = {
+            linkFunc = p1.getArguments.head.asInstanceOf[OpenCallback]
+            mockCommRegistrar
+          }
+        }).when(mockCommRegistrar).addOpenHandler(any(classOf[OpenCallback]))
+
+        // Call register and verify that the underlying registrar method called
+        commManager.register(TestTargetName)
+        verify(mockCommRegistrar).addOpenHandler(any(classOf[OpenCallback]))
+
+        // Trigger the callback to test what it does
+        linkFunc(mock[CommWriter], TestCommId, TestTargetName, v5.MsgData.Empty)
+        verify(mockCommRegistrar).link(TestTargetName, TestCommId)
+      }
+
+      // TODO: Is there a better/cleaner way to assert the contents of the callback?
+      it("should add an unlink callback to the received close events") {
+        var unlinkFunc: CloseCallback = null
+
+        // Setup used to extract the function of the callback
+        doAnswer(new Answer[CommRegistrar]() {
+          override def answer(p1: InvocationOnMock): CommRegistrar = {
+            unlinkFunc = p1.getArguments.head.asInstanceOf[CloseCallback]
+            mockCommRegistrar
+          }
+        }).when(mockCommRegistrar).addCloseHandler(any(classOf[CloseCallback]))
+
+        // Call register and verify that the underlying registrar method called
+        commManager.register(TestTargetName)
+        verify(mockCommRegistrar).addCloseHandler(any(classOf[CloseCallback]))
+
+        // Trigger the callback to test what it does
+        unlinkFunc(mock[CommWriter], TestCommId, v5.MsgData.Empty)
+        verify(mockCommRegistrar).unlink(TestCommId)
+      }
+    }
+
+    describe("#unregister") {
+      it("should remove the target from the collection of targets") {
+        val commManager = newCommManager(
+          new CommRegistrar(new CommStorage()),
+          mockCommWriter
+        )
+
+        commManager.register(TestTargetName)
+        commManager.unregister(TestTargetName)
+
+        commManager.isRegistered(TestTargetName) should be (false)
+      }
+    }
+
+    describe("#isRegistered") {
+      it("should return true if the target is currently registered") {
+        val commManager = newCommManager(
+          new CommRegistrar(new CommStorage()),
+          mockCommWriter
+        )
+
+        commManager.register(TestTargetName)
+
+        commManager.isRegistered(TestTargetName) should be (true)
+      }
+
+      it("should return false if the target is not currently registered") {
+        val commManager = newCommManager(
+          new CommRegistrar(new CommStorage()),
+          mockCommWriter
+        )
+
+        commManager.register(TestTargetName)
+        commManager.unregister(TestTargetName)
+
+        commManager.isRegistered(TestTargetName) should be (false)
+      }
+
+      it("should return false if the target has never been registered") {
+        val commManager = newCommManager(
+          new CommRegistrar(new CommStorage()),
+          mockCommWriter
+        )
+
+        commManager.isRegistered(TestTargetName) should be (false)
+      }
+    }
+
+    describe("#open") {
+      it("should return a new CommWriter instance that links during open") {
+        val commWriter = commManager.open(TestTargetName, v5.MsgData.Empty)
+
+        commWriter.writeOpen(TestTargetName)
+
+        // Should have been executed once during commManager.open(...) and
+        // another time with the call above
+        verify(mockCommRegistrar, times(2))
+          .link(mockEq(TestTargetName), any[v5.UUID])
+      }
+
+      it("should return a new CommWriter instance that unlinks during close") {
+        val commWriter = commManager.open(TestTargetName, v5.MsgData.Empty)
+
+        commWriter.writeClose(v5.MsgData.Empty)
+
+        verify(mockCommRegistrar).unlink(any[v5.UUID])
+      }
+
+      it("should initiate a comm_open") {
+        commManager.open(TestTargetName, v5.MsgData.Empty)
+
+        verify(mockCommWriter).writeOpen(TestTargetName, v5.MsgData.Empty)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
new file mode 100644
index 0000000..ad6b7c6
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
@@ -0,0 +1,460 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import java.util.UUID
+
+import com.ibm.spark.comm.CommCallbacks.{CloseCallback, MsgCallback, OpenCallback}
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+
+class CommRegistrarSpec extends FunSpec with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val TestTargetName = "some target name"
+  private val TestCommId = UUID.randomUUID().toString
+  private val TestOpenFunc: OpenCallback = (_, _, _, _) => {}
+  private val TestMsgFunc: MsgCallback = (_, _, _) => {}
+  private val TestCloseFunc: CloseCallback = (_, _, _) => {}
+
+  private var commStorage: CommStorage = _
+  private var commRegistrar: CommRegistrar = _
+
+  before {
+    commStorage = new CommStorage()
+    commRegistrar = new CommRegistrar(commStorage)
+  }
+
+  describe("CommRegistrar") {
+    describe("#withTarget") {
+      it("should update the target name to the specified name") {
+        val expected = TestTargetName
+        val actual = commRegistrar.withTarget(expected).defaultTargetName.get
+
+        actual should be (expected)
+      }
+
+      it("should replace the existing target name with the specified name") {
+        val firstName = "some name"
+        val secondName = "some other name"
+
+        val firstRegistrar = commRegistrar.withTarget(firstName)
+        val secondRegisrar = firstRegistrar.withTarget(secondName)
+
+        firstRegistrar.defaultTargetName.get should be (firstName)
+        secondRegisrar.defaultTargetName.get should be (secondName)
+      }
+    }
+
+    describe("#register") {
+      it("should mark the specified target name as registered") {
+        commRegistrar.register(TestTargetName)
+
+        commRegistrar.isRegistered(TestTargetName) should be (true)
+      }
+
+      it("should not replace existing callbacks if the target exists") {
+        // Set up the initial collection of callbacks
+        val originalRegistrar = commRegistrar.register(TestTargetName)
+          .addOpenHandler(TestOpenFunc)
+          .addMsgHandler(TestMsgFunc)
+          .addCloseHandler(TestCloseFunc)
+
+        // Attempt to re-register
+        commRegistrar.register(TestTargetName)
+
+        // The original callbacks should still be in the registrar
+        originalRegistrar.getOpenHandlers should contain (TestOpenFunc)
+        originalRegistrar.getMsgHandlers should contain (TestMsgFunc)
+        originalRegistrar.getCloseHandlers should contain (TestCloseFunc)
+      }
+
+      it("should return a new wrapper with the default target name set") {
+        val expected = TestTargetName
+
+        val actual = commRegistrar.register(expected).defaultTargetName.get
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#unregister") {
+      it("should remove all of the associated target callbacks") {
+        commRegistrar.register(TestTargetName)
+
+        commRegistrar.isRegistered(TestTargetName) should be (true)
+
+        commRegistrar.unregister(TestTargetName)
+
+        commRegistrar.isRegistered(TestTargetName) should be (false)
+      }
+
+      it("should return the removed associated target callbacks") {
+        // Register and add one of each handler
+        commRegistrar.register(TestTargetName)
+          .addOpenHandler(TestOpenFunc)
+          .addMsgHandler(TestMsgFunc)
+          .addCloseHandler(TestCloseFunc)
+
+        val commCallbacks = commRegistrar.unregister(TestTargetName).get
+
+        commCallbacks.openCallbacks should contain (TestOpenFunc)
+        commCallbacks.msgCallbacks should contain (TestMsgFunc)
+        commCallbacks.closeCallbacks should contain (TestCloseFunc)
+      }
+
+      it("should return None if there is no matching target registered") {
+        commRegistrar.unregister(TestTargetName) should be (None)
+      }
+    }
+
+    describe("#isRegistered") {
+      it("should return true if the target is currently registered") {
+        commRegistrar.register(TestTargetName)
+
+        commRegistrar.isRegistered(TestTargetName) should be (true)
+      }
+
+      it("should return false if the target is not currently registered") {
+        commRegistrar.register(TestTargetName)
+        commRegistrar.unregister(TestTargetName)
+
+        commRegistrar.isRegistered(TestTargetName) should be (false)
+      }
+
+      it("should return false if the target has never been registered") {
+        commRegistrar.isRegistered(TestTargetName) should be (false)
+      }
+    }
+
+    describe("#link") {
+      it("should add the specified Comm id to the list for the target") {
+        commRegistrar.link(TestTargetName, TestCommId)
+
+        commRegistrar.getLinks(TestTargetName) should contain (TestCommId)
+      }
+
+      it("should throw an exception if no target is provided with no default") {
+        intercept[AssertionError] {
+          commRegistrar.link(TestCommId)
+        }
+      }
+
+      it("should use the default target if it exists and no other is given") {
+        commRegistrar.register(TestTargetName).link(TestCommId)
+
+        commRegistrar.getLinks(TestTargetName) should contain (TestCommId)
+      }
+    }
+
+    describe("#getTargetFromLink") {
+      it("should return Some target name if found") {
+        val expected = TestTargetName
+
+        commRegistrar.register(expected).link(TestCommId)
+
+        val actual = commRegistrar.getTargetFromLink(TestCommId).get
+
+        actual should be (expected)
+      }
+
+      it("should return None if not found") {
+        commRegistrar.getTargetFromLink(TestCommId) should be (None)
+      }
+    }
+
+    describe("#getLinks") {
+      it("should return a collection of links for the target") {
+        commRegistrar.register(TestTargetName).link(TestCommId)
+
+        commRegistrar.getLinks(TestTargetName) should contain (TestCommId)
+      }
+
+      it("should return an empty collection if the target does not exist") {
+        commRegistrar.getLinks(TestTargetName) should be (empty)
+      }
+
+      it("should use the default target name if no name is specified") {
+        val updatedCommRegistrar =
+          commRegistrar.register(TestTargetName).link(TestCommId)
+
+        updatedCommRegistrar.getLinks should contain (TestCommId)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.getLinks
+        }
+      }
+    }
+
+    describe("#unlink") {
+      it("should remove the Comm id from the underlying target") {
+        val mockCommStorage = mock[CommStorage]
+        val commRegistrar = new CommRegistrar(mockCommStorage)
+
+        commRegistrar.unlink(TestCommId)
+
+        verify(mockCommStorage).removeCommIdFromTarget(TestCommId)
+      }
+    }
+
+    describe("#addOpenHandler") {
+      it("should add the handler if given a specific target name") {
+        commRegistrar.addOpenHandler(TestTargetName, TestOpenFunc)
+
+        commRegistrar.getOpenHandlers(TestTargetName) should
+          contain (TestOpenFunc)
+      }
+
+      it("should create a new set of CommCallbacks if the target is missing") {
+        commRegistrar.addOpenHandler(TestTargetName, TestOpenFunc)
+
+        commRegistrar.getOpenHandlers(TestTargetName) should
+          contain (TestOpenFunc)
+      }
+
+      it("should add the handler if not given a target name but has a default") {
+        commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
+
+        commRegistrar.getOpenHandlers(TestTargetName) should
+          contain (TestOpenFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.addOpenHandler(TestOpenFunc)
+        }
+      }
+    }
+
+    describe("#getOpenHandlers") {
+      it("should return a collection of open handlers for the target") {
+        commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
+
+        commRegistrar.getOpenHandlers(TestTargetName) should
+          contain (TestOpenFunc)
+      }
+
+      it("should return an empty collection if the target does not exist") {
+        commRegistrar.getOpenHandlers(TestTargetName) should be (empty)
+      }
+
+      it("should use the default target name if no name is specified") {
+        val updatedCommRegistrar =
+          commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
+
+        updatedCommRegistrar.getOpenHandlers should contain (TestOpenFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.getOpenHandlers
+        }
+      }
+    }
+
+    describe("#removeOpenHandler") {
+      it("should remove the handler if given a specific target name") {
+        val updatedRegistrar =
+          commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
+        commRegistrar.removeOpenHandler(TestTargetName, TestOpenFunc)
+
+        commRegistrar.getOpenHandlers(TestTargetName) should
+          not contain (TestOpenFunc)
+      }
+
+      it("should remove the handler if not given a target name but has a default") {
+        val updatedRegistrar =
+          commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
+        updatedRegistrar.removeOpenHandler(TestOpenFunc)
+
+        commRegistrar.getOpenHandlers(TestTargetName) should
+          not contain (TestOpenFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.removeOpenHandler(TestOpenFunc)
+        }
+      }
+    }
+
+    describe("#addMsgHandler") {
+      it("should add the handler if given a specific target name") {
+        commRegistrar.addMsgHandler(TestTargetName, TestMsgFunc)
+
+        commRegistrar.getMsgHandlers(TestTargetName) should
+          contain (TestMsgFunc)
+      }
+
+      it("should create a new set of CommCallbacks if the target is missing") {
+        commRegistrar.addMsgHandler(TestTargetName, TestMsgFunc)
+
+        commRegistrar.getMsgHandlers(TestTargetName) should
+          contain (TestMsgFunc)
+      }
+
+      it("should add the handler if not given a target name but has a default") {
+        commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
+
+        commRegistrar.getMsgHandlers(TestTargetName) should
+          contain (TestMsgFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.addMsgHandler(TestMsgFunc)
+        }
+      }
+    }
+    
+    describe("#getMsgHandlers") {
+      it("should return a collection of msg handlers for the target") {
+        commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
+
+        commRegistrar.getMsgHandlers(TestTargetName) should
+          contain (TestMsgFunc)
+      }
+
+      it("should return an empty collection if the target does not exist") {
+        commRegistrar.getMsgHandlers(TestTargetName) should be (empty)
+      }
+
+      it("should use the default target name if no name is specified") {
+        val updatedCommRegistrar =
+          commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
+
+        updatedCommRegistrar.getMsgHandlers should contain (TestMsgFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.getMsgHandlers
+        }
+      }
+    }
+
+    describe("#removeMsgHandler") {
+      it("should remove the handler if given a specific target name") {
+        val updatedRegistrar =
+          commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
+        commRegistrar.removeMsgHandler(TestTargetName, TestMsgFunc)
+
+        commRegistrar.getMsgHandlers(TestTargetName) should
+          not contain (TestMsgFunc)
+      }
+
+      it("should remove the handler if not given a target name but has a default") {
+        val updatedRegistrar =
+          commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
+        updatedRegistrar.removeMsgHandler(TestMsgFunc)
+
+        commRegistrar.getMsgHandlers(TestTargetName) should
+          not contain (TestMsgFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.removeMsgHandler(TestMsgFunc)
+        }
+      }
+    }
+
+    describe("#addCloseHandler") {
+      it("should add the handler if given a specific target name") {
+        commRegistrar.addCloseHandler(TestTargetName, TestCloseFunc)
+
+        commRegistrar.getCloseHandlers(TestTargetName) should
+          contain (TestCloseFunc)
+      }
+
+      it("should create a new set of CommCallbacks if the target is missing") {
+        commRegistrar.addCloseHandler(TestTargetName, TestCloseFunc)
+
+        commRegistrar.getCloseHandlers(TestTargetName) should
+          contain (TestCloseFunc)
+      }
+
+      it("should add the handler if not given a target name but has a default") {
+        commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
+
+        commRegistrar.getCloseHandlers(TestTargetName) should
+          contain (TestCloseFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.addCloseHandler(TestCloseFunc)
+        }
+      }
+    }
+
+    describe("#getCloseHandlers") {
+      it("should return a collection of Close handlers for the target") {
+        commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
+
+        commRegistrar.getCloseHandlers(TestTargetName) should
+          contain (TestCloseFunc)
+      }
+
+      it("should return an empty collection if the target does not exist") {
+        commRegistrar.getCloseHandlers(TestTargetName) should be (empty)
+      }
+
+      it("should use the default target name if no name is specified") {
+        val updatedCommRegistrar =
+          commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
+
+        updatedCommRegistrar.getCloseHandlers should contain (TestCloseFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.getCloseHandlers
+        }
+      }
+    }
+    
+    describe("#removeCloseHandler") {
+      it("should remove the handler if given a specific target name") {
+        val updatedRegistrar =
+          commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
+        commRegistrar.removeCloseHandler(TestTargetName, TestCloseFunc)
+
+        commRegistrar.getCloseHandlers(TestTargetName) should
+          not contain (TestCloseFunc)
+      }
+
+      it("should remove the handler if not given a target name but has a default") {
+        val updatedRegistrar =
+          commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
+        updatedRegistrar.removeCloseHandler(TestCloseFunc)
+
+        commRegistrar.getCloseHandlers(TestTargetName) should
+          not contain (TestCloseFunc)
+      }
+
+      it("should fail if not given a target name and has no default") {
+        intercept[AssertionError] {
+          commRegistrar.removeCloseHandler(TestCloseFunc)
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
new file mode 100644
index 0000000..f92b852
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.UUID
+import org.scalatest.mock.MockitoSugar
+import org.mockito.Mockito._
+import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
+
+import scala.collection.{immutable, mutable}
+
+class CommStorageSpec extends FunSpec with Matchers with BeforeAndAfter
+  with MockitoSugar
+{
+  private val TestTargetName = "some target"
+  private val TestCommId = java.util.UUID.randomUUID().toString
+
+  private var mockLinks: immutable.IndexedSeq[v5.UUID] = _
+  private var mockCommCallbacks: CommCallbacks = _
+  private var callbackStorage: mutable.Map[String, CommCallbacks] = _
+  private var linkStorage: mutable.Map[String, immutable.IndexedSeq[UUID]] = _
+  private var commStorage: CommStorage = _
+
+  before {
+    mockLinks = mock[immutable.IndexedSeq[v5.UUID]]
+    mockCommCallbacks = mock[CommCallbacks]
+    callbackStorage = new mutable.HashMap[String, CommCallbacks]()
+    linkStorage = new mutable.HashMap[String, immutable.IndexedSeq[UUID]]()
+    commStorage = new CommStorage(callbackStorage, linkStorage)
+  }
+
+  describe("CommStorage") {
+    describe("#setTargetCallbacks") {
+      it("should set the internal callback storage using the target") {
+        commStorage.setTargetCallbacks(TestTargetName, mockCommCallbacks)
+
+        callbackStorage(TestTargetName) should be (mockCommCallbacks)
+      }
+
+      it("should overwrite any existing callbacks for the target") {
+        val otherCommCallbacks = mock[CommCallbacks]
+
+        commStorage.setTargetCallbacks(TestTargetName, otherCommCallbacks)
+        callbackStorage(TestTargetName) should be (otherCommCallbacks)
+
+        commStorage.setTargetCallbacks(TestTargetName, mockCommCallbacks)
+        callbackStorage(TestTargetName) should be (mockCommCallbacks)
+      }
+    }
+
+    describe("#removeTargetCallbacks") {
+      it("should remove the internal callback with the target") {
+        commStorage.setTargetCallbacks(TestTargetName, mock[CommCallbacks])
+        commStorage.hasTargetCallbacks(TestTargetName) should be (true)
+
+        commStorage.removeTargetCallbacks(TestTargetName)
+        commStorage.hasTargetCallbacks(TestTargetName) should be (false)
+      }
+
+      it("should return Some containing the removed callbacks") {
+        val expected = mock[CommCallbacks]
+        commStorage.setTargetCallbacks(TestTargetName, expected)
+
+        val actual = commStorage.removeTargetCallbacks(TestTargetName)
+
+        actual should be (Some(expected))
+      }
+
+      it("should return None if no callbacks removed") {
+        val expected = None
+
+        val actual = commStorage.removeTargetCallbacks(TestTargetName)
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#getTargetCallbacks") {
+      it("should return Some containing callbacks associated with the target") {
+        val expected = mock[CommCallbacks]
+
+        commStorage.setTargetCallbacks(TestTargetName, expected)
+
+        val actual = commStorage.getTargetCallbacks(TestTargetName)
+
+        actual should be (Some(expected))
+      }
+
+      it("should return None if no callbacks associated with the target") {
+        val expected = None
+
+        val actual = commStorage.getTargetCallbacks(TestTargetName)
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#hasTargetCallbacks") {
+      it("should return true if the target callbacks exist") {
+        commStorage.setTargetCallbacks(TestTargetName, mock[CommCallbacks])
+
+        commStorage.hasTargetCallbacks(TestTargetName) should be (true)
+      }
+
+      it("should return false if the target callbacks do not exist") {
+        commStorage.hasTargetCallbacks(TestTargetName) should be (false)
+      }
+    }
+
+    describe("#setTargetCommIds") {
+      it("should set the internal link storage for Comm ids for the target") {
+        commStorage.setTargetCommIds(TestTargetName, mockLinks)
+
+        linkStorage(TestTargetName) should be (mockLinks)
+      }
+
+      it("should overwrite any existing internal link storage for the target") {
+        val otherLinks = mock[immutable.IndexedSeq[v5.UUID]]
+
+        commStorage.setTargetCommIds(TestTargetName, otherLinks)
+        linkStorage(TestTargetName) should be (otherLinks)
+
+        commStorage.setTargetCommIds(TestTargetName, mockLinks)
+        linkStorage(TestTargetName) should be (mockLinks)
+      }
+    }
+
+    describe("#removeTargetCommIds") {
+      it("should remove the internal links to the target") {
+        commStorage.setTargetCommIds(TestTargetName, mockLinks)
+        commStorage.hasTargetCommIds(TestTargetName) should be (true)
+
+        commStorage.removeTargetCommIds(TestTargetName)
+        commStorage.hasTargetCommIds(TestTargetName) should be (false)
+      }
+
+      it("should return Some containing the removed links") {
+        val expected = mock[immutable.IndexedSeq[v5.UUID]]
+        commStorage.setTargetCommIds(TestTargetName, expected)
+
+        val actual = commStorage.removeTargetCommIds(TestTargetName)
+
+        actual should be (Some(expected))
+      }
+
+      it("should return None if no links were removed") {
+        val expected = None
+
+        val actual = commStorage.removeTargetCommIds(TestTargetName)
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#removeCommIdFromTarget") {
+      it("should remove the Comm id from the list linked to a target") {
+        val commIds = ("1" :: TestCommId :: "2" :: Nil).toIndexedSeq
+
+        val expected = ("1" :: "2" :: Nil).toIndexedSeq
+        commStorage.setTargetCommIds(TestTargetName, commIds)
+
+        commStorage.removeCommIdFromTarget(TestCommId)
+
+        commStorage.getCommIdsFromTarget(TestTargetName) should be (Some(expected))
+      }
+
+      it("should return the Some containing target linked to removed Comm id") {
+        val commIds = ("1" :: TestCommId :: "2" :: Nil).toIndexedSeq
+
+        commStorage.setTargetCommIds(TestTargetName, commIds)
+
+        commStorage.removeCommIdFromTarget(TestCommId) should be (Some(TestTargetName))
+      }
+
+      it("should return None if no Comm id was found") {
+        commStorage.removeCommIdFromTarget(TestCommId) should be (None)
+      }
+    }
+
+    describe("#getCommIdsFromTarget") {
+      it("should return Some containing the sequence of Comm ids if found") {
+        commStorage.setTargetCommIds(TestTargetName, mockLinks)
+        commStorage.getCommIdsFromTarget(TestTargetName) should be (Some(mockLinks))
+      }
+
+      it("should return None if no Comm ids are found for the target") {
+        commStorage.getCommIdsFromTarget(TestTargetName) should be (None)
+      }
+    }
+
+    describe("#getCommIdCallbacks") {
+      it("should return Some callbacks if the Comm id is linked") {
+        val expected = mockCommCallbacks
+
+        val spyCommStorage = spy(commStorage)
+        doReturn(Some(TestTargetName)).when(spyCommStorage)
+          .getTargetFromCommId(TestCommId)
+        doReturn(Some(expected)).when(spyCommStorage)
+          .getTargetCallbacks(TestTargetName)
+
+        spyCommStorage.getCommIdCallbacks(TestCommId) should be (Some(expected))
+      }
+
+      it("should return None if the Comm id is not linked") {
+        commStorage.getCommIdCallbacks(TestCommId) should be (None)
+      }
+    }
+
+    describe("#getTargetFromCommId") {
+      it("should return Some containing the target name if found") {
+        val commIds = (TestCommId :: Nil).toIndexedSeq
+
+        commStorage.setTargetCommIds(TestTargetName, commIds)
+        commStorage.getTargetFromCommId(TestCommId) should be (Some(TestTargetName))
+      }
+
+      it("should return None if no target name is found for the Comm id") {
+        commStorage.getTargetFromCommId(TestCommId) should be (None)
+      }
+    }
+
+    describe("#hasTargetCommIds") {
+      it("should return true if the target has Comm ids associated with it") {
+        commStorage.setTargetCommIds(TestTargetName, mockLinks)
+        commStorage.hasTargetCommIds(TestTargetName) should be (true)
+      }
+
+      it("should return false if the target has no Comm ids associated with it") {
+        commStorage.hasTargetCommIds(TestTargetName) should be (false)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
new file mode 100644
index 0000000..0818da3
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import java.util.UUID
+
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import org.mockito.Matchers.{eq => mockEq, _}
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, BeforeAndAfter, Matchers}
+
+
+class CommWriterSpec extends FunSpec with Matchers with BeforeAndAfter
+  with MockitoSugar
+{
+  private val TestCommId = UUID.randomUUID().toString
+
+  class TestCommWriter extends CommWriter(TestCommId) {
+    // Stub this implementation to do nothing
+    override protected[comm] def sendCommKernelMessage[
+      T <: KernelMessageContent with CommContent
+    ](commContent: T): Unit = {}
+  }
+
+  private var commWriter: CommWriter = _
+
+  before {
+    commWriter = spy(new TestCommWriter())
+  }
+
+  describe("CommWriter") {
+    describe("#writeOpen") {
+      it("should package a CommOpen instance") {
+        commWriter.writeOpen("")
+
+        verify(commWriter).sendCommKernelMessage(any[CommOpen])
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = TestCommId
+        commWriter.writeOpen("")
+
+        verify(commWriter).sendCommKernelMessage(
+          CommOpen(comm_id = expected, target_name = "", data = MsgData.Empty))
+      }
+
+      it("should include the target name in the message") {
+        val expected = "<TARGET_NAME>"
+        commWriter.writeOpen(expected)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommOpen(
+            comm_id = TestCommId, target_name = expected, data = MsgData.Empty
+          )
+        )
+      }
+
+      it("should provide empty data in the message if no data is provided") {
+        val expected: v5.MsgData = MsgData.Empty
+        commWriter.writeOpen("")
+
+        verify(commWriter).sendCommKernelMessage(
+          CommOpen(comm_id = TestCommId, target_name = "", data = expected))
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("message" -> "a", "foo" -> "bar")
+        commWriter.writeOpen("", expected)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommOpen(comm_id = TestCommId, target_name = "", data = expected))
+      }
+    }
+
+    describe("#writeMsg") {
+      it("should send a comm_msg message to the relay") {
+        commWriter.writeMsg(MsgData.Empty)
+
+        verify(commWriter).sendCommKernelMessage(any[CommMsg])
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = TestCommId
+        commWriter.writeMsg(MsgData.Empty)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommMsg(comm_id = expected, data = MsgData.Empty))
+      }
+
+      it("should fail a require if the data is null") {
+        intercept[IllegalArgumentException] {
+          commWriter.writeMsg(null)
+        }
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("message" -> "a")
+        commWriter.writeMsg(expected)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommMsg(comm_id = TestCommId, data = expected))
+      }
+    }
+
+    describe("#writeClose") {
+      it("should send a comm_close message to the relay") {
+        commWriter.writeClose()
+
+        verify(commWriter).sendCommKernelMessage(any[CommClose])
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = TestCommId
+        commWriter.writeClose()
+
+        verify(commWriter).sendCommKernelMessage(
+          CommClose(comm_id = expected, data = MsgData.Empty))
+      }
+
+      it("should provide empty data in the message if no data is provided") {
+        val expected: v5.MsgData = MsgData.Empty
+        commWriter.writeClose()
+
+        verify(commWriter).sendCommKernelMessage(
+          CommClose(comm_id = TestCommId, data = expected))
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("message" -> "a")
+        commWriter.writeClose(expected)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommClose(comm_id = TestCommId, data = expected))
+      }
+    }
+
+    describe("#write") {
+      it("should send a comm_msg message to the relay") {
+        commWriter.write(Array('a'), 0, 1)
+
+        verify(commWriter).sendCommKernelMessage(any[CommMsg])
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = TestCommId
+        val messageData = MsgData("message" -> "a")
+        commWriter.write(Array('a'), 0, 1)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommMsg(comm_id = expected, data = messageData))
+      }
+
+      it("should package the string as part of the data with a 'message' key") {
+        val expected = MsgData("message" -> "a")
+        commWriter.write(Array('a'), 0, 1)
+
+        verify(commWriter).sendCommKernelMessage(
+          CommMsg(comm_id = TestCommId, data = expected))
+      }
+    }
+
+    describe("#flush") {
+      it("should do nothing") {
+        // TODO: Is this test necessary? It does nothing.
+        commWriter.flush()
+      }
+    }
+
+    describe("#close") {
+      it("should send a comm_close message to the relay") {
+        commWriter.close()
+
+        verify(commWriter).sendCommKernelMessage(any[CommClose])
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = TestCommId
+        commWriter.close()
+
+        verify(commWriter).sendCommKernelMessage(
+          CommClose(comm_id = expected, data = MsgData.Empty))
+      }
+
+      it("should provide empty data in the message") {
+        val expected: v5.MsgData = MsgData.Empty
+        commWriter.close()
+
+        verify(commWriter).sendCommKernelMessage(
+          CommClose(comm_id = TestCommId, data = expected))
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
new file mode 100644
index 0000000..2dd9b31
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+import org.scalatest.{Matchers, FunSpec}
+
+class HeaderBuilderSpec extends FunSpec with Matchers {
+  describe("HeaderBuilder") {
+    describe("#create") {
+      it("should set the msg_id field to a unique ID if none is provided") {
+        HeaderBuilder.create("").msg_id should not be empty
+      }
+
+      it("should set the msg_id field to the argument if provided") {
+        val expected = "some id"
+        HeaderBuilder.create("", expected).msg_id should be (expected)
+      }
+
+      it("should set the username field to the SparkKernelInfo property") {
+        val expected = SparkKernelInfo.username
+        HeaderBuilder.create("").username should be (expected)
+      }
+
+      it("should set the session field to the SparkKernelInfo property") {
+        val expected = SparkKernelInfo.session
+        HeaderBuilder.create("").session should be (expected)
+      }
+
+      it("should set the msg_type field to the argument provided") {
+        val expected = "some type"
+        HeaderBuilder.create(expected).msg_type should be (expected)
+      }
+
+      it("should set the version field to the SparkKernelInfo property") {
+        val expected = SparkKernelInfo.protocolVersion
+        HeaderBuilder.create("").version should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
new file mode 100644
index 0000000..d53d64e
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, Json, JsValue}
+
+class HeaderSpec extends FunSpec with Matchers {
+  val headerJson: JsValue = Json.parse("""
+  {
+    "msg_id": "<UUID>",
+    "username": "<STRING>",
+    "session": "<UUID>",
+    "msg_type": "<STRING>",
+    "version": "<FLOAT>"
+  }
+  """)
+
+  val header: Header = Header(
+    "<UUID>", "<STRING>", "<UUID>", "<STRING>", "<FLOAT>"
+  )
+
+  describe("Header") {
+    describe("when null") {
+      it("should implicitly convert to empty json") {
+        val header: Header = null
+        Json.toJson(header).toString() should be ("{}")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a header instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        headerJson.as[Header] should be (header)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newHeader = headerJson.asOpt[Header]
+
+        newHeader.get should be (header)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val headerResults = headerJson.validate[Header]
+
+        headerResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: Header) => valid
+        ) should be (header)
+      }
+
+      it("should implicitly convert from a header instance to valid json") {
+        Json.toJson(header) should be (headerJson)
+      }
+    }
+  }
+}



[29/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClient.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClient.scala
deleted file mode 100644
index 6dafbcd..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClient.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import akka.actor.{ActorRef, Actor}
-import akka.util.{ByteString, Timeout}
-import com.ibm.spark.communication.ZMQMessage
-import akka.pattern.ask
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.utils.LogLike
-import com.ibm.spark.kernel.protocol.v5.UUID
-import scala.collection.concurrent.{Map, TrieMap}
-import scala.concurrent.duration._
-
-object HeartbeatMessage {}
-/**
- * The client endpoint for heartbeat messages specified in the IPython Kernel
- * Spec.
- *
- * @param socketFactory A factory to create the ZeroMQ socket connection
- * @param actorLoader The loader used to retrieve actors
- * @param signatureEnabled Whether or not to check and provide signatures
- */
-class HeartbeatClient(
-  socketFactory : SocketFactory,
-  actorLoader: ActorLoader,
-  signatureEnabled: Boolean
-) extends Actor with LogLike {
-  logger.debug("Created new Heartbeat Client actor")
-  implicit val timeout = Timeout(1.minute)
-
-  val futureMap: Map[UUID, ActorRef] = TrieMap[UUID, ActorRef]()
-  val socket = socketFactory.HeartbeatClient(context.system, self)
-
-  override def receive: Receive = {
-    // from Heartbeat
-    case message: ZMQMessage =>
-      val id = message.frames.map((byteString: ByteString) =>
-        new String(byteString.toArray)).mkString("\n")
-      logger.info(s"Heartbeat client receive:$id")
-      futureMap(id) ! true
-      futureMap.remove(id)
-
-    // from SparkKernelClient
-    case HeartbeatMessage =>
-      import scala.concurrent.ExecutionContext.Implicits.global
-      val id = java.util.UUID.randomUUID().toString
-      futureMap += (id -> sender)
-      logger.info(s"Heartbeat client send: $id")
-      val future = socket ? ZMQMessage(ByteString(id.getBytes))
-      future.onComplete {
-        // future always times out because server "tells" response {
-        case(_) => futureMap.remove(id)
-      }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClient.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClient.scala
deleted file mode 100644
index b183a23..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClient.scala
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import akka.actor.Actor
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.comm.{CommStorage, CommRegistrar, ClientCommWriter}
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import Utilities._
-import com.ibm.spark.kernel.protocol.v5.client.execution.DeferredExecutionManager
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.LogLike
-
-import scala.util.Failure
-
-/**
- * The client endpoint for IOPub messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- */
-class IOPubClient(
-  socketFactory: SocketFactory, actorLoader: ActorLoader,
-  signatureEnabled: Boolean,
-  commRegistrar: CommRegistrar, commStorage: CommStorage
-) extends Actor with LogLike {
-  private val PARENT_HEADER_NULL_MESSAGE = "Parent Header was null in Kernel Message."
-  private val socket = socketFactory.IOPubClient(context.system, self)
-  logger.info("Created IOPub socket")
-
-  /**
-   * Constructs and returns a map directing message types to functions.
-   *
-   * @param kernelMessage The kernel message used to generate the map
-   *
-   * @return The map of
-   */
-  private def getMessageMap(kernelMessage: KernelMessage) = Map[String, () => Unit](
-    ExecuteResult.toTypeString -> { () =>
-      receiveKernelMessage(kernelMessage, receiveExecuteResult(_, kernelMessage))
-    },
-    StreamContent.toTypeString -> { () =>
-      receiveKernelMessage(kernelMessage, receiveStreamMessage(_, kernelMessage))
-    },
-    CommOpen.toTypeString -> { () =>
-      receiveKernelMessage(kernelMessage, receiveCommOpen(_, kernelMessage))
-    },
-    CommMsg.toTypeString -> { () =>
-      receiveKernelMessage(kernelMessage, receiveCommMsg(_, kernelMessage))
-    },
-    CommClose.toTypeString -> { () =>
-      receiveKernelMessage(kernelMessage, receiveCommClose(_, kernelMessage))
-    }
-  )
-
-
-  private def receiveKernelMessage(
-    kernelMessage: KernelMessage, func: (String) => Unit
-  ): Unit = {
-    if(kernelMessage.parentHeader != null){
-      func(kernelMessage.parentHeader.msg_id)
-    } else {
-      logger.warn("Received message with null parent header.")
-      logger.debug(s"Kernel message is: $kernelMessage")
-      sender.forward(Failure(new RuntimeException(PARENT_HEADER_NULL_MESSAGE)))
-    }
-  }
-
-  private def receiveStreamMessage(
-    parentHeaderId:String, kernelMessage: KernelMessage
-  ): Unit = {
-    // look up callback in CallbackMap based on msg_id and invoke
-    val optionalDE = DeferredExecutionManager.get(parentHeaderId)
-    optionalDE match {
-      case Some(de) => parseAndHandle(kernelMessage.contentString,
-        StreamContent.streamContentReads,
-        (streamContent: StreamContent) => de.emitStreamContent(streamContent))
-      case None =>
-        logger.warn(s"No deferred execution found for id $parentHeaderId")
-    }
-  }
-
-  private def receiveExecuteResult(
-    parentHeaderId:String, kernelMessage: KernelMessage
-  ): Unit = {
-    // look up callback in CallbackMap based on msg_id and invoke
-    val optionalDE = DeferredExecutionManager.get(parentHeaderId)
-    optionalDE match {
-      case Some(de) => parseAndHandle(kernelMessage.contentString,
-        ExecuteResult.executeResultReads,
-        (executeResult: ExecuteResult) => de.resolveResult(executeResult))
-      case None =>
-        logger.warn(s"No deferred execution found for id $parentHeaderId")
-    }
-  }
-
-  private def receiveCommOpen(
-    parentHeaderId:String, kernelMessage: KernelMessage
-  ): Unit = {
-    parseAndHandle(
-      kernelMessage.contentString,
-      CommOpen.commOpenReads,
-      (commOpen: CommOpen) => {
-        val targetName = commOpen.target_name
-        val commId = commOpen.comm_id
-        val commWriter = new ClientCommWriter(
-          actorLoader, KMBuilder(), commId)
-
-        commStorage.getTargetCallbacks(targetName) match {
-          // Unexpected target (does not exist on this side), so send close
-          case None             =>
-            commWriter.close()
-          // Found target, so execute callbacks
-          case Some(callbacks)  =>
-            callbacks.executeOpenCallbacks(
-              commWriter, commId, targetName, commOpen.data)
-        }
-      }
-    )
-  }
-
-  private def receiveCommMsg(
-    parentHeaderId:String, kernelMessage: KernelMessage
-  ): Unit = {
-    parseAndHandle(
-      kernelMessage.contentString,
-      CommMsg.commMsgReads,
-      (commMsg: CommMsg) => {
-        val commId = commMsg.comm_id
-
-        commStorage.getCommIdCallbacks(commId) match {
-          case None             =>
-          case Some(callbacks)  =>
-            val commWriter = new ClientCommWriter(
-              actorLoader, KMBuilder(), commId)
-            callbacks.executeMsgCallbacks(commWriter, commId, commMsg.data)
-        }
-      }
-    )
-  }
-
-  private def receiveCommClose(
-    parentHeaderId:String, kernelMessage: KernelMessage
-  ): Unit = {
-    parseAndHandle(
-      kernelMessage.contentString,
-      CommClose.commCloseReads,
-      (commClose: CommClose) => {
-        val commId = commClose.comm_id
-
-        commStorage.getCommIdCallbacks(commId) match {
-          case None             =>
-          case Some(callbacks)  =>
-            val commWriter = new ClientCommWriter(
-              actorLoader, KMBuilder(), commId)
-            callbacks.executeCloseCallbacks(commWriter, commId, commClose.data)
-        }
-      }
-    )
-  }
-
-  override def receive: Receive = {
-    case message: ZMQMessage =>
-      // convert to KernelMessage using implicits in v5
-      logger.debug("Received IOPub kernel message.")
-      val kernelMessage: KernelMessage = message
-
-      // TODO: Validate incoming message signature
-
-      logger.trace(s"Kernel message is $kernelMessage")
-      val messageTypeString = kernelMessage.header.msg_type
-
-      val messageMap = getMessageMap(kernelMessage)
-
-      if (messageMap.contains(messageTypeString)) {
-        messageMap(messageTypeString)()
-      } else {
-        logger.warn(s"Received unhandled MessageType $messageTypeString")
-      }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClient.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClient.scala
deleted file mode 100644
index bf504af..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClient.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import akka.actor.Actor
-import akka.util.Timeout
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, UUID}
-import Utilities._
-import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteReply
-
-import com.ibm.spark.utils.LogLike
-import scala.concurrent.Await
-import scala.concurrent.duration._
-import akka.pattern.ask
-
-/**
- * The client endpoint for Shell messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- * @param actorLoader The loader used to retrieve actors
- * @param signatureEnabled Whether or not to check and provide signatures
- */
-class ShellClient(
-  socketFactory: SocketFactory,
-  actorLoader: ActorLoader,
-  signatureEnabled: Boolean
-) extends Actor with LogLike {
-  logger.debug("Created shell client actor")
-  implicit val timeout = Timeout(21474835.seconds)
-
-  val socket = socketFactory.ShellClient(context.system, self)
-
-  def receiveExecuteReply(parentId:String, kernelMessage: KernelMessage): Unit = {
-    val deOption: Option[DeferredExecution] = DeferredExecutionManager.get(parentId)
-    deOption match {
-      case None =>
-        logger.warn(s"No deferred execution for parent id ${parentId}")
-      case Some(de) =>
-        Utilities.parseAndHandle(kernelMessage.contentString,
-          ExecuteReply.executeReplyReads, (er: ExecuteReply) => de.resolveReply(er))
-    }
-  }
-
-  override def receive: Receive = {
-    // from shell
-    case message: ZMQMessage =>
-      logger.debug("Received shell kernel message.")
-      val kernelMessage: KernelMessage = message
-
-      // TODO: Validate incoming message signature
-
-      logger.trace(s"Kernel message is ${kernelMessage}")
-      receiveExecuteReply(message.parentHeader.msg_id,kernelMessage)
-
-    // from handler
-    case message: KernelMessage =>
-      logger.trace(s"Sending kernel message ${message}")
-      val signatureManager =
-        actorLoader.load(SecurityActorType.SignatureManager)
-
-      import scala.concurrent.ExecutionContext.Implicits.global
-      val messageWithSignature = if (signatureEnabled) {
-        val signatureMessage = signatureManager ? message
-        Await.result(signatureMessage, 100.milliseconds)
-          .asInstanceOf[KernelMessage]
-      } else message
-
-      val zMQMessage: ZMQMessage = messageWithSignature
-
-      socket ! zMQMessage
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConfig.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConfig.scala
deleted file mode 100644
index 6f3789d..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConfig.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import com.typesafe.config.Config
-import play.api.libs.json.Json
-
-case class SocketConfig (
-  stdin_port: Int,
-  control_port: Int,
-  hb_port: Int,
-  shell_port: Int,
-  iopub_port: Int,
-  ip : String,
-  transport: String,
-  signature_scheme: String,
-  key: String
-)
-
-object SocketConfig {
-  implicit val socketConfigReads = Json.reads[SocketConfig]
-  implicit val socketConfigWrites = Json.writes[SocketConfig]
-
-  def fromConfig(config: Config) = {
-    new SocketConfig(
-      config.getInt("stdin_port"),
-      config.getInt("control_port"),
-      config.getInt("hb_port"),
-      config.getInt("shell_port"),
-      config.getInt("iopub_port"),
-      config.getString("ip"),
-      config.getString("transport"),
-      config.getString("signature_scheme"),
-      config.getString("key")
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConnection.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConnection.scala
deleted file mode 100644
index fae1d0e..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketConnection.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-object SocketConnection {
-  def apply(protocol: String, ip: String, port: Int) =
-    new SocketConnection(protocol, ip, port)
-}
-
-/**
- * Represent a connection string for a socket
- * @param protocol The protocol portion of the connection (e.g. tcp, akka, udp)
- * @param ip The hostname or ip address to bind on (e.g. *, myhost, 127.0.0.1)
- * @param port The port for the socket to listen on
- */
-class SocketConnection(protocol: String, ip: String, port: Int) {
-  private val SocketConnectionString : String = "%s://%s:%d"
-
-  override def toString: String = {
-    SocketConnectionString.format(protocol, ip, port)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketFactory.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketFactory.scala
deleted file mode 100644
index 07b05d7..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/SocketFactory.scala
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import java.util.UUID
-
-import akka.actor.{Props, ActorRef, ActorSystem}
-import com.ibm.spark.communication.actors.{DealerSocketActor, ReqSocketActor, SubSocketActor}
-
-object SocketFactory {
-  def apply(socketConfig: SocketConfig) = {
-    new SocketFactory(socketConfig)
-  }
-}
-
-/**
- * A Factor class to provide various socket connections for IPython Kernel Spec.
- *
- * @param socketConfig The configuration for the sockets to be properly
- *                     instantiated
- */
-class  SocketFactory(socketConfig: SocketConfig) {
-  /**
-   * Represents the identity shared between Shell and Stdin connections.
-   */
-  private val ZmqIdentity = UUID.randomUUID().toString
-
-  val HeartbeatConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.hb_port)
-  val ShellConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.shell_port)
-  val IOPubConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.iopub_port)
-  val StdinConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.stdin_port)
-
-  /**
-   * Creates a ZeroMQ request socket representing the client endpoint for
-   * heartbeat messages.
-   *
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   *
-   * @return The ActorRef created for the socket connection
-   */
-  def HeartbeatClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
-    system.actorOf(Props(classOf[ReqSocketActor], HeartbeatConnection.toString, listener))
-//    ZeroMQExtension(system).newReqSocket(Array(
-//      Listener(listener), Connect(HeartbeatConnection.toString)
-//    ))
-  }
-
-  /**
-   * Creates a ZeroMQ request socket representing the client endpoint for shell
-   * messages. Generates an id for
-   * <a href="http://api.zeromq.org/2-1:zmq-setsockopt#toc6">
-   * Router/Dealer message routing</a>.
-   *
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   *
-   * @return The ActorRef created for the socket connection
-   */
-  def ShellClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
-    system.actorOf(Props(classOf[DealerSocketActor], ShellConnection.toString, listener))
-    //socket.setIdentity(ZmqIdentity)
-//    ZeroMQExtension(system).newDealerSocket(Array(
-//      Listener(listener), Connect(ShellConnection.toString),
-//      Identity(ZmqIdentity)
-//    ))
-  }
-
-  /**
-   * Creates a ZeroMQ reply socket representing the client endpoint for stdin
-   * messages. Generates an id for
-   * <a href="http://api.zeromq.org/2-1:zmq-setsockopt#toc6">
-   * Router/Dealer message routing</a>.
-   *
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   *
-   * @return The ActorRef created for the socket connection
-   */
-  def StdinClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
-    system.actorOf(Props(classOf[DealerSocketActor], StdinConnection.toString, listener))
-    //socket.setIdentity(ZmqIdentity)
-//    ZeroMQExtension(system).newDealerSocket(Array(
-//      Listener(listener), Connect(StdinConnection.toString),
-//      Identity(ZmqIdentity)
-//    ))
-  }
-
-  /**
-   * Creates a ZeroMQ request socket representing the client endpoint for IOPub
-   * messages.
-   *
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   *
-   * @return The ActorRef created for the socket connection
-   */
-  def IOPubClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
-    system.actorOf(Props(classOf[SubSocketActor], IOPubConnection.toString, listener))
-    //socket.subscribe(ZMQ.SUBSCRIPTION_ALL)
-//    ZeroMQExtension(system).newSubSocket(Array(
-//      Listener(listener), Connect(IOPubConnection.toString), SubscribeAll
-//    ))
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClient.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClient.scala
deleted file mode 100644
index 22c6071..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClient.scala
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.client.socket
-
-import akka.actor.Actor
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{HeaderBuilder, KMBuilder, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.content.{InputReply, InputRequest}
-import com.ibm.spark.utils.LogLike
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
-import play.api.libs.json.Json
-
-import StdinClient._
-import akka.pattern.ask
-
-import scala.concurrent.duration._
-import scala.concurrent.Await
-
-object StdinClient {
-  type ResponseFunction = (String, Boolean) => String
-  val EmptyResponseFunction: ResponseFunction = (_, _) => ""
-}
-
-/**
- * The client endpoint for Stdin messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- * @param actorLoader The loader used to retrieve actors
- * @param signatureEnabled Whether or not to check and provide signatures
- */
-class StdinClient(
-  socketFactory: SocketFactory,
-  actorLoader: ActorLoader,
-  signatureEnabled: Boolean
-) extends Actor with LogLike {
-  logger.debug("Created stdin client actor")
-
-  private val socket = socketFactory.StdinClient(context.system, self)
-
-  /**
-   * The function to use for generating a response from an input_request
-   * message.
-   */
-  private var responseFunc: ResponseFunction = EmptyResponseFunction
-
-  override def receive: Receive = {
-    case responseFunc: ResponseFunction =>
-      logger.debug("Updating response function")
-      this.responseFunc = responseFunc
-
-    case message: ZMQMessage =>
-      logger.debug("Received stdin kernel message")
-      val kernelMessage: KernelMessage = message
-      val messageType = kernelMessage.header.msg_type
-
-      if (messageType == InputRequest.toTypeString) {
-        logger.debug("Message is an input request")
-
-        val inputRequest =
-          Json.parse(kernelMessage.contentString).as[InputRequest]
-        val value = responseFunc(inputRequest.prompt, inputRequest.password)
-        val inputReply = InputReply(value)
-
-        val newKernelMessage = KMBuilder()
-          .withParent(kernelMessage)
-          .withHeader(HeaderBuilder.empty.copy(
-            msg_type = InputReply.toTypeString,
-            session = getSessionId
-          ))
-          .withContentString(inputReply)
-          .build
-
-        import scala.concurrent.ExecutionContext.Implicits.global
-        val messageWithSignature = if (signatureEnabled) {
-          val signatureManager =
-            actorLoader.load(SecurityActorType.SignatureManager)
-          val signatureMessage = signatureManager ? newKernelMessage
-          Await.result(signatureMessage, 100.milliseconds)
-            .asInstanceOf[KernelMessage]
-        } else newKernelMessage
-
-        val zmqMessage: ZMQMessage = messageWithSignature
-
-        socket ! zmqMessage
-      } else {
-        logger.debug(s"Unknown message of type $messageType")
-      }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala b/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
new file mode 100644
index 0000000..a3a0d88
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, UUID}
+
+/**
+ * Represents a CommManager that uses a ClientCommWriter for its underlying
+ * open implementation.
+ *
+ * @param actorLoader The actor loader to use with the ClientCommWriter
+ * @param kmBuilder The KMBuilder to use with the ClientCommWriter
+ * @param commRegistrar The registrar to use for callback registration
+ */
+@Experimental
+class ClientCommManager(
+  private val actorLoader: ActorLoader,
+  private val kmBuilder: KMBuilder,
+  private val commRegistrar: CommRegistrar
+) extends CommManager(commRegistrar)
+{
+  /**
+   * Creates a new CommWriter instance given the Comm id.
+   *
+   * @param commId The Comm id to use with the Comm writer
+   *
+   * @return The new CommWriter instance
+   */
+  override protected def newCommWriter(commId: UUID): CommWriter =
+    new ClientCommWriter(actorLoader, kmBuilder, commId)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala b/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
new file mode 100644
index 0000000..2c7f67c
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, CommContent}
+import com.ibm.spark.kernel.protocol.v5._
+
+/**
+ * Represents a CommWriter to send messages from the Client to the Kernel.
+ *
+ * @param actorLoader The actor loader to use for loading actors responsible for
+ *                    communication
+ * @param kmBuilder The kernel message builder used to construct kernel messages
+ * @param commId The comm id associated with this writer (defaults to a
+ *               random UUID)
+ */
+@Experimental
+class ClientCommWriter(
+  private val actorLoader: ActorLoader,
+  private val kmBuilder: KMBuilder,
+  override private[comm] val commId: v5.UUID
+) extends CommWriter(commId) {
+
+  /**
+   * Sends the comm message (open/msg/close) to the actor responsible for
+   * relaying messages.
+   *
+   * @param commContent The message to relay (will be packaged)
+   *
+   * @tparam T Either CommOpen, CommMsg, or CommClose
+   */
+  override protected[comm] def sendCommKernelMessage[
+    T <: KernelMessageContent with CommContent
+  ](commContent: T): Unit = {
+    val messageType = commContent match {
+      case _: CommOpen  => CommOpen.toTypeString
+      case _: CommMsg   => CommMsg.toTypeString
+      case _: CommClose => CommClose.toTypeString
+      case _            =>
+        throw new Throwable("Invalid kernel message type!")
+    }
+    actorLoader.load(SocketType.ShellClient) !
+      kmBuilder.withHeader(messageType).withContentString(commContent).build
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
new file mode 100644
index 0000000..6c9dccd
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client
+
+import akka.actor.{ActorRefFactory, ActorSelection}
+
+/**
+ * This trait defines the interface for loading actors based on some value
+ * (enum, attribute, etc...). The thought is to allow external consumers
+ * acquire actors through a common interface, minimizing the spread of the
+ * logic about the Actors, ActorSystem, and other similar concepts.
+ */
+trait ActorLoader {
+  /**
+   * This method is meant to find an actor associated with an enum value.
+   * This enum value can map to an actor associated with handling a specific
+   * kernel message, a socket type, or other functionality.
+   * @param actorEnum The enum value used to load the actor
+   * @return An ActorSelection to pass messages to
+   */
+  def load(actorEnum: Enumeration#Value): ActorSelection
+}
+
+case class SimpleActorLoader(actorRefFactory: ActorRefFactory)
+  extends ActorLoader
+{
+  private val userActorDirectory: String = "/user/%s"
+
+  override def load(actorEnum: Enumeration#Value): ActorSelection = {
+    actorRefFactory.actorSelection(
+      userActorDirectory.format(actorEnum.toString)
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
new file mode 100644
index 0000000..7544ee9
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client
+
+import akka.actor.ActorSystem
+import akka.pattern.ask
+import akka.util.Timeout
+import com.ibm.spark.comm._
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, ExecuteRequestTuple}
+import com.ibm.spark.kernel.protocol.v5.client.socket.HeartbeatMessage
+import com.ibm.spark.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
+import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
+import com.ibm.spark.utils.LogLike
+import scala.concurrent.duration._
+
+import scala.concurrent.ExecutionContext.Implicits.global
+import scala.util.{Failure, Success}
+
+/**
+ * Client API for Spark Kernel.
+ *
+ * Note: This takes a moment to initialize an actor system, so take appropriate action
+ * if an API is to be used immediately after initialization.
+ *
+ * The actorSystem parameter allows shutdown of this client's ActorSystem.
+ */
+class SparkKernelClient(
+  private val actorLoader: ActorLoader,
+  private val actorSystem: ActorSystem,
+  private val commRegistrar: CommRegistrar
+) extends LogLike {
+  implicit val timeout = Timeout(21474835.seconds)
+
+  /**
+   * Executes code on the Spark Kernel.
+   * Gives a <code>DeferredExecution</code> used to handle results from
+   * code execution. Specifically it can be used to register
+   * callbacks that handle stream results, the code execution result, or code
+   * execution errors.
+   *
+   * Code that prints to stdout is considered streaming and will be sent to all
+   * callbacks registered with the onStream() method. For example:
+   * <code>
+   * client.execute("println(1)").onStream(someFunction)
+   * </code>
+   * someFunction will receive a
+   * {@link com.ibm.spark.kernel.protocol.v5.content.StreamContent} message:
+   * <code>
+   * {
+   *  "name" : "stdout",
+   *  "text" : "1"
+   * }
+   * </code>
+   *
+   * Code that produces a result will cause invocation of the callbacks
+   * registered with the onResult() method. The callbacks will be invoked with
+   * the result of the executed code. For example:
+   * <code>
+   * client.execute("1+1").onResult(someFunction)
+   * </code>
+   * someFunction will receive a
+   * {@link com.ibm.spark.kernel.protocol.v5.content.ExecuteResult} message:
+   * <code>
+   * {
+   *  "execution_count" : 1,
+   *  "data" : {
+   *    "text/plain" : "2"
+   *  },
+   *  "metadata" : {}
+   * }
+   * </code>
+   *
+   * Code that produces an error will be sent to all callbacks registered
+   * with the onResult() method. For example:
+   * <code>
+   * client.execute("1+1").onResult(someFunction)
+   * </code>
+   * someFunction will be invoked with an
+   * {@link com.ibm.spark.kernel.protocol.v5.content.ExecuteReply} message
+   * containing the error.
+   *
+   * @param code Scala code
+   * @return The DeferredExecution associated with the code execution.
+   */
+  def execute(code: String): DeferredExecution = {
+    val request = ExecuteRequest(code, false, true, UserExpressions(), true)
+    val de = new DeferredExecution
+    actorLoader.load(MessageType.Incoming.ExecuteRequest) ! ExecuteRequestTuple(request, de)
+    de
+  }
+
+  /**
+   * Sets the response function used when input is requested by the kernel.
+   * @param responseFunc The response function to use
+   */
+  def setResponseFunction(responseFunc: ResponseFunction): Unit =
+    actorLoader.load(SocketType.StdInClient) ! responseFunc
+
+  /**
+   * Represents the exposed interface for Comm communication with the kernel.
+   */
+  val comm = new ClientCommManager(
+    actorLoader = actorLoader,
+    kmBuilder = KMBuilder(),
+    commRegistrar = commRegistrar
+  )
+
+  // TODO: hide this? just heartbeat to see if kernel is reachable?
+  def heartbeat(failure: () => Unit): Unit = {
+    val future = actorLoader.load(SocketType.Heartbeat) ? HeartbeatMessage
+
+    future.onComplete {
+      case Success(_) =>
+        logger.info("Client received heartbeat.")
+      case Failure(_) =>
+        failure()
+        logger.info("There was an error receiving heartbeat from kernel.")
+    }
+  }
+
+  def shutdown() = {
+    logger.info("Shutting down client")
+    actorSystem.shutdown()
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
new file mode 100644
index 0000000..56e88c6
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client
+
+import java.nio.charset.Charset
+
+import akka.util.{ByteString, Timeout}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
+import com.ibm.spark.utils.LogLike
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, Json, Reads}
+
+import scala.concurrent.duration._
+
+object Utilities extends LogLike {
+  //
+  // NOTE: This is brought in to remove feature warnings regarding the use of
+  //       implicit conversions regarding the following:
+  //
+  //       1. ByteStringToString
+  //       2. ZMQMessageToKernelMessage
+  //
+  import scala.language.implicitConversions
+
+  private val sessionId: UUID = java.util.UUID.randomUUID().toString
+
+  /**
+   * This timeout needs to be defined for the Akka asks to timeout
+   */
+  implicit val timeout = Timeout(21474835.seconds) // Maximum delay
+
+  implicit def ByteStringToString(byteString : ByteString) : String = {
+    new String(byteString.toArray, Charset.forName("UTF-8"))
+  }
+
+  implicit def StringToByteString(string : String) : ByteString = {
+    ByteString(string.getBytes)
+  }
+
+  implicit def ZMQMessageToKernelMessage(message: ZMQMessage): KernelMessage = {
+    val delimiterIndex: Int =
+      message.frames.indexOf(ByteString("<IDS|MSG>".getBytes))
+    //  TODO Handle the case where there is no delimeter
+    val ids: Seq[String] =
+      message.frames.take(delimiterIndex).map(
+        (byteString : ByteString) =>  { new String(byteString.toArray) }
+      )
+    val header = Json.parse(message.frames(delimiterIndex + 2)).as[Header]
+    val parentHeader = Json.parse(message.frames(delimiterIndex + 3)).validate[ParentHeader].fold[ParentHeader](
+      // TODO: Investigate better solution than setting parentHeader to null for {}
+      (invalid: Seq[(JsPath, Seq[ValidationError])]) => null, //HeaderBuilder.empty,
+      (valid: ParentHeader) => valid
+    )
+    val metadata = Json.parse(message.frames(delimiterIndex + 4)).as[Metadata]
+
+    KMBuilder().withIds(ids.toList)
+               .withSignature(message.frame(delimiterIndex + 1))
+               .withHeader(header)
+               .withParentHeader(parentHeader)
+               .withMetadata(metadata)
+               .withContentString(message.frame(delimiterIndex + 5)).build(false)
+  }
+
+  implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = {
+    val frames: scala.collection.mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer()
+    kernelMessage.ids.map((id : String) => frames += id )
+    frames += "<IDS|MSG>"
+    frames += kernelMessage.signature
+    frames += Json.toJson(kernelMessage.header).toString()
+    frames += Json.toJson(kernelMessage.parentHeader).toString()
+    frames += Json.toJson(kernelMessage.metadata).toString
+    frames += kernelMessage.contentString
+    ZMQMessage(frames  : _*)
+  }
+
+  def parseAndHandle[T](json: String, reads: Reads[T], handler: T => Unit) : Unit = {
+    Json.parse(json).validate[T](reads).fold(
+      (invalid: Seq[(JsPath, Seq[ValidationError])]) =>
+        logger.error(s"Could not parse JSON, ${json}"),
+      (content: T) => handler(content)
+    )
+  }
+
+  def getSessionId = sessionId
+
+  def toKernelMessage(message: ExecuteRequest): KernelMessage = {
+    // construct a kernel message whose content is an ExecuteRequest
+    val id = java.util.UUID.randomUUID().toString
+    val header = Header(
+      id, "spark", sessionId, MessageType.Incoming.ExecuteRequest.toString, "5.0")
+
+    KMBuilder().withIds(Seq[String]()).withSignature("").withHeader(header)
+      .withParentHeader(HeaderBuilder.empty).withContentString(message).build
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
new file mode 100644
index 0000000..e75f7dd
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.boot
+
+import akka.actor.ActorSystem
+import com.ibm.spark.comm.{CommRegistrar, CommStorage}
+import com.ibm.spark.kernel.protocol.v5.client.boot.layers._
+import com.ibm.spark.kernel.protocol.v5.client.socket.{SocketConfig, SocketFactory}
+import com.ibm.spark.kernel.protocol.v5.client.{SimpleActorLoader, SparkKernelClient}
+import com.ibm.spark.utils.LogLike
+import com.typesafe.config.Config
+import org.zeromq.ZMQ
+
+object ClientBootstrap {
+  /**
+   * Generates a new unique name for a client actor system.
+   *
+   * @return The unique name as a string
+   */
+  def newActorSystemName(): String =
+    "spark-client-actor-system-" + java.util.UUID.randomUUID().toString
+}
+
+class ClientBootstrap(config: Config) extends LogLike {
+  this: SystemInitialization with HandlerInitialization =>
+
+  /**
+   * Creates a new Spark Kernel client instance.
+   *
+   * @return The new client instance
+   */
+  def createClient(
+    actorSystemName: String = ClientBootstrap.newActorSystemName()
+  ): SparkKernelClient = {
+    logger.trace(s"Creating new kernel client actor system, '$actorSystemName'")
+    val actorSystem = ActorSystem(actorSystemName)
+
+    logger.trace(s"Creating actor loader for actor system, '$actorSystemName'")
+    val actorLoader = SimpleActorLoader(actorSystem)
+
+    logger.trace(s"Creating socket factory for actor system, '$actorSystemName")
+    val socketFactory = new SocketFactory(SocketConfig.fromConfig(config))
+
+    logger.trace(s"Initializing underlying system for, '$actorSystemName'")
+    val (_, _, _, _, commRegistrar, _) =
+      initializeSystem(config, actorSystem, actorLoader, socketFactory)
+
+    logger.trace(s"Initializing handlers for, '$actorSystemName'")
+    initializeHandlers(actorSystem, actorLoader)
+
+    logger.trace(s"ZeroMQ (JeroMQ) version: ${ZMQ.getVersionString}")
+
+    new SparkKernelClient(actorLoader, actorSystem, commRegistrar)
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
new file mode 100644
index 0000000..57a294a
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.client.boot.layers
+
+import akka.actor.{ActorSystem, Props}
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.MessageType
+import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
+import com.ibm.spark.kernel.protocol.v5.client.handler.ExecuteHandler
+import com.ibm.spark.utils.LogLike
+
+/**
+ * Represents the event handler initialization such as message handlers.
+ */
+trait HandlerInitialization {
+  /**
+   * Initializes event handlers.
+   *
+   * @param actorSystem The actor system used by the client
+   * @param actorLoader The actor loader used by the client
+   */
+  def initializeHandlers(
+    actorSystem: ActorSystem, actorLoader: ActorLoader
+  ): Unit
+}
+
+/**
+ * Represents the standard implementation of HandlerInitialization.
+ */
+trait StandardHandlerInitialization extends HandlerInitialization {
+  this: LogLike =>
+
+  /**
+   * Initializes event handlers.
+   *
+   * @param actorSystem The actor system used by the client
+   * @param actorLoader The actor loader used by the client
+   */
+  override def initializeHandlers(
+    actorSystem: ActorSystem, actorLoader: ActorLoader
+  ): Unit = initializeMessageHandlers(actorSystem, actorLoader)
+
+  private def initializeRequestHandler[T](
+    actorSystem: ActorSystem, actorLoader: ActorLoader,
+    clazz: Class[T], messageType: MessageType
+  ) = {
+    logger.info("Creating %s handler".format(messageType.toString))
+    actorSystem.actorOf(Props(clazz, actorLoader), name = messageType.toString)
+  }
+
+  private def initializeMessageHandlers(
+    actorSystem: ActorSystem, actorLoader: ActorLoader
+  ): Unit = {
+    initializeRequestHandler(
+      actorSystem,
+      actorLoader,
+      classOf[ExecuteHandler],
+      MessageType.Incoming.ExecuteRequest
+    )
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
new file mode 100644
index 0000000..945017c
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.client.boot.layers
+
+import akka.actor.{Props, ActorRef, ActorSystem}
+import com.ibm.spark.comm.{CommRegistrar, CommStorage}
+import com.ibm.spark.communication.security.{SecurityActorType, SignatureManagerActor}
+import com.ibm.spark.kernel.protocol.v5.SocketType
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.client.socket._
+import com.ibm.spark.utils.LogLike
+import com.typesafe.config.Config
+
+/**
+ * Represents the system-related initialization such as socket actors.
+ */
+trait SystemInitialization {
+  /**
+   * Initializes the system-related client objects.
+   *
+   * @param config The configuration for the system
+   * @param actorSystem The actor system used by the client
+   * @param actorLoader The actor loader used by the client
+   * @param socketFactory The socket factory used by the client
+   *
+   * @return The heartbeat, stdin, shell, and IOPub client actors and the Comm
+   *         registrar and storage used for Comm callbacks
+   */
+  def initializeSystem(
+    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader,
+    socketFactory: SocketFactory
+  ): (ActorRef, ActorRef, ActorRef, ActorRef, CommRegistrar, CommStorage)
+}
+
+/**
+ * Represents the standard implementation of SystemInitialization.
+ */
+trait StandardSystemInitialization extends SystemInitialization with LogLike {
+  /**
+   * Initializes the system-related client objects.
+   *
+   * @param config The configuration for the system
+   * @param actorSystem The actor system used by the client
+   * @param actorLoader The actor loader used by the client
+   * @param socketFactory The socket factory used by the client
+   *
+   * @return The heartbeat, shell, and IOPub client actors
+   */
+  override def initializeSystem(
+    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader,
+    socketFactory: SocketFactory
+  ): (ActorRef, ActorRef, ActorRef, ActorRef, CommRegistrar, CommStorage) = {
+    val commStorage = new CommStorage()
+    val commRegistrar = new CommRegistrar(commStorage)
+
+    val (heartbeat, stdin, shell, ioPub) = initializeSystemActors(
+      config = config,
+      actorSystem = actorSystem,
+      actorLoader = actorLoader,
+      socketFactory = socketFactory,
+      commRegistrar = commRegistrar,
+      commStorage = commStorage
+    )
+
+    val signatureManager = initializeSecurityActors(config, actorSystem)
+
+    (heartbeat, stdin, shell, ioPub, commRegistrar, commStorage)
+  }
+
+  private def initializeSystemActors(
+    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader,
+    socketFactory: SocketFactory, commRegistrar: CommRegistrar,
+    commStorage: CommStorage
+  ) = {
+    val signatureEnabled = config.getString("key").nonEmpty
+
+    val heartbeatClient = actorSystem.actorOf(
+      Props(classOf[HeartbeatClient],
+        socketFactory, actorLoader, signatureEnabled),
+      name = SocketType.HeartbeatClient.toString
+    )
+
+    val stdinClient = actorSystem.actorOf(
+      Props(classOf[StdinClient], socketFactory, actorLoader, signatureEnabled),
+      name = SocketType.StdInClient.toString
+    )
+
+    val shellClient = actorSystem.actorOf(
+      Props(classOf[ShellClient], socketFactory, actorLoader, signatureEnabled),
+      name = SocketType.ShellClient.toString
+    )
+
+    val ioPubClient = actorSystem.actorOf(
+      Props(classOf[IOPubClient], socketFactory, actorLoader, signatureEnabled,
+        commRegistrar, commStorage),
+      name = SocketType.IOPubClient.toString
+    )
+
+    (heartbeatClient, stdinClient, shellClient, ioPubClient)
+  }
+
+  private def initializeSecurityActors(
+    config: Config,
+    actorSystem: ActorSystem
+  ): Option[ActorRef] = {
+    val key = config.getString("key")
+    val signatureScheme = config.getString("signature_scheme").replace("-", "")
+
+    var signatureManager: Option[ActorRef] = None
+
+    if (key.nonEmpty) {
+      logger.debug(s"Initializing client signatures with key '$key'!")
+      signatureManager = Some(actorSystem.actorOf(
+        Props(classOf[SignatureManagerActor], key, signatureScheme),
+        name = SecurityActorType.SignatureManager.toString
+      ))
+    } else {
+      logger.debug(s"Signatures disabled for client!")
+    }
+
+    signatureManager
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
new file mode 100644
index 0000000..6bb89ba
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.exception
+
+class ShellException(e: Throwable) extends Throwable {
+  val exception: Throwable = e
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
new file mode 100644
index 0000000..c6e7f86
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.execution
+
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.utils.LogLike
+
+case class DeferredExecution() extends LogLike {
+  private var executeResultCallbacks: List[(ExecuteResult) => Unit] = Nil
+  private var streamCallbacks: List[(StreamContent) => Unit] = Nil
+  private var errorCallbacks: List[(ExecuteReplyError) => Unit] = Nil
+  private var successCallbacks: List[(ExecuteReplyError) => Unit] = Nil
+  private var executeResultOption: Option[ExecuteResult] = None
+  private var executeReplyOption: Option[ExecuteReply] = None
+
+  /**
+   * Registers a callback for handling ExecuteResult messages.
+   * This {@param callback} will run once on successful code execution and
+   * then be unregistered. If {@param callback} is registered after the result
+   * has been returned it will be invoked immediately.
+   * In the event of a failure {@param callback} will never be called.
+   * @param callback A callback function, which will be invoked at most once,
+   *                 with an ExecuteResult IPython message
+   * @return  The DeferredExecution with the given callback registered.
+   */
+  def onResult(callback: (ExecuteResult) => Unit): DeferredExecution = {
+    this.executeResultCallbacks = callback :: this.executeResultCallbacks
+    processCallbacks()
+    this
+  }
+
+  /**
+   * Registers a callback for handling StreamContent messages.
+   * Ths {@param callback} can be called 0 or more times. If the
+   * {@param callback} is registered after StreamContent messages have been
+   * emitted, the {@param callback} will only receive messages emitted after the
+   * point of registration.
+   * @param callback A callback function, which can be invoked 0 or more times,
+   *                 with Stream Ipython messages
+   * @return  The DeferredExecution with the given callback registered.
+   */
+  def onStream(callback: (StreamContent) => Unit): DeferredExecution = {
+    this.streamCallbacks = callback :: this.streamCallbacks
+    this
+  }
+
+  /**
+   * Registers a callback for handling ExecuteReply messages when there is an
+   * error during code execution. This {@param callback} will run once on failed
+   * code execution and then be unregistered. If {@param callback} is registered
+   * after the error reply has been returned it will be invoked immediately.
+   * In the event of successful code execution {@param callback} will never be
+   * called.
+   * @param callback A callback function, which will be invoked at most once,
+   *                 with an ExecuteReply IPython message
+   * @return  The DeferredExecution with the given callback registered.
+   */
+  def onError(callback: (ExecuteReplyError) => Unit): DeferredExecution = {
+    this.errorCallbacks = callback :: this.errorCallbacks
+    processCallbacks()
+    this
+  }
+
+  /**
+   * Registers a callback to be notified when code completion has completed
+   * successfully. {@param callback} will not be called if an error has been
+   * encountered, use {@method onError}.
+   * @param callback The callback to register.
+   * @return This deferred execution
+   */
+  def onSuccess(callback: (ExecuteReplyError) => Unit): DeferredExecution = {
+    this.successCallbacks = callback :: this.successCallbacks
+    processCallbacks()
+    this
+  }
+  //  In the next three methods we need to clear each list.
+  //  This prevents methods from getting called again when
+  //  a callback is registered after processing has happened
+  private def callErrorCallbacks(executeReplyError: ExecuteReplyError) = {
+    this.errorCallbacks.foreach(_(executeReplyError))
+    this.errorCallbacks = Nil
+  }
+
+  private def callSuccessCallbacks(executeReplyOk: ExecuteReplyOk) = {
+    this.successCallbacks.foreach(_(executeReplyOk))
+    this.successCallbacks = Nil
+  }
+
+  private def callResultCallbacks(executeResult: ExecuteResult) = {
+    this.executeResultCallbacks.foreach(_(executeResult))
+    this.executeResultCallbacks = Nil
+  }
+
+  private def processCallbacks(): Unit = {
+    (executeReplyOption, executeResultOption) match {
+      case (Some(executeReply), Some(executeResult)) if executeReply.status.equals("error") =>
+        callErrorCallbacks(executeReply)
+      case (Some(executeReply), Some(executeResult)) if executeReply.status.equals("ok") =>
+        callResultCallbacks(executeResult)
+        callSuccessCallbacks(executeReply)
+      case (Some(executeReply), None) if executeReply.status.equals("ok") =>
+        callSuccessCallbacks(executeReply)
+      case value =>
+        logger.debug(
+          s"""|Did not invoke client callbacks.
+              |ExecuteReply was: ${executeReplyOption}
+              |ExecuteResult was: ${executeResultOption}
+           """.stripMargin.trim)
+    }
+  }
+
+  def resolveResult(executeResultMessage: ExecuteResult): Unit = {
+    this.executeResultOption = Some(executeResultMessage)
+    processCallbacks()
+  }
+
+  def resolveReply(executeReplyMessage: ExecuteReply): Unit = {
+    this.executeReplyOption = Some(executeReplyMessage)
+    processCallbacks()
+  }
+
+  def emitStreamContent(streamContent: StreamContent): Unit = {
+    this.streamCallbacks.foreach(streamCallback => {
+      streamCallback(streamContent)
+    })
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
new file mode 100644
index 0000000..3c7489b
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.execution
+
+import com.ibm.spark.kernel.protocol.v5.UUID
+import com.ibm.spark.utils.LogLike
+
+import scala.collection.concurrent.{Map, TrieMap}
+
+object DeferredExecutionManager extends LogLike{
+  private val executionMap: Map[UUID, DeferredExecution] = TrieMap[UUID, DeferredExecution]()
+  
+  def add(id: UUID, de: DeferredExecution): Unit = executionMap += (id -> de)
+
+  def get(id: UUID): Option[DeferredExecution] = executionMap.get(id)
+
+  def remove(de: DeferredExecution): Unit = {
+    val optionalDE: Option[(UUID, DeferredExecution)] = executionMap.find {
+      case (id: UUID, searchedDe: DeferredExecution) => {
+        de.eq(searchedDe)
+    }}
+    optionalDE match {
+      case None =>
+        logger.warn("Searched and did not find deferred execution!")
+      case Some((id, foundDe)) =>
+        executionMap.remove(id)
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
new file mode 100644
index 0000000..b9b1e5e
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.execution
+
+import com.ibm.spark.kernel.protocol.v5.UUID
+
+case class DeferredExecutionTuple ( id: UUID, de: DeferredExecution)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
new file mode 100644
index 0000000..6c8c751
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.execution
+
+import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
+
+case class ExecuteRequestTuple(request: ExecuteRequest, de: DeferredExecution)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
new file mode 100644
index 0000000..57d8e85
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.handler
+
+import akka.actor.Actor
+import akka.util.Timeout
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import com.ibm.spark.kernel.protocol.v5.client.execution.{ExecuteRequestTuple, DeferredExecutionManager}
+import com.ibm.spark.utils.LogLike
+import scala.concurrent.duration._
+
+/**
+ * Actor for handling client execute request and reply messages
+ */
+class ExecuteHandler(actorLoader: ActorLoader) extends Actor with LogLike {
+  implicit val timeout = Timeout(21474835.seconds)
+
+  override def receive: Receive = {
+    case reqTuple: ExecuteRequestTuple =>
+      // create message to send to shell
+      val km: KernelMessage = Utilities.toKernelMessage(reqTuple.request)
+      //  Register the execution for this message id with the manager
+      DeferredExecutionManager.add(km.header.msg_id,reqTuple.de)
+
+      // send the message to the ShellClient
+      val shellClient = actorLoader.load(SocketType.ShellClient)
+      shellClient ! km
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
new file mode 100644
index 0000000..6dafbcd
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import akka.actor.{ActorRef, Actor}
+import akka.util.{ByteString, Timeout}
+import com.ibm.spark.communication.ZMQMessage
+import akka.pattern.ask
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.utils.LogLike
+import com.ibm.spark.kernel.protocol.v5.UUID
+import scala.collection.concurrent.{Map, TrieMap}
+import scala.concurrent.duration._
+
+object HeartbeatMessage {}
+/**
+ * The client endpoint for heartbeat messages specified in the IPython Kernel
+ * Spec.
+ *
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ * @param actorLoader The loader used to retrieve actors
+ * @param signatureEnabled Whether or not to check and provide signatures
+ */
+class HeartbeatClient(
+  socketFactory : SocketFactory,
+  actorLoader: ActorLoader,
+  signatureEnabled: Boolean
+) extends Actor with LogLike {
+  logger.debug("Created new Heartbeat Client actor")
+  implicit val timeout = Timeout(1.minute)
+
+  val futureMap: Map[UUID, ActorRef] = TrieMap[UUID, ActorRef]()
+  val socket = socketFactory.HeartbeatClient(context.system, self)
+
+  override def receive: Receive = {
+    // from Heartbeat
+    case message: ZMQMessage =>
+      val id = message.frames.map((byteString: ByteString) =>
+        new String(byteString.toArray)).mkString("\n")
+      logger.info(s"Heartbeat client receive:$id")
+      futureMap(id) ! true
+      futureMap.remove(id)
+
+    // from SparkKernelClient
+    case HeartbeatMessage =>
+      import scala.concurrent.ExecutionContext.Implicits.global
+      val id = java.util.UUID.randomUUID().toString
+      futureMap += (id -> sender)
+      logger.info(s"Heartbeat client send: $id")
+      val future = socket ? ZMQMessage(ByteString(id.getBytes))
+      future.onComplete {
+        // future always times out because server "tells" response {
+        case(_) => futureMap.remove(id)
+      }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
new file mode 100644
index 0000000..b183a23
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import akka.actor.Actor
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.comm.{CommStorage, CommRegistrar, ClientCommWriter}
+import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import Utilities._
+import com.ibm.spark.kernel.protocol.v5.client.execution.DeferredExecutionManager
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import com.ibm.spark.utils.LogLike
+
+import scala.util.Failure
+
+/**
+ * The client endpoint for IOPub messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ */
+class IOPubClient(
+  socketFactory: SocketFactory, actorLoader: ActorLoader,
+  signatureEnabled: Boolean,
+  commRegistrar: CommRegistrar, commStorage: CommStorage
+) extends Actor with LogLike {
+  private val PARENT_HEADER_NULL_MESSAGE = "Parent Header was null in Kernel Message."
+  private val socket = socketFactory.IOPubClient(context.system, self)
+  logger.info("Created IOPub socket")
+
+  /**
+   * Constructs and returns a map directing message types to functions.
+   *
+   * @param kernelMessage The kernel message used to generate the map
+   *
+   * @return The map of
+   */
+  private def getMessageMap(kernelMessage: KernelMessage) = Map[String, () => Unit](
+    ExecuteResult.toTypeString -> { () =>
+      receiveKernelMessage(kernelMessage, receiveExecuteResult(_, kernelMessage))
+    },
+    StreamContent.toTypeString -> { () =>
+      receiveKernelMessage(kernelMessage, receiveStreamMessage(_, kernelMessage))
+    },
+    CommOpen.toTypeString -> { () =>
+      receiveKernelMessage(kernelMessage, receiveCommOpen(_, kernelMessage))
+    },
+    CommMsg.toTypeString -> { () =>
+      receiveKernelMessage(kernelMessage, receiveCommMsg(_, kernelMessage))
+    },
+    CommClose.toTypeString -> { () =>
+      receiveKernelMessage(kernelMessage, receiveCommClose(_, kernelMessage))
+    }
+  )
+
+
+  private def receiveKernelMessage(
+    kernelMessage: KernelMessage, func: (String) => Unit
+  ): Unit = {
+    if(kernelMessage.parentHeader != null){
+      func(kernelMessage.parentHeader.msg_id)
+    } else {
+      logger.warn("Received message with null parent header.")
+      logger.debug(s"Kernel message is: $kernelMessage")
+      sender.forward(Failure(new RuntimeException(PARENT_HEADER_NULL_MESSAGE)))
+    }
+  }
+
+  private def receiveStreamMessage(
+    parentHeaderId:String, kernelMessage: KernelMessage
+  ): Unit = {
+    // look up callback in CallbackMap based on msg_id and invoke
+    val optionalDE = DeferredExecutionManager.get(parentHeaderId)
+    optionalDE match {
+      case Some(de) => parseAndHandle(kernelMessage.contentString,
+        StreamContent.streamContentReads,
+        (streamContent: StreamContent) => de.emitStreamContent(streamContent))
+      case None =>
+        logger.warn(s"No deferred execution found for id $parentHeaderId")
+    }
+  }
+
+  private def receiveExecuteResult(
+    parentHeaderId:String, kernelMessage: KernelMessage
+  ): Unit = {
+    // look up callback in CallbackMap based on msg_id and invoke
+    val optionalDE = DeferredExecutionManager.get(parentHeaderId)
+    optionalDE match {
+      case Some(de) => parseAndHandle(kernelMessage.contentString,
+        ExecuteResult.executeResultReads,
+        (executeResult: ExecuteResult) => de.resolveResult(executeResult))
+      case None =>
+        logger.warn(s"No deferred execution found for id $parentHeaderId")
+    }
+  }
+
+  private def receiveCommOpen(
+    parentHeaderId:String, kernelMessage: KernelMessage
+  ): Unit = {
+    parseAndHandle(
+      kernelMessage.contentString,
+      CommOpen.commOpenReads,
+      (commOpen: CommOpen) => {
+        val targetName = commOpen.target_name
+        val commId = commOpen.comm_id
+        val commWriter = new ClientCommWriter(
+          actorLoader, KMBuilder(), commId)
+
+        commStorage.getTargetCallbacks(targetName) match {
+          // Unexpected target (does not exist on this side), so send close
+          case None             =>
+            commWriter.close()
+          // Found target, so execute callbacks
+          case Some(callbacks)  =>
+            callbacks.executeOpenCallbacks(
+              commWriter, commId, targetName, commOpen.data)
+        }
+      }
+    )
+  }
+
+  private def receiveCommMsg(
+    parentHeaderId:String, kernelMessage: KernelMessage
+  ): Unit = {
+    parseAndHandle(
+      kernelMessage.contentString,
+      CommMsg.commMsgReads,
+      (commMsg: CommMsg) => {
+        val commId = commMsg.comm_id
+
+        commStorage.getCommIdCallbacks(commId) match {
+          case None             =>
+          case Some(callbacks)  =>
+            val commWriter = new ClientCommWriter(
+              actorLoader, KMBuilder(), commId)
+            callbacks.executeMsgCallbacks(commWriter, commId, commMsg.data)
+        }
+      }
+    )
+  }
+
+  private def receiveCommClose(
+    parentHeaderId:String, kernelMessage: KernelMessage
+  ): Unit = {
+    parseAndHandle(
+      kernelMessage.contentString,
+      CommClose.commCloseReads,
+      (commClose: CommClose) => {
+        val commId = commClose.comm_id
+
+        commStorage.getCommIdCallbacks(commId) match {
+          case None             =>
+          case Some(callbacks)  =>
+            val commWriter = new ClientCommWriter(
+              actorLoader, KMBuilder(), commId)
+            callbacks.executeCloseCallbacks(commWriter, commId, commClose.data)
+        }
+      }
+    )
+  }
+
+  override def receive: Receive = {
+    case message: ZMQMessage =>
+      // convert to KernelMessage using implicits in v5
+      logger.debug("Received IOPub kernel message.")
+      val kernelMessage: KernelMessage = message
+
+      // TODO: Validate incoming message signature
+
+      logger.trace(s"Kernel message is $kernelMessage")
+      val messageTypeString = kernelMessage.header.msg_type
+
+      val messageMap = getMessageMap(kernelMessage)
+
+      if (messageMap.contains(messageTypeString)) {
+        messageMap(messageTypeString)()
+      } else {
+        logger.warn(s"Received unhandled MessageType $messageTypeString")
+      }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
new file mode 100644
index 0000000..bf504af
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import akka.actor.Actor
+import akka.util.Timeout
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.communication.security.SecurityActorType
+import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import com.ibm.spark.kernel.protocol.v5.{KernelMessage, UUID}
+import Utilities._
+import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
+import com.ibm.spark.kernel.protocol.v5.content.ExecuteReply
+
+import com.ibm.spark.utils.LogLike
+import scala.concurrent.Await
+import scala.concurrent.duration._
+import akka.pattern.ask
+
+/**
+ * The client endpoint for Shell messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ * @param actorLoader The loader used to retrieve actors
+ * @param signatureEnabled Whether or not to check and provide signatures
+ */
+class ShellClient(
+  socketFactory: SocketFactory,
+  actorLoader: ActorLoader,
+  signatureEnabled: Boolean
+) extends Actor with LogLike {
+  logger.debug("Created shell client actor")
+  implicit val timeout = Timeout(21474835.seconds)
+
+  val socket = socketFactory.ShellClient(context.system, self)
+
+  def receiveExecuteReply(parentId:String, kernelMessage: KernelMessage): Unit = {
+    val deOption: Option[DeferredExecution] = DeferredExecutionManager.get(parentId)
+    deOption match {
+      case None =>
+        logger.warn(s"No deferred execution for parent id ${parentId}")
+      case Some(de) =>
+        Utilities.parseAndHandle(kernelMessage.contentString,
+          ExecuteReply.executeReplyReads, (er: ExecuteReply) => de.resolveReply(er))
+    }
+  }
+
+  override def receive: Receive = {
+    // from shell
+    case message: ZMQMessage =>
+      logger.debug("Received shell kernel message.")
+      val kernelMessage: KernelMessage = message
+
+      // TODO: Validate incoming message signature
+
+      logger.trace(s"Kernel message is ${kernelMessage}")
+      receiveExecuteReply(message.parentHeader.msg_id,kernelMessage)
+
+    // from handler
+    case message: KernelMessage =>
+      logger.trace(s"Sending kernel message ${message}")
+      val signatureManager =
+        actorLoader.load(SecurityActorType.SignatureManager)
+
+      import scala.concurrent.ExecutionContext.Implicits.global
+      val messageWithSignature = if (signatureEnabled) {
+        val signatureMessage = signatureManager ? message
+        Await.result(signatureMessage, 100.milliseconds)
+          .asInstanceOf[KernelMessage]
+      } else message
+
+      val zMQMessage: ZMQMessage = messageWithSignature
+
+      socket ! zMQMessage
+  }
+}



[51/51] [abbrv] incubator-toree git commit: Resetting version to start back at 0.1.0

Posted by lb...@apache.org.
Resetting version to start back at 0.1.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/84629223
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/84629223
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/84629223

Branch: refs/heads/TestBranch
Commit: 846292233c9f61bfc99579ec9a20a9d0ccfb3260
Parents: c7a0db1
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Thu Jan 21 15:21:23 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Thu Jan 21 15:21:23 2016 -0600

----------------------------------------------------------------------
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/84629223/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 3d706df..1e90a4c 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
 
 .PHONY: help clean clean-dist build dev test test-travis
 
-VERSION?=0.1.5
+VERSION?=0.1.0
 IS_SNAPSHOT?=true
 APACHE_SPARK_VERSION?=1.5.1
 


[39/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
index 2fd2663..370704f 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
index c84de63..e5d3709 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
index 915be74..9f12973 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.magic.builtin
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/build.sbt
----------------------------------------------------------------------
diff --git a/sql-interpreter/build.sbt b/sql-interpreter/build.sbt
index ac8156e..9444250 100644
--- a/sql-interpreter/build.sbt
+++ b/sql-interpreter/build.sbt
@@ -1,15 +1,16 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
index 2b0f0ad..217b6ba 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sql
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
index f8ffffe..b9d534f 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sql
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
index 0641a6d..1df7315 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sql
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
index df542ab..30403cf 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sql
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
index 8c7b98b..d4ccbb6 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sql
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala b/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
index 727c809..955bdd5 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.magic.builtin
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/src/test/scala/system/StdinForSystemSpec.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/system/StdinForSystemSpec.scala b/src/test/scala/system/StdinForSystemSpec.scala
index 0461591..e44e4a5 100644
--- a/src/test/scala/system/StdinForSystemSpec.scala
+++ b/src/test/scala/system/StdinForSystemSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package system

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala b/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
index 3c8d5f9..b7b788b 100644
--- a/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
+++ b/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package test.utils.root

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/src/test/scala/test.utils/root/SparkKernelDeployer.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/test.utils/root/SparkKernelDeployer.scala b/src/test/scala/test.utils/root/SparkKernelDeployer.scala
index 9521917..f9057f4 100644
--- a/src/test/scala/test.utils/root/SparkKernelDeployer.scala
+++ b/src/test/scala/test.utils/root/SparkKernelDeployer.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package test.utils.root


[36/51] [abbrv] incubator-toree git commit: Renamed com.ibm.spark to org.apache.toree

Posted by lb...@apache.org.
Renamed com.ibm.spark to org.apache.toree


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/9612a625
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/9612a625
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/9612a625

Branch: refs/heads/TestBranch
Commit: 9612a625ac78c9def7e623238fc2f43842134f17
Parents: 68f7ddd
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Fri Jan 15 11:13:06 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Fri Jan 15 11:34:05 2016 -0600

----------------------------------------------------------------------
 .../apache/toree/comm/ClientCommManager.scala   |  8 ++---
 .../apache/toree/comm/ClientCommWriter.scala    | 12 +++----
 .../kernel/protocol/v5/client/ActorLoader.scala |  2 +-
 .../protocol/v5/client/SparkKernelClient.scala  | 22 ++++++-------
 .../kernel/protocol/v5/client/Utilities.scala   | 10 +++---
 .../v5/client/boot/ClientBootstrap.scala        | 12 +++----
 .../boot/layers/HandlerInitialization.scala     | 12 +++----
 .../boot/layers/SystemInitialization.scala      | 14 ++++----
 .../v5/client/exception/ShellException.scala    |  2 +-
 .../v5/client/execution/DeferredExecution.scala |  6 ++--
 .../execution/DeferredExecutionManager.scala    |  6 ++--
 .../execution/DeferredExecutionTuple.scala      |  4 +--
 .../client/execution/ExecuteRequestTuple.scala  |  4 +--
 .../v5/client/handler/ExecuteHandler.scala      | 10 +++---
 .../v5/client/socket/HeartbeatClient.scala      | 10 +++---
 .../protocol/v5/client/socket/IOPubClient.scala | 16 ++++-----
 .../protocol/v5/client/socket/ShellClient.scala | 16 ++++-----
 .../v5/client/socket/SocketConfig.scala         |  2 +-
 .../v5/client/socket/SocketConnection.scala     |  2 +-
 .../v5/client/socket/SocketFactory.scala        |  4 +--
 .../protocol/v5/client/socket/StdinClient.scala | 16 ++++-----
 client/src/test/resources/testng.yaml           |  2 +-
 .../scala/examples/DocumentationExamples.scala  |  8 ++---
 .../scala/examples/ScalaSparkClientUsage.scala  | 10 +++---
 .../ClientToHeartbeatSpecForIntegration.scala   |  8 ++---
 .../ClientToIOPubSpecForIntegration.scala       |  6 ++--
 .../ClientToShellSpecForIntegration.scala       |  6 ++--
 .../toree/comm/ClientCommManagerSpec.scala      | 10 +++---
 .../toree/comm/ClientCommWriterSpec.scala       |  8 ++---
 .../v5/client/SparkKernelClientSpec.scala       | 10 +++---
 .../execution/DeferredExecutionTest.scala       |  8 ++---
 .../v5/client/socket/HeartbeatClientSpec.scala  |  6 ++--
 .../v5/client/socket/IOPubClientSpec.scala      | 18 +++++------
 .../v5/client/socket/ShellClientSpec.scala      | 12 +++----
 .../v5/client/socket/StdinClientSpec.scala      | 16 ++++-----
 .../scala/system/ClientCommSpecForSystem.scala  | 10 +++---
 .../scala/test/utils/SparkClientDeployer.scala  | 14 ++++----
 .../toree/communication/SocketManager.scala     |  4 +--
 .../apache/toree/communication/ZMQMessage.scala |  2 +-
 .../actors/DealerSocketActor.scala              |  6 ++--
 .../communication/actors/PubSocketActor.scala   | 10 +++---
 .../communication/actors/RepSocketActor.scala   |  6 ++--
 .../communication/actors/ReqSocketActor.scala   |  6 ++--
 .../actors/RouterSocketActor.scala              |  6 ++--
 .../communication/actors/SubSocketActor.scala   |  6 ++--
 .../toree/communication/security/Hmac.scala     |  4 +--
 .../security/SignatureCheckerActor.scala        |  6 ++--
 .../security/SignatureManagerActor.scala        |  8 ++---
 .../security/SignatureProducerActor.scala       |  8 ++---
 .../toree/communication/security/package.scala  |  2 +-
 .../communication/socket/JeroMQSocket.scala     |  2 +-
 .../socket/PubSocketRunnable.scala              |  2 +-
 .../socket/ReqSocketRunnable.scala              |  2 +-
 .../toree/communication/socket/SocketLike.scala |  2 +-
 .../communication/socket/SocketOption.scala     |  2 +-
 .../communication/socket/SocketRunnable.scala   |  2 +-
 .../toree/communication/socket/SocketType.scala |  2 +-
 .../socket/ZeroMQSocketRunnable.scala           |  4 +--
 .../communication/utils/OrderedSupport.scala    |  4 +--
 .../JeroMQSocketIntegrationSpec.scala           |  2 +-
 ...ignatureCheckerActorSpecForIntegration.scala |  4 +--
 ...ignatureManagerActorSpecForIntegration.scala |  4 +--
 ...gnatureProducerActorSpecForIntegration.scala |  4 +--
 .../toree/communication/security/HmacSpec.scala |  2 +-
 .../communication/socket/JeroMQSocketSpec.scala |  2 +-
 .../socket/ZeroMQSocketRunnableSpec.scala       |  2 +-
 .../utils/OrderedSupportSpec.scala              |  2 +-
 etc/bin/spark-kernel                            |  2 +-
 etc/bin/toree-kernel                            |  2 +-
 .../dependencies/DependencyDownloader.scala     |  2 +-
 .../dependencies/IvyDependencyDownloader.scala  |  4 +--
 .../org/apache/toree/global/StreamState.scala   |  2 +-
 .../toree/interpreter/ExecuteFailure.scala      |  2 +-
 .../apache/toree/interpreter/Interpreter.scala  |  4 +--
 .../toree/interpreter/InterpreterTypes.scala    |  2 +-
 .../org/apache/toree/interpreter/Results.scala  |  2 +-
 .../toree/interpreter/broker/BrokerBridge.scala |  6 ++--
 .../toree/interpreter/broker/BrokerCode.scala   |  2 +-
 .../interpreter/broker/BrokerException.scala    |  2 +-
 .../toree/interpreter/broker/BrokerName.scala   |  2 +-
 .../interpreter/broker/BrokerProcess.scala      |  2 +-
 .../broker/BrokerProcessHandler.scala           |  2 +-
 .../interpreter/broker/BrokerPromise.scala      |  4 +--
 .../interpreter/broker/BrokerService.scala      |  4 +--
 .../toree/interpreter/broker/BrokerState.scala  |  4 +--
 .../interpreter/broker/BrokerTransformer.scala  | 10 +++---
 .../toree/interpreter/broker/BrokerTypes.scala  |  2 +-
 .../broker/BrokerTypesProvider.scala            |  2 +-
 .../producer/JavaSparkContextProducerLike.scala |  2 +-
 .../producer/SQLContextProducerLike.scala       |  2 +-
 .../imports/printers/WrapperConsole.scala       |  4 +--
 .../imports/printers/WrapperSystem.scala        |  4 +--
 .../org/apache/toree/interpreter/package.scala  |  2 +-
 .../toree/kernel/api/FactoryMethodsLike.scala   |  2 +-
 .../apache/toree/kernel/api/KernelLike.scala    |  4 +--
 .../apache/toree/kernel/api/KernelOptions.scala |  2 +-
 .../apache/toree/kernel/api/StreamInfo.scala    |  2 +-
 .../toree/kernel/api/StreamMethodsLike.scala    |  2 +-
 .../org/apache/toree/magic/CellMagic.scala      |  2 +-
 .../toree/magic/InternalClassLoader.scala       |  2 +-
 .../org/apache/toree/magic/LineMagic.scala      |  2 +-
 .../scala/org/apache/toree/magic/Magic.scala    |  2 +-
 .../org/apache/toree/magic/MagicExecutor.scala  |  4 +--
 .../org/apache/toree/magic/MagicLoader.scala    |  6 ++--
 .../magic/dependencies/DependencyMap.scala      | 10 +++---
 .../magic/dependencies/IncludeConfig.scala      |  4 +--
 .../IncludeDependencyDownloader.scala           |  6 ++--
 .../magic/dependencies/IncludeInterpreter.scala |  6 ++--
 .../magic/dependencies/IncludeKernel.scala      |  6 ++--
 .../dependencies/IncludeKernelInterpreter.scala |  6 ++--
 .../magic/dependencies/IncludeMagicLoader.scala |  4 +--
 .../dependencies/IncludeOutputStream.scala      |  4 +--
 .../magic/dependencies/IncludeSQLContext.scala  |  4 +--
 .../dependencies/IncludeSparkContext.scala      |  4 +--
 .../scala/org/apache/toree/magic/package.scala  |  2 +-
 .../toree/security/KernelSecurityManager.scala  |  2 +-
 .../toree/utils/ArgumentParsingSupport.scala    |  2 +-
 .../toree/utils/ConditionalOutputStream.scala   |  2 +-
 .../apache/toree/utils/DownloadSupport.scala    |  2 +-
 .../toree/utils/DynamicReflectionSupport.scala  |  2 +-
 .../apache/toree/utils/KeyValuePairUtils.scala  |  2 +-
 .../apache/toree/utils/MultiClassLoader.scala   |  2 +-
 .../apache/toree/utils/MultiOutputStream.scala  |  2 +-
 .../toree/utils/ScheduledTaskManager.scala      |  2 +-
 .../org/apache/toree/utils/TaskManager.scala    |  4 +--
 .../interpreter/broker/BrokerBridgeSpec.scala   |  6 ++--
 .../broker/BrokerProcessHandlerSpec.scala       |  2 +-
 .../interpreter/broker/BrokerProcessSpec.scala  |  2 +-
 .../interpreter/broker/BrokerStateSpec.scala    |  2 +-
 .../broker/BrokerTransformerSpec.scala          |  4 +--
 .../toree/magic/InternalClassLoaderSpec.scala   |  6 ++--
 .../apache/toree/magic/MagicLoaderSpec.scala    |  8 ++---
 .../utils/ArgumentParsingSupportSpec.scala      |  2 +-
 .../utils/ConditionalOutputStreamSpec.scala     |  2 +-
 .../toree/utils/DownloadSupportSpec.scala       |  2 +-
 .../utils/DynamicReflectionSupportSpec.scala    |  2 +-
 .../toree/utils/KeyValuePairUtilsSpec.scala     |  2 +-
 .../toree/utils/MultiOutputStreamSpec.scala     |  2 +-
 .../toree/utils/ScheduledTaskManagerSpec.scala  |  2 +-
 .../apache/toree/utils/TaskManagerSpec.scala    |  2 +-
 .../scala/org/apache/toree/SparkKernel.scala    |  8 ++---
 .../apache/toree/boot/CommandLineOptions.scala  | 10 +++---
 .../org/apache/toree/boot/KernelBootstrap.scala | 18 +++++------
 .../toree/boot/layer/BareInitialization.scala   | 20 ++++++------
 .../boot/layer/ComponentInitialization.scala    | 28 ++++++++--------
 .../boot/layer/HandlerInitialization.scala      | 30 ++++++++---------
 .../toree/boot/layer/HookInitialization.scala   |  8 ++---
 .../toree/boot/layer/InterpreterManager.scala   |  6 ++--
 .../apache/toree/comm/KernelCommManager.scala   |  8 ++---
 .../apache/toree/comm/KernelCommWriter.scala    | 12 +++----
 .../toree/global/ExecuteRequestState.scala      |  6 ++--
 .../apache/toree/global/ExecutionCounter.scala  |  4 +--
 .../toree/global/ScheduledTaskManager.scala     |  4 +--
 .../toree/kernel/api/FactoryMethods.scala       | 12 +++----
 .../org/apache/toree/kernel/api/Kernel.scala    | 34 ++++++++++----------
 .../apache/toree/kernel/api/StreamMethods.scala |  8 ++---
 .../protocol/v5/dispatch/StatusDispatch.scala   | 12 +++----
 .../protocol/v5/handler/BaseHandler.scala       | 10 +++---
 .../v5/handler/CodeCompleteHandler.scala        | 10 +++---
 .../protocol/v5/handler/CommCloseHandler.scala  | 12 +++----
 .../protocol/v5/handler/CommMsgHandler.scala    | 12 +++----
 .../protocol/v5/handler/CommOpenHandler.scala   | 12 +++----
 .../v5/handler/ExecuteRequestHandler.scala      | 18 +++++------
 .../handler/GenericSocketMessageHandler.scala   | 12 +++----
 .../v5/handler/InputRequestReplyHandler.scala   | 16 ++++-----
 .../v5/handler/KernelInfoRequestHandler.scala   | 10 +++---
 .../protocol/v5/handler/ShutdownHandler.scala   | 12 +++----
 .../v5/interpreter/InterpreterActor.scala       | 14 ++++----
 .../protocol/v5/interpreter/package.scala       |  2 +-
 .../tasks/CodeCompleteTaskActor.scala           |  8 ++---
 .../tasks/ExecuteRequestTaskActor.scala         | 18 +++++------
 .../tasks/InterpreterTaskFactory.scala          |  4 +--
 .../kernel/protocol/v5/kernel/ActorLoader.scala |  2 +-
 .../kernel/protocol/v5/kernel/Utilities.scala   |  8 ++---
 .../protocol/v5/kernel/socket/Control.scala     |  6 ++--
 .../protocol/v5/kernel/socket/Heartbeat.scala   |  6 ++--
 .../protocol/v5/kernel/socket/IOPub.scala       | 12 +++----
 .../protocol/v5/kernel/socket/Shell.scala       |  6 ++--
 .../v5/kernel/socket/SocketConfig.scala         |  2 +-
 .../v5/kernel/socket/SocketConnection.scala     |  2 +-
 .../v5/kernel/socket/SocketFactory.scala        |  4 +--
 .../protocol/v5/kernel/socket/Stdin.scala       |  6 ++--
 .../socket/ZeromqKernelMessageSocket.scala      | 12 +++----
 .../kernel/protocol/v5/magic/MagicParser.scala  |  4 +--
 .../protocol/v5/magic/PostProcessor.scala       | 10 +++---
 .../protocol/v5/relay/ExecuteRequestRelay.scala | 16 ++++-----
 .../protocol/v5/relay/KernelMessageRelay.scala  | 16 ++++-----
 .../protocol/v5/stream/KernelInputStream.scala  | 10 +++---
 .../protocol/v5/stream/KernelOutputStream.scala | 10 +++---
 .../apache/toree/magic/builtin/AddDeps.scala    |  8 ++---
 .../org/apache/toree/magic/builtin/AddJar.scala | 10 +++---
 .../toree/magic/builtin/BuiltinLoader.scala     |  4 +--
 .../org/apache/toree/magic/builtin/Html.scala   | 10 +++---
 .../apache/toree/magic/builtin/JavaScript.scala | 10 +++---
 .../apache/toree/magic/builtin/LSMagic.scala    |  6 ++--
 .../org/apache/toree/magic/builtin/RDD.scala    | 14 ++++----
 .../apache/toree/magic/builtin/ShowTypes.scala  |  8 ++---
 .../apache/toree/magic/builtin/Truncation.scala |  8 ++---
 .../apache/toree/utils/MessageLogSupport.scala  |  4 +--
 .../org/apache/toree/utils/json/RddToJson.scala |  2 +-
 .../InterpreterActorSpecForIntegration.scala    | 16 ++++-----
 .../PostProcessorSpecForIntegration.scala       | 10 +++---
 .../toree/boot/CommandLineOptionsSpec.scala     |  2 +-
 .../toree/comm/KernelCommManagerSpec.scala      | 10 +++---
 .../toree/comm/KernelCommWriterSpec.scala       |  8 ++---
 .../toree/global/ExecutionCounterSpec.scala     |  2 +-
 .../apache/toree/kernel/api/KernelSpec.scala    | 18 +++++------
 .../toree/kernel/api/StreamMethodsSpec.scala    |  6 ++--
 .../v5/dispatch/StatusDispatchSpec.scala        |  8 ++---
 .../v5/handler/CodeCompleteHandlerSpec.scala    | 10 +++---
 .../v5/handler/CommCloseHandlerSpec.scala       | 12 +++----
 .../v5/handler/CommMsgHandlerSpec.scala         | 12 +++----
 .../v5/handler/CommOpenHandlerSpec.scala        | 12 +++----
 .../v5/handler/ExecuteRequestHandlerSpec.scala  | 12 +++----
 .../GenericSocketMessageHandlerSpec.scala       |  8 ++---
 .../handler/InputRequestReplyHandlerSpec.scala  |  8 ++---
 .../handler/KernelInfoRequestHandlerSpec.scala  |  8 ++---
 .../tasks/ExecuteRequestTaskActorSpec.scala     |  8 ++---
 .../protocol/v5/kernel/ActorLoaderSpec.scala    |  4 +--
 .../v5/kernel/SimpleActorLoaderSpec.scala       |  4 +--
 .../protocol/v5/kernel/UtilitiesSpec.scala      |  6 ++--
 .../v5/kernel/socket/HeartbeatSpec.scala        |  4 +--
 .../protocol/v5/kernel/socket/IOPubSpec.scala   |  8 ++---
 .../protocol/v5/kernel/socket/ShellSpec.scala   | 10 +++---
 .../v5/kernel/socket/SocketConfigSpec.scala     |  2 +-
 .../v5/kernel/socket/SocketConnectionSpec.scala |  2 +-
 .../v5/kernel/socket/SocketFactorySpec.scala    |  2 +-
 .../protocol/v5/kernel/socket/StdinSpec.scala   | 12 +++----
 .../protocol/v5/magic/MagicParserSpec.scala     |  4 +--
 .../protocol/v5/magic/PostProcessorSpec.scala   |  8 ++---
 .../v5/relay/ExecuteRequestRelaySpec.scala      | 16 ++++-----
 .../v5/relay/KernelMessageRelaySpec.scala       | 12 +++----
 .../v5/stream/KernelInputStreamSpec.scala       |  8 ++---
 .../v5/stream/KernelOuputStreamSpec.scala       | 10 +++---
 .../toree/magic/builtin/AddDepsSpec.scala       | 20 ++++++------
 .../apache/toree/magic/builtin/AddJarSpec.scala |  8 ++---
 .../toree/magic/builtin/BuiltinLoaderSpec.scala |  2 +-
 .../apache/toree/magic/builtin/HtmlSpec.scala   |  6 ++--
 .../toree/magic/builtin/JavaScriptSpec.scala    |  6 ++--
 .../toree/magic/builtin/LSMagicSpec.scala       |  8 ++---
 .../apache/toree/magic/builtin/RDDSpec.scala    | 10 +++---
 .../apache/toree/utils/json/RddToJsonSpec.scala |  2 +-
 .../scala/system/KernelCommSpecForSystem.scala  | 14 ++++----
 .../src/test/scala/system/SuiteForSystem.scala  |  2 +-
 .../src/test/scala/system/TruncationTests.scala | 12 +++----
 .../scala/test/utils/DummyInterpreter.scala     |  6 ++--
 .../test/utils/NoArgSparkKernelTestKit.scala    |  2 +-
 .../scala/test/utils/SparkKernelDeployer.scala  | 20 ++++++------
 .../apache/toree/annotations/Experimental.scala |  2 +-
 project/Build.scala                             |  2 +-
 project/Common.scala                            |  2 +-
 .../org/apache/toree/comm/CommCallbacks.scala   |  8 ++---
 .../org/apache/toree/comm/CommManager.scala     | 12 +++----
 .../org/apache/toree/comm/CommRegistrar.scala   |  8 ++---
 .../org/apache/toree/comm/CommStorage.scala     |  6 ++--
 .../org/apache/toree/comm/CommWriter.scala      | 10 +++---
 .../toree/kernel/protocol/v5/Header.scala       |  2 +-
 .../kernel/protocol/v5/HeaderBuilder.scala      |  2 +-
 .../toree/kernel/protocol/v5/KMBuilder.scala    |  4 +--
 .../kernel/protocol/v5/KernelMessage.scala      |  2 +-
 .../protocol/v5/KernelMessageContent.scala      |  2 +-
 .../kernel/protocol/v5/SparkKernelInfo.scala    |  4 +--
 .../protocol/v5/content/ClearOutput.scala       |  4 +--
 .../kernel/protocol/v5/content/CommClose.scala  |  4 +--
 .../protocol/v5/content/CommContent.scala       |  4 +--
 .../kernel/protocol/v5/content/CommMsg.scala    |  4 +--
 .../kernel/protocol/v5/content/CommOpen.scala   |  4 +--
 .../protocol/v5/content/CompleteReply.scala     |  4 +--
 .../protocol/v5/content/CompleteRequest.scala   |  4 +--
 .../protocol/v5/content/ConnectReply.scala      |  4 +--
 .../protocol/v5/content/ConnectRequest.scala    |  4 +--
 .../protocol/v5/content/DisplayData.scala       |  4 +--
 .../protocol/v5/content/ErrorContent.scala      |  4 +--
 .../protocol/v5/content/ExecuteInput.scala      |  4 +--
 .../protocol/v5/content/ExecuteReply.scala      |  4 +--
 .../protocol/v5/content/ExecuteRequest.scala    |  4 +--
 .../protocol/v5/content/ExecuteResult.scala     |  4 +--
 .../protocol/v5/content/HistoryReply.scala      |  4 +--
 .../protocol/v5/content/HistoryRequest.scala    |  4 +--
 .../kernel/protocol/v5/content/InputReply.scala |  4 +--
 .../protocol/v5/content/InputRequest.scala      |  4 +--
 .../protocol/v5/content/InspectReply.scala      |  4 +--
 .../protocol/v5/content/InspectRequest.scala    |  4 +--
 .../protocol/v5/content/KernelInfoReply.scala   |  4 +--
 .../protocol/v5/content/KernelInfoRequest.scala |  4 +--
 .../protocol/v5/content/KernelStatus.scala      |  4 +--
 .../protocol/v5/content/ShutdownReply.scala     |  4 +--
 .../protocol/v5/content/ShutdownRequest.scala   |  4 +--
 .../protocol/v5/content/StreamContent.scala     |  4 +--
 .../kernel/protocol/v5/content/TypeString.scala |  2 +-
 .../kernel/protocol/v5/content/package.scala    |  2 +-
 .../toree/kernel/protocol/v5/package.scala      |  4 +--
 .../scala/org/apache/toree/utils/LogLike.scala  |  2 +-
 .../apache/toree/comm/CommCallbacksSpec.scala   |  6 ++--
 .../org/apache/toree/comm/CommManagerSpec.scala | 10 +++---
 .../apache/toree/comm/CommRegistrarSpec.scala   |  4 +--
 .../org/apache/toree/comm/CommStorageSpec.scala |  6 ++--
 .../org/apache/toree/comm/CommWriterSpec.scala  |  8 ++---
 .../kernel/protocol/v5/HeaderBuilderSpec.scala  |  2 +-
 .../toree/kernel/protocol/v5/HeaderSpec.scala   |  2 +-
 .../kernel/protocol/v5/KMBuilderSpec.scala      |  4 +--
 .../protocol/v5/content/ClearOutputSpec.scala   |  2 +-
 .../protocol/v5/content/CommCloseSpec.scala     |  4 +--
 .../protocol/v5/content/CommMsgSpec.scala       |  4 +--
 .../protocol/v5/content/CommOpenSpec.scala      |  4 +--
 .../v5/content/CompleteReplyErrorSpec.scala     |  2 +-
 .../v5/content/CompleteReplyOkSpec.scala        |  2 +-
 .../protocol/v5/content/CompleteReplySpec.scala |  2 +-
 .../v5/content/CompleteRequestSpec.scala        |  2 +-
 .../protocol/v5/content/ConnectReplySpec.scala  |  2 +-
 .../v5/content/ConnectRequestSpec.scala         |  2 +-
 .../protocol/v5/content/DisplayDataSpec.scala   |  4 +--
 .../protocol/v5/content/ErrorContentSpec.scala  |  2 +-
 .../protocol/v5/content/ExecuteInputSpec.scala  |  2 +-
 .../v5/content/ExecuteReplyAbortSpec.scala      |  4 +--
 .../v5/content/ExecuteReplyErrorSpec.scala      |  4 +--
 .../v5/content/ExecuteReplyOkSpec.scala         |  4 +--
 .../protocol/v5/content/ExecuteReplySpec.scala  |  4 +--
 .../v5/content/ExecuteRequestSpec.scala         |  4 +--
 .../protocol/v5/content/ExecuteResultSpec.scala |  4 +--
 .../protocol/v5/content/HistoryReplySpec.scala  |  4 +--
 .../v5/content/HistoryRequestSpec.scala         |  2 +-
 .../protocol/v5/content/InputReplySpec.scala    |  2 +-
 .../protocol/v5/content/InputRequestSpec.scala  |  2 +-
 .../v5/content/InspectReplyErrorSpec.scala      |  4 +--
 .../v5/content/InspectReplyOkSpec.scala         |  4 +--
 .../protocol/v5/content/InspectReplySpec.scala  |  2 +-
 .../v5/content/InspectRequestSpec.scala         |  2 +-
 .../v5/content/KernelInfoReplySpec.scala        |  2 +-
 .../v5/content/KernelInfoRequestSpec.scala      |  2 +-
 .../protocol/v5/content/KernelStatusSpec.scala  |  2 +-
 .../protocol/v5/content/ShutdownReplySpec.scala |  2 +-
 .../v5/content/ShutdownRequestSpec.scala        |  2 +-
 .../protocol/v5/content/StreamContentSpec.scala |  2 +-
 .../toree/kernel/protocol/v5/package.scala      |  6 ++--
 .../interpreter/pyspark/PySparkBridge.scala     |  8 ++---
 .../interpreter/pyspark/PySparkException.scala  |  4 +--
 .../pyspark/PySparkInterpreter.scala            |  8 ++---
 .../interpreter/pyspark/PySparkProcess.scala    |  4 +--
 .../pyspark/PySparkProcessHandler.scala         |  4 +--
 .../interpreter/pyspark/PySparkService.scala    |  6 ++--
 .../interpreter/pyspark/PySparkState.scala      |  4 +--
 .../pyspark/PySparkTransformer.scala            |  4 +--
 .../interpreter/pyspark/PySparkTypes.scala      |  4 +--
 .../kernel/interpreter/pyspark/package.scala    |  4 +--
 .../apache/toree/magic/builtin/PySpark.scala    | 12 +++----
 resources/compile/reference.conf                |  8 ++---
 resources/test/reference.conf                   |  8 ++---
 .../interpreter/scala/ScalaException.scala      |  2 +-
 .../interpreter/scala/ScalaInterpreter.scala    | 16 ++++-----
 .../scala/SettingsProducerLike.scala            |  2 +-
 .../scala/SparkIMainProducerLike.scala          |  2 +-
 .../scala/TaskManagerProducerLike.scala         |  4 +--
 .../org/apache/toree/magic/builtin/Scala.scala  | 12 +++----
 .../AddExternalJarMagicSpecForIntegration.scala | 10 +++---
 .../scala/ScalaInterpreterSpec.scala            |  8 ++---
 sparkr-interpreter/src/main/resources/README.md |  2 +-
 .../src/main/resources/kernelR/sparkr_runner.R  |  2 +-
 .../interpreter/sparkr/ReflectiveRBackend.scala |  2 +-
 .../interpreter/sparkr/SparkRBridge.scala       |  8 ++---
 .../interpreter/sparkr/SparkRException.scala    |  4 +--
 .../interpreter/sparkr/SparkRInterpreter.scala  |  8 ++---
 .../interpreter/sparkr/SparkRProcess.scala      |  4 +--
 .../sparkr/SparkRProcessHandler.scala           |  4 +--
 .../interpreter/sparkr/SparkRService.scala      |  8 ++---
 .../kernel/interpreter/sparkr/SparkRState.scala |  4 +--
 .../interpreter/sparkr/SparkRTransformer.scala  |  4 +--
 .../kernel/interpreter/sparkr/SparkRTypes.scala |  4 +--
 .../kernel/interpreter/sparkr/package.scala     |  4 +--
 .../org/apache/toree/magic/builtin/SparkR.scala | 12 +++----
 .../kernel/interpreter/sql/SqlException.scala   |  4 +--
 .../kernel/interpreter/sql/SqlInterpreter.scala |  8 ++---
 .../kernel/interpreter/sql/SqlService.scala     |  8 ++---
 .../kernel/interpreter/sql/SqlTransformer.scala |  4 +--
 .../toree/kernel/interpreter/sql/SqlTypes.scala |  4 +--
 .../org/apache/toree/magic/builtin/Sql.scala    | 12 +++----
 src/test/scala/system/StdinForSystemSpec.scala  |  2 +-
 .../root/SparkKernelClientDeployer.scala        |  4 +--
 .../test.utils/root/SparkKernelDeployer.scala   |  4 +--
 379 files changed, 1142 insertions(+), 1142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala b/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
index a3a0d88..196bc09 100644
--- a/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
+++ b/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
@@ -14,11 +14,11 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, UUID}
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, UUID}
 
 /**
  * Represents a CommManager that uses a ClientCommWriter for its underlying

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala b/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
index 2c7f67c..5259c0f 100644
--- a/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
+++ b/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, CommContent}
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, CommContent}
+import org.apache.toree.kernel.protocol.v5._
 
 /**
  * Represents a CommWriter to send messages from the Client to the Kernel.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
index 6c9dccd..4fa93bc 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client
+package org.apache.toree.kernel.protocol.v5.client
 
 import akka.actor.{ActorRefFactory, ActorSelection}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
index 7544ee9..2e1c690 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
@@ -14,18 +14,18 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client
+package org.apache.toree.kernel.protocol.v5.client
 
 import akka.actor.ActorSystem
 import akka.pattern.ask
 import akka.util.Timeout
-import com.ibm.spark.comm._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, ExecuteRequestTuple}
-import com.ibm.spark.kernel.protocol.v5.client.socket.HeartbeatMessage
-import com.ibm.spark.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.comm._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.execution.{DeferredExecution, ExecuteRequestTuple}
+import org.apache.toree.kernel.protocol.v5.client.socket.HeartbeatMessage
+import org.apache.toree.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
+import org.apache.toree.kernel.protocol.v5.content.ExecuteRequest
+import org.apache.toree.utils.LogLike
 import scala.concurrent.duration._
 
 import scala.concurrent.ExecutionContext.Implicits.global
@@ -59,7 +59,7 @@ class SparkKernelClient(
    * client.execute("println(1)").onStream(someFunction)
    * </code>
    * someFunction will receive a
-   * {@link com.ibm.spark.kernel.protocol.v5.content.StreamContent} message:
+   * {@link org.apache.toree.kernel.protocol.v5.content.StreamContent} message:
    * <code>
    * {
    *  "name" : "stdout",
@@ -74,7 +74,7 @@ class SparkKernelClient(
    * client.execute("1+1").onResult(someFunction)
    * </code>
    * someFunction will receive a
-   * {@link com.ibm.spark.kernel.protocol.v5.content.ExecuteResult} message:
+   * {@link org.apache.toree.kernel.protocol.v5.content.ExecuteResult} message:
    * <code>
    * {
    *  "execution_count" : 1,
@@ -91,7 +91,7 @@ class SparkKernelClient(
    * client.execute("1+1").onResult(someFunction)
    * </code>
    * someFunction will be invoked with an
-   * {@link com.ibm.spark.kernel.protocol.v5.content.ExecuteReply} message
+   * {@link org.apache.toree.kernel.protocol.v5.content.ExecuteReply} message
    * containing the error.
    *
    * @param code Scala code

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
index 56e88c6..d31a573 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client
+package org.apache.toree.kernel.protocol.v5.client
 
 import java.nio.charset.Charset
 
 import akka.util.{ByteString, Timeout}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.ExecuteRequest
+import org.apache.toree.utils.LogLike
 import play.api.data.validation.ValidationError
 import play.api.libs.json.{JsPath, Json, Reads}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
index e75f7dd..33cc20f 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.boot
+package org.apache.toree.kernel.protocol.v5.client.boot
 
 import akka.actor.ActorSystem
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.client.boot.layers._
-import com.ibm.spark.kernel.protocol.v5.client.socket.{SocketConfig, SocketFactory}
-import com.ibm.spark.kernel.protocol.v5.client.{SimpleActorLoader, SparkKernelClient}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.comm.{CommRegistrar, CommStorage}
+import org.apache.toree.kernel.protocol.v5.client.boot.layers._
+import org.apache.toree.kernel.protocol.v5.client.socket.{SocketConfig, SocketFactory}
+import org.apache.toree.kernel.protocol.v5.client.{SimpleActorLoader, SparkKernelClient}
+import org.apache.toree.utils.LogLike
 import com.typesafe.config.Config
 import org.zeromq.ZMQ
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
index 57a294a..a379a29 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
@@ -14,14 +14,14 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.boot.layers
+package org.apache.toree.kernel.protocol.v5.client.boot.layers
 
 import akka.actor.{ActorSystem, Props}
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.MessageType
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-import com.ibm.spark.kernel.protocol.v5.client.handler.ExecuteHandler
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.MessageType
+import org.apache.toree.kernel.protocol.v5.MessageType.MessageType
+import org.apache.toree.kernel.protocol.v5.client.handler.ExecuteHandler
+import org.apache.toree.utils.LogLike
 
 /**
  * Represents the event handler initialization such as message handlers.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
index 945017c..329841e 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
@@ -14,15 +14,15 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.boot.layers
+package org.apache.toree.kernel.protocol.v5.client.boot.layers
 
 import akka.actor.{Props, ActorRef, ActorSystem}
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.communication.security.{SecurityActorType, SignatureManagerActor}
-import com.ibm.spark.kernel.protocol.v5.SocketType
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.client.socket._
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.comm.{CommRegistrar, CommStorage}
+import org.apache.toree.communication.security.{SecurityActorType, SignatureManagerActor}
+import org.apache.toree.kernel.protocol.v5.SocketType
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.client.socket._
+import org.apache.toree.utils.LogLike
 import com.typesafe.config.Config
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
index 6bb89ba..38936b5 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.exception
+package org.apache.toree.kernel.protocol.v5.client.exception
 
 class ShellException(e: Throwable) extends Throwable {
   val exception: Throwable = e

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
index c6e7f86..32815f5 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.execution
+package org.apache.toree.kernel.protocol.v5.client.execution
 
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.utils.LogLike
 
 case class DeferredExecution() extends LogLike {
   private var executeResultCallbacks: List[(ExecuteResult) => Unit] = Nil

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
index 3c7489b..3154222 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.execution
+package org.apache.toree.kernel.protocol.v5.client.execution
 
-import com.ibm.spark.kernel.protocol.v5.UUID
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.UUID
+import org.apache.toree.utils.LogLike
 
 import scala.collection.concurrent.{Map, TrieMap}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
index b9b1e5e..0049407 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.execution
+package org.apache.toree.kernel.protocol.v5.client.execution
 
-import com.ibm.spark.kernel.protocol.v5.UUID
+import org.apache.toree.kernel.protocol.v5.UUID
 
 case class DeferredExecutionTuple ( id: UUID, de: DeferredExecution)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
index 6c8c751..044197f 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.execution
+package org.apache.toree.kernel.protocol.v5.client.execution
 
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
+import org.apache.toree.kernel.protocol.v5.content.ExecuteRequest
 
 case class ExecuteRequestTuple(request: ExecuteRequest, de: DeferredExecution)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
index 57d8e85..d7b7c9f 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.handler
+package org.apache.toree.kernel.protocol.v5.client.handler
 
 import akka.actor.Actor
 import akka.util.Timeout
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.client.execution.{ExecuteRequestTuple, DeferredExecutionManager}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5.client.execution.{ExecuteRequestTuple, DeferredExecutionManager}
+import org.apache.toree.utils.LogLike
 import scala.concurrent.duration._
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
index 6dafbcd..efd7eb8 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import akka.actor.{ActorRef, Actor}
 import akka.util.{ByteString, Timeout}
-import com.ibm.spark.communication.ZMQMessage
+import org.apache.toree.communication.ZMQMessage
 import akka.pattern.ask
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.utils.LogLike
-import com.ibm.spark.kernel.protocol.v5.UUID
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.UUID
 import scala.collection.concurrent.{Map, TrieMap}
 import scala.concurrent.duration._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
index b183a23..ca4b10d 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import akka.actor.Actor
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.comm.{CommStorage, CommRegistrar, ClientCommWriter}
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.comm.{CommStorage, CommRegistrar, ClientCommWriter}
+import org.apache.toree.kernel.protocol.v5.client.{ActorLoader, Utilities}
 import Utilities._
-import com.ibm.spark.kernel.protocol.v5.client.execution.DeferredExecutionManager
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.client.execution.DeferredExecutionManager
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import org.apache.toree.utils.LogLike
 
 import scala.util.Failure
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
index bf504af..ab3f478 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import akka.actor.Actor
 import akka.util.Timeout
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, UUID}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.communication.security.SecurityActorType
+import org.apache.toree.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, UUID}
 import Utilities._
-import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteReply
+import org.apache.toree.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
+import org.apache.toree.kernel.protocol.v5.content.ExecuteReply
 
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.utils.LogLike
 import scala.concurrent.Await
 import scala.concurrent.duration._
 import akka.pattern.ask

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
index 6f3789d..14f21fd 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import com.typesafe.config.Config
 import play.api.libs.json.Json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
index fae1d0e..da9b02a 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 object SocketConnection {
   def apply(protocol: String, ip: String, port: Int) =

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
index 07b05d7..087cdbc 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import java.util.UUID
 
 import akka.actor.{Props, ActorRef, ActorSystem}
-import com.ibm.spark.communication.actors.{DealerSocketActor, ReqSocketActor, SubSocketActor}
+import org.apache.toree.communication.actors.{DealerSocketActor, ReqSocketActor, SubSocketActor}
 
 object SocketFactory {
   def apply(socketConfig: SocketConfig) = {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
index 22c6071..e70ec32 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
@@ -14,16 +14,16 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import akka.actor.Actor
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{HeaderBuilder, KMBuilder, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.content.{InputReply, InputRequest}
-import com.ibm.spark.utils.LogLike
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.communication.security.SecurityActorType
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{HeaderBuilder, KMBuilder, KernelMessage}
+import org.apache.toree.kernel.protocol.v5.content.{InputReply, InputRequest}
+import org.apache.toree.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.client.Utilities._
 import play.api.libs.json.Json
 
 import StdinClient._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/resources/testng.yaml
----------------------------------------------------------------------
diff --git a/client/src/test/resources/testng.yaml b/client/src/test/resources/testng.yaml
index 4b9266d..b1ec4c8 100644
--- a/client/src/test/resources/testng.yaml
+++ b/client/src/test/resources/testng.yaml
@@ -21,4 +21,4 @@ parameters: { }
 tests:
   - name: KernelClientTests
     packages:
-      - "com.ibm.spark.kernel.client.*"
+      - "org.apache.toree.kernel.client.*"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/examples/DocumentationExamples.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/examples/DocumentationExamples.scala b/client/src/test/scala/examples/DocumentationExamples.scala
index cc390e2..dd2a8f7 100644
--- a/client/src/test/scala/examples/DocumentationExamples.scala
+++ b/client/src/test/scala/examples/DocumentationExamples.scala
@@ -16,10 +16,10 @@
 
 package examples
 
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.kernel.protocol.v5.client.boot.ClientBootstrap
-import com.ibm.spark.kernel.protocol.v5.client.boot.layers.{StandardHandlerInitialization, StandardSystemInitialization}
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.kernel.protocol.v5.client.boot.ClientBootstrap
+import org.apache.toree.kernel.protocol.v5.client.boot.layers.{StandardHandlerInitialization, StandardSystemInitialization}
+import org.apache.toree.kernel.protocol.v5.content._
 import com.typesafe.config.{Config, ConfigFactory}
 
 object DocumentationExamples extends App {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/examples/ScalaSparkClientUsage.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/examples/ScalaSparkClientUsage.scala b/client/src/test/scala/examples/ScalaSparkClientUsage.scala
index 7632049..6d38c43 100644
--- a/client/src/test/scala/examples/ScalaSparkClientUsage.scala
+++ b/client/src/test/scala/examples/ScalaSparkClientUsage.scala
@@ -17,11 +17,11 @@
 package examples
 
 import java.io.File
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.kernel.protocol.v5.client.boot.ClientBootstrap
-import com.ibm.spark.kernel.protocol.v5.client.boot.layers.{StandardHandlerInitialization, StandardSystemInitialization}
-import com.ibm.spark.kernel.protocol.v5.content.{ExecuteResult}
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.kernel.protocol.v5.client.boot.ClientBootstrap
+import org.apache.toree.kernel.protocol.v5.client.boot.layers.{StandardHandlerInitialization, StandardSystemInitialization}
+import org.apache.toree.kernel.protocol.v5.content.{ExecuteResult}
+import org.apache.toree.kernel.protocol.v5.content._
 import com.typesafe.config.{ConfigFactory, Config}
 import scala.concurrent.ExecutionContext.Implicits.global
 import scala.concurrent.Promise

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala b/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
index 9b22823..dc6c047 100644
--- a/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
+++ b/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
@@ -23,10 +23,10 @@ import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.pattern.ask
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
 import akka.util.Timeout
-import com.ibm.spark.kernel.protocol.v5.client.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.SocketType
-import com.ibm.spark.kernel.protocol.v5.socket._
-import com.ibm.spark.kernel.protocol.v5.socket.SocketConfig
+import org.apache.toree.kernel.protocol.v5.client.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.SocketType
+import org.apache.toree.kernel.protocol.v5.socket._
+import org.apache.toree.kernel.protocol.v5.socket.SocketConfig
 import com.typesafe.config.ConfigFactory
 import org.mockito.Matchers._
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala b/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
index 557630e..b4fe468 100644
--- a/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
+++ b/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
@@ -21,9 +21,9 @@ import java.util.UUID
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteResult
-import com.ibm.spark.kernel.protocol.v5.socket._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.ExecuteResult
+import org.apache.toree.kernel.protocol.v5.socket._
 import org.mockito.Matchers._
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala b/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
index 978ffd5..cc4372b 100644
--- a/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
+++ b/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
@@ -22,9 +22,9 @@ import java.util.UUID
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
 import akka.zeromq._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-import com.ibm.spark.kernel.protocol.v5.socket._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.ExecuteRequest
+import org.apache.toree.kernel.protocol.v5.socket._
 import org.mockito.Matchers._
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala b/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
index 85ef4aa..ca0cde7 100644
--- a/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
+++ b/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
@@ -14,12 +14,12 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content.CommContent
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.content.CommContent
 import org.scalatest.mock.MockitoSugar
 import org.mockito.Mockito._
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala b/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
index f5a4b43..3c795e5 100644
--- a/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
+++ b/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
@@ -13,15 +13,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
 import java.util.UUID
 
 import akka.actor.{ActorSelection, ActorSystem}
 import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.content._
 import com.typesafe.config.ConfigFactory
 import org.mockito.Matchers._
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
index 8db29f8..2683c87 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client
+package org.apache.toree.kernel.protocol.v5.client
 
 import akka.actor.ActorSystem
 import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.comm.{CommCallbacks, CommStorage, CommRegistrar}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.execution.ExecuteRequestTuple
+import org.apache.toree.comm.{CommCallbacks, CommStorage, CommRegistrar}
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.execution.ExecuteRequestTuple
 import scala.concurrent.duration._
 import org.mockito.Mockito._
 import org.mockito.Matchers.{eq => mockEq, _}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
index db3205c..655bed3 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.execution
+package org.apache.toree.kernel.protocol.v5.client.execution
 
-import com.ibm.spark.kernel.protocol.v5.content.{StreamContent, ExecuteResult}
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.{StreamContent, ExecuteResult}
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{Matchers, FunSpec}
 import org.scalatest.concurrent.ScalaFutures
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
index 9fdd702..0755785 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{Matchers, FunSpecLike}
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
index b592dcd..99c2914 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import java.util.UUID
 
@@ -22,14 +22,14 @@ import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.pattern.ask
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
 import akka.util.Timeout
-import com.ibm.spark.comm.{CommCallbacks, CommRegistrar, CommStorage, CommWriter}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
-import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, StreamContent}
+import org.apache.toree.comm.{CommCallbacks, CommRegistrar, CommStorage, CommWriter}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.Utilities._
+import org.apache.toree.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
+import org.apache.toree.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, StreamContent}
 import com.typesafe.config.ConfigFactory
 import org.mockito.Matchers.{eq => mockEq, _}
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
index 0110dfd..6c88605 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import java.util.UUID
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.communication.security.SecurityActorType
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.content.ExecuteRequest
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{Matchers, FunSpecLike}
 import org.mockito.Mockito._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
index 877c4f5..a3a48b7 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
@@ -14,19 +14,19 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.client.socket
+package org.apache.toree.kernel.protocol.v5.client.socket
 
 import akka.actor.{ActorRef, Props, ActorSystem}
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
-import com.ibm.spark.kernel.protocol.v5.content.{InputReply, InputRequest, ClearOutput, ExecuteRequest}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.communication.security.SecurityActorType
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.client.ActorLoader
+import org.apache.toree.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
+import org.apache.toree.kernel.protocol.v5.content.{InputReply, InputRequest, ClearOutput, ExecuteRequest}
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
+import org.apache.toree.kernel.protocol.v5.client.Utilities._
 import play.api.libs.json.Json
 import scala.concurrent.duration._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/system/ClientCommSpecForSystem.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/system/ClientCommSpecForSystem.scala b/client/src/test/scala/system/ClientCommSpecForSystem.scala
index 164c4c0..c8e98be 100644
--- a/client/src/test/scala/system/ClientCommSpecForSystem.scala
+++ b/client/src/test/scala/system/ClientCommSpecForSystem.scala
@@ -17,11 +17,11 @@
 package system
 
 import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage, SocketType}
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.client.Utilities._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage, SocketType}
 import org.scalatest.concurrent.Eventually
 import org.scalatest.exceptions.TestFailedDueToTimeoutException
 import org.scalatest.time.{Milliseconds, Seconds, Span}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/client/src/test/scala/test/utils/SparkClientDeployer.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/test/utils/SparkClientDeployer.scala b/client/src/test/scala/test/utils/SparkClientDeployer.scala
index 8edccfb..beebd0c 100644
--- a/client/src/test/scala/test/utils/SparkClientDeployer.scala
+++ b/client/src/test/scala/test/utils/SparkClientDeployer.scala
@@ -18,13 +18,13 @@ package test.utils
 
 import akka.actor.{Actor, Props, ActorRef, ActorSystem}
 import akka.testkit.TestProbe
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.client.socket._
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, SparkKernelClient}
-import com.ibm.spark.kernel.protocol.v5.client.boot.ClientBootstrap
-import com.ibm.spark.kernel.protocol.v5.client.boot.layers.{StandardHandlerInitialization, StandardSystemInitialization}
-import com.ibm.spark.kernel.protocol.v5.SocketType
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.comm.{CommRegistrar, CommStorage}
+import org.apache.toree.kernel.protocol.v5.client.socket._
+import org.apache.toree.kernel.protocol.v5.client.{ActorLoader, SparkKernelClient}
+import org.apache.toree.kernel.protocol.v5.client.boot.ClientBootstrap
+import org.apache.toree.kernel.protocol.v5.client.boot.layers.{StandardHandlerInitialization, StandardSystemInitialization}
+import org.apache.toree.kernel.protocol.v5.SocketType
+import org.apache.toree.utils.LogLike
 import com.typesafe.config.{Config, ConfigFactory}
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
index 994360f..bb75df7 100644
--- a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication
+package org.apache.toree.communication
 
 import java.util.UUID
 import java.util.concurrent.ConcurrentHashMap
-import com.ibm.spark.communication.socket._
+import org.apache.toree.communication.socket._
 import org.zeromq.ZMQ
 
 import scala.collection.JavaConverters._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala b/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
index ffa7705..fee8dd3 100644
--- a/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication
+package org.apache.toree.communication
 
 import akka.util.ByteString
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
index 0f0497d..16d8b76 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.actors
+package org.apache.toree.communication.actors
 
 import akka.actor.{Actor, ActorRef}
 import akka.util.ByteString
-import com.ibm.spark.communication.{ZMQMessage, SocketManager}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.{ZMQMessage, SocketManager}
+import org.apache.toree.utils.LogLike
 import org.zeromq.ZMQ
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
index f74764e..e186926 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
@@ -13,13 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.actors
+package org.apache.toree.communication.actors
 
 import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.communication.{SocketManager, ZMQMessage}
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.communication.{SocketManager, ZMQMessage}
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.utils.LogLike
 import org.zeromq.ZMQ
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
index b8643f5..9c54b30 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.actors
+package org.apache.toree.communication.actors
 
 import akka.actor.{Actor, ActorRef}
 import akka.util.ByteString
-import com.ibm.spark.communication.{SocketManager, ZMQMessage}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.{SocketManager, ZMQMessage}
+import org.apache.toree.utils.LogLike
 import org.zeromq.ZMQ
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
index e38f2a0..f1b65f4 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.actors
+package org.apache.toree.communication.actors
 
 import akka.actor.{Actor, ActorRef}
 import akka.util.ByteString
-import com.ibm.spark.communication.{ZMQMessage, SocketManager}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.{ZMQMessage, SocketManager}
+import org.apache.toree.utils.LogLike
 import org.zeromq.ZMQ
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
index 6aa3bc5..969aece 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.actors
+package org.apache.toree.communication.actors
 
 import akka.actor.{Actor, ActorRef}
 import akka.util.ByteString
-import com.ibm.spark.communication.{SocketManager, ZMQMessage}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.{SocketManager, ZMQMessage}
+import org.apache.toree.utils.LogLike
 import org.zeromq.ZMQ
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
index 8fef496..e37ba4c 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.actors
+package org.apache.toree.communication.actors
 
 import akka.actor.{Actor, ActorRef}
 import akka.util.ByteString
-import com.ibm.spark.communication.{ZMQMessage, SocketManager}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.{ZMQMessage, SocketManager}
+import org.apache.toree.utils.LogLike
 
 /**
  * Represents an actor containing a subscribe socket.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala b/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
index 9f44177..1692f1e 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.security
+package org.apache.toree.communication.security
 
 import javax.crypto.Mac
 import javax.crypto.spec.SecretKeySpec
 
-import com.ibm.spark.communication.security.HmacAlgorithm.HmacAlgorithm
+import org.apache.toree.communication.security.HmacAlgorithm.HmacAlgorithm
 
 object HmacAlgorithm extends Enumeration {
   type HmacAlgorithm = Value

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
index c3fabd7..56ca1bd 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.security
+package org.apache.toree.communication.security
 
 import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.utils.LogLike
 
 /**
  * Verifies whether or not a kernel message has a valid signature.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
index f381644..bef8797 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.security
+package org.apache.toree.communication.security
 
 import akka.actor.{Props, ActorRef, Actor}
 import akka.util.Timeout
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.utils.LogLike
 
 import scala.concurrent.duration._
 import akka.pattern.ask

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
index 36b5688..e0dc6d9 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.security
+package org.apache.toree.communication.security
 
 import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.utils.LogLike
 import play.api.libs.json.Json
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/security/package.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/package.scala b/communication/src/main/scala/org/apache/toree/communication/security/package.scala
index 5c5b1d5..208b04b 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/package.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/package.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication
+package org.apache.toree.communication
 
 package object security {
   object SecurityActorType extends Enumeration {



[12/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
new file mode 100644
index 0000000..49582f8
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import java.util.UUID
+
+import akka.actor.{Props, ActorRef, ActorSystem}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.content.{ClearOutput, CommClose}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SystemActorType, KMBuilder}
+import com.ibm.spark.comm.{CommRegistrar, CommWriter, CommCallbacks, CommStorage}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+import scala.concurrent.duration._
+
+class CommCloseHandlerSpec extends TestKit(
+  ActorSystem("CommCloseHandlerSpec")
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val TestCommId = UUID.randomUUID().toString
+  private val TestTargetName = "some test target"
+
+  private var kmBuilder: KMBuilder = _
+  private var spyCommStorage: CommStorage = _
+  private var mockCommCallbacks: CommCallbacks = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var mockActorLoader: ActorLoader = _
+  private var commCloseHandler: ActorRef = _
+  private var kernelMessageRelayProbe: TestProbe = _
+  private var statusDispatchProbe: TestProbe = _
+
+  before {
+    kmBuilder = KMBuilder()
+    mockCommCallbacks = mock[CommCallbacks]
+    spyCommStorage = spy(new CommStorage())
+    mockCommRegistrar = mock[CommRegistrar]
+
+    mockActorLoader = mock[ActorLoader]
+
+    commCloseHandler = system.actorOf(Props(
+      classOf[CommCloseHandler],
+      mockActorLoader, mockCommRegistrar, spyCommStorage
+    ))
+
+    // Used to intercept responses
+    kernelMessageRelayProbe = TestProbe()
+    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
+      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
+
+    // Used to intercept busy/idle messages
+    statusDispatchProbe = new TestProbe(system)
+    when(mockActorLoader.load(SystemActorType.StatusDispatch))
+      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
+  }
+
+  describe("CommCloseHandler") {
+    describe("#process") {
+      it("should execute close callbacks if the id is registered") {
+        // Mark our id as registered
+        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(TestCommId)
+
+        // Send a comm_open message with the test target
+        commCloseHandler ! kmBuilder
+          .withHeader(CommClose.toTypeString)
+          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Should receive a busy and an idle message
+        statusDispatchProbe.receiveN(2, 200.milliseconds)
+
+        // Verify that the msg callbacks were triggered along the way
+        verify(mockCommCallbacks).executeCloseCallbacks(
+          any[CommWriter], any[v5.UUID], any[v5.MsgData])
+      }
+
+      it("should not execute close callbacks if the id is not registered") {
+        // Mark our target as not registered
+        doReturn(None).when(spyCommStorage).getCommIdCallbacks(TestCommId)
+
+        // Send a comm_msg message with the test id
+        commCloseHandler ! kmBuilder
+          .withHeader(CommClose.toTypeString)
+          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Should receive a busy and an idle message
+        statusDispatchProbe.receiveN(2, 200.milliseconds)
+
+        // Verify that the msg callbacks were NOT triggered along the way
+        verify(mockCommCallbacks, never()).executeCloseCallbacks(
+          any[CommWriter], any[v5.UUID], any[v5.MsgData])
+      }
+
+      it("should do nothing if there is a parsing error") {
+        // Send a comm_open message with an invalid content string
+        commCloseHandler ! kmBuilder
+          .withHeader(CommClose.toTypeString)
+          .withContentString(ClearOutput(_wait = true))
+          .build
+
+        // TODO: Is there a better way to test for this without an upper time
+        //       limit? Is there a different logical approach?
+        kernelMessageRelayProbe.expectNoMsg(200.milliseconds)
+      }
+
+      it("should include the parent's header in the parent header of " +
+        "outgoing messages"){
+
+        // Register a callback that sends a message using the comm writer
+        val closeCallback: CommCallbacks.CloseCallback =
+          new CommCallbacks.CloseCallback() {
+            def apply(v1: CommWriter, v2: v5.UUID, v4: v5.MsgData) =
+              v1.writeMsg(v5.MsgData.Empty)
+          }
+        val callbacks = (new CommCallbacks).addCloseCallback(closeCallback)
+        doReturn(Some(callbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(TestCommId)
+
+        // Send a comm close message
+        val msg = kmBuilder
+          .withHeader(CommClose.toTypeString)
+          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
+          .build
+        commCloseHandler ! msg
+
+        // Verify that the message sent by the handler has the desired property
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, _, parentHeader, _, _) =>
+            parentHeader == msg.header
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
new file mode 100644
index 0000000..582a08e
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import java.util.UUID
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.comm._
+import com.ibm.spark.kernel.protocol.v5.content.{CommMsg, ClearOutput, CommOpen}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+
+import scala.concurrent.duration._
+
+class CommMsgHandlerSpec extends TestKit(
+  ActorSystem("CommMsgHandlerSpec")
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val TestCommId = UUID.randomUUID().toString
+  private val TestTargetName = "some test target"
+
+  private var kmBuilder: KMBuilder = _
+  private var spyCommStorage: CommStorage = _
+  private var mockCommCallbacks: CommCallbacks = _
+  private var mockActorLoader: ActorLoader = _
+  private var commMsgHandler: ActorRef = _
+  private var kernelMessageRelayProbe: TestProbe = _
+  private var statusDispatchProbe: TestProbe = _
+
+  before {
+    kmBuilder = KMBuilder()
+    mockCommCallbacks = mock[CommCallbacks]
+    spyCommStorage = spy(new CommStorage())
+
+    mockActorLoader = mock[ActorLoader]
+
+    commMsgHandler = system.actorOf(Props(
+      classOf[CommMsgHandler],
+      mockActorLoader, mock[CommRegistrar], spyCommStorage
+    ))
+
+    // Used to intercept responses
+    kernelMessageRelayProbe = TestProbe()
+    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
+      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
+
+    // Used to intercept busy/idle messages
+    statusDispatchProbe = new TestProbe(system)
+    when(mockActorLoader.load(SystemActorType.StatusDispatch))
+      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
+  }
+
+  describe("CommMsgHandler") {
+    describe("#process") {
+      it("should execute msg callbacks if the id is registered") {
+        // Mark our id as registered
+        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(TestCommId)
+
+        // Send a comm_open message with the test target
+        commMsgHandler ! kmBuilder
+          .withHeader(CommMsg.toTypeString)
+          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Should receive a busy and an idle message
+        statusDispatchProbe.receiveN(2, 200.milliseconds)
+
+        // Verify that the msg callbacks were triggered along the way
+        verify(mockCommCallbacks).executeMsgCallbacks(
+          any[CommWriter], any[v5.UUID], any[v5.MsgData])
+      }
+
+      it("should not execute msg callbacks if the id is not registered") {
+        // Mark our target as not registered
+        doReturn(None).when(spyCommStorage).getCommIdCallbacks(TestCommId)
+
+        // Send a comm_msg message with the test id
+        commMsgHandler ! kmBuilder
+          .withHeader(CommMsg.toTypeString)
+          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Should receive a busy and an idle message
+        statusDispatchProbe.receiveN(2, 200.milliseconds)
+
+        // Verify that the msg callbacks were NOT triggered along the way
+        verify(mockCommCallbacks, never()).executeMsgCallbacks(
+          any[CommWriter], any[v5.UUID], any[v5.MsgData])
+      }
+
+      it("should do nothing if there is a parsing error") {
+        // Send a comm_open message with an invalid content string
+        commMsgHandler ! kmBuilder
+          .withHeader(CommMsg.toTypeString)
+          .withContentString(ClearOutput(_wait = true))
+          .build
+
+        // TODO: Is there a better way to test for this without an upper time
+        //       limit? Is there a different logical approach?
+        kernelMessageRelayProbe.expectNoMsg(200.milliseconds)
+      }
+
+      it("should include the parent's header in the parent header of " +
+         "outgoing messages"){
+
+        // Register a callback that sends a message using the comm writer
+        val msgCallback: CommCallbacks.MsgCallback =
+          new CommCallbacks.MsgCallback() {
+            def apply(v1: CommWriter, v2: v5.UUID, v3: v5.MsgData): Unit =
+              v1.writeMsg(MsgData.Empty)
+          }
+        val callbacks = (new CommCallbacks).addMsgCallback(msgCallback)
+        doReturn(Some(callbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(TestCommId)
+
+        // Send a comm_msg message with the test id
+        val msg = kmBuilder
+          .withHeader(CommMsg.toTypeString)
+          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
+          .build
+        commMsgHandler ! msg
+
+        // Verify that the message sent by the handler has the desired property
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, _, parentHeader, _, _) =>
+            parentHeader == msg.header
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
new file mode 100644
index 0000000..64013e9
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import java.util.UUID
+
+import com.ibm.spark.kernel.protocol.v5
+
+import akka.actor.{Props, ActorRef, ActorSystem}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.kernel.protocol.v5.content.{CommClose, ClearOutput, CommOpen}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.comm._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+
+import scala.concurrent.duration._
+
+class CommOpenHandlerSpec extends TestKit(
+  ActorSystem("CommOpenHandlerSpec")
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val TestCommId = UUID.randomUUID().toString
+  private val TestTargetName = "some test target"
+
+  private var kmBuilder: KMBuilder = _
+  private var spyCommStorage: CommStorage = _
+  private var mockCommCallbacks: CommCallbacks = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var mockActorLoader: ActorLoader = _
+  private var commOpenHandler: ActorRef = _
+  private var kernelMessageRelayProbe: TestProbe = _
+  private var statusDispatchProbe: TestProbe = _
+
+  before {
+    kmBuilder = KMBuilder()
+    mockCommCallbacks = mock[CommCallbacks]
+    spyCommStorage = spy(new CommStorage())
+    mockCommRegistrar = mock[CommRegistrar]
+
+    mockActorLoader = mock[ActorLoader]
+
+    commOpenHandler = system.actorOf(Props(
+      classOf[CommOpenHandler],
+      mockActorLoader, mockCommRegistrar, spyCommStorage
+    ))
+
+    // Used to intercept responses
+    kernelMessageRelayProbe = TestProbe()
+    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
+      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
+
+    // Used to intercept busy/idle messages
+    statusDispatchProbe = new TestProbe(system)
+    when(mockActorLoader.load(SystemActorType.StatusDispatch))
+      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
+  }
+
+  describe("CommOpenHandler") {
+    describe("#process") {
+      it("should execute open callbacks if the target exists") {
+        // Mark our target as registered
+        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
+          .getTargetCallbacks(TestTargetName)
+
+        // Send a comm_open message with the test target
+        commOpenHandler ! kmBuilder
+          .withHeader(CommOpen.toTypeString)
+          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
+          .build
+
+        // Should receive a busy and an idle message
+        statusDispatchProbe.receiveN(2, 200.milliseconds)
+
+        // Verify that the open callbacks were triggered along the way
+        verify(mockCommCallbacks).executeOpenCallbacks(
+          any[CommWriter], any[v5.UUID], anyString(), any[v5.MsgData])
+      }
+
+      it("should close the comm connection if the target does not exist") {
+        // Mark our target as not registered
+        doReturn(None).when(spyCommStorage).getTargetCallbacks(TestTargetName)
+
+        // Send a comm_open message with the test target
+        commOpenHandler ! kmBuilder
+          .withHeader(CommOpen.toTypeString)
+          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
+          .build
+
+        // Should receive a close message as a result of the target missing
+        kernelMessageRelayProbe.expectMsgPF(200.milliseconds) {
+          case KernelMessage(_, _, header, _, _, _) =>
+            header.msg_type should be (CommClose.toTypeString)
+        }
+      }
+
+      it("should do nothing if there is a parsing error") {
+        // Send a comm_open message with an invalid content string
+        commOpenHandler ! kmBuilder
+          .withHeader(CommOpen.toTypeString)
+          .withContentString(ClearOutput(_wait = true))
+          .build
+
+        // TODO: Is there a better way to test for this without an upper time
+        //       limit? Is there a different logical approach?
+        kernelMessageRelayProbe.expectNoMsg(200.milliseconds)
+      }
+
+      it("should include the parent's header in the parent header of " +
+        "outgoing messages"){
+
+        // Register a callback that sends a message using the comm writer
+        val openCallback: CommCallbacks.OpenCallback =
+          new CommCallbacks.OpenCallback() {
+            def apply(v1: CommWriter, v2: v5.UUID, v3: String, v4: v5.MsgData) =
+              v1.writeMsg(MsgData.Empty)
+          }
+        val callbacks = (new CommCallbacks).addOpenCallback(openCallback)
+        doReturn(Some(callbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(TestCommId)
+
+        // Send a comm_open message
+        val msg = kmBuilder
+          .withHeader(CommOpen.toTypeString)
+          .withContentString(
+            CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty)
+          )
+          .build
+        commOpenHandler ! msg
+
+        // Verify that the message sent by the handler has the desired property
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, _, parentHeader, _, _) =>
+            parentHeader == msg.header
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
new file mode 100644
index 0000000..c22bc41
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import java.io.OutputStream
+import java.util.concurrent.atomic.AtomicInteger
+
+import akka.actor._
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.kernel.api.{FactoryMethods, FactoryMethodsLike, Kernel}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5Test._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import play.api.libs.json.Json
+
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import scala.concurrent.duration._
+import scala.concurrent.ExecutionContext.Implicits.global
+import scala.concurrent._
+
+class ExecuteRequestHandlerSpec extends TestKit(
+  ActorSystem("ExecuteRequestHandlerSpec")
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter {
+
+  private var mockActorLoader: ActorLoader = _
+  private var mockFactoryMethods: FactoryMethods = _
+  private var mockKernel: Kernel = _
+  private var mockOutputStream: OutputStream = _
+  private var handlerActor: ActorRef = _
+  private var kernelMessageRelayProbe: TestProbe = _
+  private var executeRequestRelayProbe: TestProbe = _
+  private var statusDispatchProbe: TestProbe = _
+
+  before {
+    mockActorLoader = mock[ActorLoader]
+    mockFactoryMethods = mock[FactoryMethods]
+    mockKernel = mock[Kernel]
+    mockOutputStream = mock[OutputStream]
+    doReturn(mockFactoryMethods).when(mockKernel)
+      .factory(any[KernelMessage], any[KMBuilder])
+
+    doReturn(mockOutputStream).when(mockFactoryMethods)
+      .newKernelOutputStream(anyString(), anyBoolean())
+
+    // Add our handler and mock interpreter to the actor system
+    handlerActor = system.actorOf(Props(
+      classOf[ExecuteRequestHandler],
+      mockActorLoader,
+      mockKernel
+    ))
+
+    kernelMessageRelayProbe = new TestProbe(system)
+    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
+      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
+
+    executeRequestRelayProbe = new TestProbe(system)
+    when(mockActorLoader.load(SystemActorType.ExecuteRequestRelay))
+      .thenReturn(system.actorSelection(executeRequestRelayProbe.ref.path.toString))
+
+    statusDispatchProbe = new TestProbe(system)
+    when(mockActorLoader.load(SystemActorType.StatusDispatch))
+      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
+  }
+
+  /**
+   * This method simulates the interpreter passing back an
+   * execute result and reply.
+   */
+  def replyToHandlerWithOkAndResult() = {
+    //  This stubs the behaviour of the interpreter executing code
+    val expectedClass = classOf[(ExecuteRequest, KernelMessage, OutputStream)]
+    executeRequestRelayProbe.expectMsgClass(expectedClass)
+    executeRequestRelayProbe.reply((
+      ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
+      ExecuteResult(1, Data("text/plain" -> "resulty result"), Metadata())
+    ))
+  }
+  
+  def replyToHandlerWithOk() = {
+    //  This stubs the behaviour of the interpreter executing code
+    val expectedClass = classOf[(ExecuteRequest, KernelMessage, OutputStream)]
+    executeRequestRelayProbe.expectMsgClass(expectedClass)
+    executeRequestRelayProbe.reply((
+      ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
+      ExecuteResult(1, Data("text/plain" -> ""), Metadata())
+    ))
+  }
+
+  /**
+   * This method simulates the interpreter passing back an
+   * execute result and reply
+   */
+  def replyToHandlerWithErrorAndResult() = {
+    //  This stubs the behaviour of the interpreter executing code
+    val expectedClass = classOf[(ExecuteRequest, KernelMessage, OutputStream)]
+    executeRequestRelayProbe.expectMsgClass(expectedClass)
+    executeRequestRelayProbe.reply((
+      ExecuteReplyError(1, Some(""), Some(""), Some(Nil)),
+      ExecuteResult(1, Data("text/plain" -> "resulty result"), Metadata())
+    ))
+  }
+
+  describe("ExecuteRequestHandler( ActorLoader )") {
+    describe("#receive( KernelMessage ) when interpreter replies") {
+
+      it("should send an execute result message if the result is not empty") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        replyToHandlerWithOkAndResult()
+        kernelMessageRelayProbe.fishForMessage(100.milliseconds) {
+          case KernelMessage(_, _, header, _, _, _) =>
+            header.msg_type == ExecuteResult.toTypeString
+        }
+      }
+
+      it("should not send an execute result message if there is no result") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        replyToHandlerWithOk()
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, header, _, _, _) =>
+            header.msg_type != ExecuteResult.toTypeString
+        }
+
+      }
+
+      it("should send an execute reply message") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        replyToHandlerWithOkAndResult()
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, header, _, _, _) =>
+            header.msg_type == ExecuteResult.toTypeString
+        }
+      }
+
+      it("should send a status idle message after the reply and result") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        replyToHandlerWithOkAndResult()
+
+        val msgCount = new AtomicInteger(0)
+        var statusMsgNum = -1
+        var statusReceived = false
+
+        val f1 = future {
+          kernelMessageRelayProbe.fishForMessage(4.seconds) {
+            case KernelMessage(_, _, header, _, _, _) =>
+              if (header.msg_type == ExecuteResult.toTypeString &&
+                    !statusReceived)
+                msgCount.incrementAndGet()
+              else if (header.msg_type == ExecuteReply.toTypeString &&
+                    !statusReceived)
+                msgCount.incrementAndGet()
+              statusReceived || (msgCount.get() >= 2)
+          }
+        }
+
+        val f2 = future {
+          statusDispatchProbe.fishForMessage(4.seconds) {
+            case (status, header) =>
+              if (status == KernelStatusIdle.toString)
+                statusReceived = true
+                statusMsgNum = msgCount.get()
+            statusReceived || (msgCount.get() >= 2)
+          }
+        }
+        val fs = (f1 zip f2)
+        Await.ready(fs, 5.seconds)
+
+        statusMsgNum should equal(2)
+      }
+
+      it("should send an execute input message") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, header, _, _, _) =>
+            header.msg_type == ExecuteInput.toTypeString
+        }
+      }
+
+      it("should send a message with ids equal to the incoming " +
+        "KernelMessage's ids") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(ids, _, _, _, _, _) =>
+            ids == MockExecuteRequestKernelMessage.ids
+        }
+      }
+
+      it("should send a message with parent header equal to the incoming " +
+        "KernelMessage's header") {
+        handlerActor ! MockExecuteRequestKernelMessage
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          case KernelMessage(_, _, _, parentHeader, _, _) =>
+            parentHeader == MockExecuteRequestKernelMessage.header
+        }
+      }
+
+      // TODO: Investigate if this is still relevant at all
+//      it("should send a status busy and idle message") {
+//        handlerActor ! MockExecuteRequestKernelMessage
+//        replyToHandlerWithOkAndResult()
+//        var busy = false
+//        var idle = false
+//
+//        statusDispatchProbe.receiveWhile(100.milliseconds) {
+//          case Tuple2(status: KernelStatusType, header: Header)=>
+//            if(status == KernelStatusType.Busy)
+//              busy = true
+//            if(status == KernelStatusType.Idle)
+//              idle = true
+//        }
+//
+//        idle should be (true)
+//        busy should be (true)
+//      }
+    }
+  }
+
+  //  Testing error timeout for interpreter future
+  describe("ExecuteRequestHandler( ActorLoader )") {
+    describe("#receive( KernelMessage with bad JSON content )"){
+      it("should respond with an execute_reply with status error")    {
+        handlerActor ! MockKernelMessageWithBadExecuteRequest
+
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          // Only mark as successful if this specific message was received
+          case KernelMessage(_, _, header, _, _, contentString)
+            if header.msg_type == ExecuteReply.toTypeString =>
+            val reply = Json.parse(contentString).as[ExecuteReply]
+            reply.status == "error"
+          case _ => false
+        }
+      }
+
+      it("should send error message to relay") {
+        handlerActor ! MockKernelMessageWithBadExecuteRequest
+
+        kernelMessageRelayProbe.fishForMessage(200.milliseconds) {
+          // Only mark as successful if this specific message was received
+          case KernelMessage(_, _, header, _, _, _)
+            if header.msg_type == ErrorContent.toTypeString => true
+          case _ => false
+        }
+      }
+
+      // TODO: Investigate if this is still relevant at all
+//      it("should send a status idle message") {
+//        handlerActor ! MockKernelMessageWithBadExecuteRequest
+//        var busy = false
+//        var idle = false
+//
+//        statusDispatchProbe.receiveWhile(100.milliseconds) {
+//          case Tuple2(status: KernelStatusType, header: Header)=>
+//            if(status == KernelStatusType.Busy)
+//              busy = true
+//            if(status == KernelStatusType.Idle)
+//              idle = true
+//        }
+//
+//        idle should be (true)
+//        busy should be (false)
+//      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
new file mode 100644
index 0000000..54ebdc8
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.actor.{ActorSystem, Props, ActorRef, ActorSelection}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5Test._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpecLike, FunSpec}
+
+class GenericSocketMessageHandlerSpec extends TestKit(ActorSystem("GenericSocketMessageHandlerSystem"))
+with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+  describe("GenericSocketMessageHandler( ActorLoader, SocketType )") {
+    //  Create a mock ActorLoader for the Relay we are going to test
+    val actorLoader: ActorLoader = mock[ActorLoader]
+
+    //  Create a probe for the ActorSelection that the ActorLoader will return
+    val selectionProbe: TestProbe = TestProbe()
+    val selection: ActorSelection = system.actorSelection(selectionProbe.ref.path.toString)
+    when(actorLoader.load(SocketType.Control)).thenReturn(selection)
+
+    //  The Relay we are going to be testing against
+    val genericHandler: ActorRef = system.actorOf(
+      Props(classOf[GenericSocketMessageHandler], actorLoader, SocketType.Control)
+    )
+
+    describe("#receive( KernelMessage )") {
+      genericHandler ! MockKernelMessage
+
+      it("should send the message to the selected actor"){
+        selectionProbe.expectMsg(MockKernelMessage)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
new file mode 100644
index 0000000..57114bb
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.handler
+
+import java.util.UUID
+import java.util.concurrent.ConcurrentHashMap
+
+import akka.actor.{Props, ActorRef, ActorSystem}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.kernel.protocol.v5.content.InputReply
+import com.ibm.spark.kernel.protocol.v5.{HeaderBuilder, MessageType, KMBuilder, SystemActorType}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.scalatest.concurrent.Eventually
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.time.{Milliseconds, Span}
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import scala.concurrent.duration._
+
+import org.mockito.Mockito._
+
+import collection.JavaConverters._
+
+class InputRequestReplyHandlerSpec
+  extends TestKit(ActorSystem("InputRequestReplyHandlerSystem"))
+  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter with Eventually
+{
+  implicit override val patienceConfig = PatienceConfig(
+    timeout = scaled(Span(200, Milliseconds)),
+    interval = scaled(Span(5, Milliseconds))
+  )
+
+  private var fakeSender: TestProbe = _
+  private var kernelMessageRelayProbe: TestProbe = _
+  private var mockActorLoader: ActorLoader = _
+  private var responseMap: collection.mutable.Map[String, ActorRef] = _
+
+  private var inputRequestReplyHandler: ActorRef = _
+
+  before {
+    fakeSender = TestProbe()
+
+    kernelMessageRelayProbe = TestProbe()
+    mockActorLoader = mock[ActorLoader]
+    doReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
+      .when(mockActorLoader).load(SystemActorType.KernelMessageRelay)
+
+    responseMap = new ConcurrentHashMap[String, ActorRef]().asScala
+
+    inputRequestReplyHandler = system.actorOf(Props(
+      classOf[InputRequestReplyHandler], mockActorLoader, responseMap
+    ))
+  }
+
+  describe("InputRequestReplyHandler") {
+    describe("#receive") {
+      it("should store the sender under the session if input_request") {
+        val session = UUID.randomUUID().toString
+        val inputRequestMessage = KMBuilder()
+          .withParentHeader(HeaderBuilder.empty.copy(session = session))
+          .withHeader(MessageType.Outgoing.InputRequest)
+          .build
+
+        fakeSender.send(inputRequestReplyHandler, inputRequestMessage)
+
+        eventually {
+          responseMap(session) should be (fakeSender.ref)
+        }
+      }
+
+      it("should forward message to relay if input_request") {
+        val inputRequestMessage = KMBuilder()
+          .withHeader(MessageType.Outgoing.InputRequest)
+          .build
+
+        fakeSender.send(inputRequestReplyHandler, inputRequestMessage)
+
+        kernelMessageRelayProbe.expectMsg(inputRequestMessage)
+      }
+
+      it("should send the received message value to the stored sender with " +
+        "the same session if input_reply") {
+        val expected = "some value"
+        val session = UUID.randomUUID().toString
+
+        // Build the message to "get back from the world"
+        val inputReplyMessage = KMBuilder()
+          .withHeader(HeaderBuilder.empty.copy(
+            msg_type = MessageType.Incoming.InputReply.toString,
+            session = session
+          ))
+          .withContentString(InputReply(expected))
+          .build
+
+        // Add our fake sender actor to the receiving end of the message
+        responseMap(session) = fakeSender.ref
+
+        fakeSender.send(inputRequestReplyHandler, inputReplyMessage)
+
+        // Sender should receive a response
+        fakeSender.expectMsg(expected)
+      }
+
+      it("should do nothing if the session is not found for input_reply") {
+        val expected = "some value"
+        val session = UUID.randomUUID().toString
+
+        // Build the message to "get back from the world"
+        val inputReplyMessage = KMBuilder()
+          .withHeader(HeaderBuilder.empty.copy(
+          msg_type = MessageType.Incoming.InputReply.toString,
+          session = session
+        ))
+          .withContentString(InputReply(expected))
+          .build
+
+        fakeSender.send(inputRequestReplyHandler, inputReplyMessage)
+
+        // Sender should not receive a response
+        fakeSender.expectNoMsg(300.milliseconds)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
new file mode 100644
index 0000000..af44443
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.actor.{ActorRef, ActorSelection, ActorSystem, Props}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.kernel.protocol.v5.content.KernelInfoReply
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.{SystemActorType, Header, KernelMessage}
+import org.mockito.AdditionalMatchers.{not => mockNot}
+import org.mockito.Matchers.{eq => mockEq}
+import com.typesafe.config.ConfigFactory
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+
+object KernelInfoRequestHandlerSpec {
+  val config = """
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class KernelInfoRequestHandlerSpec extends TestKit(
+  ActorSystem("KernelInfoRequestHandlerSpec",
+    ConfigFactory.parseString(KernelInfoRequestHandlerSpec.config))
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+  val actorLoader: ActorLoader =  mock[ActorLoader]
+  val actor = system.actorOf(Props(classOf[KernelInfoRequestHandler], actorLoader))
+
+  val relayProbe : TestProbe = TestProbe()
+  val relaySelection : ActorSelection =
+    system.actorSelection(relayProbe.ref.path)
+  when(actorLoader.load(SystemActorType.KernelMessageRelay))
+    .thenReturn(relaySelection)
+  when(actorLoader.load(mockNot(mockEq(SystemActorType.KernelMessageRelay))))
+    .thenReturn(system.actorSelection(""))
+
+  val header = Header("","","","","")
+  val kernelMessage = new KernelMessage(
+    Seq[String](), "test message", header, header, Map[String, String](), "{}"
+  )
+
+  describe("Kernel Info Request Handler") {
+    it("should return a KernelMessage containing kernel info response") {
+      actor ! kernelMessage
+      val reply = relayProbe.receiveOne(1.seconds).asInstanceOf[KernelMessage]
+      val kernelInfo = Json.parse(reply.contentString).as[KernelInfoReply]
+      kernelInfo.implementation should be ("spark")
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
new file mode 100644
index 0000000..be982cb
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
+
+import java.io.OutputStream
+
+import akka.actor.{ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit}
+import com.ibm.spark.interpreter._
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.typesafe.config.ConfigFactory
+import org.mockito.Mockito._
+import org.mockito.Matchers.{eq => mockEq, anyString, anyBoolean}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpecLike}
+
+import scala.concurrent.duration._
+
+object ExecuteRequestTaskActorSpec {
+  val config = """
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class ExecuteRequestTaskActorSpec extends TestKit(
+  ActorSystem(
+    "ExecuteRequestTaskActorSpec",
+    ConfigFactory.parseString(ExecuteRequestTaskActorSpec.config)
+  )
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+{
+  describe("ExecuteRequestTaskActor") {
+    describe("#receive") {
+      it("should return an ExecuteReplyOk if the interpreter returns success") {
+        val mockInterpreter = mock[Interpreter]
+        doReturn((Results.Success, Left(new ExecuteOutput))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+
+        val executeRequestTask =
+          system.actorOf(Props(
+            classOf[ExecuteRequestTaskActor],
+            mockInterpreter
+          ))
+
+        val executeRequest = (ExecuteRequest(
+          "val x = 3", false, false,
+          UserExpressions(), false
+        ), mock[KernelMessage], mock[OutputStream])
+
+        executeRequestTask ! executeRequest
+
+        val result =
+          receiveOne(5.seconds)
+            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
+
+        result.isLeft should be (true)
+        result.left.get shouldBe an [ExecuteOutput]
+      }
+
+      it("should return an ExecuteReplyAbort if the interpreter returns aborted") {
+        val mockInterpreter = mock[Interpreter]
+        doReturn((Results.Aborted, Right(mock[ExecuteAborted]))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+
+        val executeRequestTask =
+          system.actorOf(Props(
+            classOf[ExecuteRequestTaskActor],
+            mockInterpreter
+          ))
+
+        val executeRequest = (ExecuteRequest(
+          "val x = 3", false, false,
+          UserExpressions(), false
+        ), mock[KernelMessage], mock[OutputStream])
+
+        executeRequestTask ! executeRequest
+
+        val result =
+          receiveOne(5.seconds)
+            .asInstanceOf[Either[ExecuteOutput, ExecuteFailure]]
+
+        result.isRight should be (true)
+        result.right.get shouldBe an [ExecuteAborted]
+      }
+
+      it("should return an ExecuteReplyError if the interpreter returns error") {
+        val mockInterpreter = mock[Interpreter]
+        doReturn((Results.Error, Right(mock[ExecuteError]))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+
+        val executeRequestTask =
+          system.actorOf(Props(
+            classOf[ExecuteRequestTaskActor],
+            mockInterpreter
+          ))
+
+        val executeRequest = (ExecuteRequest(
+          "val x = 3", false, false,
+          UserExpressions(), false
+        ), mock[KernelMessage], mock[OutputStream])
+
+        executeRequestTask ! executeRequest
+
+        val result =
+          receiveOne(5.seconds)
+            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
+
+        result.isRight should be (true)
+        result.right.get shouldBe an [ExecuteError]
+      }
+
+      it("should return ExecuteReplyError if interpreter returns incomplete") {
+        val mockInterpreter = mock[Interpreter]
+        doReturn((Results.Incomplete, Right(""))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+
+        val executeRequestTask =
+          system.actorOf(Props(
+            classOf[ExecuteRequestTaskActor],
+            mockInterpreter
+          ))
+
+        val executeRequest = (ExecuteRequest(
+          "(1 + 2", false, false,
+          UserExpressions(), false
+        ), mock[KernelMessage], mock[OutputStream])
+
+        executeRequestTask ! executeRequest
+
+        val result =
+          receiveOne(5.seconds)
+            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
+
+        result.isLeft should be (false)
+        result.right.get shouldBe an [ExecuteError]
+      }
+
+      it("should return an ExecuteReplyOk when receiving empty code.") {
+        val mockInterpreter = mock[Interpreter]
+        doReturn((Results.Incomplete, Right(""))).when(mockInterpreter)
+          .interpret(anyString(), anyBoolean())
+
+        val executeRequestTask =
+          system.actorOf(Props(
+            classOf[ExecuteRequestTaskActor],
+            mockInterpreter
+          ))
+
+        val executeRequest = (ExecuteRequest(
+          "   ", false, false,
+          UserExpressions(), false
+        ), mock[KernelMessage], mock[OutputStream])
+
+        executeRequestTask ! executeRequest
+
+        val result =
+          receiveOne(5.seconds)
+            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
+
+        result.isLeft should be (true)
+        result.isRight should be (false)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
new file mode 100644
index 0000000..8bb5f40
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel
+
+import akka.actor.{ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5.{MessageType, SocketType}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+import test.utils.TestProbeProxyActor
+
+import scala.concurrent.duration._
+
+class ActorLoaderSpec extends TestKit(ActorSystem("ActorLoaderSpecSystem"))
+with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+  describe("ActorLoader"){
+    describe("#load( MessageType )"){
+      it("should load an ActorSelection that has been loaded into the system"){
+        val testProbe: TestProbe = TestProbe()
+        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe),
+          MessageType.Outgoing.ClearOutput.toString)
+        val actorLoader: ActorLoader = SimpleActorLoader(system)
+        actorLoader.load(MessageType.Outgoing.ClearOutput) ! "<Test Message>"
+        testProbe.expectMsg("<Test Message>")
+      }
+
+      it("should expect no message when there is no actor"){
+        val testProbe: TestProbe = TestProbe()
+        val actorLoader: ActorLoader = SimpleActorLoader(system)
+        actorLoader.load(MessageType.Outgoing.CompleteReply) ! "<Test Message>"
+        testProbe.expectNoMsg(25.millis)
+        // This is to test to see if there the messages go to the actor inbox or the dead mail inbox
+        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe),
+          MessageType.Outgoing.CompleteReply.toString)
+        testProbe.expectNoMsg(25.millis)
+      }
+    }
+    describe("#load( SocketType )"){
+      it("should load an ActorSelection that has been loaded into the system"){
+        val testProbe: TestProbe = TestProbe()
+        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe), SocketType.Shell.toString)
+        val actorLoader: ActorLoader = SimpleActorLoader(system)
+        actorLoader.load(SocketType.Shell) ! "<Test Message>"
+        testProbe.expectMsg("<Test Message>")
+      }
+
+      it("should expect no message when there is no actor"){
+        val testProbe: TestProbe = TestProbe()
+        val actorLoader: ActorLoader = SimpleActorLoader(system)
+        actorLoader.load(SocketType.IOPub) ! "<Test Message>"
+        testProbe.expectNoMsg(25.millis)
+        // This is to test to see if there the messages go to the actor inbox or the dead mail inbox
+        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe), SocketType.IOPub.toString)
+        testProbe.expectNoMsg(25.millis)
+      }
+
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
new file mode 100644
index 0000000..65f0990
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel
+
+import akka.actor.{ActorSelection, ActorSystem, Props}
+import akka.testkit.{TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5.MessageType
+import org.scalatest.{FunSpecLike, Matchers}
+import test.utils.TestProbeProxyActor
+
+class SimpleActorLoaderSpec extends TestKit(ActorSystem("SimpleActorLoaderSpecSystem"))
+  with FunSpecLike with Matchers
+{
+  describe("SimpleActorLoader") {
+    //val system = ActorSystem("SimpleActorLoaderSystem")
+    val testMessage: String = "Hello Message"
+
+    describe("#load( MessageType )") {
+      it("should load a MessageType Actor"){
+        //  Create a new test probe to verify our selection works
+        val messageTypeProbe: TestProbe = new TestProbe(system)
+
+        //  Add an actor to the system to send a message to
+        system.actorOf(
+          Props(classOf[TestProbeProxyActor], messageTypeProbe),
+          name = MessageType.Outgoing.ExecuteInput.toString
+        )
+
+        //  Create the ActorLoader with our test system
+        val actorLoader: SimpleActorLoader = SimpleActorLoader(system)
+
+        //  Get the actor and send it a message
+        val loadedMessageActor: ActorSelection =
+          actorLoader.load(MessageType.Outgoing.ExecuteInput)
+
+        loadedMessageActor ! testMessage
+
+        //  Assert the probe received the message
+        messageTypeProbe.expectMsg(testMessage)
+      }
+    }
+
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
new file mode 100644
index 0000000..67c6eeb
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel
+
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+
+/**
+ * Refactored from old KernelMessageSpec.
+ */
+class UtilitiesSpec extends FunSpec with Matchers {
+  val header: Header = Header(
+    "<UUID>", "<STRING>", "<UUID>", "<STRING>", "<FLOAT>"
+  )
+  val parentHeader : ParentHeader = ParentHeader(
+    "<PARENT-UUID>", "<PARENT-STRING>", "<PARENT-UUID>", "<PARENT-STRING>", "<PARENT-FLOAT>"
+  )
+  val kernelMessage = KernelMessage(
+    Seq("<STRING-1>","<STRING-2>"),
+    "<SIGNATURE>", header, parentHeader, Map(), "<STRING>"
+  )
+
+  val zmqMessage = ZMQMessage(
+    ByteString("<STRING-1>".replaceAll("""\s""", "").getBytes),
+    ByteString("<STRING-2>".replaceAll("""\s""", "").getBytes),
+    ByteString("<IDS|MSG>".replaceAll("""\s""", "").getBytes),
+    ByteString("<SIGNATURE>".replaceAll("""\s""", "").getBytes),
+    ByteString(
+      """
+      {
+          "msg_id": "<UUID>",
+          "username": "<STRING>",
+          "session": "<UUID>",
+          "msg_type": "<STRING>",
+          "version": "<FLOAT>"
+      }
+      """.stripMargin.replaceAll("""\s""", "").getBytes),
+    ByteString(
+      """
+      {
+          "msg_id": "<PARENT-UUID>",
+          "username": "<PARENT-STRING>",
+          "session": "<PARENT-UUID>",
+          "msg_type": "<PARENT-STRING>",
+          "version": "<PARENT-FLOAT>"
+      }
+      """.stripMargin.replaceAll("""\s""", "").getBytes),
+    ByteString("{}".replaceAll("""\s""", "").getBytes),
+    ByteString("<STRING>".replaceAll("""\s""", "").getBytes)
+  )
+
+  describe("Utilities") {
+    describe("implicit #KernelMessageToZMQMessage") {
+      it("should correctly convert a kernel message to a ZMQMessage") {
+        Utilities.KernelMessageToZMQMessage(kernelMessage) should be (zmqMessage)
+      }
+    }
+
+    describe("implicit #ZMQMessageToKernelMessage") {
+      it("should correctly convert a ZMQMessage to a kernel message") {
+        Utilities.ZMQMessageToKernelMessage(zmqMessage) should be (kernelMessage)
+      }
+    }
+
+    describe("implicit conversions should be inverses of each other") {
+      it("should convert back to the original message, ZMQ -> Kernel -> ZMQ") {
+        Utilities.KernelMessageToZMQMessage(
+          Utilities.ZMQMessageToKernelMessage(zmqMessage)
+        ) should be (zmqMessage)
+      }
+      it("should convert back to the original message, Kernel -> ZMQ -> Kernel") {
+        Utilities.ZMQMessageToKernelMessage(
+          Utilities.KernelMessageToZMQMessage(kernelMessage)
+        ) should be (kernelMessage)
+      }
+    }
+
+    describe("implicit #StringToByteString") {
+      it("should correctly convert a string to a ByteString") {
+        val someString = "some content"
+        val expected = ByteString(someString)
+
+        Utilities.StringToByteString(someString) should be (expected)
+      }
+    }
+
+    describe("implicit #ByteStringToString") {
+      it("should correctly convert a ByteString to a string") {
+        val expected = "some content"
+        val byteString = ByteString(expected)
+
+        Utilities.ByteStringToString(byteString) should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
new file mode 100644
index 0000000..388f466
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+import com.typesafe.config.ConfigFactory
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+
+object HeartbeatSpec {
+  val config = """
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class HeartbeatSpec extends TestKit(ActorSystem("HeartbeatActorSpec", ConfigFactory.parseString(HeartbeatSpec.config)))
+with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+  val SomeMessage: String = "some message"
+  val SomeZMQMessage: ZMQMessage = ZMQMessage(ByteString(SomeMessage.getBytes))
+
+  describe("HeartbeatActor") {
+    val socketFactory = mock[SocketFactory]
+    val probe : TestProbe = TestProbe()
+    when(socketFactory.Heartbeat(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(probe.ref)
+
+    val heartbeat = system.actorOf(Props(classOf[Heartbeat], socketFactory))
+
+    describe("send heartbeat") {
+      it("should receive and send same ZMQMessage") {
+        heartbeat ! SomeZMQMessage
+        probe.expectMsg(SomeZMQMessage)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
new file mode 100644
index 0000000..6e6fdb3
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import akka.actor.{ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5.kernel.Utilities
+import com.ibm.spark.kernel.protocol.v5Test._
+import Utilities._
+import com.typesafe.config.ConfigFactory
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+
+object IOPubSpec {
+  val config ="""
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class IOPubSpec extends TestKit(ActorSystem("IOPubActorSpec", ConfigFactory.parseString(IOPubSpec.config)))
+with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+
+  describe("IOPubActor") {
+    val socketFactory = mock[SocketFactory]
+    val probe : TestProbe = TestProbe()
+    when(socketFactory.IOPub(any(classOf[ActorSystem]))).thenReturn(probe.ref)
+
+    val socket = system.actorOf(Props(classOf[IOPub], socketFactory))
+
+    // TODO test that the response type changed
+    describe("#receive") {
+      it("should reply with a ZMQMessage") {
+        //  Use the implicit to convert the KernelMessage to ZMQMessage
+        val MockZMQMessage : ZMQMessage = MockKernelMessage
+
+        socket ! MockKernelMessage
+        probe.expectMsg(MockZMQMessage)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
new file mode 100644
index 0000000..d28a5ae
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import java.nio.charset.Charset
+
+import akka.actor.{ActorSelection, ActorRef, ActorSystem, Props}
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import com.ibm.spark.kernel.protocol.v5Test._
+import Utilities._
+import com.typesafe.config.ConfigFactory
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, Matchers}
+
+object ShellSpec {
+  val config ="""
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class ShellSpec extends TestKit(ActorSystem("ShellActorSpec", ConfigFactory.parseString(ShellSpec.config)))
+  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+
+  describe("Shell") {
+    val socketFactory = mock[SocketFactory]
+    val actorLoader = mock[ActorLoader]
+    val socketProbe : TestProbe = TestProbe()
+    when(socketFactory.Shell(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(socketProbe.ref)
+
+    val relayProbe : TestProbe = TestProbe()
+    val relaySelection : ActorSelection = system.actorSelection(relayProbe.ref.path)
+    when(actorLoader.load(SystemActorType.KernelMessageRelay)).thenReturn(relaySelection)
+
+    val shell = system.actorOf(Props(classOf[Shell], socketFactory, actorLoader))
+
+    describe("#receive") {
+      it("( KernelMessage ) should reply with a ZMQMessage via the socket") {
+        //  Use the implicit to convert the KernelMessage to ZMQMessage
+        val MockZMQMessage : ZMQMessage = MockKernelMessage
+
+        shell ! MockKernelMessage
+        socketProbe.expectMsg(MockZMQMessage)
+      }
+
+      it("( ZMQMessage ) should forward ZMQ Strings and KernelMessage to Relay") {
+        //  Use the implicit to convert the KernelMessage to ZMQMessage
+        val MockZMQMessage : ZMQMessage = MockKernelMessage
+
+        shell ! MockZMQMessage
+
+        // Should get the last four (assuming no buffer) strings in UTF-8
+        val zmqStrings = MockZMQMessage.frames.map((byteString: ByteString) =>
+          new String(byteString.toArray, Charset.forName("UTF-8"))
+        ).takeRight(4)
+
+        val kernelMessage: KernelMessage = MockZMQMessage
+
+        relayProbe.expectMsg((zmqStrings, kernelMessage))
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
new file mode 100644
index 0000000..b36f734
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import com.typesafe.config.ConfigFactory
+import org.scalatest.{FunSpec, Matchers}
+import org.slf4j.LoggerFactory
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, JsValue, Json}
+
+class SocketConfigSpec extends FunSpec with Matchers {
+  val logger = LoggerFactory.getLogger("jt4")
+  //logger.error("WOOT!")
+
+  private val jsonString: String =
+    """
+    {
+      "stdin_port": 10000,
+      "control_port": 10001,
+      "hb_port": 10002,
+      "shell_port": 10003,
+      "iopub_port": 10004,
+      "ip": "1.2.3.4",
+      "transport": "tcp",
+      "signature_scheme": "hmac-sha256",
+      "key": ""
+    }
+    """.stripMargin
+
+  val socketConfigJson: JsValue = Json.parse(jsonString)
+
+  val socketConfigFromConfig = SocketConfig.fromConfig(ConfigFactory.parseString(jsonString))
+
+  val socketConfig = SocketConfig(
+    10000, 10001, 10002, 10003, 10004, "1.2.3.4", "tcp", "hmac-sha256", ""
+  )
+
+  describe("SocketConfig") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a SocketConfig instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        socketConfigJson.as[SocketConfig] should be (socketConfig)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = socketConfigJson.asOpt[SocketConfig]
+
+        newCompleteRequest.get should be (socketConfig)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = socketConfigJson.validate[SocketConfig]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: SocketConfig) => valid
+        ) should be (socketConfig)
+      }
+
+      it("should implicitly convert from a SocketConfig instance to valid json") {
+        Json.toJson(socketConfig) should be (socketConfigJson)
+      }
+    }
+    describe("#toConfig") {
+      it("should implicitly convert from valid json to a SocketConfig instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        socketConfigFromConfig should be (socketConfig)
+      }
+      
+      it("should convert json file to SocketConfig object") {
+        socketConfigFromConfig.stdin_port should be (10000)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
new file mode 100644
index 0000000..f33ddc0
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import org.scalatest.{FunSpec, Matchers}
+
+class SocketConnectionSpec extends FunSpec with Matchers {
+  describe("SocketConnection"){
+   describe("#toString"){
+   	it("should properly format connection string"){
+      val connection: SocketConnection = SocketConnection("tcp", "127.0.0.1", 1234)
+      connection.toString should be ("tcp://127.0.0.1:1234")
+   	}
+   }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
new file mode 100644
index 0000000..abefdb3
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import org.scalatest.{FunSpec, Matchers}
+
+class SocketFactorySpec extends FunSpec with Matchers {
+  describe("SocketFactory"){
+    describe("HeartbeatConnection"){
+    	it("should be composed of transport ip and heartbeat port"){
+        val config: SocketConfig = SocketConfig(-1,-1,8000,-1, -1, "<STRING-IP>", "<STRING-TRANSPORT>","<STRING-SCHEME>","<STRING-KEY>")
+        val factory: SocketFactory = SocketFactory(config)
+        factory.HeartbeatConnection.toString should be ("<STRING-TRANSPORT>://<STRING-IP>:8000")
+    	}
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
new file mode 100644
index 0000000..2103904
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.kernel.socket
+
+import java.nio.charset.Charset
+
+import akka.actor.{Props, ActorSelection, ActorRef, ActorSystem}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import akka.util.ByteString
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5.kernel.Utilities._
+import com.ibm.spark.kernel.protocol.v5Test._
+import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SystemActorType}
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.typesafe.config.ConfigFactory
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpecLike}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+object StdinSpec {
+  val config ="""
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class StdinSpec extends TestKit(ActorSystem(
+  "StdinActorSpec", ConfigFactory.parseString(StdinSpec.config)
+)) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+  describe("Stdin") {
+    val socketFactory = mock[SocketFactory]
+    val actorLoader = mock[ActorLoader]
+    val socketProbe : TestProbe = TestProbe()
+    when(socketFactory.Stdin(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(socketProbe.ref)
+
+    val relayProbe : TestProbe = TestProbe()
+    val relaySelection : ActorSelection = system.actorSelection(relayProbe.ref.path)
+    when(actorLoader.load(SystemActorType.KernelMessageRelay)).thenReturn(relaySelection)
+
+    val stdin = system.actorOf(Props(classOf[Stdin], socketFactory, actorLoader))
+
+    describe("#receive") {
+      it("( KernelMessage ) should reply with a ZMQMessage via the socket") {
+        //  Use the implicit to convert the KernelMessage to ZMQMessage
+        val MockZMQMessage : ZMQMessage = MockKernelMessage
+
+        stdin ! MockKernelMessage
+        socketProbe.expectMsg(MockZMQMessage)
+      }
+
+      it("( ZMQMessage ) should forward ZMQ Strings and KernelMessage to Relay") {
+        //  Use the implicit to convert the KernelMessage to ZMQMessage
+        val MockZMQMessage : ZMQMessage = MockKernelMessage
+
+        stdin ! MockZMQMessage
+
+        // Should get the last four (assuming no buffer) strings in UTF-8
+        val zmqStrings = MockZMQMessage.frames.map((byteString: ByteString) =>
+          new String(byteString.toArray, Charset.forName("UTF-8"))
+        ).takeRight(4)
+
+        val kernelMessage: KernelMessage = MockZMQMessage
+
+        relayProbe.expectMsg((zmqStrings, kernelMessage))
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
new file mode 100644
index 0000000..ba3415f
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
@@ -0,0 +1,237 @@
+package com.ibm.spark.kernel.protocol.v5.magic
+
+import com.ibm.spark.magic.MagicLoader
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+class MagicParserSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("#parse") {
+    it("should call parseCell if the code is a cell magic invocation") {
+      val codeBlob =
+        """
+          |%%magic
+          |foo
+          |bean
+        """.stripMargin
+      val parser = spy(new MagicParser(mock[MagicLoader]))
+      parser.parse(codeBlob)
+      verify(parser).parseCell(codeBlob.trim)
+    }
+
+    it("should call parseLines if the code is not a cell magic") {
+      val codeBlob = """%magic foo bean"""
+      val parser = spy(new MagicParser(mock[MagicLoader]))
+      parser.parse(codeBlob)
+      verify(parser).parseLines(codeBlob.trim)
+    }
+  }
+
+  describe("#parseCell") {
+    it("should substitute the magic code for kernel code when magic is valid") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(true).when(magicLoader).hasCellMagic(anyString())
+
+      val magicName = "magic"
+      val args = "foo\nbean\nbar"
+      val codeBlob =
+        s"""%%$magicName
+           |$args
+         """.stripMargin
+      val parser = spy(new MagicParser(magicLoader))
+      val result = parser.parseCell(codeBlob)
+
+      verify(parser).substitute(magicName, args)
+      result.isLeft should be(true)
+    }
+
+    it("should return an error if the magic invocation is invalid") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(false).when(magicLoader).hasCellMagic(anyString())
+
+      val magicName = "magic"
+      val args = "foo\nbean\nbar"
+      val codeBlob =
+        s"""%%$magicName
+           |$args
+         """.stripMargin
+      val parser = spy(new MagicParser(magicLoader))
+      val result = parser.parseCell(codeBlob)
+
+      verify(parser, times(0)).substitute(anyString(), anyString())
+      result.isRight should be(true)
+    }
+
+    it("should return original code if code contains no magic invocations") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(false).when(magicLoader).hasCellMagic(anyString())
+
+      val codeBlob =
+        s"""val x = 3
+           |println(x + 2)
+         """.stripMargin
+      val parser = spy(new MagicParser(magicLoader))
+      val result = parser.parseCell(codeBlob)
+
+      verify(parser, times(0)).substitute(anyString(), anyString())
+      result.isLeft should be(true)
+      result.left.get should be(codeBlob)
+    }
+  }
+
+  describe("#parseLines") {
+    it("should call substituteLine for each line of code " +
+      "when there are no invalid magic invocations") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(true).when(magicLoader).hasLineMagic(anyString())
+
+      val codeBlob =
+        s"""val x = 3
+           |%lineMagic
+         """.stripMargin
+      val parser = spy(new MagicParser(magicLoader))
+      val result = parser.parseLines(codeBlob)
+
+      verify(parser, times(2)).substituteLine(anyString())
+      result.isLeft should be(true)
+    }
+
+    it("should return an error when there are invalid magic invocations") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(false).when(magicLoader).hasLineMagic(anyString())
+
+      val codeBlob =
+        s"""val x = 3
+           |%lineMagic
+         """.stripMargin
+      val parser = spy(new MagicParser(magicLoader))
+      val result = parser.parseLines(codeBlob)
+
+      verify(parser, times(0)).substituteLine(anyString())
+      result.isRight should be(true)
+    }
+
+    it("should return original code when there are no magic invocations") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(false).when(magicLoader).hasLineMagic(anyString())
+
+      val codeBlob =
+        s"""val x = 3
+           |val y = x + 2
+         """.stripMargin
+      val parser = spy(new MagicParser(magicLoader))
+      val result = parser.parseLines(codeBlob.trim)
+
+      result.isLeft should be(true)
+      result.left.get should be(codeBlob.trim)
+    }
+  }
+
+  describe("#parseMagic") {
+    it("should extract the cell name and arguments from a valid invocation") {
+      val magicName = "foobar"
+      val magicArgs = "baz\nbean"
+      val codeBlob = s"""%%$magicName\n$magicArgs"""
+      val parser = new MagicParser(mock[MagicLoader])
+      parser.parseMagic(codeBlob) should be(Some((magicName, magicArgs)))
+    }
+
+    it("should extract the line name and arguments from a valid invocation") {
+      val magicName = "foobar"
+      val magicArgs = "baz\nbean"
+      val codeBlob = s"""%$magicName $magicArgs"""
+      val parser = new MagicParser(mock[MagicLoader])
+      parser.parseMagic(codeBlob) should be(Some((magicName, magicArgs)))
+    }
+
+    it("should return none if the invocation was not valid") {
+      val magicName = "foobar"
+      val magicArgs = "baz\nbean"
+      val codeBlob = s"""$magicName\n$magicArgs"""
+      val parser = new MagicParser(mock[MagicLoader])
+      parser.parseMagic(codeBlob) should be(None)
+    }
+  }
+
+  describe("#substituteLine") {
+    it("should call substitute when a codeLine is a valid magic invocation") {
+      val magicName = "magic"
+      val args = "-v foo bar"
+      val codeLine = s"""%$magicName $args"""
+      val parser = spy(new MagicParser(mock[MagicLoader]))
+      doReturn(true).when(parser).isValidLineMagic(anyString())
+      parser.substituteLine(codeLine)
+      verify(parser).substitute(magicName, args)
+    }
+
+    it("should return original line of code when it's not a valid +" +
+      "magic invocation") {
+      val codeLine = """val x = 3"""
+      val parser = spy(new MagicParser(mock[MagicLoader]))
+      doReturn(false).when(parser).isValidLineMagic(anyString())
+      parser.substituteLine(codeLine) should be(codeLine)
+    }
+  }
+
+  describe("#substitute") {
+    // pointless?
+    it("should replace a magic invocation with an equivalent kernel call") {
+      val magicName = "magic"
+      val args = "foo bean"
+      val parser = new MagicParser(mock[MagicLoader])
+
+      val equivalent =
+        s"""${parser.kernelObjectName}.$magicName(\"\"\"$args\"\"\")"""
+      parser.substitute(magicName, args) should be(equivalent)
+    }
+  }
+
+  describe("#parseOutInvalidMagics") {
+    it("it should return the names of invalid magics") {
+      val magicOne = "foo"
+      val magicTwo = "qux"
+      val codeBlob =
+        s"""
+          |%$magicOne bar baz
+          |%$magicTwo quo bean
+        """.stripMargin
+      val parser = spy(new MagicParser(mock[MagicLoader]))
+      doReturn(false).when(parser).isValidLineMagic(anyString())
+
+      parser.parseOutInvalidMagics(codeBlob) should be(List(magicOne, magicTwo))
+    }
+
+    it("it should nothing if all magic invocations are valid") {
+      val magicOne = "foo"
+      val magicTwo = "qux"
+      val codeBlob =
+        s"""
+          |%$magicOne bar baz
+          |%$magicTwo quo bean
+        """.stripMargin
+      val parser = spy(new MagicParser(mock[MagicLoader]))
+      doReturn(true).when(parser).isValidLineMagic(anyString())
+
+      parser.parseOutInvalidMagics(codeBlob) should be(Nil)
+    }
+  }
+
+  describe("#isValidLineMagic") {
+    it("should return true if the line magic invocation is valid") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(true).when(magicLoader).hasLineMagic(anyString())
+
+      val parser = new MagicParser(magicLoader)
+      parser.isValidLineMagic("%foobar baz") should be(true)
+    }
+
+    it("should return false if the line magic invocation is not valid") {
+      val magicLoader = mock[MagicLoader]
+      doReturn(false).when(magicLoader).hasLineMagic(anyString())
+
+      val parser = new MagicParser(magicLoader)
+      parser.isValidLineMagic("%foobar baz") should be(false)
+    }
+  }
+}



[23/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
new file mode 100644
index 0000000..8bd12d0
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter
+
+/**
+ * Represents interpreter results, mostly taken from the
+ * tools.nsc.interpreter.Results object.
+ */
+object Results {
+  abstract sealed class Result
+
+  /** The line was interpreted successfully. */
+  case object Success extends Result { override def toString = "success" }
+
+  /** The line was erroneous in some way. */
+  case object Error extends Result { override def toString = "error" }
+
+  /** The input was incomplete.  The caller should request more input. */
+  case object Incomplete extends Result { override def toString = "incomplete" }
+
+  /** The line was aborted before completed. */
+  case object Aborted extends Result { override def toString = "aborted" }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
new file mode 100644
index 0000000..94b9a24
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import com.ibm.spark.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.api.java.JavaSparkContext
+import org.apache.spark.sql.SQLContext
+import org.apache.spark.{SparkConf, SparkContext}
+
+/**
+ * Represents the API available to the broker to act as the bridge for data
+ * between the JVM and some external process.
+ *
+ * @param _brokerState The container of broker state to expose
+ * @param _kernel The kernel API to expose through the bridge
+ */
+class BrokerBridge(
+  private val _brokerState: BrokerState,
+  private val _kernel: KernelLike
+) extends BrokerName {
+  /**
+   * Represents the current state of the broker.
+   */
+  val state: BrokerState = _brokerState
+
+  /**
+   * Represents the kernel API available.
+   */
+  val kernel: KernelLike = _kernel
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
new file mode 100644
index 0000000..e480aa8
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import BrokerTypes._
+
+/**
+ * Represents a block of code to be evaluated.
+ *
+ * @param codeId The id to associate with the code to be executed
+ * @param code The code to evaluate using the broker
+ */
+case class BrokerCode(codeId: CodeId, code: Code)
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
new file mode 100644
index 0000000..b059552
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+/**
+ * Represents a generic broker exception.
+ *
+ * @param message The message to associate with the exception
+ */
+class BrokerException(message: String) extends Throwable(message)
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
new file mode 100644
index 0000000..1482ade
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+/**
+ * Represents the interface that associates a name with a broker. Can be
+ * overridden to change name of broker in subclassing.
+ */
+trait BrokerName {
+  /** The name of the broker. */
+  val brokerName: String = "broker"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
new file mode 100644
index 0000000..5072b92
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import java.io.{OutputStream, InputStream, File, FileOutputStream}
+
+import org.apache.commons.exec._
+import org.apache.commons.exec.environment.EnvironmentUtils
+import org.apache.commons.io.{FilenameUtils, IOUtils}
+import org.slf4j.LoggerFactory
+import scala.collection.JavaConverters._
+
+/**
+ * Represents the process used to evaluate broker code.
+ *
+ * @param processName The name of the process to invoke
+ * @param entryResource The resource to be copied and fed as the first argument
+ *                      to the process
+ * @param otherResources Other resources to be included in the same directory
+ *                       as the main resource
+ * @param brokerBridge The bridge to use to retrieve kernel output streams
+ *                      and the Spark version to be verified
+ * @param brokerProcessHandler The handler to use when the process fails or
+ *                             completes
+ * @param arguments The collection of additional arguments to pass to the
+ *                  process after the main entrypoint
+ */
+class BrokerProcess(
+  private val processName: String,
+  private val entryResource: String,
+  private val otherResources: Seq[String],
+  private val brokerBridge: BrokerBridge,
+  private val brokerProcessHandler: BrokerProcessHandler,
+  private val arguments: Seq[String] = Nil
+) extends BrokerName {
+  require(processName != null && processName.trim.nonEmpty,
+    "Process name cannot be null or pure whitespace!")
+  require(entryResource != null && entryResource.trim.nonEmpty,
+    "Entry resource cannot be null or pure whitespace!")
+
+  private val logger = LoggerFactory.getLogger(this.getClass)
+  private val classLoader = this.getClass.getClassLoader
+  private val outputDir =
+    s"kernel-$brokerName-" + java.util.UUID.randomUUID().toString
+
+  /** Represents the current process being executed. */
+  @volatile private[broker] var currentExecutor: Option[Executor] = None
+
+  /**
+   * Returns the temporary directory to place any files needed for the process.
+   *
+   * @return The directory path as a string
+   */
+  protected def getTmpDirectory: String = System.getProperty("java.io.tmpdir")
+
+  /**
+   * Returns the subdirectory to use to place any files needed for the process.
+   *
+   * @return The directory path as a string
+   */
+  protected lazy val getSubDirectory: String =
+    s"kernel-$brokerName-" + java.util.UUID.randomUUID().toString
+
+  /**
+   * Copies a resource from an input stream to an output stream.
+   *
+   * @param inputStream The input stream to copy from
+   * @param outputStream The output stream to copy to
+   *
+   * @return The result of the copy operation
+   */
+  protected def copy(inputStream: InputStream, outputStream: OutputStream) =
+    IOUtils.copy(inputStream, outputStream)
+
+  /**
+   * Copies a file from the kernel resources to the temporary directory.
+   *
+   * @param resource The resource to copy
+   *
+   * @return The string path pointing to the resource's destination
+   */
+  protected def copyResourceToTmp(resource: String): String = {
+    val brokerRunnerResourceStream = classLoader.getResourceAsStream(resource)
+
+    val tmpDirectory = Option(getTmpDirectory)
+      .getOrElse(throw new BrokerException("java.io.tmpdir is not set!"))
+    val subDirectory = Option(getSubDirectory).getOrElse("")
+    val outputName = FilenameUtils.getName(resource)
+
+    val outputDir = Seq(tmpDirectory, subDirectory)
+      .filter(_.trim.nonEmpty).mkString("/")
+    val outputScript = new File(FilenameUtils.concat(outputDir, outputName))
+
+    // If our script destination is a directory, we cannot copy the script
+    if (outputScript.exists() && outputScript.isDirectory)
+      throw new BrokerException(s"Failed to create script: $outputScript")
+
+    // Ensure that all of the directories leading up to the script exist
+    val outputDirFile = new File(outputDir)
+    if (!outputDirFile.exists()) outputDirFile.mkdirs()
+
+    // Copy the script to the specified temporary destination
+    val outputScriptStream = new FileOutputStream(outputScript)
+    copy(
+      brokerRunnerResourceStream,
+      outputScriptStream
+    )
+    outputScriptStream.close()
+
+    // Return the destination of the script
+    val destination = outputScript.getPath
+    logger.debug(s"Successfully copied $resource to $destination")
+    destination
+  }
+
+  /**
+   * Creates a new process environment to be used for environment variable
+   * retrieval by the new process.
+   *
+   * @return The map of environment variables and their respective values
+   */
+  protected def newProcessEnvironment(): Map[String, String] = {
+    val procEnvironment = EnvironmentUtils.getProcEnvironment
+
+    procEnvironment.asScala.toMap
+  }
+
+  /**
+   * Creates a new executor to be used to launch the process.
+   *
+   * @return The executor to start and manage the process
+   */
+  protected def newExecutor(): Executor = new DefaultExecutor
+
+  /**
+   * Starts the Broker process.
+   */
+  def start(): Unit = currentExecutor.synchronized {
+    assert(currentExecutor.isEmpty, "Process has already been started!")
+
+    val capitalizedBrokerName = brokerName.capitalize
+
+    val script = copyResourceToTmp(entryResource)
+    logger.debug(s"New $brokerName script created: $script")
+
+    val createdResources = otherResources.map(copyResourceToTmp)
+
+    // Verify that all files were successfully created
+    val createdResult = (script +: createdResources).map(new File(_)).map(f => {
+      if (f.exists()) true
+      else {
+        val resource = f.getPath
+        logger.warn(s"Failed to create resource: $resource")
+        false
+      }
+    }).forall(_ == true)
+    if (!createdResult) throw new BrokerException(
+      s"Failed to create resources for $capitalizedBrokerName"
+    )
+
+    val commandLine = CommandLine
+      .parse(processName)
+      .addArgument(script)
+    arguments.foreach(commandLine.addArgument)
+
+    logger.debug(s"$capitalizedBrokerName command: ${commandLine.toString}")
+
+    val executor = newExecutor()
+
+    // TODO: Figure out how to dynamically update the output stream used
+    //       to use kernel.out, kernel.err, and kernel.in
+    // NOTE: Currently mapping to standard output/input, which will be caught
+    //       by our system and redirected through the kernel to the client
+    executor.setStreamHandler(new PumpStreamHandler(
+      System.out,
+      System.err,
+      System.in
+    ))
+
+    // Marking exit status of 1 as successful exit
+    executor.setExitValue(1)
+
+    // Prevent the runner from being killed due to run time as it is a
+    // long-term process
+    executor.setWatchdog(new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT))
+
+    val processEnvironment = newProcessEnvironment().asJava
+    logger.debug(s"$capitalizedBrokerName environment: $processEnvironment")
+
+    // Start the process using the environment provided to the parent
+    executor.execute(commandLine, processEnvironment, brokerProcessHandler)
+
+    currentExecutor = Some(executor)
+  }
+
+  /**
+   * Stops the Broker process.
+   */
+  def stop(): Unit = currentExecutor.synchronized {
+    currentExecutor.foreach(executor => {
+      logger.debug(s"Stopping $brokerName process")
+      executor.getWatchdog.destroyProcess()
+    })
+    currentExecutor = None
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
new file mode 100644
index 0000000..704f974
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import org.apache.commons.exec.{ExecuteException, ExecuteResultHandler}
+import org.slf4j.LoggerFactory
+
+/**
+ * Represents the handler for events triggered by the broker process.
+ *
+ * @param brokerBridge The bridge to reset when the process fails or completes
+ * @param restartOnFailure If true, restarts the process if it fails
+ * @param restartOnCompletion If true, restarts the process if it completes
+ */
+class BrokerProcessHandler(
+  private val brokerBridge: BrokerBridge,
+  private val restartOnFailure: Boolean,
+  private val restartOnCompletion: Boolean
+) extends ExecuteResultHandler with BrokerName {
+  private val logger = LoggerFactory.getLogger(this.getClass)
+  private val capitalizedBrokerName = brokerName.capitalize
+  private val resetMessage = s"$capitalizedBrokerName was reset!"
+
+  private var performReset: String => Unit = (_) => {}
+  private var performRestart: () => Unit = () => {}
+
+  /**
+   * Sets the reset method used when a reset of the process is asked.
+   *
+   * @param resetMethod The method to use for resetting the process
+   */
+  def setResetMethod(resetMethod: String => Unit): Unit =
+    performReset = resetMethod
+
+  /**
+   * Sets the restart method used when a restart of the process is asked.
+   *
+   * @param restartMethod The method to use for restarting the process
+   */
+  def setRestartMethod(restartMethod: () => Unit): Unit =
+    performRestart = restartMethod
+
+  override def onProcessFailed(ex: ExecuteException): Unit = {
+    logger.error(s"$capitalizedBrokerName process failed: $ex")
+    performReset(resetMessage)
+
+    if (restartOnFailure) performRestart()
+  }
+
+  override def onProcessComplete(exitValue: Int): Unit = {
+    logger.error(s"$capitalizedBrokerName process exited: $exitValue")
+    performReset(resetMessage)
+
+    if (restartOnCompletion) performRestart()
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
new file mode 100644
index 0000000..3fe96bf
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import com.ibm.spark.interpreter.broker.BrokerTypes.{CodeResults, CodeId}
+
+import scala.concurrent.Promise
+
+/**
+ * Represents a promise made regarding the completion of broker code execution.
+ *
+ * @param codeId The id of the code that was executed
+ * @param promise The promise to be fulfilled when the code finishes executing
+ */
+case class BrokerPromise(codeId: CodeId, promise: Promise[CodeResults])

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
new file mode 100644
index 0000000..27430af
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import com.ibm.spark.interpreter.broker.BrokerTypes.{Code, CodeResults}
+import scala.concurrent.Future
+
+/**
+ * Represents the service that provides the high-level interface between the
+ * JVM and another process.
+ */
+trait BrokerService {
+  /** Starts the broker service. */
+  def start(): Unit
+
+  /**
+   * Indicates whether or not the service is running.
+   *
+   * @return True if running, otherwise false
+   */
+  def isRunning: Boolean
+
+  /**
+   * Submits code to the broker service to be executed and return a result.
+   *
+   * @param code The code to execute
+   *
+   * @return The result as a future to eventually return
+   */
+  def submitCode(code: Code): Future[CodeResults]
+
+  /** Stops the running broker service. */
+  def stop(): Unit
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
new file mode 100644
index 0000000..409d789
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import java.util.concurrent.ConcurrentHashMap
+
+import com.ibm.spark.interpreter.broker.BrokerTypes._
+import org.slf4j.LoggerFactory
+
+import scala.concurrent.{Future, promise}
+
+/**
+ * Represents the state structure of broker.
+ *
+ * @param maxQueuedCode The maximum amount of code to support being queued
+ *                      at the same time for broker execution
+ *
+ */
+class BrokerState(private val maxQueuedCode: Int) {
+  private val logger = LoggerFactory.getLogger(this.getClass)
+
+  import scala.collection.JavaConverters._
+
+  private var _isReady: Boolean = false
+  protected val codeQueue: java.util.Queue[BrokerCode] =
+    new java.util.concurrent.ConcurrentLinkedQueue[BrokerCode]()
+  protected val promiseMap: collection.mutable.Map[CodeId, BrokerPromise] =
+    new ConcurrentHashMap[CodeId, BrokerPromise]().asScala
+
+  /**
+   * Adds new code to eventually be executed.
+   *
+   * @param code The snippet of code to execute
+   *
+   * @return The future containing the results of the execution
+   */
+  def pushCode(code: Code): Future[CodeResults] = synchronized {
+    // Throw the standard error if our maximum limit has been reached
+    if (codeQueue.size() >= maxQueuedCode)
+      throw new IllegalStateException(
+        s"Code limit of $maxQueuedCode has been reached!")
+
+    // Generate our promise that will be fulfilled when the code is executed
+    // and the results are sent back
+    val codeExecutionPromise = promise[CodeResults]()
+
+    // Build the code representation to send to Broker
+    val uniqueId = java.util.UUID.randomUUID().toString
+    val brokerCode = BrokerCode(uniqueId, code)
+    val brokerPromise = BrokerPromise(uniqueId, codeExecutionPromise)
+
+    logger.debug(s"Queueing '$code' with id '$uniqueId' to run with broker")
+
+    // Add the code to be executed to our queue and the promise to our map
+    codeQueue.add(brokerCode)
+    promiseMap.put(brokerPromise.codeId, brokerPromise)
+
+    codeExecutionPromise.future
+  }
+
+  /**
+   * Returns the total code currently queued to be executed.
+   *
+   * @return The total number of code instances queued to be executed
+   */
+  def totalQueuedCode(): Int = codeQueue.size()
+
+  /**
+   * Retrieves (and removes) the next piece of code to be executed.
+   *
+   * @note This should only be invoked by the broker process!
+   *
+   * @return The next code to execute if available, otherwise null
+   */
+  def nextCode(): BrokerCode = {
+    val brokerCode = codeQueue.poll()
+
+    if (brokerCode != null)
+      logger.trace(s"Sending $brokerCode to Broker runner")
+
+    brokerCode
+  }
+
+  /**
+   * Indicates whether or not the broker instance is ready for code.
+   *
+   * @return True if it is ready, otherwise false
+   */
+  def isReady: Boolean = _isReady
+
+  /**
+   * Marks the state of broker as ready.
+   */
+  def markReady(): Unit = _isReady = true
+
+  /**
+   * Marks the specified code as successfully completed using its id.
+   *
+   * @param codeId The id of the code to mark as a success
+   * @param output The output from the execution to be used as the result
+   */
+  def markSuccess(codeId: CodeId, output: CodeResults): Unit = {
+    logger.debug(s"Received success for code with id '$codeId': $output")
+    promiseMap.remove(codeId).foreach(_.promise.success(output))
+  }
+
+  /**
+   * Marks the specified code as successfully completed using its id. Output
+   * from success is treated as an empty string.
+   *
+   * @param codeId The id of the code to mark as a success
+   */
+  def markSuccess(codeId: CodeId): Unit = markSuccess(codeId, "")
+
+  /**
+   * Marks the specified code as unsuccessful using its id.
+   *
+   * @param codeId The id of the code to mark as a failure
+   * @param output The output from the error to be used as the description
+   *               of the exception
+   */
+  def markFailure(codeId: CodeId, output: CodeResults): Unit = {
+    logger.debug(s"Received failure for code with id '$codeId': $output")
+    promiseMap.remove(codeId).foreach(
+      _.promise.failure(new BrokerException(output)))
+  }
+
+  /**
+   * Marks the specified code as unsuccessful using its id. Output from failure
+   * is treated as an empty string.
+   *
+   * @param codeId The id of the code to mark as a failure
+   */
+  def markFailure(codeId: CodeId): Unit = markFailure(codeId, "")
+
+  /**
+   * Resets the state by clearing any pending code executions and marking all
+   * pending executions as failures (or success if specified).
+   *
+   * @param message The message to present through the interrupted promises
+   * @param markAllAsFailure If true, marks all pending executions as failures,
+   *                         otherwise marks all as success
+   */
+  def reset(message: String, markAllAsFailure: Boolean = true): Unit = {
+    codeQueue.synchronized {
+      promiseMap.synchronized {
+        codeQueue.clear()
+
+        // Use map contents for reset as it should contain non-executing
+        // code as well as executing code
+        promiseMap.foreach { case (codeId, codePromise) =>
+          if (markAllAsFailure)
+            codePromise.promise.failure(new BrokerException(message))
+          else
+            codePromise.promise.success(message)
+        }
+        promiseMap.clear()
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
new file mode 100644
index 0000000..aa18648
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import com.ibm.spark.interpreter.InterpreterTypes.ExecuteOutput
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.interpreter.broker.BrokerTypes.CodeResults
+import com.ibm.spark.interpreter.{ExecuteError, ExecuteFailure, Results}
+
+import scala.concurrent.Future
+
+/**
+ * Represents a utility that can transform raw broker information to
+ * kernel information.
+ */
+class BrokerTransformer {
+  /**
+   * Transforms a pure result containing output information into a form that
+   * the interpreter interface expects.
+   *
+   * @param futureResult The raw result as a future
+   *
+   * @return The transformed result as a future
+   */
+  def transformToInterpreterResult(futureResult: Future[CodeResults]):
+    Future[(Result, Either[ExecuteOutput, ExecuteFailure])] =
+  {
+    import scala.concurrent.ExecutionContext.Implicits.global
+
+    futureResult
+      .map(results => (Results.Success, Left(results)))
+      .recover({ case ex: BrokerException =>
+        (Results.Error, Right(ExecuteError(
+          name = ex.getClass.getName,
+          value = ex.getLocalizedMessage,
+          stackTrace = ex.getStackTrace.map(_.toString).toList
+        )))
+      })
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
new file mode 100644
index 0000000..71e4d3d
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+/**
+ * Represents all types associated with the broker interface.
+ */
+object BrokerTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
new file mode 100644
index 0000000..2af47e4
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+/**
+ * Provides broker types to the class/trait that implements this trait.
+ */
+trait BrokerTypesProvider {
+  /** Represents the id used to keep track of executing code. */
+  type CodeId = String
+
+  /** Represents the code to execute. */
+  type Code = String
+
+  /** Represents the results of code execution or the failure message. */
+  type CodeResults = String
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
new file mode 100644
index 0000000..cda61f3
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker.producer
+
+import org.apache.spark.SparkContext
+import org.apache.spark.api.java.JavaSparkContext
+
+/**
+ * Represents a producer for a JavaSparkContext.
+ */
+trait JavaSparkContextProducerLike {
+  /**
+   * Creates a new JavaSparkContext instance.
+   *
+   * @param sparkContext The SparkContext instance to use to create the Java one
+   *
+   * @return The new JavaSparkContext
+   */
+  def newJavaSparkContext(sparkContext: SparkContext): JavaSparkContext
+}
+
+/**
+ * Represents the standard producer for a JavaSparkContext.
+ */
+trait StandardJavaSparkContextProducer extends JavaSparkContextProducerLike {
+  def newJavaSparkContext(sparkContext: SparkContext): JavaSparkContext =
+    new JavaSparkContext(sparkContext)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
new file mode 100644
index 0000000..fd46268
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker.producer
+
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+
+/**
+ * Represents a producer for a SQLContext.
+ */
+trait SQLContextProducerLike {
+  /**
+   * Creates a new SQLContext instance.
+   *
+   * @param sparkContext The SparkContext instance to use to create the SQL one
+   *
+   * @return The new SQLContext
+   */
+  def newSQLContext(sparkContext: SparkContext): SQLContext
+}
+
+/**
+ * Represents the standard producer for a SQLContext.
+ */
+trait StandardSQLContextProducer extends SQLContextProducerLike {
+  def newSQLContext(sparkContext: SparkContext): SQLContext =
+    new SQLContext(sparkContext)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
new file mode 100644
index 0000000..42c5616
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.imports.printers
+
+import java.io._
+
+import com.ibm.spark.utils.DynamicReflectionSupport
+
+/**
+ * Represents a wrapper for the scala.Console for Scala 2.10.4 implementation.
+ * @param in The input stream used for standard in
+ * @param out The output stream used for standard out
+ * @param err The output stream used for standard error
+ */
+class WrapperConsole(
+  val in: BufferedReader,
+  val out: PrintStream,
+  val err: PrintStream
+) extends DynamicReflectionSupport(Class.forName("scala.Console$"), scala.Console) {
+  require(in != null)
+  require(out != null)
+  require(err != null)
+
+  //
+  // SUPPORTED PRINT OPERATIONS
+  //
+
+  def print(obj: Any): Unit = out.print(obj)
+  def printf(text: String, args: Any*): Unit =
+    out.print(text.format(args: _*))
+  def println(x: Any): Unit = out.println(x)
+  def println(): Unit = out.println()
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
new file mode 100644
index 0000000..4583680
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.imports.printers
+
+import java.io._
+
+import com.ibm.spark.utils.DynamicReflectionSupport
+
+/**
+ * Represents a wrapper for java.lang.System.
+ * @param inStream The input stream used for standard in
+ * @param outStream The output stream used for standard out
+ * @param errStream The output stream used for standard error
+ */
+class WrapperSystem(
+  private val inStream: InputStream,
+  private val outStream: OutputStream,
+  private val errStream: OutputStream
+) extends DynamicReflectionSupport(Class.forName("java.lang.System"), null){
+  require(inStream != null)
+  require(outStream != null)
+  require(errStream != null)
+
+  private val outPrinter = new PrintStream(outStream)
+  private val errPrinter = new PrintStream(errStream)
+
+  //
+  // MASKED METHODS
+  //
+
+  def in = inStream
+  def out = outPrinter
+  def err = errPrinter
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
new file mode 100644
index 0000000..451316d
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark
+
+// TODO: Deprecate and remove this package object as it is difficult to
+//       remember where this type comes from
+package object interpreter {
+  /**
+   * Represents the output from an interpret execution.
+   */
+  type ExecuteOutput = String
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
new file mode 100644
index 0000000..1642e1b
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
@@ -0,0 +1,34 @@
+package com.ibm.spark.kernel.api
+
+import java.io.{InputStream, OutputStream}
+
+/**
+ * Represents the methods available to create objects related to the kernel.
+ */
+trait FactoryMethodsLike {
+  /**
+   * Creates a new kernel output stream.
+   *
+   * @param streamType The type of output stream (stdout/stderr)
+   * @param sendEmptyOutput If true, will send message even if output is empty
+   *
+   * @return The new KernelOutputStream instance
+   */
+  def newKernelOutputStream(
+    streamType: String,
+    sendEmptyOutput: Boolean
+  ): OutputStream
+
+  /**
+   * Creates a new kernel input stream.
+   *
+   * @param prompt The text to use as a prompt
+   * @param password If true, should treat input as a password field
+   *
+   * @return The new KernelInputStream instance
+   */
+  def newKernelInputStream(
+    prompt: String,
+    password: Boolean
+  ): InputStream
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
new file mode 100644
index 0000000..c9442aa
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.api
+
+import java.io.{PrintStream, InputStream, OutputStream}
+
+import com.typesafe.config.Config
+import org.apache.spark.api.java.JavaSparkContext
+import org.apache.spark.{SparkConf, SparkContext}
+import org.apache.spark.sql.SQLContext
+
+/**
+ * Interface for the kernel API. This does not include exposed variables.
+ */
+trait KernelLike {
+
+  def createSparkContext(conf: SparkConf): SparkContext
+
+  def createSparkContext(master: String, appName: String): SparkContext
+
+  /**
+   * Executes a block of code represented as a string and returns the result.
+   *
+   * @param code The code as an option to execute
+   *
+   * @return A tuple containing the result (true/false) and the output as a
+   *         string
+   */
+  def eval(code: Option[String]): (Boolean, String)
+
+  /**
+   * Returns a collection of methods that can be used to generate objects
+   * related to the kernel.
+   *
+   * @return The collection of factory methods
+   */
+  def factory: FactoryMethodsLike
+
+  /**
+   * Returns a collection of methods that can be used to stream data from the
+   * kernel to the client.
+   *
+   * @return The collection of stream methods
+   */
+  def stream: StreamMethodsLike
+
+  /**
+   * Returns a print stream to be used for communication back to clients
+   * via standard out.
+   *
+   * @return The print stream instance or an error if the stream info is
+   *         not found
+   */
+  def out: PrintStream
+
+  /**
+   * Returns a print stream to be used for communication back to clients
+   * via standard error.
+   *
+   * @return The print stream instance or an error if the stream info is
+   *         not found
+   */
+  def err: PrintStream
+
+  /**
+   * Returns an input stream to be used to receive information from the client.
+   *
+   * @return The input stream instance or an error if the stream info is
+   *         not found
+   */
+  def in: InputStream
+
+  /**
+   * Represents data to be shared using the kernel as the middleman.
+   *
+   * @note Using Java structure to enable other languages to have easy access!
+   */
+  val data: java.util.Map[String, Any]
+
+
+  def interpreter(name: String): Option[com.ibm.spark.interpreter.Interpreter]
+
+  def config: Config
+
+  def sparkContext: SparkContext
+
+  def sparkConf: SparkConf
+
+  def javaSparkContext: JavaSparkContext
+
+  def sqlContext: SQLContext
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
new file mode 100644
index 0000000..00d00c9
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.api
+
+
+object KernelOptions {
+  var showTypes: Boolean = false
+  var noTruncation: Boolean = false
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
new file mode 100644
index 0000000..24cef4c
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.api
+
+/**
+ * Represents a "wrapper" for information needed to stream stdout/stderr from
+ * the kernel to a client.
+ *
+ * @note This exists because the KernelMessage instance is defined in the
+ *       protocol project, which is not brought into this project. Furthermore,
+ *       it is better practice to provide an explicit wrapper type rather than
+ *       a more common type for implicit use.
+ */
+trait StreamInfo

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
new file mode 100644
index 0000000..4e7d9d8
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
@@ -0,0 +1,13 @@
+package com.ibm.spark.kernel.api
+
+/**
+ * Represents the methods available to stream data from the kernel to the
+ * client.
+ */
+trait StreamMethodsLike {
+  /**
+   * Sends all text provided as one stream message to the client.
+   * @param text The text to wrap in a stream message
+   */
+  def sendAll(text: String): Unit
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
new file mode 100644
index 0000000..3da1f04
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
@@ -0,0 +1,8 @@
+package com.ibm.spark.magic
+
+/**
+ * Cell Magics change the output of a cell in IPython
+ */
+trait CellMagic extends Magic {
+  override def execute(code: String): CellMagicOutput
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
new file mode 100644
index 0000000..349efa6
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic
+
+/**
+ * Represents a classloader that can load classes from within.
+ *
+ * @param classLoader The classloader to use for internal retrieval
+ *                    (defaults to self's classloader)
+ */
+class InternalClassLoader(
+  classLoader: ClassLoader = classOf[InternalClassLoader].getClassLoader
+) extends ClassLoader(classLoader) {
+
+  // TODO: Provides an exposed reference to the super loadClass to be stubbed
+  // out in tests.
+  private[magic] def parentLoadClass(name: String, resolve: Boolean) =
+    super.loadClass(name, resolve)
+
+  /**
+   * Attempts to load the class using the local package of the builtin loader
+   * as the base of the name if unable to load normally.
+   *
+   * @param name The name of the class to load
+   * @param resolve If true, then resolve the class
+   *
+   * @return The class instance of a ClassNotFoundException
+   */
+  override def loadClass(name: String, resolve: Boolean): Class[_] =
+    try {
+      val packageName = this.getClass.getPackage.getName
+      val className = name.split('.').last
+
+      parentLoadClass(packageName + "." + className, resolve)
+    } catch {
+      case ex: ClassNotFoundException =>
+        parentLoadClass(name, resolve)
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
new file mode 100644
index 0000000..0a54e85
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
@@ -0,0 +1,9 @@
+package com.ibm.spark.magic
+
+/**
+ * Line Magics perform some function and don't return anything. I.e. you cannot
+ * do  `val x = %runMyCode 1 2 3` or alter the MIMEType of the cell.
+ */
+trait LineMagic extends Magic {
+  override def execute(code: String): Unit
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
new file mode 100644
index 0000000..0e41b35
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic
+
+/**
+  * Represents the base structure for a magic that is loaded and executed.
+  */
+trait Magic {
+   /**
+    * Execute a magic.
+    * @param code The code
+    * @return The output of the magic
+    */
+   def execute(code: String): Any
+ }

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala b/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
new file mode 100644
index 0000000..f74c9f6
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
@@ -0,0 +1,34 @@
+package com.ibm.spark.magic
+
+import com.ibm.spark.utils.DynamicReflectionSupport
+
+import scala.language.dynamics
+
+class MagicExecutor(magicLoader: MagicLoader) extends Dynamic {
+
+  val executeMethod = classOf[Magic].getDeclaredMethods.head.getName
+
+  def applyDynamic(name: String)(args: Any*): Either[CellMagicOutput, LineMagicOutput] = {
+    val className = magicLoader.magicClassName(name)
+    val isCellMagic = magicLoader.hasCellMagic(className)
+    val isLineMagic = magicLoader.hasLineMagic(className)
+
+    (isCellMagic, isLineMagic) match {
+      case (true, false) =>
+        val result = executeMagic(className, args)
+        Left(result.asInstanceOf[CellMagicOutput])
+      case (false, true) =>
+        executeMagic(className, args)
+        Right(LineMagicOutput)
+      case (_, _) =>
+        Left(CellMagicOutput("text/plain" ->
+          s"Magic ${className} could not be executed."))
+    }
+  }
+
+  private def executeMagic(className: String, args: Seq[Any]) = {
+    val inst = magicLoader.createMagicInstance(className)
+    val dynamicSupport = new DynamicReflectionSupport(inst.getClass, inst)
+    dynamicSupport.applyDynamic(executeMethod)(args)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
new file mode 100644
index 0000000..c700c9e
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic
+
+import java.net.{URL, URLClassLoader}
+
+import com.google.common.reflect.ClassPath
+import com.ibm.spark.magic.dependencies.DependencyMap
+
+import scala.reflect.runtime.{universe => runtimeUniverse}
+import scala.collection.JavaConversions._
+
+class MagicLoader(
+  var dependencyMap: DependencyMap = new DependencyMap(),
+  urls: Array[URL] = Array(),
+  parentLoader: ClassLoader = null
+) extends URLClassLoader(urls, parentLoader) {
+  private val magicPackage = "com.ibm.spark.magic.builtin"
+
+  /**
+   * Checks whether a magic with a given name, implementing a given interface,
+   * exists.
+   * @param name case insensitive magic name
+   * @param interface interface
+   * @return true if a magic with the given name and interface exists
+   */
+  private def hasSpecificMagic(name: String, interface: Class[_]) : Boolean = {
+    val className = magicClassName(name)
+    try {
+      val clazz = loadClass(className)
+      clazz.getInterfaces.contains(interface)
+    } catch {
+      case _: Throwable => false
+    }
+  }
+
+  /**
+   * Checks whether a line magic exists.
+   * @param name case insensitive line magic name
+   * @return true if the line magic exists
+   */
+  def hasLineMagic(name: String): Boolean =
+    hasSpecificMagic(name, classOf[LineMagic])
+
+  /**
+   * Checks whether a cell magic exists.
+   * @param name case insensitive cell magic name
+   * @return true if the cell magic exists
+   */
+  def hasCellMagic(name: String): Boolean =
+    hasSpecificMagic(name, classOf[CellMagic])
+
+  /**
+   * Attempts to load a class with a given name from a package.
+   * @param name the name of the class
+   * @param resolve whether to resolve the class or not
+   * @return the class if found
+   */
+  override def loadClass(name: String, resolve: Boolean): Class[_] =
+    try {
+      super.loadClass(magicPackage + "." + name, resolve)
+    } catch {
+      case ex: ClassNotFoundException =>
+        super.loadClass(name, resolve)
+    }
+
+  /**
+   * Returns the class name for a case insensitive magic name query.
+   * If no match is found, returns the query.
+   * @param query a magic name, e.g. jAvasCRipt
+   * @return the queried magic name's corresponding class, e.g. JavaScript
+   */
+  def magicClassName(query: String): String = {
+    lowercaseClassMap(magicClassNames).getOrElse(query.toLowerCase, query)
+  }
+
+  /**
+   * @return list of magic class names in magicPackage.
+   */
+  protected def magicClassNames : List[String] = {
+    val classPath: ClassPath = ClassPath.from(this)
+    val classes = classPath.getTopLevelClasses(magicPackage)
+    classes.asList.map(_.getSimpleName).toList
+  }
+
+  /**
+   * @param names list of class names
+   * @return map of lowercase class names to class names
+   */
+  private def lowercaseClassMap(names: List[String]): Map[String, String] = {
+    names.map(n => (n.toLowerCase, n)).toMap
+  }
+
+  def addJar(jar: URL) = addURL(jar)
+  /**
+   * Creates a instance of the specified magic with dependencies added.
+   * @param name name of magic class
+   * @return instance of the Magic corresponding to the given name
+   */
+  protected[magic] def createMagicInstance(name: String): Any = {
+    val magicClass = loadClass(name) // Checks parent loadClass first
+
+    val runtimeMirror = runtimeUniverse.runtimeMirror(this)
+    val classSymbol = runtimeMirror.staticClass(magicClass.getCanonicalName)
+    val classMirror = runtimeMirror.reflectClass(classSymbol)
+    val selfType = classSymbol.selfType
+
+    val classConstructorSymbol =
+      selfType.declaration(runtimeUniverse.nme.CONSTRUCTOR).asMethod
+    val classConstructorMethod =
+      classMirror.reflectConstructor(classConstructorSymbol)
+
+    val magicInstance = classConstructorMethod()
+
+
+    // Add all of our dependencies to the new instance
+    dependencyMap.internalMap.filter(selfType <:< _._1).values.foreach(
+      _(magicInstance.asInstanceOf[Magic])
+    )
+
+    magicInstance
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
new file mode 100644
index 0000000..f641a50
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import java.io.OutputStream
+
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.kernel.api.KernelLike
+import com.ibm.spark.magic.{MagicLoader, Magic}
+import com.typesafe.config.Config
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+
+import scala.reflect.runtime.universe._
+import com.ibm.spark.dependencies.DependencyDownloader
+
+/**
+ * Represents a mapping of dependency types to implementations.
+ *
+ * TODO: Explore Scala macros to avoid duplicate code.
+ */
+class DependencyMap {
+  val internalMap =
+    scala.collection.mutable.Map[Type, PartialFunction[Magic, Unit]]()
+
+  /**
+   * Sets the Interpreter for this map.
+   * @param interpreter The new Interpreter
+   */
+  def setInterpreter(interpreter: Interpreter) = {
+    internalMap(typeOf[IncludeInterpreter]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeInterpreter].interpreter_=(interpreter)
+      )
+
+    this
+  }
+
+  /**
+   * Sets the Interpreter for this map.
+   * @param interpreter The new Interpreter
+   */
+  //@deprecated("Use setInterpreter with IncludeInterpreter!", "2015.05.06")
+  def setKernelInterpreter(interpreter: Interpreter) = {
+    internalMap(typeOf[IncludeKernelInterpreter]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeKernelInterpreter].kernelInterpreter_=(interpreter)
+      )
+
+    this
+  }
+
+  /**
+   * Sets the SparkContext for this map.
+   * @param sparkContext The new SparkContext
+   */
+  def setSparkContext(sparkContext: SparkContext) = {
+    internalMap(typeOf[IncludeSparkContext]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeSparkContext].sparkContext_=(sparkContext)
+      )
+
+    this
+  }
+  
+  /**
+   * Sets the SQLContext for this map.
+   * @param sqlContext The new SQLContext
+   */
+  def setSQLContext(sqlContext: SQLContext) = {
+    internalMap(typeOf[IncludeSQLContext]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeSQLContext].sqlContext_=(sqlContext)
+      )
+
+    this
+  }
+
+  /**
+   * Sets the OutputStream for this map.
+   * @param outputStream The new OutputStream
+   */
+  def setOutputStream(outputStream: OutputStream) = {
+    internalMap(typeOf[IncludeOutputStream]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeOutputStream].outputStream_=(outputStream)
+      )
+
+    this
+  }
+
+  /**
+   * Sets the DependencyDownloader for this map.
+   * @param dependencyDownloader The new DependencyDownloader
+   */
+  def setDependencyDownloader(dependencyDownloader: DependencyDownloader) = {
+    internalMap(typeOf[IncludeDependencyDownloader]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeDependencyDownloader]
+            .dependencyDownloader_=(dependencyDownloader)
+      )
+
+    this
+  }  
+  
+  /**
+   * Sets the Kernel Object for this map.
+   * @param kernel The new Kernel
+   */
+  def setKernel(kernel: KernelLike) = {
+    internalMap(typeOf[IncludeKernel]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeKernel]
+            .kernel_=(kernel)
+      )
+
+    this
+  }
+
+  /**
+   * Sets the MagicLoader for this map.
+   * @param magicLoader The new MagicLoader
+   */
+  def setMagicLoader(magicLoader: MagicLoader) = {
+    internalMap(typeOf[IncludeMagicLoader]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeMagicLoader]
+            .magicLoader_=(magicLoader)
+      )
+
+    this
+  }
+
+  /**
+   * Sets the Config Object for this map.
+   * @param config The config for the kernel
+   */
+  def setConfig(config: Config) = {
+    internalMap(typeOf[IncludeConfig]) =
+      PartialFunction[Magic, Unit](
+        magic =>
+          magic.asInstanceOf[IncludeConfig]
+            .config=(config)
+      )
+
+    this
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
new file mode 100644
index 0000000..675c084
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.magic.{Magic}
+import com.typesafe.config.Config
+
+trait IncludeConfig {
+  this: Magic =>
+
+  private var _config: Config = _
+  def config: Config = _config
+  def config_= (newConfig: Config) =
+    _config = newConfig
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
new file mode 100644
index 0000000..109fbd1
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.dependencies.DependencyDownloader
+import com.ibm.spark.magic.Magic
+
+trait IncludeDependencyDownloader {
+  this: Magic =>
+
+  private var _dependencyDownloader: DependencyDownloader = _
+  def dependencyDownloader: DependencyDownloader = _dependencyDownloader
+  def dependencyDownloader_=(newDependencyDownloader: DependencyDownloader) =
+    _dependencyDownloader = newDependencyDownloader
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
new file mode 100644
index 0000000..fb01131
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.magic.Magic
+
+trait IncludeInterpreter {
+  this: Magic =>
+
+  //val interpreter: Interpreter
+  private var _interpreter: Interpreter = _
+  def interpreter: Interpreter = _interpreter
+  def interpreter_=(newInterpreter: Interpreter) =
+    _interpreter = newInterpreter
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
new file mode 100644
index 0000000..fca3cb1
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.kernel.api.KernelLike
+import com.ibm.spark.magic.Magic
+
+trait IncludeKernel {
+  this: Magic =>
+
+  private var _kernel: KernelLike = _
+  def kernel: KernelLike = _kernel
+  def kernel_=(newKernel: KernelLike) =
+    _kernel = newKernel
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
new file mode 100644
index 0000000..de19c07
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.magic.Magic
+
+//@deprecated("Use IncludeInterpreter instead!", "2015.05.06")
+trait IncludeKernelInterpreter {
+  this: Magic =>
+
+  //val interpreter: Interpreter
+  private var _interpreter: Interpreter = _
+  def kernelInterpreter: Interpreter = _interpreter
+  def kernelInterpreter_=(newInterpreter: Interpreter) =
+    _interpreter = newInterpreter
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
new file mode 100644
index 0000000..0a78508
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.magic.{MagicLoader, Magic}
+
+
+trait IncludeMagicLoader {
+  this: Magic =>
+
+  //val sparkContext: SparkContext
+  private var _magicLoader: MagicLoader = _
+  def magicLoader: MagicLoader = _magicLoader
+  def magicLoader_=(newMagicLoader: MagicLoader) =
+    _magicLoader = newMagicLoader
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
new file mode 100644
index 0000000..a3e679e
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import java.io.OutputStream
+
+import com.ibm.spark.magic.Magic
+
+trait IncludeOutputStream {
+  this: Magic =>
+
+  //val outputStream: OutputStream
+  private var _outputStream: OutputStream = _
+  def outputStream: OutputStream = _outputStream
+  def outputStream_=(newOutputStream: OutputStream) =
+    _outputStream = newOutputStream
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
new file mode 100644
index 0000000..5a9b26c
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
@@ -0,0 +1,13 @@
+package com.ibm.spark.magic.dependencies
+
+import com.ibm.spark.magic.Magic
+import org.apache.spark.sql.SQLContext
+
+trait IncludeSQLContext {
+  this: Magic =>
+
+  private var _sqlContext: SQLContext = _
+  def sqlContext: SQLContext = _sqlContext
+  def sqlContext_=(newSqlContext: SQLContext) =
+    _sqlContext = newSqlContext
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
new file mode 100644
index 0000000..df5e245
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic.dependencies
+
+import com.ibm.spark.magic.Magic
+import org.apache.spark.SparkContext
+
+trait IncludeSparkContext {
+  this: Magic =>
+
+  //val sparkContext: SparkContext
+  private var _sparkContext: SparkContext = _
+  def sparkContext: SparkContext = _sparkContext
+  def sparkContext_=(newSparkContext: SparkContext) =
+    _sparkContext = newSparkContext
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/package.scala b/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
new file mode 100644
index 0000000..292d641
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark
+
+package object magic {
+  /**
+   * Represents the output of a magic execution.
+   */
+  // TODO: This is a duplicate of Data in kernel protocol, needs to be given
+  //       a type/val that can be translated into a specific protocol via
+  //       implicits - or some other transformation - to separate this from
+  //       the protocol type
+  type CellMagicOutput = Map[String, String]
+  val CellMagicOutput = Map
+  
+  type LineMagicOutput = Unit
+  val LineMagicOutput : LineMagicOutput = ()
+}


[05/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
new file mode 100644
index 0000000..cd5116b
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+import com.ibm.spark.kernel.protocol.v5.content.{CommOpen, StreamContent}
+import org.scalatest.{Matchers, FunSpec}
+import play.api.libs.json._
+
+class KMBuilderSpec extends FunSpec with Matchers {
+  describe("KMBuilder") {
+    val emptyKM = KernelMessage(
+      ids          = Seq(),
+      signature    = "",
+      header       = HeaderBuilder.empty,
+      parentHeader = HeaderBuilder.empty,
+      metadata     = Metadata(),
+      contentString = ""
+    )
+    val nonEmptyHeader = Header("1", "user", "2", "msg", "version")
+
+    describe("constructor") {
+      it("should hold an empty KernelMessage when constructed by default") {
+        KMBuilder().km should be(emptyKM)
+      }
+
+      it("should throw an IllegalArgumentException if given a null message") {
+        intercept[IllegalArgumentException] {
+          KMBuilder(null)
+        }
+      }
+    }
+
+    describe("#build"){
+      it("should build a KernelMessage") {
+        KMBuilder().build.copy(metadata = Metadata()) should be(emptyKM)
+      }
+
+      class KM2 extends KMBuilder {
+        override def metadataDefaults : Metadata = {
+          Metadata("foo" -> "bar", "baos" -> "bean")
+        }
+      }
+      it("should include default metadata in built message by default") {
+        val builder = new KM2
+        val metadata = builder.build.metadata
+        builder.metadataDefaults.foreach { case (k, v) =>
+            assert (metadata.contains(k) && metadata(k) == v)
+        }
+      }
+
+      it("should not include default metadata in built message if disabled") {
+        val builder = new KM2
+        val metadata = builder.build(includeDefaultMetadata = false).metadata
+        metadata should be(Metadata())
+      }
+    }
+
+    describe("withXYZ"){
+      describe("#withIds"){
+        it("should produce a KMBuilder with a KernelMessage with ids set") {
+          val ids = Seq("baos", "win")
+          val builder = KMBuilder().withIds(ids)
+          builder.km.ids should be (ids)
+        }
+      }
+
+      describe("#withSignature"){
+        it("should produce a KMBuilder with a KernelMessage with signature set") {
+          val sig = "beans"
+          val builder = KMBuilder().withSignature(sig)
+          builder.km.signature should be (sig)
+        }
+      }
+
+      describe("#withHeader"){
+        it("should produce a KMBuilder with a KernelMessage with header set," +
+           "given a Header") {
+          val builder = KMBuilder().withHeader(nonEmptyHeader)
+          builder.km.header should be (nonEmptyHeader)
+        }
+        it("should produce a KMBuilder with a KernelMessage with header set " +
+          "to a header for the given message type") {
+          val msgType = MessageType.Outgoing.ExecuteResult
+          val header = HeaderBuilder.create(msgType.toString).copy(msg_id = "")
+          val builder = KMBuilder().withHeader(msgType)
+          builder.km.header.copy(msg_id = "") should be (header)
+        }
+        it("should produce a KMBuilder with a KernelMessage with header set " +
+          "to a header for the given string message type") {
+          val msgType = CommOpen.toTypeString
+          val header = HeaderBuilder.create(msgType).copy(msg_id = "")
+          val builder = KMBuilder().withHeader(msgType)
+          builder.km.header.copy(msg_id = "") should be (header)
+        }
+      }
+
+      describe("#withParent"){
+        it("should produce a KMBuilder with a KernelMessage with " +
+           "parentHeader set to the header of the given parent message") {
+          val parent = emptyKM.copy(header = nonEmptyHeader)
+          val builder = KMBuilder().withParent(parent)
+          builder.km.parentHeader should be (parent.header)
+        }
+      }
+
+      describe("#withParentHeader"){
+        it("should produce a KMBuilder with a KernelMessage with " +
+           "parentHeader set") {
+          val builder = KMBuilder().withParentHeader(nonEmptyHeader)
+          builder.km.parentHeader should be (nonEmptyHeader)
+        }
+      }
+
+      describe("#withMetadata"){
+        it("should produce a KMBuilder with a KernelMessage whose metadata " +
+           "contains the given metadata") {
+          val metadata = Metadata("foo" -> "bar", "baos" -> "bean")
+          val builder = KMBuilder().withMetadata(metadata)
+          builder.km.metadata should be (metadata)
+          val builtKM = builder.build
+          metadata.foreach { case (k, v) =>
+            assert (builtKM.metadata.contains(k) && builtKM.metadata(k) == v)
+          }
+        }
+      }
+
+      describe("#withContentString"){
+        it("should produce a KMBuilder with a KernelMessage with content set") {
+          val content = "foo bar"
+          val builder = KMBuilder().withContentString(content)
+          builder.km.contentString should be (content)
+        }
+        it("should produce a KMBuilder with a KernelMessage with content" +
+           "containing a JSON string of the given object") {
+          val sc = StreamContent("foo", "bar")
+          val builder = KMBuilder().withContentString(sc)
+          builder.km.contentString should be (Json.toJson(sc).toString)
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
new file mode 100644
index 0000000..3811314
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ClearOutputSpec extends FunSpec with Matchers {
+  val clearOutputJson: JsValue = Json.parse("""
+  {
+    "wait": true
+  }
+""")
+
+  val clearOutput = ClearOutput(
+    true
+  )
+
+  describe("ClearOutput") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ClearOutput.toTypeString should be ("clear_output")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ClearOutput instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        clearOutputJson.as[ClearOutput] should be (clearOutput)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = clearOutputJson.asOpt[ClearOutput]
+
+        newCompleteRequest.get should be (clearOutput)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = clearOutputJson.validate[ClearOutput]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ClearOutput) => valid
+        ) should be (clearOutput)
+      }
+
+      it("should implicitly convert from a ClearOutput instance to valid json") {
+        Json.toJson(clearOutput) should be (clearOutputJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
new file mode 100644
index 0000000..15ba4ed
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CommCloseSpec extends FunSpec with Matchers {
+  val commCloseJson: JsValue = Json.parse("""
+  {
+    "comm_id": "<UUID>",
+    "data": {}
+  }
+  """)
+
+  val commClose = CommClose(
+    "<UUID>", MsgData.Empty
+  )
+
+  describe("CommClose") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CommClose.toTypeString should be ("comm_close")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CommClose instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        commCloseJson.as[CommClose] should be (commClose)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = commCloseJson.asOpt[CommClose]
+
+        newCompleteRequest.get should be (commClose)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = commCloseJson.validate[CommClose]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CommClose) => valid
+        ) should be (commClose)
+      }
+
+      it("should implicitly convert from a CommClose instance to valid json") {
+        Json.toJson(commClose) should be (commCloseJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
new file mode 100644
index 0000000..74b99fe
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5._
+
+class CommMsgSpec extends FunSpec with Matchers {
+  val commMsgJson: JsValue = Json.parse("""
+  {
+    "comm_id": "<UUID>",
+    "data": {}
+  }
+  """)
+
+  val commMsgJsonWithData: JsValue = Json.parse(
+    """
+    {
+      "comm_id": "<UUID>",
+      "data": {
+        "key" : {
+          "foo" : "bar",
+          "baz" : {
+            "qux" : 3
+          }
+        }
+      }
+    }
+    """.stripMargin)
+
+  val commMsg = CommMsg(
+    "<UUID>", MsgData.Empty
+  )
+
+  val commMsgWithData = CommMsg(
+    "<UUID>", MsgData("key" -> Json.obj(
+      "foo" -> "bar",
+      "baz" -> Map("qux" -> 3)
+    ))
+  )
+
+  describe("CommMsg") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CommMsg.toTypeString should be ("comm_msg")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CommMsg instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        commMsgJson.as[CommMsg] should be (commMsg)
+      }
+
+      it("should implicitly convert json with a non-empty json data field " +
+         "to a CommMsg instance") {
+        commMsgJsonWithData.as[CommMsg] should be (commMsgWithData)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = commMsgJson.asOpt[CommMsg]
+
+        newCompleteRequest.get should be (commMsg)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = commMsgJson.validate[CommMsg]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CommMsg) => valid
+        ) should be (commMsg)
+      }
+
+      it("should implicitly convert from a CommMsg instance to valid json") {
+        Json.toJson(commMsg) should be (commMsgJson)
+      }
+
+      it("should implicitly convert a CommMsg instance with non-empty json " +
+         "data to valid json") {
+        Json.toJson(commMsgWithData) should be (commMsgJsonWithData)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
new file mode 100644
index 0000000..3f216e9
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5.MsgData
+
+class CommOpenSpec extends FunSpec with Matchers {
+  val commOpenJson: JsValue = Json.parse("""
+  {
+    "comm_id": "<UUID>",
+    "target_name": "<STRING>",
+    "data": {}
+  }
+  """)
+
+  val commOpen = CommOpen(
+    "<UUID>", "<STRING>", MsgData.Empty
+  )
+
+  describe("CommOpen") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CommOpen.toTypeString should be ("comm_open")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CommOpen instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        commOpenJson.as[CommOpen] should be (commOpen)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = commOpenJson.asOpt[CommOpen]
+
+        newCompleteRequest.get should be (commOpen)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = commOpenJson.validate[CommOpen]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CommOpen) => valid
+        ) should be (commOpen)
+      }
+
+      it("should implicitly convert from a CommOpen instance to valid json") {
+        Json.toJson(commOpen) should be (commOpenJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
new file mode 100644
index 0000000..ab41581
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CompleteReplyErrorSpec extends FunSpec with Matchers {
+  val completeReplyErrorJson: JsValue = Json.parse("""
+  {
+    "matches": [],
+    "cursor_start": 1,
+    "cursor_end": 5,
+    "metadata": {},
+    "status": "error",
+    "ename":"<STRING>",
+    "evalue": "<STRING>",
+    "traceback": []
+  }
+  """)
+  
+  
+  val completeReplyError: CompleteReplyError = CompleteReplyError(
+    List(), 1, 5, Map(), Some("<STRING>"), Some("<STRING>"), Some(List())
+  )
+
+  describe("CompleteReplyError") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteReplyError instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeReplyErrorJson.as[CompleteReplyError] should be (completeReplyError)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReplyOk = completeReplyErrorJson.asOpt[CompleteReplyError]
+
+        newCompleteReplyOk.get should be (completeReplyError)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyOkResults = completeReplyErrorJson.validate[CompleteReplyError]
+
+        CompleteReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteReplyError) => valid
+        ) should be (completeReplyError)
+      }
+
+      it("should implicitly convert from a CompleteReplyError instance to valid json") {
+        Json.toJson(completeReplyError) should be (completeReplyErrorJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
new file mode 100644
index 0000000..a3edeec
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CompleteReplyOkSpec extends FunSpec with Matchers {
+  val completeReplyOkJson: JsValue = Json.parse("""
+  {
+    "matches": [],
+    "cursor_start": 1,
+    "cursor_end": 5,
+    "metadata": {},
+    "status": "ok"
+  }
+  """)
+  
+  
+  val completeReplyOk: CompleteReplyOk = CompleteReplyOk(
+    List(), 1, 5, Map()
+  )
+
+  describe("CompleteReplyOk") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteReplyOk instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeReplyOkJson.as[CompleteReplyOk] should be (completeReplyOk)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReplyOk = completeReplyOkJson.asOpt[CompleteReplyOk]
+
+        newCompleteReplyOk.get should be (completeReplyOk)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyOkResults = completeReplyOkJson.validate[CompleteReplyOk]
+
+        CompleteReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteReplyOk) => valid
+        ) should be (completeReplyOk)
+      }
+
+      it("should implicitly convert from a CompleteReplyOk instance to valid json") {
+        Json.toJson(completeReplyOk) should be (completeReplyOkJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
new file mode 100644
index 0000000..a0e6a27
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, JsValue, Json}
+
+/**
+ * Created by Senkwich on 7/24/14.
+ */
+class CompleteReplySpec extends FunSpec with Matchers {
+
+
+  val completeReplyJson: JsValue = Json.parse("""
+  {
+    "matches": [],
+    "cursor_start": 1,
+    "cursor_end": 5,
+    "metadata": {},
+    "status": "<STRING>"
+  }
+  """)
+
+  val completeReply: CompleteReply = CompleteReply(
+    List(), 1, 5, Map(), "<STRING>", None, None, None
+  )
+
+  describe("CompleteReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CompleteReply.toTypeString should be ("complete_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeReplyJson.as[CompleteReply] should be (completeReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReply = completeReplyJson.asOpt[CompleteReply]
+
+        newCompleteReply.get should be (completeReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyResults = completeReplyJson.validate[CompleteReply]
+
+        CompleteReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteReply) => valid
+        ) should be (completeReply)
+      }
+
+      it("should implicitly convert from a CompleteReply instance to valid json") {
+        Json.toJson(completeReply) should be (completeReplyJson)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
new file mode 100644
index 0000000..3738354
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CompleteRequestSpec extends FunSpec with Matchers {
+  val completeRequestJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "cursor_pos": 999
+  }
+  """)
+
+  val completeRequest: CompleteRequest = CompleteRequest(
+    "<STRING>", 999
+  )
+
+  describe("CompleteRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CompleteRequest.toTypeString should be ("complete_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeRequestJson.as[CompleteRequest] should be (completeRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = completeRequestJson.asOpt[CompleteRequest]
+
+        newCompleteRequest.get should be (completeRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = completeRequestJson.validate[CompleteRequest]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteRequest) => valid
+        ) should be (completeRequest)
+      }
+
+      it("should implicitly convert from a CompleteRequest instance to valid json") {
+        Json.toJson(completeRequest) should be (completeRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
new file mode 100644
index 0000000..7ebfb07
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, JsValue, Json}
+
+/**
+ * Created by Senkwich on 7/24/14.
+ */
+class ConnectReplySpec extends FunSpec with Matchers {
+
+
+  val connectReplyJson: JsValue = Json.parse("""
+  {
+    "shell_port": 11111,
+    "iopub_port": 22222,
+    "stdin_port": 33333,
+    "hb_port": 44444
+  }
+  """)
+
+  val connectReply: ConnectReply = ConnectReply(11111,22222,33333,44444)
+
+  describe("ConnectReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ConnectReply.toTypeString should be ("connect_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ConnectReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        connectReplyJson.as[ConnectReply] should be (connectReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newConnectReply = connectReplyJson.asOpt[ConnectReply]
+
+        newConnectReply.get should be (connectReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ConnectReplyResults = connectReplyJson.validate[ConnectReply]
+
+        ConnectReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ConnectReply) => valid
+        ) should be (connectReply)
+      }
+
+      it("should implicitly convert from a ConnectReply instance to valid json") {
+        Json.toJson(connectReply) should be (connectReplyJson)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
new file mode 100644
index 0000000..af64d75
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ConnectRequestSpec extends FunSpec with Matchers {
+  val connectRequestJson: JsValue = Json.parse("""
+  {}
+  """)
+
+  val connectRequest: ConnectRequest = ConnectRequest()
+
+  describe("ConnectRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ConnectRequest.toTypeString should be ("connect_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ConnectRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        connectRequestJson.as[ConnectRequest] should be (connectRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newConnectRequest = connectRequestJson.asOpt[ConnectRequest]
+
+        newConnectRequest.get should be (connectRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ConnectRequestResults = connectRequestJson.validate[ConnectRequest]
+
+        ConnectRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ConnectRequest) => valid
+        ) should be (connectRequest)
+      }
+
+      it("should implicitly convert from a ConnectRequest instance to valid json") {
+        Json.toJson(connectRequest) should be (connectRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
new file mode 100644
index 0000000..26b03e7
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.FunSuite
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5._
+
+class DisplayDataSpec extends FunSpec with Matchers {
+  val displayDataJson: JsValue = Json.parse("""
+  {
+    "source": "<STRING>",
+    "data": {},
+    "metadata": {}
+  }
+  """)
+
+  val displayData: DisplayData = DisplayData(
+    "<STRING>", Map(), Map()
+  )
+
+  describe("DisplayData") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        DisplayData.toTypeString should be ("display_data")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a displayData instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        displayDataJson.as[DisplayData] should be (displayData)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newDisplayData = displayDataJson.asOpt[DisplayData]
+
+        newDisplayData.get should be (displayData)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val displayDataResults = displayDataJson.validate[DisplayData]
+
+        displayDataResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: DisplayData) => valid
+        ) should be (displayData)
+      }
+
+      it("should implicitly convert from a displayData instance to valid json") {
+        Json.toJson(displayData) should be (displayDataJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
new file mode 100644
index 0000000..3321d1e
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ErrorContentSpec extends FunSpec with Matchers {
+  val errorJson: JsValue = Json.parse("""
+  {
+    "ename": "<STRING>",
+    "evalue": "<STRING>",
+    "traceback": ["<STRING>"]
+  }
+  """)
+
+  val error = ErrorContent("<STRING>", "<STRING>", List("<STRING>"))
+  
+  describe("ErrorContent") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ErrorContent.toTypeString should be ("error")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ErrorContent instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        errorJson.as[ErrorContent] should be (error)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = errorJson.asOpt[ErrorContent]
+
+        newCompleteRequest.get should be (error)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = errorJson.validate[ErrorContent]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ErrorContent) => valid
+        ) should be (error)
+      }
+
+      it("should implicitly convert from a ErrorContent instance to valid json") {
+        Json.toJson(error) should be (errorJson)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
new file mode 100644
index 0000000..7327785
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ExecuteInputSpec extends FunSpec with Matchers {
+  val executeInputJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "execution_count": 42
+  }
+  """)
+
+  val executeInput: ExecuteInput = ExecuteInput(
+    "<STRING>", 42
+  )
+
+  describe("ExecuteInput") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteInput.toTypeString should be ("execute_input")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeInput instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeInputJson.as[ExecuteInput] should be (executeInput)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteInput = executeInputJson.asOpt[ExecuteInput]
+
+        newExecuteInput.get should be (executeInput)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeInputResults = executeInputJson.validate[ExecuteInput]
+
+        executeInputResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteInput) => valid
+        ) should be (executeInput)
+      }
+
+      it("should implicitly convert from a executeInput instance to valid json") {
+        Json.toJson(executeInput) should be (executeInputJson)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
new file mode 100644
index 0000000..5241650
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ExecuteReplyAbortSpec extends FunSpec with Matchers {
+  val executeReplyAbortJson: JsValue = Json.parse("""
+  {
+    "status": "abort",
+    "execution_count": 999
+  }
+  """)
+
+  val executeReplyAbort: ExecuteReplyAbort = ExecuteReplyAbort(
+    999
+  )
+
+  describe("ExecuteReplyAbort") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ExecuteReplyAbort instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyAbortJson.as[ExecuteReplyAbort] should be (executeReplyAbort)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReplyAbort = executeReplyAbortJson.asOpt[ExecuteReplyAbort]
+
+        newExecuteReplyAbort.get should be (executeReplyAbort)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ExecuteReplyAbortResults = executeReplyAbortJson.validate[ExecuteReplyAbort]
+
+        ExecuteReplyAbortResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReplyAbort) => valid
+        ) should be (executeReplyAbort)
+      }
+
+      it("should implicitly convert from a ExecuteReplyAbort instance to valid json") {
+        Json.toJson(executeReplyAbort) should be (executeReplyAbortJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
new file mode 100644
index 0000000..9859d5e
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteReplyErrorSpec extends FunSpec with Matchers {
+  val executeReplyErrorJson: JsValue = Json.parse("""
+  {
+    "status": "error",
+    "execution_count": 999,
+    "ename": "<STRING>",
+    "evalue": "<STRING>",
+    "traceback": []
+  }
+  """)
+
+  val executeReplyError: ExecuteReplyError = ExecuteReplyError(
+    999, Some("<STRING>"), Some("<STRING>"), Some(List())
+  )
+
+  describe("ExecuteReplyError") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ExecuteReplyError instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyErrorJson.as[ExecuteReplyError] should be (executeReplyError)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReplyError = executeReplyErrorJson.asOpt[ExecuteReplyError]
+
+        newExecuteReplyError.get should be (executeReplyError)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ExecuteReplyErrorResults = executeReplyErrorJson.validate[ExecuteReplyError]
+
+        ExecuteReplyErrorResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReplyError) => valid
+        ) should be (executeReplyError)
+      }
+
+      it("should implicitly convert from a ExecuteReplyError instance to valid json") {
+        Json.toJson(executeReplyError) should be (executeReplyErrorJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
new file mode 100644
index 0000000..be73811
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteReplyOkSpec extends FunSpec with Matchers {
+  val executeReplyOkJson: JsValue = Json.parse("""
+  {
+    "status": "ok",
+    "execution_count": 999,
+    "payload": [],
+    "user_expressions": {}
+  }
+  """)
+
+  val executeReplyOk: ExecuteReplyOk = ExecuteReplyOk(
+    999, Some(Payloads()), Some(UserExpressions())
+  )
+
+  describe("ExecuteReplyOk") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeReplyOk instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyOkJson.as[ExecuteReplyOk] should be (executeReplyOk)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReplyOk = executeReplyOkJson.asOpt[ExecuteReplyOk]
+
+        newExecuteReplyOk.get should be (executeReplyOk)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeReplyOkResults = executeReplyOkJson.validate[ExecuteReplyOk]
+
+        executeReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReplyOk) => valid
+        ) should be (executeReplyOk)
+      }
+
+      it("should implicitly convert from a executeReplyOk instance to valid json") {
+        Json.toJson(executeReplyOk) should be (executeReplyOkJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
new file mode 100644
index 0000000..24af1f2
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ExecuteReplySpec extends FunSpec with Matchers {
+  val executeReplyJson: JsValue = Json.parse("""
+  {
+    "status": "<STRING>",
+    "execution_count": 999
+  }
+  """)
+
+  val executeReply: ExecuteReply = ExecuteReply(
+    "<STRING>", 999, None, None, None, None, None
+  )
+
+  describe("ExecuteReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteReply.toTypeString should be ("execute_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyJson.as[ExecuteReply] should be (executeReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReply = executeReplyJson.asOpt[ExecuteReply]
+
+        newExecuteReply.get should be (executeReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeReplyResults = executeReplyJson.validate[ExecuteReply]
+
+        executeReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReply) => valid
+        ) should be (executeReply)
+      }
+
+      it("should implicitly convert from a executeReply instance to valid json") {
+        Json.toJson(executeReply) should be (executeReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
new file mode 100644
index 0000000..bb8cd71
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteRequestSpec extends FunSpec with Matchers {
+  val executeRequestJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "silent": false,
+    "store_history": false,
+    "user_expressions": {},
+    "allow_stdin": false
+  }
+  """)
+
+  val executeRequest: ExecuteRequest = ExecuteRequest(
+    "<STRING>", false, false, UserExpressions(), false
+  )
+
+  describe("ExecuteRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteRequest.toTypeString should be ("execute_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeRequestJson.as[ExecuteRequest] should be (executeRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteRequest = executeRequestJson.asOpt[ExecuteRequest]
+
+        newExecuteRequest.get should be (executeRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeRequestResults = executeRequestJson.validate[ExecuteRequest]
+
+        executeRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteRequest) => valid
+        ) should be (executeRequest)
+      }
+
+      it("should implicitly convert from a executeRequest instance to valid json") {
+        Json.toJson(executeRequest) should be (executeRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
new file mode 100644
index 0000000..fdbe3ca
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteResultSpec extends FunSpec with Matchers {
+  val executeResultJson: JsValue = Json.parse("""
+  {
+    "execution_count": 999,
+    "data": {"text/plain": "resulty result"},
+    "metadata": {}
+  }
+  """)
+
+  val executeResult = ExecuteResult(
+    999, Data("text/plain" -> "resulty result"), Metadata()
+  )
+
+  describe("ExecuteResult") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteResult.toTypeString should be ("execute_result")
+      }
+    }
+
+    describe("#hasContent") {
+      it("should be true when data has a non-empty text/plain field") {
+        executeResult.hasContent should be (true)
+      }
+
+      it("should be false if data is null") {
+        val executeResultNoData = ExecuteResult(
+          999, null, Metadata()
+        )
+        executeResultNoData.hasContent should be (false)
+      }
+
+      it("should be false when data does not have a text/plain field") {
+        val executeResultEmptyData = ExecuteResult(
+          999, Data(), Metadata()
+        )
+        executeResultEmptyData.hasContent should be (false)
+
+      }
+
+      it("should be false if text/plain field maps to an empty string") {
+        val executeResultEmptyString = ExecuteResult(
+          999, Data("text/plain" -> ""), Metadata()
+        )
+        executeResultEmptyString.hasContent should be (false)
+      }
+
+      it("should be false if text/plain maps to null") {
+        val executeResultTextPlainNull = ExecuteResult(
+          999, Data("text/plain" -> null), Metadata()
+        )
+        executeResultTextPlainNull.hasContent should be (false)
+      }
+    }
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ExecuteResult instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeResultJson.as[ExecuteResult] should be (executeResult)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = executeResultJson.asOpt[ExecuteResult]
+
+        newCompleteRequest.get should be (executeResult)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = executeResultJson.validate[ExecuteResult]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteResult) => valid
+        ) should be (executeResult)
+      }
+
+      it("should implicitly convert from a ExecuteResult instance to valid json") {
+        Json.toJson(executeResult) should be (executeResultJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
new file mode 100644
index 0000000..4e69066
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class HistoryReplySpec extends FunSpec with Matchers {
+  val historyReplyJson: JsValue = Json.parse("""
+  {
+    "history": ["<STRING>", "<STRING2>", "<STRING3>"]
+  }
+  """)
+
+  val historyReply = HistoryReply(
+    List("<STRING>", "<STRING2>", "<STRING3>")
+  )
+
+  describe("HistoryReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        HistoryReply.toTypeString should be ("history_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a HistoryReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        historyReplyJson.as[HistoryReply] should be (historyReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = historyReplyJson.asOpt[HistoryReply]
+
+        newCompleteRequest.get should be (historyReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = historyReplyJson.validate[HistoryReply]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: HistoryReply) => valid
+        ) should be (historyReply)
+      }
+
+      it("should implicitly convert from a HistoryReply instance to valid json") {
+        Json.toJson(historyReply) should be (historyReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
new file mode 100644
index 0000000..dc775fa
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class HistoryRequestSpec extends FunSpec with Matchers {
+  val historyRequestJson: JsValue = Json.parse("""
+  {
+    "output": true,
+    "ras": true,
+    "hist_access_type": "<STRING>",
+    "session": 1,
+    "start": 0,
+    "stop": 5,
+    "n": 1,
+    "pattern": "<STRING>",
+    "unique": true
+  }
+  """)
+
+  val historyRequest = HistoryRequest(
+    true, true, "<STRING>", 1, 0, 5, 1, "<STRING>", true
+  )
+
+  describe("HistoryRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        HistoryRequest.toTypeString should be ("history_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a HistoryRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        historyRequestJson.as[HistoryRequest] should be (historyRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = historyRequestJson.asOpt[HistoryRequest]
+
+        newCompleteRequest.get should be (historyRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = historyRequestJson.validate[HistoryRequest]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: HistoryRequest) => valid
+        ) should be (historyRequest)
+      }
+
+      it("should implicitly convert from a HistoryRequest instance to valid json") {
+        Json.toJson(historyRequest) should be (historyRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
new file mode 100644
index 0000000..a5d14b1
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InputReplySpec extends FunSpec with Matchers {
+  val inputReplyJson: JsValue = Json.parse("""
+  {
+    "value": "<STRING>"
+  }
+  """)
+
+  val inputReply = InputReply(
+    "<STRING>"
+  )
+
+  describe("InputReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InputReply.toTypeString should be ("input_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InputReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inputReplyJson.as[InputReply] should be (inputReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReply = inputReplyJson.asOpt[InputReply]
+
+        newCompleteReply.get should be (inputReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyResults = inputReplyJson.validate[InputReply]
+
+        CompleteReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InputReply) => valid
+        ) should be (inputReply)
+      }
+
+      it("should implicitly convert from a InputReply instance to valid json") {
+        Json.toJson(inputReply) should be (inputReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
new file mode 100644
index 0000000..7b5b3db
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InputRequestSpec extends FunSpec with Matchers {
+  val inputRequestJson: JsValue = Json.parse("""
+  {
+    "prompt": "<STRING>",
+    "password": true
+  }
+  """)
+
+  val inputRequest = InputRequest(
+    "<STRING>", true
+  )
+
+  describe("InputRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InputRequest.toTypeString should be ("input_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InputRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inputRequestJson.as[InputRequest] should be (inputRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = inputRequestJson.asOpt[InputRequest]
+
+        newCompleteRequest.get should be (inputRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = inputRequestJson.validate[InputRequest]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InputRequest) => valid
+        ) should be (inputRequest)
+      }
+
+      it("should implicitly convert from a InputRequest instance to valid json") {
+        Json.toJson(inputRequest) should be (inputRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
new file mode 100644
index 0000000..b88a39a
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InspectReplyErrorSpec extends FunSpec with Matchers {
+  val inspectReplyErrorJson: JsValue = Json.parse("""
+  {
+    "status": "error",
+    "data": {},
+    "metadata": {},
+    "ename": "<STRING>",
+    "evalue": "<STRING>",
+    "traceback": []
+  }
+  """)
+
+  val inspectReplyError: InspectReplyError = InspectReplyError(
+    Data(), Metadata(), Some("<STRING>"), Some("<STRING>"), Some(List())
+  )
+
+  describe("InspectReplyError") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectReplyError instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectReplyErrorJson.as[InspectReplyError] should be (inspectReplyError)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectReplyError = inspectReplyErrorJson.asOpt[InspectReplyError]
+
+        newInspectReplyError.get should be (inspectReplyError)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectReplyErrorResults = inspectReplyErrorJson.validate[InspectReplyError]
+
+        InspectReplyErrorResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectReplyError) => valid
+        ) should be (inspectReplyError)
+      }
+
+      it("should implicitly convert from a InspectReplyError instance to valid json") {
+        Json.toJson(inspectReplyError) should be (inspectReplyErrorJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
new file mode 100644
index 0000000..fcea013
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class InspectReplyOkSpec extends FunSpec with Matchers {
+  val inspectReplyOkJson: JsValue = Json.parse("""
+  {
+    "status": "ok",
+    "data": {},
+    "metadata": {}
+  }
+  """)
+
+  val inspectReplyOk: InspectReplyOk = InspectReplyOk(
+    Data(), Metadata()
+  )
+
+  describe("InspectReplyOk") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectReplyOk instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectReplyOkJson.as[InspectReplyOk] should be (inspectReplyOk)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectReplyOk = inspectReplyOkJson.asOpt[InspectReplyOk]
+
+        newInspectReplyOk.get should be (inspectReplyOk)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectReplyOkResults = inspectReplyOkJson.validate[InspectReplyOk]
+
+        InspectReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectReplyOk) => valid
+        ) should be (inspectReplyOk)
+      }
+
+      it("should implicitly convert from a InspectReplyOk instance to valid json") {
+        Json.toJson(inspectReplyOk) should be (inspectReplyOkJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
new file mode 100644
index 0000000..0ad56e9
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InspectReplySpec extends FunSpec with Matchers {
+  val inspectReplyJson: JsValue = Json.parse("""
+  {
+    "status": "<STRING>",
+    "data": {},
+    "metadata": {}
+  }
+  """)
+
+  val inspectReply: InspectReply = InspectReply(
+    "<STRING>", Map(), Map(), None, None, None
+  )
+
+  describe("InspectReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InspectReply.toTypeString should be ("inspect_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectReplyJson.as[InspectReply] should be (inspectReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectReply = inspectReplyJson.asOpt[InspectReply]
+
+        newInspectReply.get should be (inspectReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectReplyResults = inspectReplyJson.validate[InspectReply]
+
+        InspectReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectReply) => valid
+        ) should be (inspectReply)
+      }
+
+      it("should implicitly convert from a InspectReply instance to valid json") {
+        Json.toJson(inspectReply) should be (inspectReplyJson)
+      }
+    }
+  }
+}
+



[07/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/comm/CommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/comm/CommWriterSpec.scala b/protocol/src/test/scala/com/ibm/spark/comm/CommWriterSpec.scala
deleted file mode 100644
index 0818da3..0000000
--- a/protocol/src/test/scala/com/ibm/spark/comm/CommWriterSpec.scala
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import java.util.UUID
-
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import org.mockito.Matchers.{eq => mockEq, _}
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, BeforeAndAfter, Matchers}
-
-
-class CommWriterSpec extends FunSpec with Matchers with BeforeAndAfter
-  with MockitoSugar
-{
-  private val TestCommId = UUID.randomUUID().toString
-
-  class TestCommWriter extends CommWriter(TestCommId) {
-    // Stub this implementation to do nothing
-    override protected[comm] def sendCommKernelMessage[
-      T <: KernelMessageContent with CommContent
-    ](commContent: T): Unit = {}
-  }
-
-  private var commWriter: CommWriter = _
-
-  before {
-    commWriter = spy(new TestCommWriter())
-  }
-
-  describe("CommWriter") {
-    describe("#writeOpen") {
-      it("should package a CommOpen instance") {
-        commWriter.writeOpen("")
-
-        verify(commWriter).sendCommKernelMessage(any[CommOpen])
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = TestCommId
-        commWriter.writeOpen("")
-
-        verify(commWriter).sendCommKernelMessage(
-          CommOpen(comm_id = expected, target_name = "", data = MsgData.Empty))
-      }
-
-      it("should include the target name in the message") {
-        val expected = "<TARGET_NAME>"
-        commWriter.writeOpen(expected)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommOpen(
-            comm_id = TestCommId, target_name = expected, data = MsgData.Empty
-          )
-        )
-      }
-
-      it("should provide empty data in the message if no data is provided") {
-        val expected: v5.MsgData = MsgData.Empty
-        commWriter.writeOpen("")
-
-        verify(commWriter).sendCommKernelMessage(
-          CommOpen(comm_id = TestCommId, target_name = "", data = expected))
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("message" -> "a", "foo" -> "bar")
-        commWriter.writeOpen("", expected)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommOpen(comm_id = TestCommId, target_name = "", data = expected))
-      }
-    }
-
-    describe("#writeMsg") {
-      it("should send a comm_msg message to the relay") {
-        commWriter.writeMsg(MsgData.Empty)
-
-        verify(commWriter).sendCommKernelMessage(any[CommMsg])
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = TestCommId
-        commWriter.writeMsg(MsgData.Empty)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommMsg(comm_id = expected, data = MsgData.Empty))
-      }
-
-      it("should fail a require if the data is null") {
-        intercept[IllegalArgumentException] {
-          commWriter.writeMsg(null)
-        }
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("message" -> "a")
-        commWriter.writeMsg(expected)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommMsg(comm_id = TestCommId, data = expected))
-      }
-    }
-
-    describe("#writeClose") {
-      it("should send a comm_close message to the relay") {
-        commWriter.writeClose()
-
-        verify(commWriter).sendCommKernelMessage(any[CommClose])
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = TestCommId
-        commWriter.writeClose()
-
-        verify(commWriter).sendCommKernelMessage(
-          CommClose(comm_id = expected, data = MsgData.Empty))
-      }
-
-      it("should provide empty data in the message if no data is provided") {
-        val expected: v5.MsgData = MsgData.Empty
-        commWriter.writeClose()
-
-        verify(commWriter).sendCommKernelMessage(
-          CommClose(comm_id = TestCommId, data = expected))
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("message" -> "a")
-        commWriter.writeClose(expected)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommClose(comm_id = TestCommId, data = expected))
-      }
-    }
-
-    describe("#write") {
-      it("should send a comm_msg message to the relay") {
-        commWriter.write(Array('a'), 0, 1)
-
-        verify(commWriter).sendCommKernelMessage(any[CommMsg])
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = TestCommId
-        val messageData = MsgData("message" -> "a")
-        commWriter.write(Array('a'), 0, 1)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommMsg(comm_id = expected, data = messageData))
-      }
-
-      it("should package the string as part of the data with a 'message' key") {
-        val expected = MsgData("message" -> "a")
-        commWriter.write(Array('a'), 0, 1)
-
-        verify(commWriter).sendCommKernelMessage(
-          CommMsg(comm_id = TestCommId, data = expected))
-      }
-    }
-
-    describe("#flush") {
-      it("should do nothing") {
-        // TODO: Is this test necessary? It does nothing.
-        commWriter.flush()
-      }
-    }
-
-    describe("#close") {
-      it("should send a comm_close message to the relay") {
-        commWriter.close()
-
-        verify(commWriter).sendCommKernelMessage(any[CommClose])
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = TestCommId
-        commWriter.close()
-
-        verify(commWriter).sendCommKernelMessage(
-          CommClose(comm_id = expected, data = MsgData.Empty))
-      }
-
-      it("should provide empty data in the message") {
-        val expected: v5.MsgData = MsgData.Empty
-        commWriter.close()
-
-        verify(commWriter).sendCommKernelMessage(
-          CommClose(comm_id = TestCommId, data = expected))
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilderSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilderSpec.scala
deleted file mode 100644
index 2dd9b31..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilderSpec.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-import org.scalatest.{Matchers, FunSpec}
-
-class HeaderBuilderSpec extends FunSpec with Matchers {
-  describe("HeaderBuilder") {
-    describe("#create") {
-      it("should set the msg_id field to a unique ID if none is provided") {
-        HeaderBuilder.create("").msg_id should not be empty
-      }
-
-      it("should set the msg_id field to the argument if provided") {
-        val expected = "some id"
-        HeaderBuilder.create("", expected).msg_id should be (expected)
-      }
-
-      it("should set the username field to the SparkKernelInfo property") {
-        val expected = SparkKernelInfo.username
-        HeaderBuilder.create("").username should be (expected)
-      }
-
-      it("should set the session field to the SparkKernelInfo property") {
-        val expected = SparkKernelInfo.session
-        HeaderBuilder.create("").session should be (expected)
-      }
-
-      it("should set the msg_type field to the argument provided") {
-        val expected = "some type"
-        HeaderBuilder.create(expected).msg_type should be (expected)
-      }
-
-      it("should set the version field to the SparkKernelInfo property") {
-        val expected = SparkKernelInfo.protocolVersion
-        HeaderBuilder.create("").version should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderSpec.scala
deleted file mode 100644
index d53d64e..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/HeaderSpec.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-import org.scalatest.{Matchers, FunSpec}
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, Json, JsValue}
-
-class HeaderSpec extends FunSpec with Matchers {
-  val headerJson: JsValue = Json.parse("""
-  {
-    "msg_id": "<UUID>",
-    "username": "<STRING>",
-    "session": "<UUID>",
-    "msg_type": "<STRING>",
-    "version": "<FLOAT>"
-  }
-  """)
-
-  val header: Header = Header(
-    "<UUID>", "<STRING>", "<UUID>", "<STRING>", "<FLOAT>"
-  )
-
-  describe("Header") {
-    describe("when null") {
-      it("should implicitly convert to empty json") {
-        val header: Header = null
-        Json.toJson(header).toString() should be ("{}")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a header instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        headerJson.as[Header] should be (header)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newHeader = headerJson.asOpt[Header]
-
-        newHeader.get should be (header)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val headerResults = headerJson.validate[Header]
-
-        headerResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: Header) => valid
-        ) should be (header)
-      }
-
-      it("should implicitly convert from a header instance to valid json") {
-        Json.toJson(header) should be (headerJson)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/KMBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/KMBuilderSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/KMBuilderSpec.scala
deleted file mode 100644
index cd5116b..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/KMBuilderSpec.scala
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-import com.ibm.spark.kernel.protocol.v5.content.{CommOpen, StreamContent}
-import org.scalatest.{Matchers, FunSpec}
-import play.api.libs.json._
-
-class KMBuilderSpec extends FunSpec with Matchers {
-  describe("KMBuilder") {
-    val emptyKM = KernelMessage(
-      ids          = Seq(),
-      signature    = "",
-      header       = HeaderBuilder.empty,
-      parentHeader = HeaderBuilder.empty,
-      metadata     = Metadata(),
-      contentString = ""
-    )
-    val nonEmptyHeader = Header("1", "user", "2", "msg", "version")
-
-    describe("constructor") {
-      it("should hold an empty KernelMessage when constructed by default") {
-        KMBuilder().km should be(emptyKM)
-      }
-
-      it("should throw an IllegalArgumentException if given a null message") {
-        intercept[IllegalArgumentException] {
-          KMBuilder(null)
-        }
-      }
-    }
-
-    describe("#build"){
-      it("should build a KernelMessage") {
-        KMBuilder().build.copy(metadata = Metadata()) should be(emptyKM)
-      }
-
-      class KM2 extends KMBuilder {
-        override def metadataDefaults : Metadata = {
-          Metadata("foo" -> "bar", "baos" -> "bean")
-        }
-      }
-      it("should include default metadata in built message by default") {
-        val builder = new KM2
-        val metadata = builder.build.metadata
-        builder.metadataDefaults.foreach { case (k, v) =>
-            assert (metadata.contains(k) && metadata(k) == v)
-        }
-      }
-
-      it("should not include default metadata in built message if disabled") {
-        val builder = new KM2
-        val metadata = builder.build(includeDefaultMetadata = false).metadata
-        metadata should be(Metadata())
-      }
-    }
-
-    describe("withXYZ"){
-      describe("#withIds"){
-        it("should produce a KMBuilder with a KernelMessage with ids set") {
-          val ids = Seq("baos", "win")
-          val builder = KMBuilder().withIds(ids)
-          builder.km.ids should be (ids)
-        }
-      }
-
-      describe("#withSignature"){
-        it("should produce a KMBuilder with a KernelMessage with signature set") {
-          val sig = "beans"
-          val builder = KMBuilder().withSignature(sig)
-          builder.km.signature should be (sig)
-        }
-      }
-
-      describe("#withHeader"){
-        it("should produce a KMBuilder with a KernelMessage with header set," +
-           "given a Header") {
-          val builder = KMBuilder().withHeader(nonEmptyHeader)
-          builder.km.header should be (nonEmptyHeader)
-        }
-        it("should produce a KMBuilder with a KernelMessage with header set " +
-          "to a header for the given message type") {
-          val msgType = MessageType.Outgoing.ExecuteResult
-          val header = HeaderBuilder.create(msgType.toString).copy(msg_id = "")
-          val builder = KMBuilder().withHeader(msgType)
-          builder.km.header.copy(msg_id = "") should be (header)
-        }
-        it("should produce a KMBuilder with a KernelMessage with header set " +
-          "to a header for the given string message type") {
-          val msgType = CommOpen.toTypeString
-          val header = HeaderBuilder.create(msgType).copy(msg_id = "")
-          val builder = KMBuilder().withHeader(msgType)
-          builder.km.header.copy(msg_id = "") should be (header)
-        }
-      }
-
-      describe("#withParent"){
-        it("should produce a KMBuilder with a KernelMessage with " +
-           "parentHeader set to the header of the given parent message") {
-          val parent = emptyKM.copy(header = nonEmptyHeader)
-          val builder = KMBuilder().withParent(parent)
-          builder.km.parentHeader should be (parent.header)
-        }
-      }
-
-      describe("#withParentHeader"){
-        it("should produce a KMBuilder with a KernelMessage with " +
-           "parentHeader set") {
-          val builder = KMBuilder().withParentHeader(nonEmptyHeader)
-          builder.km.parentHeader should be (nonEmptyHeader)
-        }
-      }
-
-      describe("#withMetadata"){
-        it("should produce a KMBuilder with a KernelMessage whose metadata " +
-           "contains the given metadata") {
-          val metadata = Metadata("foo" -> "bar", "baos" -> "bean")
-          val builder = KMBuilder().withMetadata(metadata)
-          builder.km.metadata should be (metadata)
-          val builtKM = builder.build
-          metadata.foreach { case (k, v) =>
-            assert (builtKM.metadata.contains(k) && builtKM.metadata(k) == v)
-          }
-        }
-      }
-
-      describe("#withContentString"){
-        it("should produce a KMBuilder with a KernelMessage with content set") {
-          val content = "foo bar"
-          val builder = KMBuilder().withContentString(content)
-          builder.km.contentString should be (content)
-        }
-        it("should produce a KMBuilder with a KernelMessage with content" +
-           "containing a JSON string of the given object") {
-          val sc = StreamContent("foo", "bar")
-          val builder = KMBuilder().withContentString(sc)
-          builder.km.contentString should be (Json.toJson(sc).toString)
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutputSpec.scala
deleted file mode 100644
index 3811314..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutputSpec.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ClearOutputSpec extends FunSpec with Matchers {
-  val clearOutputJson: JsValue = Json.parse("""
-  {
-    "wait": true
-  }
-""")
-
-  val clearOutput = ClearOutput(
-    true
-  )
-
-  describe("ClearOutput") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ClearOutput.toTypeString should be ("clear_output")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ClearOutput instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        clearOutputJson.as[ClearOutput] should be (clearOutput)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = clearOutputJson.asOpt[ClearOutput]
-
-        newCompleteRequest.get should be (clearOutput)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = clearOutputJson.validate[ClearOutput]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ClearOutput) => valid
-        ) should be (clearOutput)
-      }
-
-      it("should implicitly convert from a ClearOutput instance to valid json") {
-        Json.toJson(clearOutput) should be (clearOutputJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommCloseSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommCloseSpec.scala
deleted file mode 100644
index 15ba4ed..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommCloseSpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class CommCloseSpec extends FunSpec with Matchers {
-  val commCloseJson: JsValue = Json.parse("""
-  {
-    "comm_id": "<UUID>",
-    "data": {}
-  }
-  """)
-
-  val commClose = CommClose(
-    "<UUID>", MsgData.Empty
-  )
-
-  describe("CommClose") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        CommClose.toTypeString should be ("comm_close")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CommClose instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        commCloseJson.as[CommClose] should be (commClose)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = commCloseJson.asOpt[CommClose]
-
-        newCompleteRequest.get should be (commClose)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = commCloseJson.validate[CommClose]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CommClose) => valid
-        ) should be (commClose)
-      }
-
-      it("should implicitly convert from a CommClose instance to valid json") {
-        Json.toJson(commClose) should be (commCloseJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsgSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsgSpec.scala
deleted file mode 100644
index 74b99fe..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsgSpec.scala
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5._
-
-class CommMsgSpec extends FunSpec with Matchers {
-  val commMsgJson: JsValue = Json.parse("""
-  {
-    "comm_id": "<UUID>",
-    "data": {}
-  }
-  """)
-
-  val commMsgJsonWithData: JsValue = Json.parse(
-    """
-    {
-      "comm_id": "<UUID>",
-      "data": {
-        "key" : {
-          "foo" : "bar",
-          "baz" : {
-            "qux" : 3
-          }
-        }
-      }
-    }
-    """.stripMargin)
-
-  val commMsg = CommMsg(
-    "<UUID>", MsgData.Empty
-  )
-
-  val commMsgWithData = CommMsg(
-    "<UUID>", MsgData("key" -> Json.obj(
-      "foo" -> "bar",
-      "baz" -> Map("qux" -> 3)
-    ))
-  )
-
-  describe("CommMsg") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        CommMsg.toTypeString should be ("comm_msg")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CommMsg instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        commMsgJson.as[CommMsg] should be (commMsg)
-      }
-
-      it("should implicitly convert json with a non-empty json data field " +
-         "to a CommMsg instance") {
-        commMsgJsonWithData.as[CommMsg] should be (commMsgWithData)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = commMsgJson.asOpt[CommMsg]
-
-        newCompleteRequest.get should be (commMsg)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = commMsgJson.validate[CommMsg]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CommMsg) => valid
-        ) should be (commMsg)
-      }
-
-      it("should implicitly convert from a CommMsg instance to valid json") {
-        Json.toJson(commMsg) should be (commMsgJson)
-      }
-
-      it("should implicitly convert a CommMsg instance with non-empty json " +
-         "data to valid json") {
-        Json.toJson(commMsgWithData) should be (commMsgJsonWithData)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpenSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpenSpec.scala
deleted file mode 100644
index 3f216e9..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpenSpec.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5.MsgData
-
-class CommOpenSpec extends FunSpec with Matchers {
-  val commOpenJson: JsValue = Json.parse("""
-  {
-    "comm_id": "<UUID>",
-    "target_name": "<STRING>",
-    "data": {}
-  }
-  """)
-
-  val commOpen = CommOpen(
-    "<UUID>", "<STRING>", MsgData.Empty
-  )
-
-  describe("CommOpen") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        CommOpen.toTypeString should be ("comm_open")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CommOpen instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        commOpenJson.as[CommOpen] should be (commOpen)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = commOpenJson.asOpt[CommOpen]
-
-        newCompleteRequest.get should be (commOpen)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = commOpenJson.validate[CommOpen]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CommOpen) => valid
-        ) should be (commOpen)
-      }
-
-      it("should implicitly convert from a CommOpen instance to valid json") {
-        Json.toJson(commOpen) should be (commOpenJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
deleted file mode 100644
index ab41581..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class CompleteReplyErrorSpec extends FunSpec with Matchers {
-  val completeReplyErrorJson: JsValue = Json.parse("""
-  {
-    "matches": [],
-    "cursor_start": 1,
-    "cursor_end": 5,
-    "metadata": {},
-    "status": "error",
-    "ename":"<STRING>",
-    "evalue": "<STRING>",
-    "traceback": []
-  }
-  """)
-  
-  
-  val completeReplyError: CompleteReplyError = CompleteReplyError(
-    List(), 1, 5, Map(), Some("<STRING>"), Some("<STRING>"), Some(List())
-  )
-
-  describe("CompleteReplyError") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CompleteReplyError instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        completeReplyErrorJson.as[CompleteReplyError] should be (completeReplyError)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteReplyOk = completeReplyErrorJson.asOpt[CompleteReplyError]
-
-        newCompleteReplyOk.get should be (completeReplyError)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteReplyOkResults = completeReplyErrorJson.validate[CompleteReplyError]
-
-        CompleteReplyOkResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CompleteReplyError) => valid
-        ) should be (completeReplyError)
-      }
-
-      it("should implicitly convert from a CompleteReplyError instance to valid json") {
-        Json.toJson(completeReplyError) should be (completeReplyErrorJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
deleted file mode 100644
index a3edeec..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class CompleteReplyOkSpec extends FunSpec with Matchers {
-  val completeReplyOkJson: JsValue = Json.parse("""
-  {
-    "matches": [],
-    "cursor_start": 1,
-    "cursor_end": 5,
-    "metadata": {},
-    "status": "ok"
-  }
-  """)
-  
-  
-  val completeReplyOk: CompleteReplyOk = CompleteReplyOk(
-    List(), 1, 5, Map()
-  )
-
-  describe("CompleteReplyOk") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CompleteReplyOk instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        completeReplyOkJson.as[CompleteReplyOk] should be (completeReplyOk)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteReplyOk = completeReplyOkJson.asOpt[CompleteReplyOk]
-
-        newCompleteReplyOk.get should be (completeReplyOk)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteReplyOkResults = completeReplyOkJson.validate[CompleteReplyOk]
-
-        CompleteReplyOkResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CompleteReplyOk) => valid
-        ) should be (completeReplyOk)
-      }
-
-      it("should implicitly convert from a CompleteReplyOk instance to valid json") {
-        Json.toJson(completeReplyOk) should be (completeReplyOkJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplySpec.scala
deleted file mode 100644
index a0e6a27..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReplySpec.scala
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{Matchers, FunSpec}
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, JsValue, Json}
-
-/**
- * Created by Senkwich on 7/24/14.
- */
-class CompleteReplySpec extends FunSpec with Matchers {
-
-
-  val completeReplyJson: JsValue = Json.parse("""
-  {
-    "matches": [],
-    "cursor_start": 1,
-    "cursor_end": 5,
-    "metadata": {},
-    "status": "<STRING>"
-  }
-  """)
-
-  val completeReply: CompleteReply = CompleteReply(
-    List(), 1, 5, Map(), "<STRING>", None, None, None
-  )
-
-  describe("CompleteReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        CompleteReply.toTypeString should be ("complete_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CompleteReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        completeReplyJson.as[CompleteReply] should be (completeReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteReply = completeReplyJson.asOpt[CompleteReply]
-
-        newCompleteReply.get should be (completeReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteReplyResults = completeReplyJson.validate[CompleteReply]
-
-        CompleteReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CompleteReply) => valid
-        ) should be (completeReply)
-      }
-
-      it("should implicitly convert from a CompleteReply instance to valid json") {
-        Json.toJson(completeReply) should be (completeReplyJson)
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequestSpec.scala
deleted file mode 100644
index 3738354..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequestSpec.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class CompleteRequestSpec extends FunSpec with Matchers {
-  val completeRequestJson: JsValue = Json.parse("""
-  {
-    "code": "<STRING>",
-    "cursor_pos": 999
-  }
-  """)
-
-  val completeRequest: CompleteRequest = CompleteRequest(
-    "<STRING>", 999
-  )
-
-  describe("CompleteRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        CompleteRequest.toTypeString should be ("complete_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a CompleteRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        completeRequestJson.as[CompleteRequest] should be (completeRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = completeRequestJson.asOpt[CompleteRequest]
-
-        newCompleteRequest.get should be (completeRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = completeRequestJson.validate[CompleteRequest]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: CompleteRequest) => valid
-        ) should be (completeRequest)
-      }
-
-      it("should implicitly convert from a CompleteRequest instance to valid json") {
-        Json.toJson(completeRequest) should be (completeRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReplySpec.scala
deleted file mode 100644
index 7ebfb07..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReplySpec.scala
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, JsValue, Json}
-
-/**
- * Created by Senkwich on 7/24/14.
- */
-class ConnectReplySpec extends FunSpec with Matchers {
-
-
-  val connectReplyJson: JsValue = Json.parse("""
-  {
-    "shell_port": 11111,
-    "iopub_port": 22222,
-    "stdin_port": 33333,
-    "hb_port": 44444
-  }
-  """)
-
-  val connectReply: ConnectReply = ConnectReply(11111,22222,33333,44444)
-
-  describe("ConnectReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ConnectReply.toTypeString should be ("connect_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ConnectReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        connectReplyJson.as[ConnectReply] should be (connectReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newConnectReply = connectReplyJson.asOpt[ConnectReply]
-
-        newConnectReply.get should be (connectReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val ConnectReplyResults = connectReplyJson.validate[ConnectReply]
-
-        ConnectReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ConnectReply) => valid
-        ) should be (connectReply)
-      }
-
-      it("should implicitly convert from a ConnectReply instance to valid json") {
-        Json.toJson(connectReply) should be (connectReplyJson)
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequestSpec.scala
deleted file mode 100644
index af64d75..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequestSpec.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ConnectRequestSpec extends FunSpec with Matchers {
-  val connectRequestJson: JsValue = Json.parse("""
-  {}
-  """)
-
-  val connectRequest: ConnectRequest = ConnectRequest()
-
-  describe("ConnectRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ConnectRequest.toTypeString should be ("connect_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ConnectRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        connectRequestJson.as[ConnectRequest] should be (connectRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newConnectRequest = connectRequestJson.asOpt[ConnectRequest]
-
-        newConnectRequest.get should be (connectRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val ConnectRequestResults = connectRequestJson.validate[ConnectRequest]
-
-        ConnectRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ConnectRequest) => valid
-        ) should be (connectRequest)
-      }
-
-      it("should implicitly convert from a ConnectRequest instance to valid json") {
-        Json.toJson(connectRequest) should be (connectRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayDataSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayDataSpec.scala
deleted file mode 100644
index 26b03e7..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayDataSpec.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.FunSuite
-
-import org.scalatest.{Matchers, FunSpec}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5._
-
-class DisplayDataSpec extends FunSpec with Matchers {
-  val displayDataJson: JsValue = Json.parse("""
-  {
-    "source": "<STRING>",
-    "data": {},
-    "metadata": {}
-  }
-  """)
-
-  val displayData: DisplayData = DisplayData(
-    "<STRING>", Map(), Map()
-  )
-
-  describe("DisplayData") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        DisplayData.toTypeString should be ("display_data")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a displayData instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        displayDataJson.as[DisplayData] should be (displayData)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newDisplayData = displayDataJson.asOpt[DisplayData]
-
-        newDisplayData.get should be (displayData)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val displayDataResults = displayDataJson.validate[DisplayData]
-
-        displayDataResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: DisplayData) => valid
-        ) should be (displayData)
-      }
-
-      it("should implicitly convert from a displayData instance to valid json") {
-        Json.toJson(displayData) should be (displayDataJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContentSpec.scala
deleted file mode 100644
index 3321d1e..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContentSpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{Matchers, FunSpec}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ErrorContentSpec extends FunSpec with Matchers {
-  val errorJson: JsValue = Json.parse("""
-  {
-    "ename": "<STRING>",
-    "evalue": "<STRING>",
-    "traceback": ["<STRING>"]
-  }
-  """)
-
-  val error = ErrorContent("<STRING>", "<STRING>", List("<STRING>"))
-  
-  describe("ErrorContent") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ErrorContent.toTypeString should be ("error")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ErrorContent instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        errorJson.as[ErrorContent] should be (error)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = errorJson.asOpt[ErrorContent]
-
-        newCompleteRequest.get should be (error)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = errorJson.validate[ErrorContent]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ErrorContent) => valid
-        ) should be (error)
-      }
-
-      it("should implicitly convert from a ErrorContent instance to valid json") {
-        Json.toJson(error) should be (errorJson)
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInputSpec.scala
deleted file mode 100644
index 7327785..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInputSpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ExecuteInputSpec extends FunSpec with Matchers {
-  val executeInputJson: JsValue = Json.parse("""
-  {
-    "code": "<STRING>",
-    "execution_count": 42
-  }
-  """)
-
-  val executeInput: ExecuteInput = ExecuteInput(
-    "<STRING>", 42
-  )
-
-  describe("ExecuteInput") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ExecuteInput.toTypeString should be ("execute_input")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a executeInput instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeInputJson.as[ExecuteInput] should be (executeInput)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newExecuteInput = executeInputJson.asOpt[ExecuteInput]
-
-        newExecuteInput.get should be (executeInput)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val executeInputResults = executeInputJson.validate[ExecuteInput]
-
-        executeInputResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteInput) => valid
-        ) should be (executeInput)
-      }
-
-      it("should implicitly convert from a executeInput instance to valid json") {
-        Json.toJson(executeInput) should be (executeInputJson)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
deleted file mode 100644
index 5241650..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ExecuteReplyAbortSpec extends FunSpec with Matchers {
-  val executeReplyAbortJson: JsValue = Json.parse("""
-  {
-    "status": "abort",
-    "execution_count": 999
-  }
-  """)
-
-  val executeReplyAbort: ExecuteReplyAbort = ExecuteReplyAbort(
-    999
-  )
-
-  describe("ExecuteReplyAbort") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ExecuteReplyAbort instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeReplyAbortJson.as[ExecuteReplyAbort] should be (executeReplyAbort)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newExecuteReplyAbort = executeReplyAbortJson.asOpt[ExecuteReplyAbort]
-
-        newExecuteReplyAbort.get should be (executeReplyAbort)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val ExecuteReplyAbortResults = executeReplyAbortJson.validate[ExecuteReplyAbort]
-
-        ExecuteReplyAbortResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteReplyAbort) => valid
-        ) should be (executeReplyAbort)
-      }
-
-      it("should implicitly convert from a ExecuteReplyAbort instance to valid json") {
-        Json.toJson(executeReplyAbort) should be (executeReplyAbortJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
deleted file mode 100644
index 9859d5e..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-import com.ibm.spark.kernel.protocol.v5._
-
-class ExecuteReplyErrorSpec extends FunSpec with Matchers {
-  val executeReplyErrorJson: JsValue = Json.parse("""
-  {
-    "status": "error",
-    "execution_count": 999,
-    "ename": "<STRING>",
-    "evalue": "<STRING>",
-    "traceback": []
-  }
-  """)
-
-  val executeReplyError: ExecuteReplyError = ExecuteReplyError(
-    999, Some("<STRING>"), Some("<STRING>"), Some(List())
-  )
-
-  describe("ExecuteReplyError") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ExecuteReplyError instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeReplyErrorJson.as[ExecuteReplyError] should be (executeReplyError)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newExecuteReplyError = executeReplyErrorJson.asOpt[ExecuteReplyError]
-
-        newExecuteReplyError.get should be (executeReplyError)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val ExecuteReplyErrorResults = executeReplyErrorJson.validate[ExecuteReplyError]
-
-        ExecuteReplyErrorResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteReplyError) => valid
-        ) should be (executeReplyError)
-      }
-
-      it("should implicitly convert from a ExecuteReplyError instance to valid json") {
-        Json.toJson(executeReplyError) should be (executeReplyErrorJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
deleted file mode 100644
index be73811..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-import com.ibm.spark.kernel.protocol.v5._
-
-class ExecuteReplyOkSpec extends FunSpec with Matchers {
-  val executeReplyOkJson: JsValue = Json.parse("""
-  {
-    "status": "ok",
-    "execution_count": 999,
-    "payload": [],
-    "user_expressions": {}
-  }
-  """)
-
-  val executeReplyOk: ExecuteReplyOk = ExecuteReplyOk(
-    999, Some(Payloads()), Some(UserExpressions())
-  )
-
-  describe("ExecuteReplyOk") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a executeReplyOk instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeReplyOkJson.as[ExecuteReplyOk] should be (executeReplyOk)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newExecuteReplyOk = executeReplyOkJson.asOpt[ExecuteReplyOk]
-
-        newExecuteReplyOk.get should be (executeReplyOk)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val executeReplyOkResults = executeReplyOkJson.validate[ExecuteReplyOk]
-
-        executeReplyOkResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteReplyOk) => valid
-        ) should be (executeReplyOk)
-      }
-
-      it("should implicitly convert from a executeReplyOk instance to valid json") {
-        Json.toJson(executeReplyOk) should be (executeReplyOkJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplySpec.scala
deleted file mode 100644
index 24af1f2..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReplySpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class ExecuteReplySpec extends FunSpec with Matchers {
-  val executeReplyJson: JsValue = Json.parse("""
-  {
-    "status": "<STRING>",
-    "execution_count": 999
-  }
-  """)
-
-  val executeReply: ExecuteReply = ExecuteReply(
-    "<STRING>", 999, None, None, None, None, None
-  )
-
-  describe("ExecuteReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ExecuteReply.toTypeString should be ("execute_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a executeReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeReplyJson.as[ExecuteReply] should be (executeReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newExecuteReply = executeReplyJson.asOpt[ExecuteReply]
-
-        newExecuteReply.get should be (executeReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val executeReplyResults = executeReplyJson.validate[ExecuteReply]
-
-        executeReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteReply) => valid
-        ) should be (executeReply)
-      }
-
-      it("should implicitly convert from a executeReply instance to valid json") {
-        Json.toJson(executeReply) should be (executeReplyJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequestSpec.scala
deleted file mode 100644
index bb8cd71..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequestSpec.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{Matchers, FunSpec}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5._
-
-class ExecuteRequestSpec extends FunSpec with Matchers {
-  val executeRequestJson: JsValue = Json.parse("""
-  {
-    "code": "<STRING>",
-    "silent": false,
-    "store_history": false,
-    "user_expressions": {},
-    "allow_stdin": false
-  }
-  """)
-
-  val executeRequest: ExecuteRequest = ExecuteRequest(
-    "<STRING>", false, false, UserExpressions(), false
-  )
-
-  describe("ExecuteRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ExecuteRequest.toTypeString should be ("execute_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a executeRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeRequestJson.as[ExecuteRequest] should be (executeRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newExecuteRequest = executeRequestJson.asOpt[ExecuteRequest]
-
-        newExecuteRequest.get should be (executeRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val executeRequestResults = executeRequestJson.validate[ExecuteRequest]
-
-        executeRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteRequest) => valid
-        ) should be (executeRequest)
-      }
-
-      it("should implicitly convert from a executeRequest instance to valid json") {
-        Json.toJson(executeRequest) should be (executeRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResultSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResultSpec.scala
deleted file mode 100644
index fdbe3ca..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResultSpec.scala
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-import com.ibm.spark.kernel.protocol.v5._
-
-class ExecuteResultSpec extends FunSpec with Matchers {
-  val executeResultJson: JsValue = Json.parse("""
-  {
-    "execution_count": 999,
-    "data": {"text/plain": "resulty result"},
-    "metadata": {}
-  }
-  """)
-
-  val executeResult = ExecuteResult(
-    999, Data("text/plain" -> "resulty result"), Metadata()
-  )
-
-  describe("ExecuteResult") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        ExecuteResult.toTypeString should be ("execute_result")
-      }
-    }
-
-    describe("#hasContent") {
-      it("should be true when data has a non-empty text/plain field") {
-        executeResult.hasContent should be (true)
-      }
-
-      it("should be false if data is null") {
-        val executeResultNoData = ExecuteResult(
-          999, null, Metadata()
-        )
-        executeResultNoData.hasContent should be (false)
-      }
-
-      it("should be false when data does not have a text/plain field") {
-        val executeResultEmptyData = ExecuteResult(
-          999, Data(), Metadata()
-        )
-        executeResultEmptyData.hasContent should be (false)
-
-      }
-
-      it("should be false if text/plain field maps to an empty string") {
-        val executeResultEmptyString = ExecuteResult(
-          999, Data("text/plain" -> ""), Metadata()
-        )
-        executeResultEmptyString.hasContent should be (false)
-      }
-
-      it("should be false if text/plain maps to null") {
-        val executeResultTextPlainNull = ExecuteResult(
-          999, Data("text/plain" -> null), Metadata()
-        )
-        executeResultTextPlainNull.hasContent should be (false)
-      }
-    }
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a ExecuteResult instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        executeResultJson.as[ExecuteResult] should be (executeResult)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = executeResultJson.asOpt[ExecuteResult]
-
-        newCompleteRequest.get should be (executeResult)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = executeResultJson.validate[ExecuteResult]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: ExecuteResult) => valid
-        ) should be (executeResult)
-      }
-
-      it("should implicitly convert from a ExecuteResult instance to valid json") {
-        Json.toJson(executeResult) should be (executeResultJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReplySpec.scala
deleted file mode 100644
index 4e69066..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReplySpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-import com.ibm.spark.kernel.protocol.v5._
-
-class HistoryReplySpec extends FunSpec with Matchers {
-  val historyReplyJson: JsValue = Json.parse("""
-  {
-    "history": ["<STRING>", "<STRING2>", "<STRING3>"]
-  }
-  """)
-
-  val historyReply = HistoryReply(
-    List("<STRING>", "<STRING2>", "<STRING3>")
-  )
-
-  describe("HistoryReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        HistoryReply.toTypeString should be ("history_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a HistoryReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        historyReplyJson.as[HistoryReply] should be (historyReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = historyReplyJson.asOpt[HistoryReply]
-
-        newCompleteRequest.get should be (historyReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = historyReplyJson.validate[HistoryReply]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: HistoryReply) => valid
-        ) should be (historyReply)
-      }
-
-      it("should implicitly convert from a HistoryReply instance to valid json") {
-        Json.toJson(historyReply) should be (historyReplyJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequestSpec.scala
deleted file mode 100644
index dc775fa..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequestSpec.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class HistoryRequestSpec extends FunSpec with Matchers {
-  val historyRequestJson: JsValue = Json.parse("""
-  {
-    "output": true,
-    "ras": true,
-    "hist_access_type": "<STRING>",
-    "session": 1,
-    "start": 0,
-    "stop": 5,
-    "n": 1,
-    "pattern": "<STRING>",
-    "unique": true
-  }
-  """)
-
-  val historyRequest = HistoryRequest(
-    true, true, "<STRING>", 1, 0, 5, 1, "<STRING>", true
-  )
-
-  describe("HistoryRequest") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        HistoryRequest.toTypeString should be ("history_request")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a HistoryRequest instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        historyRequestJson.as[HistoryRequest] should be (historyRequest)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = historyRequestJson.asOpt[HistoryRequest]
-
-        newCompleteRequest.get should be (historyRequest)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = historyRequestJson.validate[HistoryRequest]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: HistoryRequest) => valid
-        ) should be (historyRequest)
-      }
-
-      it("should implicitly convert from a HistoryRequest instance to valid json") {
-        Json.toJson(historyRequest) should be (historyRequestJson)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputReplySpec.scala
deleted file mode 100644
index a5d14b1..0000000
--- a/protocol/src/test/scala/com/ibm/spark/kernel/protocol/v5/content/InputReplySpec.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.content
-
-import org.scalatest.{FunSpec, Matchers}
-import play.api.data.validation.ValidationError
-import play.api.libs.json._
-
-class InputReplySpec extends FunSpec with Matchers {
-  val inputReplyJson: JsValue = Json.parse("""
-  {
-    "value": "<STRING>"
-  }
-  """)
-
-  val inputReply = InputReply(
-    "<STRING>"
-  )
-
-  describe("InputReply") {
-    describe("#toTypeString") {
-      it("should return correct type") {
-        InputReply.toTypeString should be ("input_reply")
-      }
-    }
-
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a InputReply instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        inputReplyJson.as[InputReply] should be (inputReply)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteReply = inputReplyJson.asOpt[InputReply]
-
-        newCompleteReply.get should be (inputReply)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteReplyResults = inputReplyJson.validate[InputReply]
-
-        CompleteReplyResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: InputReply) => valid
-        ) should be (inputReply)
-      }
-
-      it("should implicitly convert from a InputReply instance to valid json") {
-        Json.toJson(inputReply) should be (inputReplyJson)
-      }
-    }
-  }
-}
-



[14/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
deleted file mode 100644
index 54ebdc8..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.actor.{ActorSystem, Props, ActorRef, ActorSelection}
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5Test._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpecLike, FunSpec}
-
-class GenericSocketMessageHandlerSpec extends TestKit(ActorSystem("GenericSocketMessageHandlerSystem"))
-with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-  describe("GenericSocketMessageHandler( ActorLoader, SocketType )") {
-    //  Create a mock ActorLoader for the Relay we are going to test
-    val actorLoader: ActorLoader = mock[ActorLoader]
-
-    //  Create a probe for the ActorSelection that the ActorLoader will return
-    val selectionProbe: TestProbe = TestProbe()
-    val selection: ActorSelection = system.actorSelection(selectionProbe.ref.path.toString)
-    when(actorLoader.load(SocketType.Control)).thenReturn(selection)
-
-    //  The Relay we are going to be testing against
-    val genericHandler: ActorRef = system.actorOf(
-      Props(classOf[GenericSocketMessageHandler], actorLoader, SocketType.Control)
-    )
-
-    describe("#receive( KernelMessage )") {
-      genericHandler ! MockKernelMessage
-
-      it("should send the message to the selected actor"){
-        selectionProbe.expectMsg(MockKernelMessage)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
deleted file mode 100644
index 57114bb..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import java.util.UUID
-import java.util.concurrent.ConcurrentHashMap
-
-import akka.actor.{Props, ActorRef, ActorSystem}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5.content.InputReply
-import com.ibm.spark.kernel.protocol.v5.{HeaderBuilder, MessageType, KMBuilder, SystemActorType}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import org.scalatest.concurrent.Eventually
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.time.{Milliseconds, Span}
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import scala.concurrent.duration._
-
-import org.mockito.Mockito._
-
-import collection.JavaConverters._
-
-class InputRequestReplyHandlerSpec
-  extends TestKit(ActorSystem("InputRequestReplyHandlerSystem"))
-  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter with Eventually
-{
-  implicit override val patienceConfig = PatienceConfig(
-    timeout = scaled(Span(200, Milliseconds)),
-    interval = scaled(Span(5, Milliseconds))
-  )
-
-  private var fakeSender: TestProbe = _
-  private var kernelMessageRelayProbe: TestProbe = _
-  private var mockActorLoader: ActorLoader = _
-  private var responseMap: collection.mutable.Map[String, ActorRef] = _
-
-  private var inputRequestReplyHandler: ActorRef = _
-
-  before {
-    fakeSender = TestProbe()
-
-    kernelMessageRelayProbe = TestProbe()
-    mockActorLoader = mock[ActorLoader]
-    doReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
-      .when(mockActorLoader).load(SystemActorType.KernelMessageRelay)
-
-    responseMap = new ConcurrentHashMap[String, ActorRef]().asScala
-
-    inputRequestReplyHandler = system.actorOf(Props(
-      classOf[InputRequestReplyHandler], mockActorLoader, responseMap
-    ))
-  }
-
-  describe("InputRequestReplyHandler") {
-    describe("#receive") {
-      it("should store the sender under the session if input_request") {
-        val session = UUID.randomUUID().toString
-        val inputRequestMessage = KMBuilder()
-          .withParentHeader(HeaderBuilder.empty.copy(session = session))
-          .withHeader(MessageType.Outgoing.InputRequest)
-          .build
-
-        fakeSender.send(inputRequestReplyHandler, inputRequestMessage)
-
-        eventually {
-          responseMap(session) should be (fakeSender.ref)
-        }
-      }
-
-      it("should forward message to relay if input_request") {
-        val inputRequestMessage = KMBuilder()
-          .withHeader(MessageType.Outgoing.InputRequest)
-          .build
-
-        fakeSender.send(inputRequestReplyHandler, inputRequestMessage)
-
-        kernelMessageRelayProbe.expectMsg(inputRequestMessage)
-      }
-
-      it("should send the received message value to the stored sender with " +
-        "the same session if input_reply") {
-        val expected = "some value"
-        val session = UUID.randomUUID().toString
-
-        // Build the message to "get back from the world"
-        val inputReplyMessage = KMBuilder()
-          .withHeader(HeaderBuilder.empty.copy(
-            msg_type = MessageType.Incoming.InputReply.toString,
-            session = session
-          ))
-          .withContentString(InputReply(expected))
-          .build
-
-        // Add our fake sender actor to the receiving end of the message
-        responseMap(session) = fakeSender.ref
-
-        fakeSender.send(inputRequestReplyHandler, inputReplyMessage)
-
-        // Sender should receive a response
-        fakeSender.expectMsg(expected)
-      }
-
-      it("should do nothing if the session is not found for input_reply") {
-        val expected = "some value"
-        val session = UUID.randomUUID().toString
-
-        // Build the message to "get back from the world"
-        val inputReplyMessage = KMBuilder()
-          .withHeader(HeaderBuilder.empty.copy(
-          msg_type = MessageType.Incoming.InputReply.toString,
-          session = session
-        ))
-          .withContentString(InputReply(expected))
-          .build
-
-        fakeSender.send(inputRequestReplyHandler, inputReplyMessage)
-
-        // Sender should not receive a response
-        fakeSender.expectNoMsg(300.milliseconds)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
deleted file mode 100644
index af44443..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.actor.{ActorRef, ActorSelection, ActorSystem, Props}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5.content.KernelInfoReply
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{SystemActorType, Header, KernelMessage}
-import org.mockito.AdditionalMatchers.{not => mockNot}
-import org.mockito.Matchers.{eq => mockEq}
-import com.typesafe.config.ConfigFactory
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, Matchers}
-import play.api.libs.json.Json
-
-import scala.concurrent.duration._
-
-object KernelInfoRequestHandlerSpec {
-  val config = """
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class KernelInfoRequestHandlerSpec extends TestKit(
-  ActorSystem("KernelInfoRequestHandlerSpec",
-    ConfigFactory.parseString(KernelInfoRequestHandlerSpec.config))
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-  val actorLoader: ActorLoader =  mock[ActorLoader]
-  val actor = system.actorOf(Props(classOf[KernelInfoRequestHandler], actorLoader))
-
-  val relayProbe : TestProbe = TestProbe()
-  val relaySelection : ActorSelection =
-    system.actorSelection(relayProbe.ref.path)
-  when(actorLoader.load(SystemActorType.KernelMessageRelay))
-    .thenReturn(relaySelection)
-  when(actorLoader.load(mockNot(mockEq(SystemActorType.KernelMessageRelay))))
-    .thenReturn(system.actorSelection(""))
-
-  val header = Header("","","","","")
-  val kernelMessage = new KernelMessage(
-    Seq[String](), "test message", header, header, Map[String, String](), "{}"
-  )
-
-  describe("Kernel Info Request Handler") {
-    it("should return a KernelMessage containing kernel info response") {
-      actor ! kernelMessage
-      val reply = relayProbe.receiveOne(1.seconds).asInstanceOf[KernelMessage]
-      val kernelInfo = Json.parse(reply.contentString).as[KernelInfoReply]
-      kernelInfo.implementation should be ("spark")
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
deleted file mode 100644
index be982cb..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
-
-import java.io.OutputStream
-
-import akka.actor.{ActorSystem, Props}
-import akka.testkit.{ImplicitSender, TestKit}
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.typesafe.config.ConfigFactory
-import org.mockito.Mockito._
-import org.mockito.Matchers.{eq => mockEq, anyString, anyBoolean}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpecLike}
-
-import scala.concurrent.duration._
-
-object ExecuteRequestTaskActorSpec {
-  val config = """
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class ExecuteRequestTaskActorSpec extends TestKit(
-  ActorSystem(
-    "ExecuteRequestTaskActorSpec",
-    ConfigFactory.parseString(ExecuteRequestTaskActorSpec.config)
-  )
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-{
-  describe("ExecuteRequestTaskActor") {
-    describe("#receive") {
-      it("should return an ExecuteReplyOk if the interpreter returns success") {
-        val mockInterpreter = mock[Interpreter]
-        doReturn((Results.Success, Left(new ExecuteOutput))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-
-        val executeRequestTask =
-          system.actorOf(Props(
-            classOf[ExecuteRequestTaskActor],
-            mockInterpreter
-          ))
-
-        val executeRequest = (ExecuteRequest(
-          "val x = 3", false, false,
-          UserExpressions(), false
-        ), mock[KernelMessage], mock[OutputStream])
-
-        executeRequestTask ! executeRequest
-
-        val result =
-          receiveOne(5.seconds)
-            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
-
-        result.isLeft should be (true)
-        result.left.get shouldBe an [ExecuteOutput]
-      }
-
-      it("should return an ExecuteReplyAbort if the interpreter returns aborted") {
-        val mockInterpreter = mock[Interpreter]
-        doReturn((Results.Aborted, Right(mock[ExecuteAborted]))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-
-        val executeRequestTask =
-          system.actorOf(Props(
-            classOf[ExecuteRequestTaskActor],
-            mockInterpreter
-          ))
-
-        val executeRequest = (ExecuteRequest(
-          "val x = 3", false, false,
-          UserExpressions(), false
-        ), mock[KernelMessage], mock[OutputStream])
-
-        executeRequestTask ! executeRequest
-
-        val result =
-          receiveOne(5.seconds)
-            .asInstanceOf[Either[ExecuteOutput, ExecuteFailure]]
-
-        result.isRight should be (true)
-        result.right.get shouldBe an [ExecuteAborted]
-      }
-
-      it("should return an ExecuteReplyError if the interpreter returns error") {
-        val mockInterpreter = mock[Interpreter]
-        doReturn((Results.Error, Right(mock[ExecuteError]))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-
-        val executeRequestTask =
-          system.actorOf(Props(
-            classOf[ExecuteRequestTaskActor],
-            mockInterpreter
-          ))
-
-        val executeRequest = (ExecuteRequest(
-          "val x = 3", false, false,
-          UserExpressions(), false
-        ), mock[KernelMessage], mock[OutputStream])
-
-        executeRequestTask ! executeRequest
-
-        val result =
-          receiveOne(5.seconds)
-            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
-
-        result.isRight should be (true)
-        result.right.get shouldBe an [ExecuteError]
-      }
-
-      it("should return ExecuteReplyError if interpreter returns incomplete") {
-        val mockInterpreter = mock[Interpreter]
-        doReturn((Results.Incomplete, Right(""))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-
-        val executeRequestTask =
-          system.actorOf(Props(
-            classOf[ExecuteRequestTaskActor],
-            mockInterpreter
-          ))
-
-        val executeRequest = (ExecuteRequest(
-          "(1 + 2", false, false,
-          UserExpressions(), false
-        ), mock[KernelMessage], mock[OutputStream])
-
-        executeRequestTask ! executeRequest
-
-        val result =
-          receiveOne(5.seconds)
-            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
-
-        result.isLeft should be (false)
-        result.right.get shouldBe an [ExecuteError]
-      }
-
-      it("should return an ExecuteReplyOk when receiving empty code.") {
-        val mockInterpreter = mock[Interpreter]
-        doReturn((Results.Incomplete, Right(""))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-
-        val executeRequestTask =
-          system.actorOf(Props(
-            classOf[ExecuteRequestTaskActor],
-            mockInterpreter
-          ))
-
-        val executeRequest = (ExecuteRequest(
-          "   ", false, false,
-          UserExpressions(), false
-        ), mock[KernelMessage], mock[OutputStream])
-
-        executeRequestTask ! executeRequest
-
-        val result =
-          receiveOne(5.seconds)
-            .asInstanceOf[Either[ExecuteOutput, ExecuteError]]
-
-        result.isLeft should be (true)
-        result.isRight should be (false)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoaderSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
deleted file mode 100644
index 8bb5f40..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel
-
-import akka.actor.{ActorSystem, Props}
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5.{MessageType, SocketType}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, Matchers}
-import test.utils.TestProbeProxyActor
-
-import scala.concurrent.duration._
-
-class ActorLoaderSpec extends TestKit(ActorSystem("ActorLoaderSpecSystem"))
-with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-  describe("ActorLoader"){
-    describe("#load( MessageType )"){
-      it("should load an ActorSelection that has been loaded into the system"){
-        val testProbe: TestProbe = TestProbe()
-        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe),
-          MessageType.Outgoing.ClearOutput.toString)
-        val actorLoader: ActorLoader = SimpleActorLoader(system)
-        actorLoader.load(MessageType.Outgoing.ClearOutput) ! "<Test Message>"
-        testProbe.expectMsg("<Test Message>")
-      }
-
-      it("should expect no message when there is no actor"){
-        val testProbe: TestProbe = TestProbe()
-        val actorLoader: ActorLoader = SimpleActorLoader(system)
-        actorLoader.load(MessageType.Outgoing.CompleteReply) ! "<Test Message>"
-        testProbe.expectNoMsg(25.millis)
-        // This is to test to see if there the messages go to the actor inbox or the dead mail inbox
-        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe),
-          MessageType.Outgoing.CompleteReply.toString)
-        testProbe.expectNoMsg(25.millis)
-      }
-    }
-    describe("#load( SocketType )"){
-      it("should load an ActorSelection that has been loaded into the system"){
-        val testProbe: TestProbe = TestProbe()
-        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe), SocketType.Shell.toString)
-        val actorLoader: ActorLoader = SimpleActorLoader(system)
-        actorLoader.load(SocketType.Shell) ! "<Test Message>"
-        testProbe.expectMsg("<Test Message>")
-      }
-
-      it("should expect no message when there is no actor"){
-        val testProbe: TestProbe = TestProbe()
-        val actorLoader: ActorLoader = SimpleActorLoader(system)
-        actorLoader.load(SocketType.IOPub) ! "<Test Message>"
-        testProbe.expectNoMsg(25.millis)
-        // This is to test to see if there the messages go to the actor inbox or the dead mail inbox
-        system.actorOf(Props(classOf[TestProbeProxyActor], testProbe), SocketType.IOPub.toString)
-        testProbe.expectNoMsg(25.millis)
-      }
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
deleted file mode 100644
index 65f0990..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel
-
-import akka.actor.{ActorSelection, ActorSystem, Props}
-import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5.MessageType
-import org.scalatest.{FunSpecLike, Matchers}
-import test.utils.TestProbeProxyActor
-
-class SimpleActorLoaderSpec extends TestKit(ActorSystem("SimpleActorLoaderSpecSystem"))
-  with FunSpecLike with Matchers
-{
-  describe("SimpleActorLoader") {
-    //val system = ActorSystem("SimpleActorLoaderSystem")
-    val testMessage: String = "Hello Message"
-
-    describe("#load( MessageType )") {
-      it("should load a MessageType Actor"){
-        //  Create a new test probe to verify our selection works
-        val messageTypeProbe: TestProbe = new TestProbe(system)
-
-        //  Add an actor to the system to send a message to
-        system.actorOf(
-          Props(classOf[TestProbeProxyActor], messageTypeProbe),
-          name = MessageType.Outgoing.ExecuteInput.toString
-        )
-
-        //  Create the ActorLoader with our test system
-        val actorLoader: SimpleActorLoader = SimpleActorLoader(system)
-
-        //  Get the actor and send it a message
-        val loadedMessageActor: ActorSelection =
-          actorLoader.load(MessageType.Outgoing.ExecuteInput)
-
-        loadedMessageActor ! testMessage
-
-        //  Assert the probe received the message
-        messageTypeProbe.expectMsg(testMessage)
-      }
-    }
-
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/UtilitiesSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/UtilitiesSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/UtilitiesSpec.scala
deleted file mode 100644
index 67c6eeb..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/UtilitiesSpec.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel
-
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{FunSpec, Matchers}
-
-/**
- * Refactored from old KernelMessageSpec.
- */
-class UtilitiesSpec extends FunSpec with Matchers {
-  val header: Header = Header(
-    "<UUID>", "<STRING>", "<UUID>", "<STRING>", "<FLOAT>"
-  )
-  val parentHeader : ParentHeader = ParentHeader(
-    "<PARENT-UUID>", "<PARENT-STRING>", "<PARENT-UUID>", "<PARENT-STRING>", "<PARENT-FLOAT>"
-  )
-  val kernelMessage = KernelMessage(
-    Seq("<STRING-1>","<STRING-2>"),
-    "<SIGNATURE>", header, parentHeader, Map(), "<STRING>"
-  )
-
-  val zmqMessage = ZMQMessage(
-    ByteString("<STRING-1>".replaceAll("""\s""", "").getBytes),
-    ByteString("<STRING-2>".replaceAll("""\s""", "").getBytes),
-    ByteString("<IDS|MSG>".replaceAll("""\s""", "").getBytes),
-    ByteString("<SIGNATURE>".replaceAll("""\s""", "").getBytes),
-    ByteString(
-      """
-      {
-          "msg_id": "<UUID>",
-          "username": "<STRING>",
-          "session": "<UUID>",
-          "msg_type": "<STRING>",
-          "version": "<FLOAT>"
-      }
-      """.stripMargin.replaceAll("""\s""", "").getBytes),
-    ByteString(
-      """
-      {
-          "msg_id": "<PARENT-UUID>",
-          "username": "<PARENT-STRING>",
-          "session": "<PARENT-UUID>",
-          "msg_type": "<PARENT-STRING>",
-          "version": "<PARENT-FLOAT>"
-      }
-      """.stripMargin.replaceAll("""\s""", "").getBytes),
-    ByteString("{}".replaceAll("""\s""", "").getBytes),
-    ByteString("<STRING>".replaceAll("""\s""", "").getBytes)
-  )
-
-  describe("Utilities") {
-    describe("implicit #KernelMessageToZMQMessage") {
-      it("should correctly convert a kernel message to a ZMQMessage") {
-        Utilities.KernelMessageToZMQMessage(kernelMessage) should be (zmqMessage)
-      }
-    }
-
-    describe("implicit #ZMQMessageToKernelMessage") {
-      it("should correctly convert a ZMQMessage to a kernel message") {
-        Utilities.ZMQMessageToKernelMessage(zmqMessage) should be (kernelMessage)
-      }
-    }
-
-    describe("implicit conversions should be inverses of each other") {
-      it("should convert back to the original message, ZMQ -> Kernel -> ZMQ") {
-        Utilities.KernelMessageToZMQMessage(
-          Utilities.ZMQMessageToKernelMessage(zmqMessage)
-        ) should be (zmqMessage)
-      }
-      it("should convert back to the original message, Kernel -> ZMQ -> Kernel") {
-        Utilities.ZMQMessageToKernelMessage(
-          Utilities.KernelMessageToZMQMessage(kernelMessage)
-        ) should be (kernelMessage)
-      }
-    }
-
-    describe("implicit #StringToByteString") {
-      it("should correctly convert a string to a ByteString") {
-        val someString = "some content"
-        val expected = ByteString(someString)
-
-        Utilities.StringToByteString(someString) should be (expected)
-      }
-    }
-
-    describe("implicit #ByteStringToString") {
-      it("should correctly convert a ByteString to a string") {
-        val expected = "some content"
-        val byteString = ByteString(expected)
-
-        Utilities.ByteStringToString(byteString) should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
deleted file mode 100644
index 388f466..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.typesafe.config.ConfigFactory
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, Matchers}
-
-object HeartbeatSpec {
-  val config = """
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class HeartbeatSpec extends TestKit(ActorSystem("HeartbeatActorSpec", ConfigFactory.parseString(HeartbeatSpec.config)))
-with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-  val SomeMessage: String = "some message"
-  val SomeZMQMessage: ZMQMessage = ZMQMessage(ByteString(SomeMessage.getBytes))
-
-  describe("HeartbeatActor") {
-    val socketFactory = mock[SocketFactory]
-    val probe : TestProbe = TestProbe()
-    when(socketFactory.Heartbeat(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(probe.ref)
-
-    val heartbeat = system.actorOf(Props(classOf[Heartbeat], socketFactory))
-
-    describe("send heartbeat") {
-      it("should receive and send same ZMQMessage") {
-        heartbeat ! SomeZMQMessage
-        probe.expectMsg(SomeZMQMessage)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPubSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
deleted file mode 100644
index 6e6fdb3..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import akka.actor.{ActorSystem, Props}
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities
-import com.ibm.spark.kernel.protocol.v5Test._
-import Utilities._
-import com.typesafe.config.ConfigFactory
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, Matchers}
-
-object IOPubSpec {
-  val config ="""
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class IOPubSpec extends TestKit(ActorSystem("IOPubActorSpec", ConfigFactory.parseString(IOPubSpec.config)))
-with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-
-  describe("IOPubActor") {
-    val socketFactory = mock[SocketFactory]
-    val probe : TestProbe = TestProbe()
-    when(socketFactory.IOPub(any(classOf[ActorSystem]))).thenReturn(probe.ref)
-
-    val socket = system.actorOf(Props(classOf[IOPub], socketFactory))
-
-    // TODO test that the response type changed
-    describe("#receive") {
-      it("should reply with a ZMQMessage") {
-        //  Use the implicit to convert the KernelMessage to ZMQMessage
-        val MockZMQMessage : ZMQMessage = MockKernelMessage
-
-        socket ! MockKernelMessage
-        probe.expectMsg(MockZMQMessage)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ShellSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ShellSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ShellSpec.scala
deleted file mode 100644
index d28a5ae..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ShellSpec.scala
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import java.nio.charset.Charset
-
-import akka.actor.{ActorSelection, ActorRef, ActorSystem, Props}
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5Test._
-import Utilities._
-import com.typesafe.config.ConfigFactory
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, Matchers}
-
-object ShellSpec {
-  val config ="""
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class ShellSpec extends TestKit(ActorSystem("ShellActorSpec", ConfigFactory.parseString(ShellSpec.config)))
-  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-
-  describe("Shell") {
-    val socketFactory = mock[SocketFactory]
-    val actorLoader = mock[ActorLoader]
-    val socketProbe : TestProbe = TestProbe()
-    when(socketFactory.Shell(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(socketProbe.ref)
-
-    val relayProbe : TestProbe = TestProbe()
-    val relaySelection : ActorSelection = system.actorSelection(relayProbe.ref.path)
-    when(actorLoader.load(SystemActorType.KernelMessageRelay)).thenReturn(relaySelection)
-
-    val shell = system.actorOf(Props(classOf[Shell], socketFactory, actorLoader))
-
-    describe("#receive") {
-      it("( KernelMessage ) should reply with a ZMQMessage via the socket") {
-        //  Use the implicit to convert the KernelMessage to ZMQMessage
-        val MockZMQMessage : ZMQMessage = MockKernelMessage
-
-        shell ! MockKernelMessage
-        socketProbe.expectMsg(MockZMQMessage)
-      }
-
-      it("( ZMQMessage ) should forward ZMQ Strings and KernelMessage to Relay") {
-        //  Use the implicit to convert the KernelMessage to ZMQMessage
-        val MockZMQMessage : ZMQMessage = MockKernelMessage
-
-        shell ! MockZMQMessage
-
-        // Should get the last four (assuming no buffer) strings in UTF-8
-        val zmqStrings = MockZMQMessage.frames.map((byteString: ByteString) =>
-          new String(byteString.toArray, Charset.forName("UTF-8"))
-        ).takeRight(4)
-
-        val kernelMessage: KernelMessage = MockZMQMessage
-
-        relayProbe.expectMsg((zmqStrings, kernelMessage))
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
deleted file mode 100644
index b36f734..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import com.typesafe.config.ConfigFactory
-import org.scalatest.{FunSpec, Matchers}
-import org.slf4j.LoggerFactory
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, JsValue, Json}
-
-class SocketConfigSpec extends FunSpec with Matchers {
-  val logger = LoggerFactory.getLogger("jt4")
-  //logger.error("WOOT!")
-
-  private val jsonString: String =
-    """
-    {
-      "stdin_port": 10000,
-      "control_port": 10001,
-      "hb_port": 10002,
-      "shell_port": 10003,
-      "iopub_port": 10004,
-      "ip": "1.2.3.4",
-      "transport": "tcp",
-      "signature_scheme": "hmac-sha256",
-      "key": ""
-    }
-    """.stripMargin
-
-  val socketConfigJson: JsValue = Json.parse(jsonString)
-
-  val socketConfigFromConfig = SocketConfig.fromConfig(ConfigFactory.parseString(jsonString))
-
-  val socketConfig = SocketConfig(
-    10000, 10001, 10002, 10003, 10004, "1.2.3.4", "tcp", "hmac-sha256", ""
-  )
-
-  describe("SocketConfig") {
-    describe("implicit conversions") {
-      it("should implicitly convert from valid json to a SocketConfig instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        socketConfigJson.as[SocketConfig] should be (socketConfig)
-      }
-
-      it("should also work with asOpt") {
-        // This is safer, but we lose the error information as it returns
-        // None if the conversion fails
-        val newCompleteRequest = socketConfigJson.asOpt[SocketConfig]
-
-        newCompleteRequest.get should be (socketConfig)
-      }
-
-      it("should also work with validate") {
-        // This is the safest as it collects all error information (not just first error) and reports it
-        val CompleteRequestResults = socketConfigJson.validate[SocketConfig]
-
-        CompleteRequestResults.fold(
-          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
-          (valid: SocketConfig) => valid
-        ) should be (socketConfig)
-      }
-
-      it("should implicitly convert from a SocketConfig instance to valid json") {
-        Json.toJson(socketConfig) should be (socketConfigJson)
-      }
-    }
-    describe("#toConfig") {
-      it("should implicitly convert from valid json to a SocketConfig instance") {
-        // This is the least safe way to convert as an error is thrown if it fails
-        socketConfigFromConfig should be (socketConfig)
-      }
-      
-      it("should convert json file to SocketConfig object") {
-        socketConfigFromConfig.stdin_port should be (10000)
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
deleted file mode 100644
index f33ddc0..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import org.scalatest.{FunSpec, Matchers}
-
-class SocketConnectionSpec extends FunSpec with Matchers {
-  describe("SocketConnection"){
-   describe("#toString"){
-   	it("should properly format connection string"){
-      val connection: SocketConnection = SocketConnection("tcp", "127.0.0.1", 1234)
-      connection.toString should be ("tcp://127.0.0.1:1234")
-   	}
-   }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
deleted file mode 100644
index abefdb3..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import org.scalatest.{FunSpec, Matchers}
-
-class SocketFactorySpec extends FunSpec with Matchers {
-  describe("SocketFactory"){
-    describe("HeartbeatConnection"){
-    	it("should be composed of transport ip and heartbeat port"){
-        val config: SocketConfig = SocketConfig(-1,-1,8000,-1, -1, "<STRING-IP>", "<STRING-TRANSPORT>","<STRING-SCHEME>","<STRING-KEY>")
-        val factory: SocketFactory = SocketFactory(config)
-        factory.HeartbeatConnection.toString should be ("<STRING-TRANSPORT>://<STRING-IP>:8000")
-    	}
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/StdinSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/StdinSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/StdinSpec.scala
deleted file mode 100644
index 2103904..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/StdinSpec.scala
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import java.nio.charset.Charset
-
-import akka.actor.{Props, ActorSelection, ActorRef, ActorSystem}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities._
-import com.ibm.spark.kernel.protocol.v5Test._
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, SystemActorType}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.typesafe.config.ConfigFactory
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpecLike}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-object StdinSpec {
-  val config ="""
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class StdinSpec extends TestKit(ActorSystem(
-  "StdinActorSpec", ConfigFactory.parseString(StdinSpec.config)
-)) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-  describe("Stdin") {
-    val socketFactory = mock[SocketFactory]
-    val actorLoader = mock[ActorLoader]
-    val socketProbe : TestProbe = TestProbe()
-    when(socketFactory.Stdin(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(socketProbe.ref)
-
-    val relayProbe : TestProbe = TestProbe()
-    val relaySelection : ActorSelection = system.actorSelection(relayProbe.ref.path)
-    when(actorLoader.load(SystemActorType.KernelMessageRelay)).thenReturn(relaySelection)
-
-    val stdin = system.actorOf(Props(classOf[Stdin], socketFactory, actorLoader))
-
-    describe("#receive") {
-      it("( KernelMessage ) should reply with a ZMQMessage via the socket") {
-        //  Use the implicit to convert the KernelMessage to ZMQMessage
-        val MockZMQMessage : ZMQMessage = MockKernelMessage
-
-        stdin ! MockKernelMessage
-        socketProbe.expectMsg(MockZMQMessage)
-      }
-
-      it("( ZMQMessage ) should forward ZMQ Strings and KernelMessage to Relay") {
-        //  Use the implicit to convert the KernelMessage to ZMQMessage
-        val MockZMQMessage : ZMQMessage = MockKernelMessage
-
-        stdin ! MockZMQMessage
-
-        // Should get the last four (assuming no buffer) strings in UTF-8
-        val zmqStrings = MockZMQMessage.frames.map((byteString: ByteString) =>
-          new String(byteString.toArray, Charset.forName("UTF-8"))
-        ).takeRight(4)
-
-        val kernelMessage: KernelMessage = MockZMQMessage
-
-        relayProbe.expectMsg((zmqStrings, kernelMessage))
-      }
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParserSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParserSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParserSpec.scala
deleted file mode 100644
index ba3415f..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParserSpec.scala
+++ /dev/null
@@ -1,237 +0,0 @@
-package com.ibm.spark.kernel.protocol.v5.magic
-
-import com.ibm.spark.magic.MagicLoader
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-class MagicParserSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("#parse") {
-    it("should call parseCell if the code is a cell magic invocation") {
-      val codeBlob =
-        """
-          |%%magic
-          |foo
-          |bean
-        """.stripMargin
-      val parser = spy(new MagicParser(mock[MagicLoader]))
-      parser.parse(codeBlob)
-      verify(parser).parseCell(codeBlob.trim)
-    }
-
-    it("should call parseLines if the code is not a cell magic") {
-      val codeBlob = """%magic foo bean"""
-      val parser = spy(new MagicParser(mock[MagicLoader]))
-      parser.parse(codeBlob)
-      verify(parser).parseLines(codeBlob.trim)
-    }
-  }
-
-  describe("#parseCell") {
-    it("should substitute the magic code for kernel code when magic is valid") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(true).when(magicLoader).hasCellMagic(anyString())
-
-      val magicName = "magic"
-      val args = "foo\nbean\nbar"
-      val codeBlob =
-        s"""%%$magicName
-           |$args
-         """.stripMargin
-      val parser = spy(new MagicParser(magicLoader))
-      val result = parser.parseCell(codeBlob)
-
-      verify(parser).substitute(magicName, args)
-      result.isLeft should be(true)
-    }
-
-    it("should return an error if the magic invocation is invalid") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(false).when(magicLoader).hasCellMagic(anyString())
-
-      val magicName = "magic"
-      val args = "foo\nbean\nbar"
-      val codeBlob =
-        s"""%%$magicName
-           |$args
-         """.stripMargin
-      val parser = spy(new MagicParser(magicLoader))
-      val result = parser.parseCell(codeBlob)
-
-      verify(parser, times(0)).substitute(anyString(), anyString())
-      result.isRight should be(true)
-    }
-
-    it("should return original code if code contains no magic invocations") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(false).when(magicLoader).hasCellMagic(anyString())
-
-      val codeBlob =
-        s"""val x = 3
-           |println(x + 2)
-         """.stripMargin
-      val parser = spy(new MagicParser(magicLoader))
-      val result = parser.parseCell(codeBlob)
-
-      verify(parser, times(0)).substitute(anyString(), anyString())
-      result.isLeft should be(true)
-      result.left.get should be(codeBlob)
-    }
-  }
-
-  describe("#parseLines") {
-    it("should call substituteLine for each line of code " +
-      "when there are no invalid magic invocations") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(true).when(magicLoader).hasLineMagic(anyString())
-
-      val codeBlob =
-        s"""val x = 3
-           |%lineMagic
-         """.stripMargin
-      val parser = spy(new MagicParser(magicLoader))
-      val result = parser.parseLines(codeBlob)
-
-      verify(parser, times(2)).substituteLine(anyString())
-      result.isLeft should be(true)
-    }
-
-    it("should return an error when there are invalid magic invocations") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(false).when(magicLoader).hasLineMagic(anyString())
-
-      val codeBlob =
-        s"""val x = 3
-           |%lineMagic
-         """.stripMargin
-      val parser = spy(new MagicParser(magicLoader))
-      val result = parser.parseLines(codeBlob)
-
-      verify(parser, times(0)).substituteLine(anyString())
-      result.isRight should be(true)
-    }
-
-    it("should return original code when there are no magic invocations") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(false).when(magicLoader).hasLineMagic(anyString())
-
-      val codeBlob =
-        s"""val x = 3
-           |val y = x + 2
-         """.stripMargin
-      val parser = spy(new MagicParser(magicLoader))
-      val result = parser.parseLines(codeBlob.trim)
-
-      result.isLeft should be(true)
-      result.left.get should be(codeBlob.trim)
-    }
-  }
-
-  describe("#parseMagic") {
-    it("should extract the cell name and arguments from a valid invocation") {
-      val magicName = "foobar"
-      val magicArgs = "baz\nbean"
-      val codeBlob = s"""%%$magicName\n$magicArgs"""
-      val parser = new MagicParser(mock[MagicLoader])
-      parser.parseMagic(codeBlob) should be(Some((magicName, magicArgs)))
-    }
-
-    it("should extract the line name and arguments from a valid invocation") {
-      val magicName = "foobar"
-      val magicArgs = "baz\nbean"
-      val codeBlob = s"""%$magicName $magicArgs"""
-      val parser = new MagicParser(mock[MagicLoader])
-      parser.parseMagic(codeBlob) should be(Some((magicName, magicArgs)))
-    }
-
-    it("should return none if the invocation was not valid") {
-      val magicName = "foobar"
-      val magicArgs = "baz\nbean"
-      val codeBlob = s"""$magicName\n$magicArgs"""
-      val parser = new MagicParser(mock[MagicLoader])
-      parser.parseMagic(codeBlob) should be(None)
-    }
-  }
-
-  describe("#substituteLine") {
-    it("should call substitute when a codeLine is a valid magic invocation") {
-      val magicName = "magic"
-      val args = "-v foo bar"
-      val codeLine = s"""%$magicName $args"""
-      val parser = spy(new MagicParser(mock[MagicLoader]))
-      doReturn(true).when(parser).isValidLineMagic(anyString())
-      parser.substituteLine(codeLine)
-      verify(parser).substitute(magicName, args)
-    }
-
-    it("should return original line of code when it's not a valid +" +
-      "magic invocation") {
-      val codeLine = """val x = 3"""
-      val parser = spy(new MagicParser(mock[MagicLoader]))
-      doReturn(false).when(parser).isValidLineMagic(anyString())
-      parser.substituteLine(codeLine) should be(codeLine)
-    }
-  }
-
-  describe("#substitute") {
-    // pointless?
-    it("should replace a magic invocation with an equivalent kernel call") {
-      val magicName = "magic"
-      val args = "foo bean"
-      val parser = new MagicParser(mock[MagicLoader])
-
-      val equivalent =
-        s"""${parser.kernelObjectName}.$magicName(\"\"\"$args\"\"\")"""
-      parser.substitute(magicName, args) should be(equivalent)
-    }
-  }
-
-  describe("#parseOutInvalidMagics") {
-    it("it should return the names of invalid magics") {
-      val magicOne = "foo"
-      val magicTwo = "qux"
-      val codeBlob =
-        s"""
-          |%$magicOne bar baz
-          |%$magicTwo quo bean
-        """.stripMargin
-      val parser = spy(new MagicParser(mock[MagicLoader]))
-      doReturn(false).when(parser).isValidLineMagic(anyString())
-
-      parser.parseOutInvalidMagics(codeBlob) should be(List(magicOne, magicTwo))
-    }
-
-    it("it should nothing if all magic invocations are valid") {
-      val magicOne = "foo"
-      val magicTwo = "qux"
-      val codeBlob =
-        s"""
-          |%$magicOne bar baz
-          |%$magicTwo quo bean
-        """.stripMargin
-      val parser = spy(new MagicParser(mock[MagicLoader]))
-      doReturn(true).when(parser).isValidLineMagic(anyString())
-
-      parser.parseOutInvalidMagics(codeBlob) should be(Nil)
-    }
-  }
-
-  describe("#isValidLineMagic") {
-    it("should return true if the line magic invocation is valid") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(true).when(magicLoader).hasLineMagic(anyString())
-
-      val parser = new MagicParser(magicLoader)
-      parser.isValidLineMagic("%foobar baz") should be(true)
-    }
-
-    it("should return false if the line magic invocation is not valid") {
-      val magicLoader = mock[MagicLoader]
-      doReturn(false).when(magicLoader).hasLineMagic(anyString())
-
-      val parser = new MagicParser(magicLoader)
-      parser.isValidLineMagic("%foobar baz") should be(false)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessorSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessorSpec.scala
deleted file mode 100644
index 1557460..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessorSpec.scala
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.ibm.spark.kernel.protocol.v5.magic
-
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.magic.{CellMagicOutput, LineMagicOutput}
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers}
-
-class PostProcessorSpec extends FunSpec with Matchers with MockitoSugar{
-  describe("#matchCellMagic") {
-    it("should return the cell magic output when the Left contains a " +
-       "CellMagicOutput") {
-      val processor = new PostProcessor(mock[Interpreter])
-      val codeOutput = "some output"
-      val cmo = CellMagicOutput()
-      val left = Left(cmo)
-      processor.matchCellMagic(codeOutput, left) should be(cmo)
-    }
-
-    it("should package the original code when the Left does not contain a " +
-       "CellMagicOutput") {
-      val processor = new PostProcessor(mock[Interpreter])
-      val codeOutput = "some output"
-      val left = Left("")
-      val data = Data(MIMEType.PlainText -> codeOutput)
-      processor.matchCellMagic(codeOutput, left) should be(data)
-    }
-  }
-
-  describe("#matchLineMagic") {
-    it("should process the code output when the Right contains a " +
-       "LineMagicOutput") {
-      val processor = spy(new PostProcessor(mock[Interpreter]))
-      val codeOutput = "some output"
-      val lmo = LineMagicOutput
-      val right = Right(lmo)
-      processor.matchLineMagic(codeOutput, right)
-      verify(processor).processLineMagic(codeOutput)
-    }
-
-    it("should package the original code when the Right does not contain a " +
-       "LineMagicOutput") {
-      val processor = new PostProcessor(mock[Interpreter])
-      val codeOutput = "some output"
-      val right = Right("")
-      val data = Data(MIMEType.PlainText -> codeOutput)
-      processor.matchLineMagic(codeOutput, right) should be(data)
-    }
-  }
-
-  describe("#processLineMagic") {
-    it("should remove the result of the magic invocation if it is the last " +
-       "line") {
-      val processor = new PostProcessor(mock[Interpreter])
-      val x = "hello world"
-      val codeOutput = s"$x\nsome other output"
-      val data = Data(MIMEType.PlainText -> x)
-      processor.processLineMagic(codeOutput) should be(data)
-    }
-  }
-
-  describe("#process") {
-    it("should call matchCellMagic when the last variable is a Left") {
-      val intp = mock[Interpreter]
-      val left = Left("")
-      // Need to mock lastExecutionVariableName as it is being chained with
-      // the read method
-      doReturn(Some("")).when(intp).lastExecutionVariableName
-      doReturn(Some(left)).when(intp).read(anyString())
-
-      val processor = spy(new PostProcessor(intp))
-      val codeOutput = "hello"
-      processor.process(codeOutput)
-      verify(processor).matchCellMagic(codeOutput, left)
-    }
-
-    it("should call matchLineMagic when the last variable is a Right") {
-      val intp = mock[Interpreter]
-      val right = Right("")
-      // Need to mock lastExecutionVariableName as it is being chained with
-      // the read method
-      doReturn(Some("")).when(intp).lastExecutionVariableName
-      doReturn(Some(right)).when(intp).read(anyString())
-
-      val processor = spy(new PostProcessor(intp))
-      val codeOutput = "hello"
-      processor.process(codeOutput)
-      verify(processor).matchLineMagic(codeOutput, right)
-    }
-
-    it("should package the original code output when the Left is not a " +
-      "Left[CellMagicOutput, Nothing]") {
-      val intp = mock[Interpreter]
-      val left = Left("")
-      // Need to mock lastExecutionVariableName as it is being chained with
-      // the read method
-      doReturn(Some("")).when(intp).lastExecutionVariableName
-      doReturn(Some(left)).when(intp).read(anyString())
-
-      val processor = spy(new PostProcessor(intp))
-      val codeOutput = "hello"
-      val data = Data(MIMEType.PlainText -> codeOutput)
-      processor.process(codeOutput) should be(data)
-    }
-
-    it("should package the original code output when the Right is not a " +
-       "Right[LineMagicOutput, Nothing]") {
-      val intp = mock[Interpreter]
-      val right = Right("")
-      // Need to mock lastExecutionVariableName as it is being chained with
-      // the read method
-      doReturn(Some("")).when(intp).lastExecutionVariableName
-      doReturn(Some(right)).when(intp).read(anyString())
-
-      val processor = spy(new PostProcessor(intp))
-      val codeOutput = "hello"
-      val data = Data(MIMEType.PlainText -> codeOutput)
-      processor.process(codeOutput) should be(data)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
deleted file mode 100644
index 7adf620..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.relay
-
-import java.io.OutputStream
-
-import akka.actor._
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.magic.dependencies.DependencyMap
-import com.typesafe.config.ConfigFactory
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-
-object ExecuteRequestRelaySpec {
-  val config = """
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class ExecuteRequestRelaySpec extends TestKit(
-  ActorSystem(
-    "ExecuteRequestRelayActorSystem",
-    ConfigFactory.parseString(ExecuteRequestRelaySpec.config)
-  )
-) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  var mockActorLoader: ActorLoader      = _
-  var interpreterActorProbe: TestProbe  = _
-
-  before {
-    mockActorLoader = mock[ActorLoader]
-    interpreterActorProbe = new TestProbe(system)
-    val mockInterpreterActorSelection =
-      system.actorSelection(interpreterActorProbe.ref.path.toString)
-    doReturn(mockInterpreterActorSelection).when(mockActorLoader)
-      .load(SystemActorType.Interpreter)
-  }
-
-  describe("ExecuteRequestRelay") {
-    describe("#receive(KernelMessage)") {
-      it("should handle an abort returned by the InterpreterActor") {
-        val executeRequest =
-          ExecuteRequest("%myMagic", false, true, UserExpressions(), true)
-
-        val mockMagicLoader = mock[MagicLoader]
-        val mockPostProcessor = mock[PostProcessor]
-        val mockDependencyMap = mock[DependencyMap]
-        doReturn(mockDependencyMap).when(mockMagicLoader).dependencyMap
-
-        val mockMagicParser = mock[MagicParser]
-        doReturn(Left(executeRequest.code))
-          .when(mockMagicParser).parse(executeRequest.code)
-
-        val executeRequestRelay = system.actorOf(Props(
-          classOf[ExecuteRequestRelay], mockActorLoader,
-          mockMagicLoader, mockMagicParser, mockPostProcessor
-        ))
-
-        // Send the message to the ExecuteRequestRelay
-        executeRequestRelay !
-          ((executeRequest, mock[KernelMessage], mock[OutputStream]))
-
-        // Expected does not actually match real return of magic, which
-        // is a tuple of ExecuteReply and ExecuteResult
-        val expected = new ExecuteAborted()
-        interpreterActorProbe.expectMsgClass(
-          classOf[(ExecuteRequest, KernelMessage, OutputStream)]
-        )
-
-        // Reply with an error
-        interpreterActorProbe.reply(Right(expected))
-
-        expectMsg(
-          (ExecuteReplyAbort(1), ExecuteResult(1, Data(), Metadata()))
-        )
-      }
-
-      it("should handle an error returned by the InterpreterActor") {
-        val executeRequest =
-          ExecuteRequest("%myMagic", false, true, UserExpressions(), true)
-
-        val mockMagicLoader = mock[MagicLoader]
-        val mockPostProcessor = mock[PostProcessor]
-        val mockDependencyMap = mock[DependencyMap]
-        doReturn(mockDependencyMap).when(mockMagicLoader).dependencyMap
-
-        val mockMagicParser = mock[MagicParser]
-        doReturn(Left(executeRequest.code))
-          .when(mockMagicParser).parse(executeRequest.code)
-
-        val executeRequestRelay = system.actorOf(Props(
-          classOf[ExecuteRequestRelay], mockActorLoader,
-          mockMagicLoader, mockMagicParser, mockPostProcessor
-        ))
-
-        // Send the message to the ExecuteRequestRelay
-        executeRequestRelay !
-          ((executeRequest, mock[KernelMessage], mock[OutputStream]))
-
-        // Expected does not actually match real return of magic, which
-        // is a tuple of ExecuteReply and ExecuteResult
-        val expected = ExecuteError("NAME", "MESSAGE", List())
-        interpreterActorProbe.expectMsgClass(
-          classOf[(ExecuteRequest, KernelMessage, OutputStream)]
-        )
-
-        // Reply with an error
-        interpreterActorProbe.reply(Right(expected))
-
-        expectMsg((
-          ExecuteReplyError(1, Some(expected.name), Some(expected.value),
-            Some(expected.stackTrace.map(_.toString).toList)),
-          ExecuteResult(1, Data("text/plain" -> expected.toString), Metadata())
-        ))
-      }
-
-      it("should return an (ExecuteReply, ExecuteResult) on interpreter " +
-         "success") {
-        val expected = "SOME OTHER VALUE"
-        val executeRequest =
-          ExecuteRequest("notAMagic", false, true, UserExpressions(), true)
-
-        val mockMagicLoader = mock[MagicLoader]
-        val mockPostProcessor = mock[PostProcessor]
-        doReturn(Data(MIMEType.PlainText -> expected))
-          .when(mockPostProcessor).process(expected)
-
-        val mockDependencyMap = mock[DependencyMap]
-        doReturn(mockDependencyMap).when(mockMagicLoader).dependencyMap
-
-        val mockMagicParser = mock[MagicParser]
-        doReturn(Left(executeRequest.code))
-          .when(mockMagicParser).parse(executeRequest.code)
-
-        val executeRequestRelay = system.actorOf(Props(
-          classOf[ExecuteRequestRelay], mockActorLoader,
-          mockMagicLoader, mockMagicParser, mockPostProcessor
-        ))
-
-        // Send the message to the ExecuteRequestRelay
-        executeRequestRelay !
-          ((executeRequest, mock[KernelMessage], mock[OutputStream]))
-
-        // Expected does not actually match real return of interpreter, which
-        // is a tuple of ExecuteReply and ExecuteResult
-        interpreterActorProbe.expectMsgClass(
-          classOf[(ExecuteRequest, KernelMessage, OutputStream)]
-        )
-
-        // Reply with a successful interpret
-        interpreterActorProbe.reply(Left(expected))
-
-        expectMsg((
-          ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
-          ExecuteResult(1, Data(MIMEType.PlainText -> expected), Metadata())
-        ))
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
deleted file mode 100644
index 63fa50c..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.relay
-
-import akka.actor._
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import Utilities._
-import org.mockito.Mockito._
-import org.scalatest.concurrent.{PatienceConfiguration, ScalaFutures}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.time.{Millis, Seconds, Span}
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import org.mockito.Matchers.{eq => mockEq}
-import org.mockito.AdditionalMatchers.{not => mockNot}
-import scala.concurrent.duration._
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import scala.concurrent._
-import akka.pattern.pipe
-import scala.util.Random
-import ExecutionContext.Implicits.global
-
-class KernelMessageRelaySpec extends TestKit(ActorSystem("RelayActorSystem"))
-  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter with ScalaFutures {
-  private val IncomingMessageType = MessageType.Incoming.CompleteRequest.toString
-  private val OutgoingMessageType = MessageType.Outgoing.CompleteReply.toString
-
-  private val header: Header = Header("<UUID>", "<USER>", "<SESSION>",
-    "<TYPE>", "<VERSION>")
-  private val parentHeader: Header = Header("<PARENT-UUID>", "<PARENT-USER>",
-    "<PARENT-SESSION>", "<PARENT-TYPE>", "<PARENT-VERSION>")
-  private val incomingKernelMessage: KernelMessage = KernelMessage(Seq("<ID>"),
-    "<SIGNATURE>", header.copy(msg_type = IncomingMessageType),
-    parentHeader, Metadata(), "<CONTENT>")
-  private val outgoingKernelMessage: KernelMessage = KernelMessage(Seq("<ID>"),
-    "<SIGNATURE>", header.copy(msg_type = OutgoingMessageType),
-    incomingKernelMessage.header, Metadata(), "<CONTENT>")
-  private val incomingZmqStrings = "1" :: "2" :: "3" :: "4" :: Nil
-
-  private var actorLoader: ActorLoader = _
-  private var signatureProbe: TestProbe = _
-  private var signatureSelection: ActorSelection = _
-  private var captureProbe: TestProbe = _
-  private var captureSelection: ActorSelection = _
-  private var handlerProbe: TestProbe = _
-  private var handlerSelection: ActorSelection = _
-  private var relayWithoutSignatureManager: ActorRef = _
-  private var relayWithSignatureManager: ActorRef = _
-
-  before {
-    // Create a mock ActorLoader for the Relay we are going to test
-    actorLoader = mock[ActorLoader]
-
-    // Create a probe for the signature manager and mock the ActorLoader to
-    // return the associated ActorSelection
-    signatureProbe = TestProbe()
-    signatureSelection = system.actorSelection(signatureProbe.ref.path.toString)
-    when(actorLoader.load(SecurityActorType.SignatureManager))
-      .thenReturn(signatureSelection)
-
-    // Create a probe to capture output from the relay for testing
-    captureProbe = TestProbe()
-    captureSelection = system.actorSelection(captureProbe.ref.path.toString)
-    when(actorLoader.load(mockNot(mockEq(SecurityActorType.SignatureManager))))
-      .thenReturn(captureSelection)
-
-    relayWithoutSignatureManager = system.actorOf(Props(
-      classOf[KernelMessageRelay], actorLoader, false,
-      mock[Map[String, String]], mock[Map[String, String]]
-    ))
-
-    relayWithSignatureManager = system.actorOf(Props(
-      classOf[KernelMessageRelay], actorLoader, true,
-      mock[Map[String, String]], mock[Map[String, String]]
-    ))
-  }
-
-  describe("Relay") {
-    describe("#receive") {
-      describe("when not using the signature manager") {
-        it("should not send anything to SignatureManager for incoming") {
-          relayWithoutSignatureManager ! true // Mark as ready for incoming
-          relayWithoutSignatureManager ! incomingKernelMessage
-          signatureProbe.expectNoMsg(25.millis)
-        }
-
-        it("should not send anything to SignatureManager for outgoing") {
-          relayWithoutSignatureManager ! outgoingKernelMessage
-          signatureProbe.expectNoMsg(25.millis)
-        }
-
-        it("should relay KernelMessage for incoming") {
-          relayWithoutSignatureManager ! true // Mark as ready for incoming
-          relayWithoutSignatureManager !
-            ((incomingZmqStrings, incomingKernelMessage))
-          captureProbe.expectMsg(incomingKernelMessage)
-        }
-
-        it("should relay KernelMessage for outgoing") {
-          relayWithoutSignatureManager ! outgoingKernelMessage
-          captureProbe.expectMsg(outgoingKernelMessage)
-        }
-      }
-
-      describe("when using the signature manager") {
-        it("should verify the signature if the message is incoming") {
-          relayWithSignatureManager ! true // Mark as ready for incoming
-          relayWithSignatureManager ! incomingKernelMessage
-          signatureProbe.expectMsg(incomingKernelMessage)
-        }
-
-        it("should construct the signature if the message is outgoing") {
-          relayWithSignatureManager ! outgoingKernelMessage
-          signatureProbe.expectMsg(outgoingKernelMessage)
-        }
-      }
-
-      describe("when not ready") {
-        it("should not relay the message if it is incoming") {
-          val incomingMessage: ZMQMessage = incomingKernelMessage
-
-          relayWithoutSignatureManager ! incomingMessage
-          captureProbe.expectNoMsg(25.millis)
-        }
-
-        it("should relay the message if it is outgoing") {
-          relayWithoutSignatureManager ! outgoingKernelMessage
-          captureProbe.expectMsg(outgoingKernelMessage)
-        }
-      }
-
-      describe("when ready") {
-        it("should relay the message if it is incoming") {
-          relayWithoutSignatureManager ! true // Mark as ready for incoming
-          relayWithoutSignatureManager !
-            ((incomingZmqStrings, incomingKernelMessage))
-          captureProbe.expectMsg(incomingKernelMessage)
-        }
-
-        it("should relay the message if it is outgoing") {
-          relayWithoutSignatureManager ! true // Mark as ready for incoming
-          relayWithoutSignatureManager ! outgoingKernelMessage
-          captureProbe.expectMsg(outgoingKernelMessage)
-        }
-      }
-
-      describe("multiple messages in order"){
-        it("should relay messages in the order they were received") {
-          //  Setup the base actor system and the relay
-          val actorLoader = mock[ActorLoader]
-          val kernelMessageRelay = system.actorOf(Props(
-            classOf[KernelMessageRelay], actorLoader, true,
-            mock[Map[String, String]], mock[Map[String, String]]
-          ))
-          //  Where all of the messages are relayed to, otherwise NPE
-          val captureProbe = TestProbe()
-          val captureSelection = system.actorSelection(captureProbe.ref.path.toString)
-          when(actorLoader.load(MessageType.Incoming.CompleteRequest))
-            .thenReturn(captureSelection)
-
-
-          val n = 5
-          val chaoticPromise: Promise[String] = Promise()
-          var actual : List[String] = List()
-          val expected = (0 until n).map(_.toString).toList
-
-          // setup a ChaoticActor to accumulate message values
-          // A promise succeeds after n messages have been accumulated
-          val chaoticActor: ActorRef = system.actorOf(Props(
-            classOf[ChaoticActor[Boolean]],
-            (paramVal: Any) => {
-              val tuple = paramVal.asInstanceOf[(String, Seq[_])]
-              actual = actual :+ tuple._1
-              if (actual.length == n) chaoticPromise.success("Done")
-              true
-            }
-          ))
-
-          when(actorLoader.load(SecurityActorType.SignatureManager))
-            .thenReturn(system.actorSelection(chaoticActor.path))
-
-          kernelMessageRelay ! true
-
-          // Sends messages with contents = to values of increasing counter
-          sendKernelMessages(n, kernelMessageRelay)
-          // Message values should be accumulated in the proper order
-          whenReady(chaoticPromise.future,
-            PatienceConfiguration.Timeout(Span(3, Seconds)),
-            PatienceConfiguration.Interval(Span(100, Millis))) {
-            case _: String =>
-              actual should be(expected)
-          }
-
-        }
-      }
-    }
-  }
-  def sendKernelMessages(n: Int, kernelMessageRelay: ActorRef): Unit ={
-    // Sends n messages to the relay
-    (0 until n).foreach (i => {
-      val km = KernelMessage(Seq("<ID>"), s"${i}",
-        header.copy(msg_type = IncomingMessageType), parentHeader,
-        Metadata(), s"${i}")
-      kernelMessageRelay ! Tuple2(Seq("SomeString"), km)
-    })
-
-  }
-}
-
-
-case class ChaoticActor[U](receiveFunc : Any => U) extends Actor {
-  override def receive: Receive = {
-    case fVal: Any =>
-      //  The test actor system runs the actors on a single thread, so we must
-      //  simulate asynchronous behaviour by staring a new thread
-      val promise = Promise[U]()
-      promise.future pipeTo sender
-      new Thread(new Runnable {
-        override def run(): Unit = {
-          Thread.sleep(Random.nextInt(30) * 10)
-          promise.success(receiveFunc(fVal))
-        }
-      }).start()
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStreamSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
deleted file mode 100644
index 5d06cb6..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.stream
-
-import akka.actor.{ActorRef, Actor, ActorSystem}
-import akka.testkit.{TestActorRef, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.InputRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import org.mockito.Mockito._
-import org.scalatest._
-import org.scalatest.mock.MockitoSugar
-import play.api.libs.json.Json
-
-import scala.concurrent.duration._
-
-class KernelInputStreamSpec
-  extends TestKit(ActorSystem("KernelInputStreamActorSystem"))
-  with FunSpecLike with Matchers with GivenWhenThen with BeforeAndAfter
-  with MockitoSugar
-{
-
-  private var mockActorLoader: ActorLoader = _
-  private var mockKMBuilder: KMBuilder = _
-  private var kernelInputOutputHandlerProbe: TestProbe = _
-  private var kernelInputStream: KernelInputStream = _
-  private var fakeInputOutputHandlerActor: ActorRef = _
-
-  private val TestReplyString = "some reply"
-
-  before {
-    mockActorLoader = mock[ActorLoader]
-    mockKMBuilder = KMBuilder() // No need to really mock this
-
-    kernelInputStream = new KernelInputStream(mockActorLoader, mockKMBuilder)
-
-    kernelInputOutputHandlerProbe = TestProbe()
-    fakeInputOutputHandlerActor = TestActorRef(new Actor {
-      override def receive: Receive = {
-        // Handle case for getting an input_request
-        case kernelMessage: KernelMessage =>
-          val messageType = kernelMessage.header.msg_type
-          kernelInputOutputHandlerProbe.ref ! kernelMessage
-          if (messageType == MessageType.Outgoing.InputRequest.toString)
-            sender ! TestReplyString
-      }
-    })
-
-    // Add the actor that routes to our test probe and responds with a fake
-    // set of data
-    doReturn(system.actorSelection(fakeInputOutputHandlerActor.path.toString))
-      .when(mockActorLoader).load(MessageType.Incoming.InputReply)
-  }
-
-  describe("KernelInputStream") {
-    describe("#available") {
-      it("should be zero when no input has been read") {
-        kernelInputStream.available() should be (0)
-      }
-
-      it("should match the bytes remaining internally") {
-        kernelInputStream.read()
-
-        kernelInputStream.available() should be (TestReplyString.length - 1)
-      }
-    }
-
-    describe("#read") {
-      it("should send a request for more data if the buffer is empty") {
-        // Fresh input stream has nothing in its buffer
-        kernelInputStream.read()
-
-        // Verify that a message was sent out requesting data
-        kernelInputOutputHandlerProbe.expectMsgPF() {
-          case KernelMessage(_, _, header, _, _, _)
-            if header.msg_type == MessageType.Outgoing.InputRequest.toString =>
-              true
-        }
-      }
-
-      it("should use the provided prompt in its requests") {
-        val expected = KernelInputStream.DefaultPrompt
-
-        // Fresh input stream has nothing in its buffer
-        kernelInputStream.read()
-
-        // Verify that a message was sent out requesting data with the
-        // specific prompt
-        kernelInputOutputHandlerProbe.expectMsgPF() {
-          case KernelMessage(_, _, header, _, _, contentString)
-            if header.msg_type == MessageType.Outgoing.InputRequest.toString =>
-            Json.parse(contentString).as[InputRequest].prompt should be (expected)
-        }
-      }
-
-      it("should use the provided password flag in its requests") {
-        val expected = KernelInputStream.DefaultPassword
-
-        // Fresh input stream has nothing in its buffer
-        kernelInputStream.read()
-
-        // Verify that a message was sent out requesting data with the
-        // specific prompt
-        kernelInputOutputHandlerProbe.expectMsgPF() {
-          case KernelMessage(_, _, header, _, _, contentString)
-            if header.msg_type == MessageType.Outgoing.InputRequest.toString =>
-            Json.parse(contentString).as[InputRequest].password should be (expected)
-        }
-      }
-
-      it("should return the next byte from the current buffer") {
-        kernelInputStream.read() should be (TestReplyString.head)
-      }
-
-      it("should not send a request for more data if data is in the buffer") {
-        // Run read for length of message (avoiding sending out a second
-        // request)
-        val readLength = TestReplyString.length
-
-        for (i <- 1 to readLength)
-          kernelInputStream.read() should be (TestReplyString.charAt(i - 1))
-
-        kernelInputOutputHandlerProbe.expectMsgClass(classOf[KernelMessage])
-        kernelInputOutputHandlerProbe.expectNoMsg(300.milliseconds)
-      }
-    }
-  }
-}


[49/51] [abbrv] incubator-toree git commit: Updates to README to reflect new name and Apache

Posted by lb...@apache.org.
Updates to README to reflect new name and Apache


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/bbece2db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/bbece2db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/bbece2db

Branch: refs/heads/TestBranch
Commit: bbece2db0d99426392fa1e37c5a22da1f47e08b7
Parents: c3b736a
Author: Gino Bustelo <gi...@bustelos.com>
Authored: Thu Jan 21 14:32:06 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Thu Jan 21 15:13:22 2016 -0600

----------------------------------------------------------------------
 README.md | 59 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 34 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/bbece2db/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 38f0a22..fe0e944 100644
--- a/README.md
+++ b/README.md
@@ -2,24 +2,24 @@
 [![License][license-badge]][license-url]
 [![Join the chat at https://gitter.im/ibm-et/spark-kernel][gitter-badge]][gitter-url]
 
-Spark Kernel
+Apache Toree
 ============
-The main goal of the Spark Kernel is to provide the foundation for interactive applications to connect to and use [Apache Spark][1].
+The main goal of the Toree is to provide the foundation for interactive applications to connect to and use [Apache Spark][1].
 
 Overview
 ========
-The Spark Kernel provides an interface that allows clients to interact with a Spark Cluster. Clients can send libraries and snippets of code that are interpreted and ran against a preconfigured Spark context. These snippets can do a variety of things:
+Toree provides an interface that allows clients to interact with a Spark Cluster. Clients can send libraries and snippets of code that are interpreted and ran against a preconfigured Spark context. These snippets can do a variety of things:
  1. Define and run spark jobs of all kinds
  2. Collect results from spark and push them to the client
  3. Load necessary dependencies for the running code
  4. Start and monitor a stream
  5. ...
 
-The kernel's main supported language is `Scala`, but it is also capable of processing both `Python` and `R`. It implements the latest Jupyter message protocol (5.0), so it can easily plug into the 3.x branch of Jupyter/IPython for quick, interactive data exploration.
+The main supported language is `Scala`, but it is also capable of processing both `Python` and `R`. It implements the latest Jupyter message protocol (5.0), so it can easily plug into the latest releases of Jupyter/IPython (3.2.x+ and 4.x+) for quick, interactive data exploration.
 
 Try It
 ======
-A version of the Spark Kernel is deployed as part of the [Try Jupyter!][try-jupyter] site. Select `Scala 2.10.4 (Spark 1.4.1)` under the `New` dropdown. Note that this version only supports `Scala`.
+A version of Toree is deployed as part of the [Try Jupyter!][try-jupyter] site. Select `Scala 2.10.4 (Spark 1.4.1)` under the `New` dropdown. Note that this version only supports `Scala`.
 
 Develop
 =======
@@ -27,12 +27,12 @@ This project uses `make` as the entry point for build, test, and packaging. It s
 install `sbt`, `jupyter/ipython`, and other develoment requirements locally on your machine. The 2nd mode uses [Vagrant][vagrant] to simplify the development experience. In vagrant mode, all commands are sent to the vagrant box 
 that has all necessary dependencies pre-installed. To run in vagrant mode, run `export USE_VAGRANT=true`.  
 
-To build and interact with the Spark Kernel using Jupyter, run
+To build and interact with Toree using Jupyter, run
 ```
 make dev
 ```
 
-This will start a Jupyter notebook server. Depending on your mode, it will be accessible at `http://localhost:8888` or `http://192.168.44.44:8888`. From here you can create notebooks that use the Spark Kernel configured for local mode.
+This will start a Jupyter notebook server. Depending on your mode, it will be accessible at `http://localhost:8888` or `http://192.168.44.44:8888`. From here you can create notebooks that use Toree configured for Spark local mode.
 
 Tests can be run by doing `make test`.
 
@@ -40,51 +40,60 @@ Tests can be run by doing `make test`.
 
 Build & Package
 ===============
-To build and package up the Spark Kernel, run
+To build and package up Toree, run
 ```
 make dist
 ```
 
-The resulting package of the kernel will be located at `./dist/spark-kernel-<VERSION>.tar.gz`. The uncompressed package is what is used is ran by Jupyter when doing `make dev`.
+The resulting package of the kernel will be located at `./dist//toree-kernel-<VERSION>.tar.gz`. The uncompressed package is what is used is ran by Jupyter when doing `make dev`.
 
+Reporting Issues
+================
+Refer to and open issue [here][issues]
+
+Communication
+=============
+You can reach us through [gitter][gitter-url] or our [mailing list][mail-list]
 
 Version
 =======
-Our goal is to keep `master` up to date with the latest version of Spark. When new versions of Spark require code changes, we create a separate branch. The table below shows what is available now.
+We are working on publishing binary releases of Toree soon. As part of our move into Apache Incubator, Toree will start a new version sequence starting at `0.1`. 
+
+Our goal is to keep `master` up to date with the latest version of Spark. When new versions of Spark require specific code changes to Toree, we will branch out older Spark version support. 
+
+As it stands, we maintain several branches for legacy versions of Spark. The table below shows what is available now.
 
-Branch                       | Spark Kernel Version | Apache Spark Version
----------------------------- | -------------------- | --------------------
-[master][master]             | 0.1.5                | 1.5.1+
-[branch-0.1.4][branch-0.1.4] | 0.1.4                | 1.4.1
-[branch-0.1.3][branch-0.1.3] | 0.1.3                | 1.3.1
+Branch                       | Apache Spark Version
+---------------------------- | --------------------
+[master][master]             | 1.5.1+
+[branch-0.1.4][branch-0.1.4] | 1.4.1
+[branch-0.1.3][branch-0.1.3] | 1.3.1
 
-Please note that for the most part, new features to Spark Kernel will only be added to the `master` branch.
+Please note that for the most part, new features will mainly be added to the `master` branch.
 
 Resources
 =========
 
-There is more detailed information available in our [Wiki][5] and our [Getting Started][4] guide.
+We are working on porting our documentation into Apache. For the time being, you can refer to this [Wiki][5] and our [Getting Started][4] guide. You may also visit our [website][website].
 
 [1]: https://spark.apache.org/
 [2]: https://github.com/ibm-et/spark-kernel/wiki/Guide-to-the-Comm-API-of-the-Spark-Kernel-and-Spark-Kernel-Client
 [3]: https://github.com/ibm-et/spark-kernel/wiki/Guide-to-Developing-Magics-for-the-Spark-Kernel
 [4]: https://github.com/ibm-et/spark-kernel/wiki/Getting-Started-with-the-Spark-Kernel
 [5]: https://github.com/ibm-et/spark-kernel/wiki
-[6]: https://github.com/ibm-et/spark-kernel/issues
 
+[website]: http://toree.apache.org
+[issues]: https://issues.apache.org/jira/browse/TOREE
 [build-badge]: https://travis-ci.org/ibm-et/spark-kernel.svg?branch=master
 [build-url]: https://travis-ci.org/ibm-et/spark-kernel
-[coverage-badge]: https://coveralls.io/repos/ibm-et/spark-kernel/badge.svg?branch=master
-[coverage-url]: https://coveralls.io/r/ibm-et/spark-kernel?branch=master
-[scaladoc-badge]: https://img.shields.io/badge/Scaladoc-Latest-34B6A8.svg?style=flat
-[scaladoc-url]: http://ibm-et.github.io/spark-kernel/latest/api
 [license-badge]: https://img.shields.io/badge/License-Apache%202-blue.svg?style=flat
 [license-url]: LICENSE
 [gitter-badge]: https://badges.gitter.im/Join%20Chat.svg
 [gitter-url]: https://gitter.im/ibm-et/spark-kernel
 [try-jupyter]: http://try.jupyter.org
 [vagrant]: https://www.vagrantup.com/
+[mail-list]: mailto:dev@toree.incubator.apache.org
 
-[master]: https://github.com/ibm-et/spark-kernel
-[branch-0.1.4]: https://github.com/ibm-et/spark-kernel/tree/branch-0.1.4
-[branch-0.1.3]: https://github.com/ibm-et/spark-kernel/tree/branch-0.1.3
+[master]: https://github.com/apache/incubator-toree
+[branch-0.1.4]: https://github.com/apache/incubator-toree/tree/branch-0.1.4
+[branch-0.1.3]: https://github.com/apache/incubator-toree/tree/branch-0.1.3


[32/51] [abbrv] incubator-toree git commit: Renamed com.ibm.spark to org.apache.toree

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
index 6bf986b..41b2d47 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
@@ -14,9 +14,9 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 case class ShutdownReply(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
index 6681169..e965b5c 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json.Json
 
 case class ShutdownRequest(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
index 12d5366..e818926 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import org.apache.toree.kernel.protocol.v5.KernelMessageContent
 import play.api.libs.json._
 
 case class StreamContent(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
index e163b28..cf6d43d 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 /**
  * Indicates that the implementation contains a method to return the type

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
index ad10884..304ad86 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 package object content {
   // Provide an ExecuteReplyOk type and object representing a

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
index 7f999dd..3eb2cd4 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol
+package org.apache.toree.kernel.protocol
 
-import com.ibm.spark.kernel.protocol.v5.MIMEType.MIMEType
+import org.apache.toree.kernel.protocol.v5.MIMEType.MIMEType
 import play.api.libs.json.{JsValue, Json, JsObject}
 
 package object v5 {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala b/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
index 517140c..edbfd8f 100644
--- a/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
+++ b/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import org.slf4j.LoggerFactory
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
index a84a51d..45acb4d 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommCallbacksSpec.scala
@@ -14,12 +14,12 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
 // TODO: Move duplicate code to separate project (kernel and client)
 
-import com.ibm.spark.comm.CommCallbacks._
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.comm.CommCallbacks._
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{FunSpec, Matchers}
 
 class CommCallbacksSpec extends FunSpec with Matchers {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
index f02333e..1bdbebf 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommManagerSpec.scala
@@ -14,12 +14,12 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.comm.CommCallbacks.{CloseCallback, OpenCallback}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.UUID
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommOpen}
+import org.apache.toree.comm.CommCallbacks.{CloseCallback, OpenCallback}
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.UUID
+import org.apache.toree.kernel.protocol.v5.content.{CommClose, CommOpen}
 import org.mockito.invocation.InvocationOnMock
 import org.mockito.stubbing.Answer
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
index ad6b7c6..dde8259 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommRegistrarSpec.scala
@@ -14,11 +14,11 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
 import java.util.UUID
 
-import com.ibm.spark.comm.CommCallbacks.{CloseCallback, MsgCallback, OpenCallback}
+import org.apache.toree.comm.CommCallbacks.{CloseCallback, MsgCallback, OpenCallback}
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
index f92b852..3adbd4f 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommStorageSpec.scala
@@ -14,10 +14,10 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.UUID
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.UUID
 import org.scalatest.mock.MockitoSugar
 import org.mockito.Mockito._
 import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala b/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
index 0818da3..b3f2b09 100644
--- a/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/comm/CommWriterSpec.scala
@@ -13,13 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
 import java.util.UUID
 
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
 import org.mockito.Matchers.{eq => mockEq, _}
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
index 2dd9b31..754ec2a 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilderSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 import org.scalatest.{Matchers, FunSpec}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
index d53d64e..815dbe6 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 import org.scalatest.{Matchers, FunSpec}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
index cd5116b..6abf28b 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
-import com.ibm.spark.kernel.protocol.v5.content.{CommOpen, StreamContent}
+import org.apache.toree.kernel.protocol.v5.content.{CommOpen, StreamContent}
 import org.scalatest.{Matchers, FunSpec}
 import play.api.libs.json._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
index 3811314..cce14e1 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 
 import org.scalatest.{FunSpec, Matchers}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
index 15ba4ed..f11f3f6 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
index 74b99fe..2b294a8 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class CommMsgSpec extends FunSpec with Matchers {
   val commMsgJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
index 3f216e9..d1bec90 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5.MsgData
+import org.apache.toree.kernel.protocol.v5.MsgData
 
 class CommOpenSpec extends FunSpec with Matchers {
   val commOpenJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
index ab41581..7710555 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
index a3edeec..8f50386 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
index a0e6a27..5ec860d 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{Matchers, FunSpec}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
index 3738354..47b8c14 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
index 7ebfb07..2ba3f5c 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
index af64d75..c2c5568 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
index 26b03e7..bda4267 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.FunSuite
 
 import org.scalatest.{Matchers, FunSpec}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class DisplayDataSpec extends FunSpec with Matchers {
   val displayDataJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
index 3321d1e..030f7cd 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{Matchers, FunSpec}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
index 7327785..6846836 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
index 5241650..60d4d3e 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
index 9859d5e..97e6a10 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class ExecuteReplyErrorSpec extends FunSpec with Matchers {
   val executeReplyErrorJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
index be73811..96ddbe0 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class ExecuteReplyOkSpec extends FunSpec with Matchers {
   val executeReplyOkJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
index 24af1f2..242ff99 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
index bb8cd71..5500b69 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{Matchers, FunSpec}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class ExecuteRequestSpec extends FunSpec with Matchers {
   val executeRequestJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
index fdbe3ca..8723fea 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class ExecuteResultSpec extends FunSpec with Matchers {
   val executeResultJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
index 4e69066..d144574 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class HistoryReplySpec extends FunSpec with Matchers {
   val historyReplyJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
index dc775fa..55fb801 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
index a5d14b1..3356905 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
index 7b5b3db..0fe0dac 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
index b88a39a..c3d98fa 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
index fcea013..28f07d0 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError
 import play.api.libs.json._
 
-import com.ibm.spark.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5._
 
 class InspectReplyOkSpec extends FunSpec with Matchers {
   val inspectReplyOkJson: JsValue = Json.parse("""

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
index 0ad56e9..435b34f 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
index 2ff561d..cb67fc1 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
index 7d704e2..2d07042 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
index e63b4c3..66b0830 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
index 4663d98..71fc9af 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
index 15e8eba..6ca748b 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
index fdc063d..5e9fec9 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
index 5c435a8..f60fdb9 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.content
+package org.apache.toree.kernel.protocol.v5.content
 
 import org.scalatest.{FunSpec, Matchers}
 import play.api.data.validation.ValidationError

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
index 0174f9b..9235d2b 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol
+package org.apache.toree.kernel.protocol
 
 //import akka.zeromq.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.{CompleteRequest, ExecuteRequest}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.{CompleteRequest, ExecuteRequest}
 import play.api.libs.json.Json
 
 package object v5Test {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
index e0e8f60..ef7a95b 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, SQLContextProducerLike, JavaSparkContextProducerLike}
-import com.ibm.spark.interpreter.broker.{BrokerState, BrokerBridge}
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, SQLContextProducerLike, JavaSparkContextProducerLike}
+import org.apache.toree.interpreter.broker.{BrokerState, BrokerBridge}
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
index 664c806..23512a5 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.BrokerException
+import org.apache.toree.interpreter.broker.BrokerException
 
 /**
  * Represents a generic PySpark exception.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
index 615ed19..b0e5d2b 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
 import java.net.URL
 
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
 import org.slf4j.LoggerFactory

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
index ace6635..13ef1c5 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
 import java.io.{FileOutputStream, File}
 
-import com.ibm.spark.interpreter.broker.BrokerProcess
+import org.apache.toree.interpreter.broker.BrokerProcess
 import org.apache.commons.exec.environment.EnvironmentUtils
 import org.apache.commons.exec._
 import org.apache.commons.io.IOUtils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
index ab2aeb1..ae66d5b 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.BrokerProcessHandler
+import org.apache.toree.interpreter.broker.BrokerProcessHandler
 
 /**
  * Represents the handler for events triggered by the PySpark process.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
index ec264e2..a9b1e1f 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.BrokerService
-import com.ibm.spark.kernel.interpreter.pyspark.PySparkTypes._
+import org.apache.toree.interpreter.broker.BrokerService
+import org.apache.toree.kernel.interpreter.pyspark.PySparkTypes._
 import org.apache.spark.SparkContext
 import org.slf4j.LoggerFactory
 import py4j.GatewayServer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
index 2d0f63f..946687f 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.BrokerState
+import org.apache.toree.interpreter.broker.BrokerState
 
 /**
  * Represents the state structure of PySpark.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
index 146ca8e..b26b3bd 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.BrokerTransformer
+import org.apache.toree.interpreter.broker.BrokerTransformer
 
 /**
  * Represents a utility that can transform raw PySpark information to

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
index 1004a1f..64e10df 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.pyspark
+package org.apache.toree.kernel.interpreter.pyspark
 
-import com.ibm.spark.interpreter.broker.BrokerTypesProvider
+import org.apache.toree.interpreter.broker.BrokerTypesProvider
 
 /**
  * Represents all types associated with the PySpark interface.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
index 618a678..f0d8760 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter
+package org.apache.toree.kernel.interpreter
 
-import com.ibm.spark.interpreter.broker.{BrokerCode, BrokerPromise}
+import org.apache.toree.interpreter.broker.{BrokerCode, BrokerPromise}
 
 /**
  * Contains aliases to broker types.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
index a0a79b5..343caa0 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
-import com.ibm.spark.kernel.interpreter.pyspark.{PySparkInterpreter, PySparkException}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
-import com.ibm.spark.magic.dependencies.IncludeKernel
+import org.apache.toree.interpreter.{ExecuteError, ExecuteAborted}
+import org.apache.toree.kernel.interpreter.pyspark.{PySparkInterpreter, PySparkException}
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.{CellMagicOutput, CellMagic}
+import org.apache.toree.magic.dependencies.IncludeKernel
 
 /**
  * Represents the magic interface to use the PySpark interpreter.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/resources/compile/reference.conf
----------------------------------------------------------------------
diff --git a/resources/compile/reference.conf b/resources/compile/reference.conf
index a01a88c..f28e97d 100644
--- a/resources/compile/reference.conf
+++ b/resources/compile/reference.conf
@@ -59,8 +59,8 @@ default_interpreter = "Scala"
 default_interpreter = ${?DEFAULT_INTERPRETER}
 
 default_interpreter_plugin = [
-  "Scala:com.ibm.spark.kernel.interpreter.scala.ScalaInterpreter",
-  "PySpark:com.ibm.spark.kernel.interpreter.pyspark.PySparkInterpreter",
-  "SparkR:com.ibm.spark.kernel.interpreter.sparkr.SparkRInterpreter",
-  "SQL:com.ibm.spark.kernel.interpreter.sql.SqlInterpreter"
+  "Scala:org.apache.toree.kernel.interpreter.scala.ScalaInterpreter",
+  "PySpark:org.apache.toree.kernel.interpreter.pyspark.PySparkInterpreter",
+  "SparkR:org.apache.toree.kernel.interpreter.sparkr.SparkRInterpreter",
+  "SQL:org.apache.toree.kernel.interpreter.sql.SqlInterpreter"
 ]

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/resources/test/reference.conf
----------------------------------------------------------------------
diff --git a/resources/test/reference.conf b/resources/test/reference.conf
index 6100469..50d1d59 100644
--- a/resources/test/reference.conf
+++ b/resources/test/reference.conf
@@ -58,9 +58,9 @@ default_interpreter = "Scala"
 default_interpreter = ${?DEFAULT_INTERPRETER}
 
 default_interpreter_plugin = [
-  "Scala:com.ibm.spark.kernel.interpreter.scala.ScalaInterpreter",
-  "PySpark:com.ibm.spark.kernel.interpreter.pyspark.PySparkInterpreter",
-  "SparkR:com.ibm.spark.kernel.interpreter.sparkr.SparkRInterpreter",
-  "SQL:com.ibm.spark.kernel.interpreter.sql.SqlInterpreter"
+  "Scala:org.apache.toree.kernel.interpreter.scala.ScalaInterpreter",
+  "PySpark:org.apache.toree.kernel.interpreter.pyspark.PySparkInterpreter",
+  "SparkR:org.apache.toree.kernel.interpreter.sparkr.SparkRInterpreter",
+  "SQL:org.apache.toree.kernel.interpreter.sql.SqlInterpreter"
 ]
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
index 978cf90..c28e27f 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.scala
+package org.apache.toree.kernel.interpreter.scala
 
 /**
  * Represents a generic Scala exception.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
index ca9bd7a..20fd410 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.interpreter.scala
+package org.apache.toree.kernel.interpreter.scala
 
 import java.io.{BufferedReader, ByteArrayOutputStream, InputStreamReader, PrintStream}
 import java.net.{URL, URLClassLoader}
@@ -23,12 +23,12 @@ import java.util.concurrent.ExecutionException
 
 import akka.actor.Actor
 import akka.actor.Actor.Receive
-import com.ibm.spark.global.StreamState
-import com.ibm.spark.interpreter
-import com.ibm.spark.interpreter._
-import com.ibm.spark.interpreter.imports.printers.{WrapperConsole, WrapperSystem}
-import com.ibm.spark.kernel.api.{KernelLike, KernelOptions}
-import com.ibm.spark.utils.{MultiOutputStream, TaskManager}
+import org.apache.toree.global.StreamState
+import org.apache.toree.interpreter
+import org.apache.toree.interpreter._
+import org.apache.toree.interpreter.imports.printers.{WrapperConsole, WrapperSystem}
+import org.apache.toree.kernel.api.{KernelLike, KernelOptions}
+import org.apache.toree.utils.{MultiOutputStream, TaskManager}
 import org.apache.spark.SparkContext
 import org.apache.spark.repl.{SparkCommandLine, SparkIMain, SparkJLineCompletion}
 import org.apache.spark.sql.SQLContext
@@ -239,7 +239,7 @@ class ScalaInterpreter() extends Interpreter {
   protected def bindKernelVarialble(kernel: KernelLike): Unit = {
     doQuietly {
       bind(
-        "kernel", "com.ibm.spark.kernel.api.Kernel",
+        "kernel", "org.apache.toree.kernel.api.Kernel",
         kernel, List( """@transient implicit""")
       )
     }

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
index c6c95af..064a9ca 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.interpreter.scala
+package org.apache.toree.kernel.interpreter.scala
 
 import org.apache.spark.repl.SparkCommandLine
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
index d175b80..6a49d10 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.interpreter.scala
+package org.apache.toree.kernel.interpreter.scala
 
 import org.apache.spark.repl.SparkIMain
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
index 9025316..1acc672 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.interpreter.scala
+package org.apache.toree.kernel.interpreter.scala
 
-import com.ibm.spark.utils.TaskManager
+import org.apache.toree.utils.TaskManager
 
 trait TaskManagerProducerLike {
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala b/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
index c850926..63e237b 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError}
-import com.ibm.spark.kernel.interpreter.scala.{ScalaException, ScalaInterpreter}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.dependencies.IncludeKernel
-import com.ibm.spark.magic.{CellMagic, CellMagicOutput}
+import org.apache.toree.interpreter.{ExecuteAborted, ExecuteError}
+import org.apache.toree.kernel.interpreter.scala.{ScalaException, ScalaInterpreter}
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.dependencies.IncludeKernel
+import org.apache.toree.magic.{CellMagic, CellMagicOutput}
 
 /**
  * Represents the magic interface to use the Scala interpreter.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala b/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
index 60cfcac..8e9a587 100644
--- a/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
+++ b/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
@@ -18,11 +18,11 @@ package integration.interpreter.scala
 
 import java.io.{ByteArrayOutputStream, OutputStream}
 
-import com.ibm.spark.global.StreamState
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.kernel.interpreter.scala.{ScalaInterpreter, StandardSettingsProducer, StandardSparkIMainProducer, StandardTaskManagerProducer}
-import com.ibm.spark.utils.{TaskManager, MultiOutputStream}
+import org.apache.toree.global.StreamState
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.kernel.interpreter.scala.{ScalaInterpreter, StandardSettingsProducer, StandardSparkIMainProducer, StandardTaskManagerProducer}
+import org.apache.toree.utils.{TaskManager, MultiOutputStream}
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala b/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
index 1b89df3..35ea035 100644
--- a/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
+++ b/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.interpreter.scala
+package org.apache.toree.kernel.interpreter.scala
 
 import java.io.{File, InputStream, OutputStream}
 import java.net.{URLClassLoader, URL}
 
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.utils.TaskManager
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.interpreter._
+import org.apache.toree.utils.TaskManager
 import org.apache.spark.SparkConf
 import org.apache.spark.repl.SparkIMain
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/resources/README.md
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/resources/README.md b/sparkr-interpreter/src/main/resources/README.md
index 89f05f5..9b602e7 100644
--- a/sparkr-interpreter/src/main/resources/README.md
+++ b/sparkr-interpreter/src/main/resources/README.md
@@ -29,7 +29,7 @@ kernel to provide a form of communicate suitable for use as an interpreter:
    package scope of `org.apache.spark.api.r`
    
        - To circumvent, use a reflective wrapping under 
-         `com.ibm.spark.kernel.interpreter.r.ReflectiveRBackend`
+         `org.apache.toree.kernel.interpreter.r.ReflectiveRBackend`
          
 Building the custom R bundle
 ----------------------------

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R b/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
index 8f9f3e9..8074bbe 100644
--- a/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
+++ b/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
@@ -47,7 +47,7 @@ sparkR.connect()
 
 # Retrieve the bridge used to perform actions on the JVM
 bridge <- callJStatic(
-  "com.ibm.spark.kernel.interpreter.sparkr.SparkRBridge", "sparkRBridge"
+  "org.apache.toree.kernel.interpreter.sparkr.SparkRBridge", "sparkRBridge"
 )
 
 # Retrieve the state used to pull code off the JVM and push results back

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
index 81cb86e..a1c6319 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
 /**
  * Provides reflective access into the backend R component that is not

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
index 44fa203..360d6c6 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, JavaSparkContextProducerLike, SQLContextProducerLike}
-import com.ibm.spark.interpreter.broker.{BrokerState, BrokerBridge}
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, JavaSparkContextProducerLike, SQLContextProducerLike}
+import org.apache.toree.interpreter.broker.{BrokerState, BrokerBridge}
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
index 0be8f61..1f91e0f 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.BrokerException
+import org.apache.toree.interpreter.broker.BrokerException
 
 /**
  * Represents a generic SparkR exception.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
index 45fe03c..ba49574 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
 import java.net.URL
 
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
 import org.slf4j.LoggerFactory

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
index 2429dc4..a56cf42 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.BrokerProcess
+import org.apache.toree.interpreter.broker.BrokerProcess
 import scala.collection.JavaConverters._
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
index d33d265..9082598 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.BrokerProcessHandler
+import org.apache.toree.interpreter.broker.BrokerProcessHandler
 
 /**
  * Represents the handler for events triggered by the SparkR process.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
index 71731a8..928b0df 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
 import java.util.concurrent.{TimeUnit, Semaphore}
 
-import com.ibm.spark.interpreter.broker.BrokerService
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.kernel.interpreter.sparkr.SparkRTypes.{Code, CodeResults}
+import org.apache.toree.interpreter.broker.BrokerService
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.kernel.interpreter.sparkr.SparkRTypes.{Code, CodeResults}
 import org.apache.spark.SparkContext
 import org.slf4j.LoggerFactory
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
index 60f67a3..4c7a210 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.BrokerState
+import org.apache.toree.interpreter.broker.BrokerState
 
 /**
  * Represents the state structure of SparkR.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
index 45c44c0..af28ac7 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.BrokerTransformer
+import org.apache.toree.interpreter.broker.BrokerTransformer
 
 /**
  * Represents the transformer used by SparkR.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
index 11f33c0..2fd2663 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTypes.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sparkr
+package org.apache.toree.kernel.interpreter.sparkr
 
-import com.ibm.spark.interpreter.broker.BrokerTypesProvider
+import org.apache.toree.interpreter.broker.BrokerTypesProvider
 
 /**
  * Represents all types associated with the SparkR interface.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
index 872d376..c84de63 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/package.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter
+package org.apache.toree.kernel.interpreter
 
-import com.ibm.spark.interpreter.broker.{BrokerCode, BrokerPromise}
+import org.apache.toree.interpreter.broker.{BrokerCode, BrokerPromise}
 
 /**
  * Contains aliases to broker types.



[37/51] [abbrv] incubator-toree git commit: Moving SparkKernel entry point to Main

Posted by lb...@apache.org.
Moving SparkKernel entry point to Main


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/ac330ed1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/ac330ed1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/ac330ed1

Branch: refs/heads/TestBranch
Commit: ac330ed1de044225bb9651a7315183b31a99226a
Parents: 9612a62
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Fri Jan 15 11:46:57 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Fri Jan 15 11:46:57 2016 -0600

----------------------------------------------------------------------
 .../src/main/scala/org/apache/toree/Main.scala  | 43 ++++++++++++++++++++
 .../scala/org/apache/toree/SparkKernel.scala    | 43 --------------------
 2 files changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/ac330ed1/kernel/src/main/scala/org/apache/toree/Main.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/Main.scala b/kernel/src/main/scala/org/apache/toree/Main.scala
new file mode 100644
index 0000000..1a8ac40
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/Main.scala
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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 org.apache.toree
+
+import org.apache.toree.boot.layer._
+import org.apache.toree.boot.{CommandLineOptions, KernelBootstrap}
+import org.apache.toree.kernel.BuildInfo
+
+object SparkKernel extends App {
+  private val options = new CommandLineOptions(args)
+
+  if (options.help) {
+    options.printHelpOn(System.out)
+  } else if (options.version) {
+    println(s"Kernel Version:       ${BuildInfo.version}")
+    println(s"Build Date:           ${BuildInfo.buildDate}")
+    println(s"Scala Version:        ${BuildInfo.scalaVersion}")
+    println(s"Apache Spark Version: ${BuildInfo.sparkVersion}")
+  } else {
+    (new KernelBootstrap(options.toConfig)
+      with StandardBareInitialization
+      with StandardComponentInitialization
+      with StandardHandlerInitialization
+      with StandardHookInitialization)
+      .initialize()
+      .waitForTermination()
+      .shutdown()
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/ac330ed1/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/SparkKernel.scala b/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
deleted file mode 100644
index 1a8ac40..0000000
--- a/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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 org.apache.toree
-
-import org.apache.toree.boot.layer._
-import org.apache.toree.boot.{CommandLineOptions, KernelBootstrap}
-import org.apache.toree.kernel.BuildInfo
-
-object SparkKernel extends App {
-  private val options = new CommandLineOptions(args)
-
-  if (options.help) {
-    options.printHelpOn(System.out)
-  } else if (options.version) {
-    println(s"Kernel Version:       ${BuildInfo.version}")
-    println(s"Build Date:           ${BuildInfo.buildDate}")
-    println(s"Scala Version:        ${BuildInfo.scalaVersion}")
-    println(s"Apache Spark Version: ${BuildInfo.sparkVersion}")
-  } else {
-    (new KernelBootstrap(options.toConfig)
-      with StandardBareInitialization
-      with StandardComponentInitialization
-      with StandardHandlerInitialization
-      with StandardHookInitialization)
-      .initialize()
-      .waitForTermination()
-      .shutdown()
-  }
-}


[42/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/StackActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/StackActor.scala b/kernel/src/test/scala/test/utils/StackActor.scala
index 35e6a3d..c343649 100644
--- a/kernel/src/test/scala/test/utils/StackActor.scala
+++ b/kernel/src/test/scala/test/utils/StackActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 test.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/TestProbeProxyActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/TestProbeProxyActor.scala b/kernel/src/test/scala/test/utils/TestProbeProxyActor.scala
index fa19102..a8c88dd 100644
--- a/kernel/src/test/scala/test/utils/TestProbeProxyActor.scala
+++ b/kernel/src/test/scala/test/utils/TestProbeProxyActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 test.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/macros/build.sbt
----------------------------------------------------------------------
diff --git a/macros/build.sbt b/macros/build.sbt
index 4a119f1..a980739 100644
--- a/macros/build.sbt
+++ b/macros/build.sbt
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 // Do not export a jar for this or publish anything (should serve just as a pre-processor)
 libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/macros/project/plugins.sbt
----------------------------------------------------------------------
diff --git a/macros/project/plugins.sbt b/macros/project/plugins.sbt
index 17346fa..e21a163 100644
--- a/macros/project/plugins.sbt
+++ b/macros/project/plugins.sbt
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 resolvers += Resolver.sonatypeRepo("releases")
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
----------------------------------------------------------------------
diff --git a/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala b/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
index 8f51434..4543664 100644
--- a/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
+++ b/macros/src/main/scala/org/apache/toree/annotations/Experimental.scala
@@ -1,9 +1,11 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,8 +13,9 @@
  *  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.
+ *  limitations under the License
  */
+
 package org.apache.toree.annotations
 
 import scala.language.experimental.macros

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/project/Build.scala
----------------------------------------------------------------------
diff --git a/project/Build.scala b/project/Build.scala
index 1ecba1d..95f0aa0 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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
  */
 
 import java.text.SimpleDateFormat

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/project/Common.scala
----------------------------------------------------------------------
diff --git a/project/Common.scala b/project/Common.scala
index a409de8..c70fbe8 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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
  */
 
 import org.apache.commons.io.FileUtils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/project/build.properties
----------------------------------------------------------------------
diff --git a/project/build.properties b/project/build.properties
index 02cb92b..69fc25e 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1,2 +1,19 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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
+#
+
 sbt.version=0.13.9
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/project/plugins.sbt
----------------------------------------------------------------------
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 7c01ef5..9c9f6ef 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,18 +1,20 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
+
 logLevel := Level.Warn
 
 resolvers += Classpaths.sbtPluginReleases

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/build.sbt
----------------------------------------------------------------------
diff --git a/protocol/build.sbt b/protocol/build.sbt
index e705600..6586f96 100644
--- a/protocol/build.sbt
+++ b/protocol/build.sbt
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
 resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/project/plugins.sbt
----------------------------------------------------------------------
diff --git a/protocol/project/plugins.sbt b/protocol/project/plugins.sbt
index 7d420a0..9444250 100644
--- a/protocol/project/plugins.sbt
+++ b/protocol/project/plugins.sbt
@@ -1,15 +1,16 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala b/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
index 8f3f560..f0bd63a 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
@@ -1,9 +1,11 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,8 +13,9 @@
  *  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.
+ *  limitations under the License
  */
+
 package org.apache.toree.comm
 
 import org.apache.toree.annotations.Experimental

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala b/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
index 536d69a..b6ba9c1 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala b/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
index 0495b34..e2342f5 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
@@ -1,9 +1,11 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,8 +13,9 @@
  *  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.
+ *  limitations under the License
  */
+
 package org.apache.toree.comm
 
 import org.apache.toree.annotations.Experimental

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
index 5d0be8f..dbdefad 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
index e16b2fe..8a181f8 100644
--- a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
@@ -1,9 +1,11 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,8 +13,9 @@
  *  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.
+ *  limitations under the License
  */
+
 package org.apache.toree.comm
 
 import org.apache.toree.annotations.Experimental

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
index c382ba4..1bb3926 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
index 61004a2..f019883 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
index e49a5cc..70eeb4b 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
index 5490670..6ef6663 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
index ffe0b0c..030bf2f 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
index a3e7e50..1f09326 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
index 85e961c..4053b43 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
index 0b69fdf..dbb0963 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
index a910ed4..85c1c2e 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
@@ -1,18 +1,21 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
+ *      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.
+ *  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 org.apache.toree.kernel.protocol.v5.content
 
 import org.apache.toree.kernel.protocol.v5.KernelMessageContent

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
index 16d47f9..f79561c 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
index dfee897..b4d2656 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
index 91faed9..5765e57 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
index a5d24b8..f6ceb5d 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
index 3b5c3cf..20fb96e 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
index 6da6527..d57c28d 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
index 436c68f..88c2594 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
index 2e649a7..95f7916 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
index 4eac017..018ceef 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
index e640861..108455d 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
index 3dc25b5..941b418 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
index a116d0a..028213f 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
index 17e8819..29e52a0 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
index 6a8bc1b..24db2df 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
index 985d3c4..f80171c 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
index d673b0d..2fd7f99 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
index 8847ff3..c60a3c1 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
index 4a8dc12..18527ca 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
index 0f23aa5..f78fe55 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
index a217ef1..ab473a3 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
index dcd7ad5..d7e148b 100644
--- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content



[46/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala b/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
index 57cdd63..03614ed 100644
--- a/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.global

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
index 0148057..3e13508 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
index 2227fea..9a0ffcb 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
index ea68d66..e112145 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
index 947f903..5343260 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
index a01249e..1c54495 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
index 399f110..871b732 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
index 7d7b478..ab17227 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
index 47bccce..d292022 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
index 2150981..46af0e3 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
index 5569fea..596dd65 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
index e7fb8a3..6a3892e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
index 0efc002..36aab44 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
index cab8dbd..a07f724 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
index 7a51ca6..2d7a553 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
index 56ba559..4de3895 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
index be4acd4..7f2b613 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
index 62a1b7e..610b319 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker.producer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
index 7835062..4a78c2b 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.broker.producer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
index 460a557..697cbd8 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.imports.printers

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
index 11c798e..c1c9db6 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.interpreter.imports.printers

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
index 37e0ddb..5aec706 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
index b0c33f7..1c0f201 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.api
 
 import java.io.{InputStream, OutputStream}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
index cda8546..9c110c5 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.api

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
index eca1a06..625c14e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.api
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
index 5e22b50..ab577dd 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.api

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
index f22d03a..b7494c3 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.api
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
index 0bb5b32..7e68624 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.magic
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
index f770608..b79a701 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
index 97a2b7d..a26eef2 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.magic
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
index 091f91c..584202b 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala b/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
index 9ca1ed5..e1e1372 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.magic
 
 import org.apache.toree.utils.DynamicReflectionSupport

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
index f8e026c..e8b706c 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
index 1f36e2b..d136811 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
index 1b8adbd..44c4d06 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
index 34d87c6..6f39137 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
index 477ea54..cf60540 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
index 4bace51..965769f 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
index e1d3db6..1bc33aa 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
index 641fade..b615629 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
index a33838a..2525dcc 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
index a547b2f..91b8348 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.magic.dependencies
 
 import org.apache.toree.magic.Magic

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
index 68b1a16..f0f0473 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/package.scala b/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
index cb2e51d..7f04364 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
index 20c1a2e..3225261 100644
--- a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.security


[13/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala b/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
deleted file mode 100644
index cb4f158..0000000
--- a/kernel/src/test/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.stream
-
-import java.util.UUID
-
-import akka.actor.{ActorSelection, ActorSystem}
-import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.ScheduledTaskManager
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest._
-import play.api.libs.json._
-import com.ibm.spark.kernel.protocol.v5.content.StreamContent
-
-import scala.concurrent.duration._
-
-class KernelOuputStreamSpec
-  extends TestKit(ActorSystem("KernelOutputStreamActorSystem"))
-  with FunSpecLike with Matchers with GivenWhenThen with BeforeAndAfter
-  with MockitoSugar
-{
-
-  private var mockActorLoader: ActorLoader = _
-  private var mockScheduledTaskManager: MockScheduledTaskManager = _
-  private var kernelOutputRelayProbe: TestProbe = _
-
-  //
-  // SHARED ELEMENTS BETWEEN TESTS
-  //
-
-  private val ExecutionCount = 3
-
-  private val MaxMessageTimeout = 1.second
-  private val MaxNoMessageTimeout = 200.milliseconds
-
-  private val GeneratedTaskId = UUID.randomUUID().toString
-
-  private val skeletonBuilder = KMBuilder()
-    .withIds(Nil).withSignature("").withContentString("")
-    .withParentHeader(Header("", "", "", "", "5.0"))
-
-  /**
-   * This stubs out the methods of the scheduled task manager and provides a
-   * form of verification, which is not (easily) doable with Mockito due to the
-   * call-by-name argument in addTask.
-   */
-  private class MockScheduledTaskManager extends ScheduledTaskManager {
-    private var addTaskCalled = false
-    private var removeTaskCalled = false
-    private var stopCalled = false
-
-    def verifyAddTaskCalled(): Unit = addTaskCalled should be (true)
-    def verifyRemoveTaskCalled(): Unit = removeTaskCalled should be (true)
-    def verifyStopCalled(): Unit = stopCalled should be (true)
-    def verifyAddTaskNotCalled(): Unit = addTaskCalled should be (false)
-    def verifyRemoveTaskNotCalled(): Unit = removeTaskCalled should be (false)
-    def verifyStopNotCalled(): Unit = stopCalled should be (false)
-    def resetVerify(): Unit = {
-      addTaskCalled = false
-      removeTaskCalled = false
-      stopCalled = false
-    }
-
-    override def addTask[T](executionDelay: Long, timeInterval: Long, task: => T): String =
-    { addTaskCalled = true; GeneratedTaskId }
-
-    override def removeTask(taskId: String): Boolean =
-    { removeTaskCalled = true; true }
-
-    override def stop(): Unit = stopCalled = true
-
-    def teardown(): Unit = super.stop()
-  }
-
-  before {
-    // Create a mock ActorLoader for the KernelOutputStream we are testing
-    mockActorLoader = mock[ActorLoader]
-
-    mockScheduledTaskManager = new MockScheduledTaskManager
-
-    // Create a probe for the relay and mock the ActorLoader to return the
-    // associated ActorSelection
-    kernelOutputRelayProbe = TestProbe()
-    val kernelOutputRelaySelection: ActorSelection =
-      system.actorSelection(kernelOutputRelayProbe.ref.path.toString)
-    doReturn(kernelOutputRelaySelection)
-      .when(mockActorLoader).load(SystemActorType.KernelMessageRelay)
-  }
-
-  after {
-    mockScheduledTaskManager.teardown()
-  }
-
-  describe("KernelOutputStream") {
-    describe("#write(Int)") {
-      it("should add a new byte to the internal list") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("a byte is written to the stream")
-        val expected = 'a'
-        kernelOutputStream.write(expected)
-
-        Then("it should be appended to the internal list")
-        kernelOutputStream.flush()
-        val message = kernelOutputRelayProbe
-          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
-        val executeResult = Json.parse(message.contentString).as[StreamContent]
-        executeResult.text should be (expected.toString)
-      }
-
-      it("should enable periodic flushing") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("a byte is written to the stream")
-        val expected = 'a'
-        kernelOutputStream.write(expected)
-
-        Then("it should add a task to periodically flush")
-        mockScheduledTaskManager.verifyAddTaskCalled()
-      }
-
-      it("should not enable periodic flushing if already enabled") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        And("periodic flushing is already enabled")
-        kernelOutputStream.write('a')
-        mockScheduledTaskManager.verifyAddTaskCalled()
-        mockScheduledTaskManager.resetVerify()
-
-        When("a byte is written to the stream")
-        kernelOutputStream.write('b')
-
-        Then("it should not add a task to periodically flush")
-        mockScheduledTaskManager.verifyAddTaskNotCalled()
-      }
-    }
-    describe("#flush") {
-      it("should disable periodic flushing") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("a byte is written to the stream")
-        val expected = 'a'
-        kernelOutputStream.write(expected)
-
-        And("flush is invoked")
-        kernelOutputStream.flush()
-
-        Then("it should remove the task to periodically flush")
-        mockScheduledTaskManager.verifyRemoveTaskCalled()
-      }
-
-      it("should not disable periodic flushing if not enabled") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("flush is invoked")
-        kernelOutputStream.flush()
-
-        Then("it should not remove the task to periodically flush")
-        mockScheduledTaskManager.verifyRemoveTaskNotCalled()
-      }
-
-      it("should not send empty (whitespace) messages if flag is false") {
-        Given("a kernel output stream with send empty output set to false")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager,
-          sendEmptyOutput = false
-        )
-
-        When("whitespace is created and flushed")
-        val expected = "\r \r \n \t"
-        kernelOutputStream.write(expected.getBytes)
-        kernelOutputStream.flush()
-
-        Then("no message should be sent")
-        kernelOutputRelayProbe.expectNoMsg(MaxNoMessageTimeout)
-      }
-
-      it("should send empty (whitespace) messages if flag is true") {
-        Given("a kernel output stream with send empty output set to false")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager,
-          sendEmptyOutput = true
-        )
-
-        When("whitespace is created and flushed")
-        val expected = "\r \r \n \t"
-        kernelOutputStream.write(expected.getBytes)
-        kernelOutputStream.flush()
-
-        Then("the whitespace message should have been sent")
-        val message = kernelOutputRelayProbe
-          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
-        val actual = Json.parse(message.contentString).as[StreamContent].text
-
-        actual should be (expected)
-      }
-
-      it("should set the ids of the kernel message") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("a string is written as the result and flushed")
-        val expected = "some string"
-        kernelOutputStream.write(expected.getBytes)
-        kernelOutputStream.flush()
-
-        Then("the ids should be set to execute_result")
-        val message = kernelOutputRelayProbe
-          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
-        message.ids should be (Seq(MessageType.Outgoing.Stream.toString))
-      }
-
-      it("should set the message type in the header of the kernel message to an execute_result") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("a string is written as the result and flushed")
-        val expected = "some string"
-        kernelOutputStream.write(expected.getBytes)
-        kernelOutputStream.flush()
-
-        Then("the msg_type in the header should be execute_result")
-        val message = kernelOutputRelayProbe
-          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
-        message.header.msg_type should be (MessageType.Outgoing.Stream.toString)
-      }
-
-      it("should set the content string of the kernel message") {
-        Given("a kernel output stream with a skeleton kernel builder")
-        val kernelOutputStream = new KernelOutputStream(
-          mockActorLoader, skeletonBuilder, mockScheduledTaskManager
-        )
-
-        When("a string is written as the result and flushed")
-        val expected = "some string"
-        kernelOutputStream.write(expected.getBytes)
-        kernelOutputStream.flush()
-
-        Then("the content string should have text/plain set to the string")
-        val message = kernelOutputRelayProbe
-          .receiveOne(MaxMessageTimeout).asInstanceOf[KernelMessage]
-        val executeResult = Json.parse(message.contentString).as[StreamContent]
-        executeResult.text should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddDepsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddDepsSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddDepsSpec.scala
deleted file mode 100644
index 956088c..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddDepsSpec.scala
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.{ByteArrayOutputStream, OutputStream}
-import java.net.URL
-
-import com.ibm.spark.dependencies.DependencyDownloader
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.utils.ArgumentParsingSupport
-import org.apache.spark.SparkContext
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{GivenWhenThen, Matchers, FunSpec}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies._
-
-class AddDepsSpec extends FunSpec with Matchers with MockitoSugar
-  with GivenWhenThen
-{
-  describe("AddDeps"){
-    describe("#execute") {
-      it("should print out the help message if the input is invalid") {
-        val byteArrayOutputStream = new ByteArrayOutputStream()
-        val mockIntp = mock[Interpreter]
-        val mockSC = mock[SparkContext]
-        val mockDownloader = mock[DependencyDownloader]
-        var printHelpWasRun = false
-
-        val addDepsMagic = new AddDeps
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeDependencyDownloader
-          with ArgumentParsingSupport
-        {
-          override val sparkContext: SparkContext = mockSC
-          override val interpreter: Interpreter = mockIntp
-          override val dependencyDownloader: DependencyDownloader =
-            mockDownloader
-          override val outputStream: OutputStream = byteArrayOutputStream
-
-          override def printHelp(
-            outputStream: OutputStream, usage: String
-          ): Unit = printHelpWasRun = true
-        }
-
-        val expected = LineMagicOutput
-        val actual = addDepsMagic.execute("notvalid")
-
-        printHelpWasRun should be (true)
-        verify(mockIntp, times(0)).addJars(any())
-        verify(mockIntp, times(0)).bind(any(), any(), any(), any())
-        verify(mockSC, times(0)).addJar(any())
-        verify(mockDownloader, times(0)).retrieve(
-          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
-        actual should be (expected)
-      }
-
-      it("should set the retrievals transitive to true if provided") {
-        val mockDependencyDownloader = mock[DependencyDownloader]
-        doReturn(Nil).when(mockDependencyDownloader).retrieve(
-          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
-
-        val addDepsMagic = new AddDeps
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeDependencyDownloader
-          with ArgumentParsingSupport
-        {
-          override val sparkContext: SparkContext = mock[SparkContext]
-          override val interpreter: Interpreter = mock[Interpreter]
-          override val dependencyDownloader: DependencyDownloader =
-            mockDependencyDownloader
-          override val outputStream: OutputStream = mock[OutputStream]
-        }
-
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: "--transitive" :: Nil
-        addDepsMagic.execute(expected.mkString(" "))
-
-        verify(mockDependencyDownloader).retrieve(
-          expected(0), expected(1), expected(2), true)
-      }
-
-      it("should set the retrieval's transitive to false if not provided") {
-        val mockDependencyDownloader = mock[DependencyDownloader]
-        doReturn(Nil).when(mockDependencyDownloader).retrieve(
-          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
-
-        val addDepsMagic = new AddDeps
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeDependencyDownloader
-          with ArgumentParsingSupport
-        {
-          override val sparkContext: SparkContext = mock[SparkContext]
-          override val interpreter: Interpreter = mock[Interpreter]
-          override val dependencyDownloader: DependencyDownloader =
-            mockDependencyDownloader
-          override val outputStream: OutputStream = mock[OutputStream]
-        }
-
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
-        addDepsMagic.execute(expected.mkString(" "))
-
-        verify(mockDependencyDownloader).retrieve(
-          expected(0), expected(1), expected(2), false)
-      }
-
-      it("should add retrieved artifacts to the interpreter") {
-        val mockDependencyDownloader = mock[DependencyDownloader]
-        doReturn(Nil).when(mockDependencyDownloader).retrieve(
-          anyString(), anyString(), anyString(), anyBoolean(), anyBoolean())
-        val mockInterpreter = mock[Interpreter]
-
-        val addDepsMagic = new AddDeps
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeDependencyDownloader
-          with ArgumentParsingSupport
-        {
-          override val sparkContext: SparkContext = mock[SparkContext]
-          override val interpreter: Interpreter = mockInterpreter
-          override val dependencyDownloader: DependencyDownloader =
-            mockDependencyDownloader
-          override val outputStream: OutputStream = mock[OutputStream]
-        }
-
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
-        addDepsMagic.execute(expected.mkString(" "))
-
-        verify(mockInterpreter).addJars(any[URL])
-      }
-
-      it("should add retrieved artifacts to the spark context") {
-        val mockDependencyDownloader = mock[DependencyDownloader]
-        val fakeUrl = new URL("file:/foo")
-        doReturn(fakeUrl :: fakeUrl :: fakeUrl :: Nil)
-          .when(mockDependencyDownloader).retrieve(
-            anyString(), anyString(), anyString(), anyBoolean(), anyBoolean()
-          )
-        val mockSparkContext = mock[SparkContext]
-
-        val addDepsMagic = new AddDeps
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeDependencyDownloader
-          with ArgumentParsingSupport
-        {
-          override val sparkContext: SparkContext = mockSparkContext
-          override val interpreter: Interpreter = mock[Interpreter]
-          override val dependencyDownloader: DependencyDownloader =
-            mockDependencyDownloader
-          override val outputStream: OutputStream = mock[OutputStream]
-        }
-
-        val expected = "com.ibm.spark" :: "kernel" :: "1.0" :: Nil
-        addDepsMagic.execute(expected.mkString(" "))
-
-        verify(mockSparkContext, times(3)).addJar(anyString())
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddJarSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddJarSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddJarSpec.scala
deleted file mode 100644
index 5612c8a..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/AddJarSpec.scala
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.OutputStream
-import java.net.URL
-import java.nio.file.{FileSystems, Files}
-
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.dependencies.{IncludeConfig, IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
-import com.typesafe.config.ConfigFactory
-import org.apache.spark.SparkContext
-import org.scalatest.{Matchers, FunSpec}
-import org.scalatest.mock.MockitoSugar
-
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import com.ibm.spark.magic.MagicLoader
-
-class AddJarSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("AddJar"){
-    describe("#execute") {
-      it("should call addJar on the provided SparkContext and addJars on the " +
-         "provided interpreter") {
-        val mockSparkContext = mock[SparkContext]
-        val mockInterpreter = mock[Interpreter]
-        val mockOutputStream = mock[OutputStream]
-        val mockMagicLoader = mock[MagicLoader]
-        val testConfig = ConfigFactory.load()
-
-        val addJarMagic = new AddJar
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeConfig
-        {
-          override val sparkContext: SparkContext = mockSparkContext
-          override val interpreter: Interpreter = mockInterpreter
-          override val outputStream: OutputStream = mockOutputStream
-          override lazy val magicLoader: MagicLoader = mockMagicLoader
-          override val config = testConfig
-          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL =
-            new URL("file://someFile") // Cannot mock URL
-        }
-
-        addJarMagic.execute("""http://www.example.com/someJar.jar""")
-
-        verify(mockSparkContext).addJar(anyString())
-        verify(mockInterpreter).addJars(any[URL])
-        verify(mockMagicLoader, times(0)).addJar(any())
-      }
-
-      it("should raise exception if jar file does not end in .jar or .zip") {
-        val mockOutputStream = mock[OutputStream]
-
-        val addJarMagic = new AddJar
-          with IncludeOutputStream
-        {
-          override val outputStream: OutputStream = mockOutputStream
-        }
-
-        intercept[IllegalArgumentException] {
-          addJarMagic.execute("""http://www.example.com/""")
-        }
-        intercept[IllegalArgumentException] {
-          addJarMagic.execute("""http://www.example.com/not_a_jar""")
-        }
-      }
-
-      it("should extract jar file name from jar URL") {
-        val mockOutputStream = mock[OutputStream]
-
-        val addJarMagic = new AddJar
-          with IncludeOutputStream
-        {
-          override val outputStream: OutputStream = mockOutputStream
-        }
-
-        var url = """http://www.example.com/someJar.jar"""
-        var jarName = addJarMagic.getFileFromLocation(url)
-        assert(jarName == "someJar.jar")
-
-        url = """http://www.example.com/remotecontent?filepath=/path/to/someJar.jar"""
-        jarName = addJarMagic.getFileFromLocation(url)
-        assert(jarName == "someJar.jar")
-
-        url = """http://www.example.com/"""
-        jarName = addJarMagic.getFileFromLocation(url)
-        assert(jarName == "")
-      }
-
-      it("should use a cached jar if the force option is not provided") {
-        val mockSparkContext = mock[SparkContext]
-        val mockInterpreter = mock[Interpreter]
-        val mockOutputStream = mock[OutputStream]
-        var downloadFileCalled = false  // Used to verify that downloadFile
-                                        // was or was not called in this test
-        val testConfig = ConfigFactory.load()
-
-        val addJarMagic = new AddJar
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeConfig
-        {
-          override val sparkContext: SparkContext = mockSparkContext
-          override val interpreter: Interpreter = mockInterpreter
-          override val outputStream: OutputStream = mockOutputStream
-          override val config = testConfig
-          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL = {
-            downloadFileCalled = true
-            new URL("file://someFile") // Cannot mock URL
-          }
-        }
-
-        // Create a temporary file representing our jar to fake the cache
-        val tmpFilePath = Files.createTempFile(
-          FileSystems.getDefault.getPath(AddJar.getJarDir(testConfig)),
-          "someJar",
-          ".jar"
-        )
-
-        addJarMagic.execute(
-          """http://www.example.com/""" + tmpFilePath.getFileName)
-
-        tmpFilePath.toFile.delete()
-
-        downloadFileCalled should be (false)
-        verify(mockSparkContext).addJar(anyString())
-        verify(mockInterpreter).addJars(any[URL])
-      }
-
-      it("should not use a cached jar if the force option is provided") {
-        val mockSparkContext = mock[SparkContext]
-        val mockInterpreter = mock[Interpreter]
-        val mockOutputStream = mock[OutputStream]
-        var downloadFileCalled = false  // Used to verify that downloadFile
-                                        // was or was not called in this test
-        val testConfig = ConfigFactory.load()
-
-        val addJarMagic = new AddJar
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeConfig
-        {
-          override val sparkContext: SparkContext = mockSparkContext
-          override val interpreter: Interpreter = mockInterpreter
-          override val outputStream: OutputStream = mockOutputStream
-          override val config = testConfig
-          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL = {
-            downloadFileCalled = true
-            new URL("file://someFile") // Cannot mock URL
-          }
-        }
-
-        // Create a temporary file representing our jar to fake the cache
-        val tmpFilePath = Files.createTempFile(
-          FileSystems.getDefault.getPath(AddJar.getJarDir(testConfig)),
-          "someJar",
-          ".jar"
-        )
-
-        addJarMagic.execute(
-          """-f http://www.example.com/""" + tmpFilePath.getFileName)
-
-        tmpFilePath.toFile.delete()
-
-        downloadFileCalled should be (true)
-        verify(mockSparkContext).addJar(anyString())
-        verify(mockInterpreter).addJars(any[URL])
-      }
-
-      it("should add magic jar to magicloader and not to interpreter and spark"+
-         "context") {
-        val mockSparkContext = mock[SparkContext]
-        val mockInterpreter = mock[Interpreter]
-        val mockOutputStream = mock[OutputStream]
-        val mockMagicLoader = mock[MagicLoader]
-        val testConfig = ConfigFactory.load()
-
-        val addJarMagic = new AddJar
-          with IncludeSparkContext
-          with IncludeInterpreter
-          with IncludeOutputStream
-          with IncludeConfig
-        {
-          override val sparkContext: SparkContext = mockSparkContext
-          override val interpreter: Interpreter = mockInterpreter
-          override val outputStream: OutputStream = mockOutputStream
-          override lazy val magicLoader: MagicLoader = mockMagicLoader
-          override val config = testConfig
-          override def downloadFile(fileUrl: URL, destinationUrl: URL): URL =
-            new URL("file://someFile") // Cannot mock URL
-        }
-
-        addJarMagic.execute(
-          """--magic http://www.example.com/someJar.jar""")
-
-        verify(mockMagicLoader).addJar(any())
-        verify(mockSparkContext, times(0)).addJar(anyString())
-        verify(mockInterpreter, times(0)).addJars(any[URL])
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/BuiltinLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/BuiltinLoaderSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/BuiltinLoaderSpec.scala
deleted file mode 100644
index d2abde7..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/BuiltinLoaderSpec.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpec}
-
-class BuiltinLoaderSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("BuiltinLoader") {
-    describe("#getClasses") {
-      it("should return classes in a package") {
-        val pkg = this.getClass.getPackage.getName
-        val classes = new BuiltinLoader().getClasses(pkg)
-        classes.size shouldNot be(0)
-      }
-    }
-
-    describe("#loadClasses") {
-      it("should return class objects for classes in a package") {
-        val pkg = this.getClass.getPackage.getName
-        val classes = new BuiltinLoader().loadClasses(pkg).toList
-        classes.contains(this.getClass) should be (true)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/HtmlSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/HtmlSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/HtmlSpec.scala
deleted file mode 100644
index 541cfcd..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/HtmlSpec.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.CellMagicOutput
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers}
-
-class HtmlSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("Html"){
-    describe("#execute") {
-      it("should return the entire cell's contents with the MIME type of " +
-         "text/html") {
-        val htmlMagic = new Html
-
-        val code = "some code on a line\nanother line"
-        val expected = CellMagicOutput(MIMEType.TextHtml -> code)
-        htmlMagic.execute(code) should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/JavaScriptSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/JavaScriptSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/JavaScriptSpec.scala
deleted file mode 100644
index 33dfbd5..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/JavaScriptSpec.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers}
-import com.ibm.spark.magic.CellMagicOutput
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-
-class JavaScriptSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("JavaScript"){
-    describe("#execute") {
-      it("should return the entire cell's contents with the MIME type of text/javascript") {
-        val javaScriptMagic = new JavaScript
-
-        val code = "some code on a line\nmore code on another line"
-        val expected = CellMagicOutput(MIMEType.ApplicationJavaScript -> code)
-        javaScriptMagic.execute(code) should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/LSMagicSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/LSMagicSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/LSMagicSpec.scala
deleted file mode 100644
index 60b4a6a..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/LSMagicSpec.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.ibm.spark.magic.builtin
-
-import java.io.OutputStream
-import java.net.URL
-
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.dependencies.{IncludeOutputStream, IncludeInterpreter, IncludeSparkContext}
-import com.ibm.spark.magic.{CellMagic, LineMagic}
-import org.apache.spark.SparkContext
-import org.scalatest.{Matchers, FunSpec}
-import org.scalatest.mock.MockitoSugar
-
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-class TestLSMagic(sc: SparkContext, intp: Interpreter, os: OutputStream)
-  extends LSMagic
-  with IncludeSparkContext
-  with IncludeInterpreter
-  with IncludeOutputStream
-  {
-    override val sparkContext: SparkContext = sc
-    override val interpreter: Interpreter = intp
-    override val outputStream: OutputStream = os
-  }
-
-class LSMagicSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("LSMagic") {
-
-    describe("#execute") {
-      it("should call println with a magics message") {
-        val lsm = spy(new TestLSMagic(
-          mock[SparkContext], mock[Interpreter], mock[OutputStream])
-        )
-        val classList = new BuiltinLoader().loadClasses()
-        lsm.execute("")
-        verify(lsm).magicNames("%", classOf[LineMagic], classList)
-        verify(lsm).magicNames("%%", classOf[CellMagic], classList)
-      }
-    }
-
-    describe("#magicNames") {
-      it("should filter classnames by interface") {
-        val prefix = "%"
-        val interface = classOf[LineMagic]
-        val classes : List[Class[_]] = List(classOf[LSMagic], classOf[Integer])
-        val lsm = new TestLSMagic(
-          mock[SparkContext], mock[Interpreter], mock[OutputStream])
-        lsm.magicNames(prefix, interface, classes).length should be(1)
-      }
-      it("should prepend prefix to each name"){
-        val prefix = "%"
-        val className = classOf[LSMagic].getSimpleName
-        val interface = classOf[LineMagic]
-        val expected = s"${prefix}${className}"
-        val classes : List[Class[_]] = List(classOf[LSMagic], classOf[Integer])
-        val lsm = new TestLSMagic(
-          mock[SparkContext], mock[Interpreter], mock[OutputStream])
-        lsm.magicNames(prefix, interface, classes) should be(List(expected))
-      }
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/magic/builtin/RDDSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/magic/builtin/RDDSpec.scala b/kernel/src/test/scala/com/ibm/spark/magic/builtin/RDDSpec.scala
deleted file mode 100644
index 56b4cb7..0000000
--- a/kernel/src/test/scala/com/ibm/spark/magic/builtin/RDDSpec.scala
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter.{Results, ExecuteAborted, ExecuteError, Interpreter}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
-import org.apache.spark.sql.DataFrame
-import org.apache.spark.sql.types.StructType
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-import play.api.libs.json.Json
-
-class RDDSpec extends FunSpec with Matchers with MockitoSugar with BeforeAndAfter {
-
-  val resOutput = "res1: org.apache.spark.sql.SchemaRDD ="
-
-  val mockInterpreter = mock[Interpreter]
-  val mockDataFrame = mock[DataFrame]
-  val mockRdd = mock[org.apache.spark.rdd.RDD[Any]]
-  val mockStruct = mock[StructType]
-  val columns = Seq("foo", "bar").toArray
-  val rows = Array( Array("a", "b"), Array("c", "d") )
-
-  doReturn(mockStruct).when(mockDataFrame).schema
-  doReturn(columns).when(mockStruct).fieldNames
-  doReturn(mockRdd).when(mockDataFrame).map(any())(any())
-  doReturn(rows).when(mockRdd).take(anyInt())
-
-  val rddMagic = new RDD with IncludeKernelInterpreter {
-    override val kernelInterpreter: Interpreter = mockInterpreter
-  }
-
-  before {
-    doReturn(Some("someRDD")).when(mockInterpreter).lastExecutionVariableName
-    doReturn(Some(mockDataFrame)).when(mockInterpreter).read(anyString())
-    doReturn((Results.Success, Left(resOutput)))
-      .when(mockInterpreter).interpret(anyString(), anyBoolean())
-  }
-
-  describe("RDD") {
-    describe("#execute") {
-      it("should return valid JSON when the executed code evaluates to a " +
-         "SchemaRDD") {
-        val magicOutput = rddMagic.execute("schemaRDD")
-        magicOutput.contains(MIMEType.ApplicationJson) should be (true)
-        Json.parse(magicOutput(MIMEType.ApplicationJson))
-      }
-
-      it("should return normally when the executed code does not evaluate to " +
-         "a SchemaRDD") {
-        doReturn((mock[Result], Left("foo"))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-        val magicOutput = rddMagic.execute("")
-        magicOutput.contains(MIMEType.PlainText) should be (true)
-      }
-
-      it("should return error message when the interpreter does not return " +
-         "SchemaRDD as expected") {
-        doReturn(Some("foo")).when(mockInterpreter).read(anyString())
-        val magicOutput = rddMagic.execute("")
-        magicOutput.contains(MIMEType.PlainText) should be (true)
-      }
-
-      it("should throw a Throwable if the interpreter returns an ExecuteError"){
-        val expected = "some error message"
-        val mockExecuteError = mock[ExecuteError]
-        doReturn(expected).when(mockExecuteError).value
-
-        doReturn((mock[Result], Right(mockExecuteError))).when(mockInterpreter)
-          .interpret(anyString(), anyBoolean())
-        val actual = {
-          val exception = intercept[Throwable] {
-            rddMagic.execute("")
-          }
-          exception.getLocalizedMessage
-        }
-
-        actual should be (expected)
-      }
-
-      it("should throw a Throwable if the interpreter returns an " +
-         "ExecuteAborted") {
-        val expected = "RDD magic aborted!"
-        val mockExecuteAborted = mock[ExecuteAborted]
-
-        doReturn((mock[Result], Right(mockExecuteAborted)))
-          .when(mockInterpreter).interpret(anyString(), anyBoolean())
-        val actual = {
-          val exception = intercept[Throwable] {
-            rddMagic.execute("")
-          }
-          exception.getLocalizedMessage
-        }
-
-        actual should be (expected)
-      }
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/com/ibm/spark/utils/json/RddToJsonSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/com/ibm/spark/utils/json/RddToJsonSpec.scala b/kernel/src/test/scala/com/ibm/spark/utils/json/RddToJsonSpec.scala
deleted file mode 100644
index 121d35e..0000000
--- a/kernel/src/test/scala/com/ibm/spark/utils/json/RddToJsonSpec.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils.json
-
-import org.apache.spark.rdd.RDD
-import org.apache.spark.sql.DataFrame
-import org.apache.spark.sql.types.StructType
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpec}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import play.api.libs.json.{JsArray, JsString, Json}
-
-class RddToJsonSpec extends FunSpec with MockitoSugar with Matchers {
-
-  val mockDataFrame = mock[DataFrame]
-  val mockRdd = mock[RDD[Any]]
-  val mockStruct = mock[StructType]
-  val columns = Seq("foo", "bar").toArray
-  val rows = Array( Array("a", "b"), Array("c", "d") )
-
-  doReturn(mockStruct).when(mockDataFrame).schema
-  doReturn(columns).when(mockStruct).fieldNames
-  doReturn(mockRdd).when(mockDataFrame).map(any())(any())
-  doReturn(rows).when(mockRdd).take(anyInt())
-
-  describe("RddToJson") {
-    describe("#convert(SchemaRDD)") {
-      it("should convert to valid JSON object") {
-
-        val json = RddToJson.convert(mockDataFrame)
-        val jsValue = Json.parse(json)
-
-        jsValue \ "columns" should be (JsArray(Seq(JsString("foo"), JsString("bar"))))
-        jsValue \ "rows" should be (JsArray(Seq(
-          JsArray(Seq(JsString("a"), JsString("b"))),
-          JsArray(Seq(JsString("c"), JsString("d"))))))
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
new file mode 100644
index 0000000..703d677
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.boot
+
+import java.io.File
+
+import com.typesafe.config.Config
+import joptsimple.OptionException
+import org.scalatest.{FunSpec, Matchers}
+
+import scala.collection.JavaConverters._
+
+class CommandLineOptionsSpec extends FunSpec with Matchers {
+
+  describe("CommandLineOptions") {
+    describe("when received --max-interpreter-threads=<int>") {
+      it("should set the configuration to the specified value") {
+        val expected = 999
+        val options = new CommandLineOptions(
+          s"--max-interpreter-threads=$expected" :: Nil
+        )
+
+        val actual = options.toConfig.getInt("max_interpreter_threads")
+
+        actual should be (expected)
+      }
+    }
+
+    describe("when received --help") {
+      it("should set the help flag to true") {
+        val options = new CommandLineOptions("--help" :: Nil)
+
+        options.help should be (true)
+      }
+    }
+
+    describe("when received -h") {
+      it("should set the help flag to true") {
+        val options = new CommandLineOptions("-h" :: Nil)
+
+        options.help should be (true)
+      }
+    }
+
+    describe("when not received --help or -h") {
+      it("should set the help flag to false") {
+        val options = new CommandLineOptions(Nil)
+
+        options.help should be (false)
+      }
+    }
+
+    describe("when received --version") {
+      it("should set the version flag to true") {
+        val options = new CommandLineOptions("--version" :: Nil)
+
+        options.version should be (true)
+      }
+    }
+
+    describe("when received -v") {
+      it("should set the version flag to true") {
+        val options = new CommandLineOptions("-v" :: Nil)
+
+        options.version should be (true)
+      }
+    }
+
+    describe("when not received --version or -v") {
+      it("should set the version flag to false") {
+        val options = new CommandLineOptions(Nil)
+
+        options.version should be (false)
+      }
+    }
+
+    describe("when received --spark-conf=<key>=<value>") {
+      it("should add the key-value pair to the string representation") {
+        val expected = "key=value"
+        val options = new CommandLineOptions(s"--spark-conf=$expected" :: Nil)
+        val actual = options.toConfig.getString("spark_configuration")
+
+        actual should be (expected)
+      }
+
+      it("should append to existing command line key-value pairs") {
+        val expected = "key1=value1" :: "key2=value2" :: Nil
+        val options = new CommandLineOptions(
+          s"--spark-conf=${expected(0)}" ::
+          s"--spark-conf=${expected(1)}" ::
+          Nil
+        )
+        val actual = options.toConfig.getString("spark_configuration")
+
+        actual should be (expected.mkString(","))
+      }
+    }
+
+    describe("when received -S<key>=<value>") {
+      it("should add the key-value pair to the string representation") {
+        val expected = "key=value"
+        val options = new CommandLineOptions(s"-S$expected" :: Nil)
+        val actual = options.toConfig.getString("spark_configuration")
+
+        actual should be(expected)
+      }
+
+      it("should append to existing command line key-value pairs") {
+        val expected = "key1=value1" :: "key2=value2" :: Nil
+        val options = new CommandLineOptions(
+          s"-S${expected(0)}" ::
+          s"-S${expected(1)}" ::
+          Nil
+        )
+        val actual = options.toConfig.getString("spark_configuration")
+
+        actual should be (expected.mkString(","))
+      }
+    }
+
+    describe("when received --profile=<path>") {
+      it("should error if path is not set") {
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--profile"))
+        }
+      }
+
+      describe("#toConfig") {
+        it("should include values specified in file") {
+
+          val pathToProfileFixture: String = new File(getClass.getResource("/fixtures/profile.json").toURI).getAbsolutePath
+          val options = new CommandLineOptions(Seq("--profile="+pathToProfileFixture))
+
+          val config: Config = options.toConfig
+
+          config.entrySet() should not be ('empty)
+          config.getInt("stdin_port") should be(12345)
+          config.getInt("shell_port") should be(54321)
+          config.getInt("iopub_port") should be(11111)
+          config.getInt("control_port") should be(22222)
+          config.getInt("hb_port") should be(33333)
+        }
+      }
+    }
+
+    describe("when received --<protocol port name>=<value>"){
+      it("should error if value is not set") {
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--stdin-port"))
+        }
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--shell-port"))
+        }
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--iopub-port"))
+        }
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--control-port"))
+        }
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--heartbeat-port"))
+        }
+      }
+
+      describe("#toConfig") {
+        it("should return config with commandline option values") {
+
+          val options = new CommandLineOptions(List(
+            "--stdin-port", "99999",
+            "--shell-port", "88888",
+            "--iopub-port", "77777",
+            "--control-port", "55555",
+            "--heartbeat-port", "44444"
+          ))
+
+          val config: Config = options.toConfig
+
+          config.entrySet() should not be ('empty)
+          config.getInt("stdin_port") should be(99999)
+          config.getInt("shell_port") should be(88888)
+          config.getInt("iopub_port") should be(77777)
+          config.getInt("control_port") should be(55555)
+          config.getInt("hb_port") should be(44444)
+        }
+      }
+    }
+
+    describe("when received --profile and --<protocol port name>=<value>"){
+      describe("#toConfig") {
+        it("should return config with <protocol port> argument value") {
+
+          val pathToProfileFixture: String = (new File(getClass.getResource("/fixtures/profile.json").toURI)).getAbsolutePath
+          val options = new CommandLineOptions(List("--profile", pathToProfileFixture, "--stdin-port", "99999", "--shell-port", "88888"))
+
+          val config: Config = options.toConfig
+
+          config.entrySet() should not be ('empty)
+          config.getInt("stdin_port") should be(99999)
+          config.getInt("shell_port") should be(88888)
+          config.getInt("iopub_port") should be(11111)
+          config.getInt("control_port") should be(22222)
+        }
+      }
+
+    }
+
+    describe("when no arguments are received"){
+      describe("#toConfig") {
+        it("should read default value set in reference.conf") {
+
+          val options = new CommandLineOptions(Nil)
+
+          val config: Config = options.toConfig
+          config.getInt("stdin_port") should be(48691)
+          config.getInt("shell_port") should be(40544)
+          config.getInt("iopub_port") should be(43462)
+          config.getInt("control_port") should be(44808)
+        }
+      }
+    }
+
+    describe("when using -- to separate interpreter arguments"){
+      describe("#toConfig") {
+        it("should return interpreter_args config property when there are args before --") {
+
+          val options = new CommandLineOptions(List("--stdin-port", "99999", "--shell-port", "88888", "--", "someArg1", "someArg2", "someArg3"))
+
+          val config: Config = options .toConfig
+
+          config.entrySet() should not be ('empty)
+          config.getStringList("interpreter_args").asScala should be (List("someArg1", "someArg2", "someArg3"))
+        }
+
+        it("should return interpreter_args config property when args is at the beginning") {
+
+          val options = new CommandLineOptions(List("--", "someArg1", "someArg2", "someArg3"))
+
+          val config: Config = options .toConfig
+
+          config.entrySet() should not be ('empty)
+          config.getStringList("interpreter_args").asScala should be (List("someArg1", "someArg2", "someArg3"))
+        }
+
+        it("should return interpreter_args config property as empty list when there is nothing after --") {
+
+          val options = new CommandLineOptions(List("--stdin-port", "99999", "--shell-port", "88888", "--"))
+
+          val config: Config = options .toConfig
+
+          config.entrySet() should not be ('empty)
+          config.getStringList("interpreter_args").asScala should be ('empty)
+        }
+      }
+    }
+
+    describe("when received --ip=<value>") {
+      it("should error if value is not set") {
+        intercept[OptionException] {
+          new CommandLineOptions(Seq("--ip"))
+        }
+      }
+
+      describe("#toConfig") {
+        it("should set ip to specified value") {
+          val expected = "1.2.3.4"
+          val options = new CommandLineOptions(s"--ip=${expected}" :: Nil)
+          val config: Config = options.toConfig
+
+          config.getString("ip") should be(expected)
+        }
+
+        it("should set ip to 127.0.0.1") {
+          val options = new CommandLineOptions(Nil)
+          val config: Config = options.toConfig
+
+          config.getString("ip") should be("127.0.0.1")
+        }
+      }
+    }
+
+    describe("when received options with surrounding whitespace") {
+      it("should trim whitespace") {
+        val url1 = "url1"
+        val url2 = "url2"
+
+        val options = new CommandLineOptions(Seq(
+          " --magic-url ", s" ${url1}\t",
+          "--magic-url", s" \t ${url2} \t"
+        ))
+        val config: Config = options.toConfig
+
+        config.getList("magic_urls").unwrapped.asScala should
+          be (Seq(url1, url2))
+      }
+    }
+
+    describe("when received --interpreter-plugin") {
+      it("should return the interpreter-plugin along with the defaults") {
+        val options = new CommandLineOptions(Seq(
+          "--interpreter-plugin",
+          "dummy:test.utils.DummyInterpreter"
+        ))
+
+        val config: Config = options.toConfig
+
+        val p = config.getList("interpreter_plugins")
+
+        p should not be empty
+
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala b/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
new file mode 100644
index 0000000..7b4442c
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.CommContent
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.scalatest.mock.MockitoSugar
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+
+class KernelCommManagerSpec extends FunSpec with Matchers with BeforeAndAfter
+  with MockitoSugar
+{
+  private val TestTargetName = "some target"
+
+  private var mockActorLoader: ActorLoader = _
+  private var mockKMBuilder: KMBuilder = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var kernelCommManager: KernelCommManager = _
+
+  private var generatedCommWriter: CommWriter = _
+
+  before {
+    mockActorLoader = mock[ActorLoader]
+    mockKMBuilder = mock[KMBuilder]
+    mockCommRegistrar = mock[CommRegistrar]
+
+    kernelCommManager = new KernelCommManager(
+      mockActorLoader,
+      mockKMBuilder,
+      mockCommRegistrar
+    ) {
+      override protected def newCommWriter(commId: UUID): CommWriter = {
+        val commWriter = super.newCommWriter(commId)
+
+        generatedCommWriter = commWriter
+
+        val spyCommWriter = spy(commWriter)
+        doNothing().when(spyCommWriter)
+          .sendCommKernelMessage(any[KernelMessageContent with CommContent])
+
+        spyCommWriter
+      }
+    }
+  }
+
+  describe("KernelCommManager") {
+    describe("#open") {
+      it("should return a wrapped instance of KernelCommWriter") {
+        kernelCommManager.open(TestTargetName, v5.MsgData.Empty)
+
+        // Exposed hackishly for testing
+        generatedCommWriter shouldBe a [KernelCommWriter]
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala b/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
new file mode 100644
index 0000000..eb792bb
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
@@ -0,0 +1,270 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.comm
+
+import java.util.UUID
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import play.api.libs.json.Json
+import scala.concurrent.duration._
+
+import akka.actor.{ActorSelection, ActorSystem}
+import akka.testkit.{TestProbe, TestKit}
+import com.typesafe.config.ConfigFactory
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+object KernelCommWriterSpec {
+  val config ="""
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class KernelCommWriterSpec extends TestKit(
+  ActorSystem("KernelCommWriterSpec",
+    ConfigFactory.parseString(KernelCommWriterSpec.config))
+) with FunSpecLike with Matchers with BeforeAndAfter with MockitoSugar
+{
+
+  private val commId = UUID.randomUUID().toString
+  private var kernelCommWriter: KernelCommWriter = _
+  private var kernelMessageBuilder: KMBuilder = _
+
+  private var actorLoader: ActorLoader = _
+  private var kernelMessageRelayProbe: TestProbe = _
+
+  /**
+   * Retrieves the next message available.
+   *
+   * @return The KernelMessage instance (or an error if timed out)
+   */
+  private def getNextMessage =
+    kernelMessageRelayProbe.receiveOne(200.milliseconds)
+      .asInstanceOf[KernelMessage]
+
+  /**
+   * Retrieves the next message available and returns its type.
+   *
+   * @return The type of the message (pulled from message header)
+   */
+  private def getNextMessageType = getNextMessage.header.msg_type
+
+  /**
+   * Retrieves the next message available and parses the content string.
+   *
+   * @tparam T The type to coerce the content string into
+   *
+   * @return The resulting KernelMessageContent instance
+   */
+  private def getNextMessageContents[T <: KernelMessageContent]
+    (implicit fjs: play.api.libs.json.Reads[T], mf: Manifest[T]) =
+  {
+    val receivedMessage = getNextMessage
+
+    Json.parse(receivedMessage.contentString).as[T]
+  }
+
+  before {
+    kernelMessageBuilder = spy(KMBuilder())
+
+    // Construct path for kernel message relay
+    actorLoader = mock[ActorLoader]
+    kernelMessageRelayProbe = TestProbe()
+    val kernelMessageRelaySelection: ActorSelection =
+      system.actorSelection(kernelMessageRelayProbe.ref.path.toString)
+    doReturn(kernelMessageRelaySelection)
+      .when(actorLoader).load(SystemActorType.KernelMessageRelay)
+
+    // Create a new writer to use for testing
+    kernelCommWriter = new KernelCommWriter(actorLoader, kernelMessageBuilder, commId)
+  }
+
+  describe("KernelCommWriter") {
+    describe("#writeOpen") {
+      it("should send a comm_open message to the relay") {
+        kernelCommWriter.writeOpen(anyString())
+
+        getNextMessageType should be (CommOpen.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        kernelCommWriter.writeOpen(anyString())
+
+        val actual = getNextMessageContents[CommOpen].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should include the target name in the message") {
+        val expected = "<TARGET_NAME>"
+        kernelCommWriter.writeOpen(expected)
+
+        val actual = getNextMessageContents[CommOpen].target_name
+
+        actual should be (expected)
+      }
+
+      it("should provide empty data in the message if no data is provided") {
+        val expected = MsgData.Empty
+        kernelCommWriter.writeOpen(anyString())
+
+        val actual = getNextMessageContents[CommOpen].data
+
+        actual should be (expected)
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("some key" -> "some value")
+        kernelCommWriter.writeOpen(anyString(), expected)
+
+        val actual = getNextMessageContents[CommOpen].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#writeMsg") {
+      it("should send a comm_msg message to the relay") {
+        kernelCommWriter.writeMsg(MsgData.Empty)
+
+        getNextMessageType should be (CommMsg.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        kernelCommWriter.writeMsg(MsgData.Empty)
+
+        val actual = getNextMessageContents[CommMsg].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should fail a require if the data is null") {
+        intercept[IllegalArgumentException] {
+          kernelCommWriter.writeMsg(null)
+        }
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("some key" -> "some value")
+        kernelCommWriter.writeMsg(expected)
+
+        val actual = getNextMessageContents[CommMsg].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#writeClose") {
+      it("should send a comm_close message to the relay") {
+        kernelCommWriter.writeClose()
+
+        getNextMessageType should be (CommClose.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        kernelCommWriter.writeClose()
+
+        val actual = getNextMessageContents[CommClose].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should provide empty data in the message if no data is provided") {
+        val expected = MsgData.Empty
+        kernelCommWriter.writeClose()
+
+        val actual = getNextMessageContents[CommClose].data
+
+        actual should be (expected)
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("some key" -> "some value")
+        kernelCommWriter.writeClose(expected)
+
+        val actual = getNextMessageContents[CommClose].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#write") {
+      it("should send a comm_msg message to the relay") {
+        kernelCommWriter.write(Array('a'), 0, 1)
+
+        getNextMessageType should be (CommMsg.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        kernelCommWriter.write(Array('a'), 0, 1)
+
+        val actual = getNextMessageContents[CommMsg].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should package the string as part of the data with a 'message' key") {
+        val expected = MsgData("message" -> "a")
+        kernelCommWriter.write(Array('a'), 0, 1)
+
+        val actual = getNextMessageContents[CommMsg].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#flush") {
+      it("should do nothing") {
+        // TODO: Is this test necessary? It does nothing.
+        kernelCommWriter.flush()
+      }
+    }
+
+    describe("#close") {
+      it("should send a comm_close message to the relay") {
+        kernelCommWriter.close()
+
+        getNextMessageType should be (CommClose.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        kernelCommWriter.close()
+
+        val actual = getNextMessageContents[CommClose].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should provide empty data in the message") {
+        val expected = MsgData.Empty
+        kernelCommWriter.close()
+
+        val actual = getNextMessageContents[CommClose].data
+
+        actual should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala b/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
new file mode 100644
index 0000000..4d1641f
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.global
+
+import org.scalatest.{FunSpec, Matchers}
+
+class ExecutionCounterSpec extends FunSpec with Matchers {
+  describe("ExecutionCounter") {
+    describe("#increment( String )"){
+      it("should increment value when key is not present"){
+        ExecutionCounter incr "foo" should be(1)
+      }
+      it("should increment value for key when it is present"){
+        ExecutionCounter incr "bar" should be(1)
+        ExecutionCounter incr "bar" should be(2)
+      }
+
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
new file mode 100644
index 0000000..58ea0c5
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
@@ -0,0 +1,178 @@
+package com.ibm.spark.kernel.api
+
+import java.io.{InputStream, PrintStream}
+
+import com.ibm.spark.boot.layer.InterpreterManager
+import com.ibm.spark.comm.CommManager
+import com.ibm.spark.interpreter._
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.magic.MagicLoader
+import com.typesafe.config.Config
+import org.apache.spark.{SparkConf, SparkContext}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+import com.ibm.spark.global.ExecuteRequestState
+
+class KernelSpec extends FunSpec with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val BadCode = Some("abc foo bar")
+  private val GoodCode = Some("val foo = 1")
+  private val ErrorCode = Some("val foo = bar")
+  private val ErrorMsg = "Name: error\n" +
+    "Message: bad\n" +
+    "StackTrace: 1"
+
+  private var mockConfig: Config = _
+  private var mockSparkContext: SparkContext = _
+  private var mockSparkConf: SparkConf = _
+  private var mockActorLoader: ActorLoader = _
+  private var mockInterpreter: Interpreter = _
+  private var mockInterpreterManager: InterpreterManager = _
+  private var mockCommManager: CommManager = _
+  private var mockMagicLoader: MagicLoader = _
+  private var kernel: Kernel = _
+  private var spyKernel: Kernel = _
+
+  before {
+    mockConfig = mock[Config]
+    mockInterpreter = mock[Interpreter]
+    mockInterpreterManager = mock[InterpreterManager]
+    mockSparkContext = mock[SparkContext]
+    mockSparkConf = mock[SparkConf]
+    when(mockInterpreterManager.defaultInterpreter)
+      .thenReturn(Some(mockInterpreter))
+    when(mockInterpreterManager.interpreters)
+      .thenReturn(Map[String, com.ibm.spark.interpreter.Interpreter]())
+    when(mockInterpreter.interpret(BadCode.get))
+      .thenReturn((Results.Incomplete, null))
+    when(mockInterpreter.interpret(GoodCode.get))
+      .thenReturn((Results.Success, Left(new ExecuteOutput("ok"))))
+    when(mockInterpreter.interpret(ErrorCode.get))
+      .thenReturn((Results.Error, Right(ExecuteError("error","bad", List("1")))))
+
+
+    mockCommManager = mock[CommManager]
+    mockActorLoader = mock[ActorLoader]
+    mockMagicLoader = mock[MagicLoader]
+
+    kernel = new Kernel(
+      mockConfig, mockActorLoader, mockInterpreterManager, mockCommManager,
+      mockMagicLoader
+    )
+
+    spyKernel = spy(kernel)
+
+  }
+
+  after {
+    ExecuteRequestState.reset()
+  }
+
+  describe("Kernel") {
+    describe("#eval") {
+      it("should return syntax error") {
+        kernel eval BadCode should be((false, "Syntax Error!"))
+      }
+
+      it("should return ok") {
+        kernel eval GoodCode should be((true, "ok"))
+      }
+
+      it("should return error") {
+        kernel eval ErrorCode should be((false, ErrorMsg))
+      }
+
+      it("should return error on None") {
+        kernel eval None should be ((false, "Error!"))
+      }
+    }
+
+    describe("#out") {
+      it("should throw an exception if the ExecuteRequestState has not been set") {
+        intercept[IllegalArgumentException] {
+          kernel.out
+        }
+      }
+
+      it("should create a new PrintStream instance if the ExecuteRequestState has been set") {
+        ExecuteRequestState.processIncomingKernelMessage(
+          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
+            mock[Metadata], "")
+        )
+        kernel.out shouldBe a [PrintStream]
+      }
+    }
+
+    describe("#err") {
+      it("should throw an exception if the ExecuteRequestState has not been set") {
+        intercept[IllegalArgumentException] {
+          kernel.err
+        }
+      }
+
+      it("should create a new PrintStream instance if the ExecuteRequestState has been set") {
+        ExecuteRequestState.processIncomingKernelMessage(
+          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
+            mock[Metadata], "")
+        )
+
+        // TODO: Access the underlying streamType field to assert stderr?
+        kernel.err shouldBe a [PrintStream]
+      }
+    }
+
+    describe("#in") {
+      it("should throw an exception if the ExecuteRequestState has not been set") {
+        intercept[IllegalArgumentException] {
+          kernel.in
+        }
+      }
+
+      it("should create a new InputStream instance if the ExecuteRequestState has been set") {
+        ExecuteRequestState.processIncomingKernelMessage(
+          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
+            mock[Metadata], "")
+        )
+
+        kernel.in shouldBe a [InputStream]
+      }
+    }
+
+    describe("#stream") {
+      it("should throw an exception if the ExecuteRequestState has not been set") {
+        intercept[IllegalArgumentException] {
+          kernel.stream
+        }
+      }
+
+      it("should create a StreamMethods instance if the ExecuteRequestState has been set") {
+        ExecuteRequestState.processIncomingKernelMessage(
+          new KernelMessage(Nil, "", mock[Header], mock[ParentHeader],
+            mock[Metadata], "")
+        )
+
+        kernel.stream shouldBe a [StreamMethods]
+      }
+    }
+
+    describe("when spark.master is set in config") {
+
+      it("should create SparkConf") {
+        val expected = "some value"
+        doReturn(expected).when(mockConfig).getString("spark.master")
+        doReturn("").when(mockConfig).getString("spark_configuration")
+
+        // Provide stub for interpreter classServerURI since also executed
+        doReturn("").when(mockInterpreter).classServerURI
+
+        val sparkConf = kernel.createSparkConf(new SparkConf().setMaster(expected))
+
+        sparkConf.get("spark.master") should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
new file mode 100644
index 0000000..fc87588
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
@@ -0,0 +1,70 @@
+package com.ibm.spark.kernel.api
+
+import akka.actor.ActorSystem
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, BeforeAndAfter, Matchers, FunSpec}
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+
+import org.mockito.Mockito._
+
+class StreamMethodsSpec extends TestKit(
+  ActorSystem("StreamMethodsSpec")
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val MaxDuration = 300.milliseconds
+
+  private var kernelMessageRelayProbe: TestProbe = _
+  private var mockParentHeader: v5.ParentHeader = _
+  private var mockActorLoader: v5.kernel.ActorLoader = _
+  private var mockKernelMessage: v5.KernelMessage = _
+  private var streamMethods: StreamMethods = _
+
+  before {
+    kernelMessageRelayProbe = TestProbe()
+
+    mockParentHeader = mock[v5.ParentHeader]
+
+    mockActorLoader = mock[v5.kernel.ActorLoader]
+    doReturn(system.actorSelection(kernelMessageRelayProbe.ref.path))
+      .when(mockActorLoader).load(v5.SystemActorType.KernelMessageRelay)
+
+    mockKernelMessage = mock[v5.KernelMessage]
+    doReturn(mockParentHeader).when(mockKernelMessage).header
+
+    streamMethods = new StreamMethods(mockActorLoader, mockKernelMessage)
+  }
+
+  describe("StreamMethods") {
+    describe("#()") {
+      it("should put the header of the given message as the parent header") {
+        val expected = mockKernelMessage.header
+        val actual = streamMethods.kmBuilder.build.parentHeader
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#sendAll") {
+      it("should send a message containing all of the given text") {
+        val expected = "some text"
+
+        streamMethods.sendAll(expected)
+
+        val outgoingMessage = kernelMessageRelayProbe.receiveOne(MaxDuration)
+        val kernelMessage = outgoingMessage.asInstanceOf[KernelMessage]
+
+        val actual = Json.parse(kernelMessage.contentString)
+          .as[v5.content.StreamContent].text
+
+        actual should be (expected)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
new file mode 100644
index 0000000..60d3b42
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.dispatch
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import akka.testkit.{TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.KernelStatus
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+
+class StatusDispatchSpec extends TestKit(ActorSystem("StatusDispatchSystem"))
+with FunSpecLike with Matchers with MockitoSugar with BeforeAndAfter{
+  var statusDispatchRef: ActorRef = _
+  var relayProbe: TestProbe = _
+  before {
+    //  Mock the relay with a probe
+    relayProbe = TestProbe()
+    //  Mock the ActorLoader
+    val mockActorLoader: ActorLoader = mock[ActorLoader]
+    when(mockActorLoader.load(SystemActorType.KernelMessageRelay))
+      .thenReturn(system.actorSelection(relayProbe.ref.path.toString))
+
+    statusDispatchRef = system.actorOf(Props(classOf[StatusDispatch],mockActorLoader))
+  }
+
+
+  describe("StatusDispatch") {
+    describe("#receive( KernelStatusType )") {
+      it("should send a status message to the relay") {
+        statusDispatchRef ! KernelStatusType.Busy
+        //  Check the kernel message is the correct type
+        val statusMessage: KernelMessage = relayProbe.receiveOne(500.milliseconds).asInstanceOf[KernelMessage]
+        statusMessage.header.msg_type should be (MessageType.Outgoing.Status.toString)
+        //  Check the status is what we sent
+        val status: KernelStatus = Json.parse(statusMessage.contentString).as[KernelStatus]
+         status.execution_state should be (KernelStatusType.Busy.toString)
+      }
+    }
+
+    describe("#receive( KernelStatusType, Header )") {
+      it("should send a status message to the relay") {
+        val tuple = Tuple2(KernelStatusType.Busy, mock[Header])
+        statusDispatchRef ! tuple
+        //  Check the kernel message is the correct type
+        val statusMessage: KernelMessage = relayProbe.receiveOne(500.milliseconds).asInstanceOf[KernelMessage]
+        statusMessage.header.msg_type should be (MessageType.Outgoing.Status.toString)
+        //  Check the status is what we sent
+        val status: KernelStatus = Json.parse(statusMessage.contentString).as[KernelStatus]
+        status.execution_state should be (KernelStatusType.Busy.toString)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
new file mode 100644
index 0000000..b44ad1c
--- /dev/null
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.handler
+
+import akka.actor._
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.CompleteRequest
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5Test._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpecLike, BeforeAndAfter, Matchers}
+import org.mockito.Mockito._
+import scala.concurrent.duration._
+
+class CodeCompleteHandlerSpec extends TestKit(
+  ActorSystem("CodeCompleteHandlerSpec")
+) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter {
+
+  var actorLoader: ActorLoader = _
+  var handlerActor: ActorRef = _
+  var kernelMessageRelayProbe: TestProbe = _
+  var interpreterProbe: TestProbe = _
+  var statusDispatchProbe: TestProbe = _
+
+  before {
+    actorLoader = mock[ActorLoader]
+
+    handlerActor = system.actorOf(Props(classOf[CodeCompleteHandler], actorLoader))
+
+    kernelMessageRelayProbe = TestProbe()
+    when(actorLoader.load(SystemActorType.KernelMessageRelay))
+      .thenReturn(system.actorSelection(kernelMessageRelayProbe.ref.path.toString))
+
+    interpreterProbe = new TestProbe(system)
+    when(actorLoader.load(SystemActorType.Interpreter))
+      .thenReturn(system.actorSelection(interpreterProbe.ref.path.toString))
+
+    statusDispatchProbe = new TestProbe(system)
+    when(actorLoader.load(SystemActorType.StatusDispatch))
+      .thenReturn(system.actorSelection(statusDispatchProbe.ref.path.toString))
+  }
+
+  def replyToHandlerWithOkAndResult() = {
+    val expectedClass = classOf[CompleteRequest]
+    interpreterProbe.expectMsgClass(expectedClass)
+    interpreterProbe.reply((0, List[String]()))
+  }
+
+  def replyToHandlerWithOkAndBadResult() = {
+    val expectedClass = classOf[CompleteRequest]
+    interpreterProbe.expectMsgClass(expectedClass)
+    interpreterProbe.reply("hello")
+  }
+
+  describe("CodeCompleteHandler (ActorLoader)") {
+    it("should send a CompleteRequest") {
+      handlerActor ! MockCompleteRequestKernelMessage
+      replyToHandlerWithOkAndResult()
+      kernelMessageRelayProbe.fishForMessage(500.milliseconds) {
+        case KernelMessage(_, _, header, _, _, _) =>
+          header.msg_type == MessageType.Outgoing.CompleteReply.toString
+      }
+    }
+
+    it("should throw an error for bad JSON") {
+      handlerActor ! MockKernelMessageWithBadJSON
+      var result = false
+      try {
+        replyToHandlerWithOkAndResult()
+      }
+      catch {
+        case t: Throwable => result = true
+      }
+      result should be (true)
+    }
+
+    it("should throw an error for bad code completion") {
+      handlerActor ! MockCompleteRequestKernelMessage
+      try {
+        replyToHandlerWithOkAndBadResult()
+      }
+      catch {
+        case error: Exception => error.getMessage should be ("Parse error in CodeCompleteHandler")
+      }
+    }
+
+    it("should send an idle message") {
+      handlerActor ! MockCompleteRequestKernelMessage
+      replyToHandlerWithOkAndResult()
+      statusDispatchProbe.fishForMessage(500.milliseconds) {
+        case Tuple2(status, _) =>
+          status == KernelStatusType.Idle
+      }
+    }
+  }
+}


[24/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/LineMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/LineMagic.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/LineMagic.scala
deleted file mode 100644
index 0a54e85..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/LineMagic.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.ibm.spark.magic
-
-/**
- * Line Magics perform some function and don't return anything. I.e. you cannot
- * do  `val x = %runMyCode 1 2 3` or alter the MIMEType of the cell.
- */
-trait LineMagic extends Magic {
-  override def execute(code: String): Unit
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/Magic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/Magic.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/Magic.scala
deleted file mode 100644
index 0e41b35..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/Magic.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic
-
-/**
-  * Represents the base structure for a magic that is loaded and executed.
-  */
-trait Magic {
-   /**
-    * Execute a magic.
-    * @param code The code
-    * @return The output of the magic
-    */
-   def execute(code: String): Any
- }

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/MagicExecutor.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/MagicExecutor.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/MagicExecutor.scala
deleted file mode 100644
index f74c9f6..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/MagicExecutor.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.ibm.spark.magic
-
-import com.ibm.spark.utils.DynamicReflectionSupport
-
-import scala.language.dynamics
-
-class MagicExecutor(magicLoader: MagicLoader) extends Dynamic {
-
-  val executeMethod = classOf[Magic].getDeclaredMethods.head.getName
-
-  def applyDynamic(name: String)(args: Any*): Either[CellMagicOutput, LineMagicOutput] = {
-    val className = magicLoader.magicClassName(name)
-    val isCellMagic = magicLoader.hasCellMagic(className)
-    val isLineMagic = magicLoader.hasLineMagic(className)
-
-    (isCellMagic, isLineMagic) match {
-      case (true, false) =>
-        val result = executeMagic(className, args)
-        Left(result.asInstanceOf[CellMagicOutput])
-      case (false, true) =>
-        executeMagic(className, args)
-        Right(LineMagicOutput)
-      case (_, _) =>
-        Left(CellMagicOutput("text/plain" ->
-          s"Magic ${className} could not be executed."))
-    }
-  }
-
-  private def executeMagic(className: String, args: Seq[Any]) = {
-    val inst = magicLoader.createMagicInstance(className)
-    val dynamicSupport = new DynamicReflectionSupport(inst.getClass, inst)
-    dynamicSupport.applyDynamic(executeMethod)(args)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/MagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/MagicLoader.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/MagicLoader.scala
deleted file mode 100644
index c700c9e..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/MagicLoader.scala
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic
-
-import java.net.{URL, URLClassLoader}
-
-import com.google.common.reflect.ClassPath
-import com.ibm.spark.magic.dependencies.DependencyMap
-
-import scala.reflect.runtime.{universe => runtimeUniverse}
-import scala.collection.JavaConversions._
-
-class MagicLoader(
-  var dependencyMap: DependencyMap = new DependencyMap(),
-  urls: Array[URL] = Array(),
-  parentLoader: ClassLoader = null
-) extends URLClassLoader(urls, parentLoader) {
-  private val magicPackage = "com.ibm.spark.magic.builtin"
-
-  /**
-   * Checks whether a magic with a given name, implementing a given interface,
-   * exists.
-   * @param name case insensitive magic name
-   * @param interface interface
-   * @return true if a magic with the given name and interface exists
-   */
-  private def hasSpecificMagic(name: String, interface: Class[_]) : Boolean = {
-    val className = magicClassName(name)
-    try {
-      val clazz = loadClass(className)
-      clazz.getInterfaces.contains(interface)
-    } catch {
-      case _: Throwable => false
-    }
-  }
-
-  /**
-   * Checks whether a line magic exists.
-   * @param name case insensitive line magic name
-   * @return true if the line magic exists
-   */
-  def hasLineMagic(name: String): Boolean =
-    hasSpecificMagic(name, classOf[LineMagic])
-
-  /**
-   * Checks whether a cell magic exists.
-   * @param name case insensitive cell magic name
-   * @return true if the cell magic exists
-   */
-  def hasCellMagic(name: String): Boolean =
-    hasSpecificMagic(name, classOf[CellMagic])
-
-  /**
-   * Attempts to load a class with a given name from a package.
-   * @param name the name of the class
-   * @param resolve whether to resolve the class or not
-   * @return the class if found
-   */
-  override def loadClass(name: String, resolve: Boolean): Class[_] =
-    try {
-      super.loadClass(magicPackage + "." + name, resolve)
-    } catch {
-      case ex: ClassNotFoundException =>
-        super.loadClass(name, resolve)
-    }
-
-  /**
-   * Returns the class name for a case insensitive magic name query.
-   * If no match is found, returns the query.
-   * @param query a magic name, e.g. jAvasCRipt
-   * @return the queried magic name's corresponding class, e.g. JavaScript
-   */
-  def magicClassName(query: String): String = {
-    lowercaseClassMap(magicClassNames).getOrElse(query.toLowerCase, query)
-  }
-
-  /**
-   * @return list of magic class names in magicPackage.
-   */
-  protected def magicClassNames : List[String] = {
-    val classPath: ClassPath = ClassPath.from(this)
-    val classes = classPath.getTopLevelClasses(magicPackage)
-    classes.asList.map(_.getSimpleName).toList
-  }
-
-  /**
-   * @param names list of class names
-   * @return map of lowercase class names to class names
-   */
-  private def lowercaseClassMap(names: List[String]): Map[String, String] = {
-    names.map(n => (n.toLowerCase, n)).toMap
-  }
-
-  def addJar(jar: URL) = addURL(jar)
-  /**
-   * Creates a instance of the specified magic with dependencies added.
-   * @param name name of magic class
-   * @return instance of the Magic corresponding to the given name
-   */
-  protected[magic] def createMagicInstance(name: String): Any = {
-    val magicClass = loadClass(name) // Checks parent loadClass first
-
-    val runtimeMirror = runtimeUniverse.runtimeMirror(this)
-    val classSymbol = runtimeMirror.staticClass(magicClass.getCanonicalName)
-    val classMirror = runtimeMirror.reflectClass(classSymbol)
-    val selfType = classSymbol.selfType
-
-    val classConstructorSymbol =
-      selfType.declaration(runtimeUniverse.nme.CONSTRUCTOR).asMethod
-    val classConstructorMethod =
-      classMirror.reflectConstructor(classConstructorSymbol)
-
-    val magicInstance = classConstructorMethod()
-
-
-    // Add all of our dependencies to the new instance
-    dependencyMap.internalMap.filter(selfType <:< _._1).values.foreach(
-      _(magicInstance.asInstanceOf[Magic])
-    )
-
-    magicInstance
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/DependencyMap.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/DependencyMap.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/DependencyMap.scala
deleted file mode 100644
index f641a50..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/DependencyMap.scala
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import java.io.OutputStream
-
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.magic.{MagicLoader, Magic}
-import com.typesafe.config.Config
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
-
-import scala.reflect.runtime.universe._
-import com.ibm.spark.dependencies.DependencyDownloader
-
-/**
- * Represents a mapping of dependency types to implementations.
- *
- * TODO: Explore Scala macros to avoid duplicate code.
- */
-class DependencyMap {
-  val internalMap =
-    scala.collection.mutable.Map[Type, PartialFunction[Magic, Unit]]()
-
-  /**
-   * Sets the Interpreter for this map.
-   * @param interpreter The new Interpreter
-   */
-  def setInterpreter(interpreter: Interpreter) = {
-    internalMap(typeOf[IncludeInterpreter]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeInterpreter].interpreter_=(interpreter)
-      )
-
-    this
-  }
-
-  /**
-   * Sets the Interpreter for this map.
-   * @param interpreter The new Interpreter
-   */
-  //@deprecated("Use setInterpreter with IncludeInterpreter!", "2015.05.06")
-  def setKernelInterpreter(interpreter: Interpreter) = {
-    internalMap(typeOf[IncludeKernelInterpreter]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeKernelInterpreter].kernelInterpreter_=(interpreter)
-      )
-
-    this
-  }
-
-  /**
-   * Sets the SparkContext for this map.
-   * @param sparkContext The new SparkContext
-   */
-  def setSparkContext(sparkContext: SparkContext) = {
-    internalMap(typeOf[IncludeSparkContext]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeSparkContext].sparkContext_=(sparkContext)
-      )
-
-    this
-  }
-  
-  /**
-   * Sets the SQLContext for this map.
-   * @param sqlContext The new SQLContext
-   */
-  def setSQLContext(sqlContext: SQLContext) = {
-    internalMap(typeOf[IncludeSQLContext]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeSQLContext].sqlContext_=(sqlContext)
-      )
-
-    this
-  }
-
-  /**
-   * Sets the OutputStream for this map.
-   * @param outputStream The new OutputStream
-   */
-  def setOutputStream(outputStream: OutputStream) = {
-    internalMap(typeOf[IncludeOutputStream]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeOutputStream].outputStream_=(outputStream)
-      )
-
-    this
-  }
-
-  /**
-   * Sets the DependencyDownloader for this map.
-   * @param dependencyDownloader The new DependencyDownloader
-   */
-  def setDependencyDownloader(dependencyDownloader: DependencyDownloader) = {
-    internalMap(typeOf[IncludeDependencyDownloader]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeDependencyDownloader]
-            .dependencyDownloader_=(dependencyDownloader)
-      )
-
-    this
-  }  
-  
-  /**
-   * Sets the Kernel Object for this map.
-   * @param kernel The new Kernel
-   */
-  def setKernel(kernel: KernelLike) = {
-    internalMap(typeOf[IncludeKernel]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeKernel]
-            .kernel_=(kernel)
-      )
-
-    this
-  }
-
-  /**
-   * Sets the MagicLoader for this map.
-   * @param magicLoader The new MagicLoader
-   */
-  def setMagicLoader(magicLoader: MagicLoader) = {
-    internalMap(typeOf[IncludeMagicLoader]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeMagicLoader]
-            .magicLoader_=(magicLoader)
-      )
-
-    this
-  }
-
-  /**
-   * Sets the Config Object for this map.
-   * @param config The config for the kernel
-   */
-  def setConfig(config: Config) = {
-    internalMap(typeOf[IncludeConfig]) =
-      PartialFunction[Magic, Unit](
-        magic =>
-          magic.asInstanceOf[IncludeConfig]
-            .config=(config)
-      )
-
-    this
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeConfig.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeConfig.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeConfig.scala
deleted file mode 100644
index 675c084..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeConfig.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.magic.{Magic}
-import com.typesafe.config.Config
-
-trait IncludeConfig {
-  this: Magic =>
-
-  private var _config: Config = _
-  def config: Config = _config
-  def config_= (newConfig: Config) =
-    _config = newConfig
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeDependencyDownloader.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeDependencyDownloader.scala
deleted file mode 100644
index 109fbd1..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeDependencyDownloader.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.dependencies.DependencyDownloader
-import com.ibm.spark.magic.Magic
-
-trait IncludeDependencyDownloader {
-  this: Magic =>
-
-  private var _dependencyDownloader: DependencyDownloader = _
-  def dependencyDownloader: DependencyDownloader = _dependencyDownloader
-  def dependencyDownloader_=(newDependencyDownloader: DependencyDownloader) =
-    _dependencyDownloader = newDependencyDownloader
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeInterpreter.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeInterpreter.scala
deleted file mode 100644
index fb01131..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeInterpreter.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.Magic
-
-trait IncludeInterpreter {
-  this: Magic =>
-
-  //val interpreter: Interpreter
-  private var _interpreter: Interpreter = _
-  def interpreter: Interpreter = _interpreter
-  def interpreter_=(newInterpreter: Interpreter) =
-    _interpreter = newInterpreter
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernel.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernel.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernel.scala
deleted file mode 100644
index fca3cb1..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernel.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.magic.Magic
-
-trait IncludeKernel {
-  this: Magic =>
-
-  private var _kernel: KernelLike = _
-  def kernel: KernelLike = _kernel
-  def kernel_=(newKernel: KernelLike) =
-    _kernel = newKernel
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernelInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernelInterpreter.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernelInterpreter.scala
deleted file mode 100644
index de19c07..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeKernelInterpreter.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.Magic
-
-//@deprecated("Use IncludeInterpreter instead!", "2015.05.06")
-trait IncludeKernelInterpreter {
-  this: Magic =>
-
-  //val interpreter: Interpreter
-  private var _interpreter: Interpreter = _
-  def kernelInterpreter: Interpreter = _interpreter
-  def kernelInterpreter_=(newInterpreter: Interpreter) =
-    _interpreter = newInterpreter
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeMagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeMagicLoader.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeMagicLoader.scala
deleted file mode 100644
index 0a78508..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeMagicLoader.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.magic.{MagicLoader, Magic}
-
-
-trait IncludeMagicLoader {
-  this: Magic =>
-
-  //val sparkContext: SparkContext
-  private var _magicLoader: MagicLoader = _
-  def magicLoader: MagicLoader = _magicLoader
-  def magicLoader_=(newMagicLoader: MagicLoader) =
-    _magicLoader = newMagicLoader
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeOutputStream.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeOutputStream.scala
deleted file mode 100644
index a3e679e..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeOutputStream.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import java.io.OutputStream
-
-import com.ibm.spark.magic.Magic
-
-trait IncludeOutputStream {
-  this: Magic =>
-
-  //val outputStream: OutputStream
-  private var _outputStream: OutputStream = _
-  def outputStream: OutputStream = _outputStream
-  def outputStream_=(newOutputStream: OutputStream) =
-    _outputStream = newOutputStream
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSQLContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSQLContext.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSQLContext.scala
deleted file mode 100644
index 5a9b26c..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSQLContext.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ibm.spark.magic.dependencies
-
-import com.ibm.spark.magic.Magic
-import org.apache.spark.sql.SQLContext
-
-trait IncludeSQLContext {
-  this: Magic =>
-
-  private var _sqlContext: SQLContext = _
-  def sqlContext: SQLContext = _sqlContext
-  def sqlContext_=(newSqlContext: SQLContext) =
-    _sqlContext = newSqlContext
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSparkContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSparkContext.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSparkContext.scala
deleted file mode 100644
index df5e245..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/dependencies/IncludeSparkContext.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.dependencies
-
-import com.ibm.spark.magic.Magic
-import org.apache.spark.SparkContext
-
-trait IncludeSparkContext {
-  this: Magic =>
-
-  //val sparkContext: SparkContext
-  private var _sparkContext: SparkContext = _
-  def sparkContext: SparkContext = _sparkContext
-  def sparkContext_=(newSparkContext: SparkContext) =
-    _sparkContext = newSparkContext
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/magic/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/magic/package.scala b/kernel-api/src/main/scala/com/ibm/spark/magic/package.scala
deleted file mode 100644
index 292d641..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/magic/package.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark
-
-package object magic {
-  /**
-   * Represents the output of a magic execution.
-   */
-  // TODO: This is a duplicate of Data in kernel protocol, needs to be given
-  //       a type/val that can be translated into a specific protocol via
-  //       implicits - or some other transformation - to separate this from
-  //       the protocol type
-  type CellMagicOutput = Map[String, String]
-  val CellMagicOutput = Map
-  
-  type LineMagicOutput = Unit
-  val LineMagicOutput : LineMagicOutput = ()
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/security/KernelSecurityManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/security/KernelSecurityManager.scala b/kernel-api/src/main/scala/com/ibm/spark/security/KernelSecurityManager.scala
deleted file mode 100644
index 2529866..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/security/KernelSecurityManager.scala
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.security
-
-import java.security.Permission
-import java.util.UUID
-
-import scala.collection.immutable.HashMap
-
-object KernelSecurityManager {
-  val RestrictedGroupName = "restricted-" + UUID.randomUUID().toString
-
-  /**
-   * Special case for this permission since the name changes with each status
-   * code.
-   */
-  private val SystemExitPermissionName = "exitVM." // + status
-
-  /**
-   * Used to indicate which permissions to check. Only checks if the permission
-   * is found in the keys and the value for that permission is true.
-   */
-  private val permissionsToCheck: Map[String, Boolean] = HashMap(
-    "modifyThreadGroup" -> true
-  )
-
-  /**
-   * Checks whether the permission with the provided name is listed to be
-   * checked.
-   *
-   * @param name The name of the permission
-   *
-   * @return True if the permission is listed to be checked, false otherwise
-   */
-  private def shouldCheckPermission(name: String): Boolean =
-    permissionsToCheck.getOrElse(name, shouldCheckPermissionSpecialCases(name))
-
-  /**
-   * Checks whether the permission with the provided name is one of the special
-   * cases that don't exist in the normal name conventions.
-   *
-   * @param name The name of the permission
-   *
-   * @return True if the permission is to be checked, false otherwise
-   */
-  private def shouldCheckPermissionSpecialCases(name: String): Boolean =
-    name.startsWith(SystemExitPermissionName)
-}
-
-class KernelSecurityManager extends SecurityManager {
-  import KernelSecurityManager._
-
-  override def checkPermission(perm: Permission, context: scala.Any): Unit = {
-    // TODO: Investigate why the StackOverflowError occurs in IntelliJ without
-    //       this check for FilePermission related to this class
-    // NOTE: The above problem does not happen when built with sbt pack
-    if (perm.getActions == "read" &&
-      perm.getName.contains(this.getClass.getSimpleName))
-      return
-
-    if (shouldCheckPermission(perm.getName))
-      super.checkPermission(perm, context)
-  }
-
-  override def checkPermission(perm: Permission): Unit = {
-    // TODO: Investigate why the StackOverflowError occurs in IntelliJ without
-    //       this check for FilePermission related to this class
-    // NOTE: The above problem does not happen when built with sbt pack
-    if (perm.getActions == "read" &&
-      perm.getName.contains(this.getClass.getSimpleName))
-      return
-
-    if (shouldCheckPermission(perm.getName))
-      super.checkPermission(perm)
-  }
-
-  override def getThreadGroup: ThreadGroup = {
-    val currentGroup = Thread.currentThread().getThreadGroup
-
-    // For restricted groups, we can only catch them in the checkAccess if we
-    // set the current group as the parent (to make sure all groups have a
-    // consistent name)
-    if (currentGroup.getName == RestrictedGroupName) {
-      new ThreadGroup(currentGroup, currentGroup.getName)
-    } else {
-      super.getThreadGroup
-    }
-  }
-
-  override def checkAccess(g: ThreadGroup): Unit = {
-    //super.checkAccess(g)
-    if (g == null) return
-
-    val parentGroup = g.getParent
-
-    if (parentGroup != null &&
-      parentGroup.getName == RestrictedGroupName &&
-      g.getName != RestrictedGroupName)
-      throw new SecurityException("Not allowed to modify ThreadGroups!")
-  }
-
-  override def checkExit(status: Int): Unit = {
-    val currentGroup = Thread.currentThread().getThreadGroup
-
-    if (currentGroup.getName == RestrictedGroupName) {
-      // TODO: Determine why System.exit(...) is being blocked in the ShutdownHandler
-      System.out.println("Unauthorized system.exit detected!")
-      //throw new SecurityException("Not allowed to invoke System.exit!")
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/ArgumentParsingSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/ArgumentParsingSupport.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/ArgumentParsingSupport.scala
deleted file mode 100644
index a748fe4..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/ArgumentParsingSupport.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import joptsimple.{OptionSpec, OptionParser}
-import scala.collection.JavaConverters._
-import scala.language.implicitConversions
-import java.io.{PrintStream, OutputStream}
-
-trait ArgumentParsingSupport {
-  protected lazy val parser = new OptionParser()
-  private var options: joptsimple.OptionSet = _
-  parser.allowsUnrecognizedOptions()
-
-  /**
-   * Parses the arguments provided as a string, updating all internal
-   * references to specific arguments.
-   *
-   * @param args The arguments as a string
-   * @param delimiter An optional delimiter for separating arguments
-   */
-  def parseArgs(args: String, delimiter: String = " ") = {
-    options = parser.parse(args.split(delimiter): _*)
-
-    options.nonOptionArguments().asScala.map(_.toString)
-  }
-
-  def printHelp(outputStream: OutputStream, usage: String) = {
-    val printStream = new PrintStream(outputStream)
-
-    printStream.println(s"Usage: $usage\n")
-    parser.printHelpOn(outputStream)
-  }
-
-  implicit def has[T](spec: OptionSpec[T]): Boolean = {
-    require(options != null, "Arguments not parsed yet!")
-    options.has(spec)
-  }
-
-  implicit def get[T](spec: OptionSpec[T]): Option[T] = {
-    require(options != null, "Arguments not parsed yet!")
-    Some(options.valueOf(spec)).filter(_ != null)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/ConditionalOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/ConditionalOutputStream.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/ConditionalOutputStream.scala
deleted file mode 100644
index 65f7650..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/ConditionalOutputStream.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.io.OutputStream
-
-class ConditionalOutputStream(
-  private val outputStream: OutputStream,
-  condition: => Boolean
-) extends OutputStream {
-  require(outputStream != null)
-
-  override def write(b: Int): Unit = if (condition) outputStream.write(b)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/DownloadSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/DownloadSupport.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/DownloadSupport.scala
deleted file mode 100644
index 9d36326..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/DownloadSupport.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.net.URL
-import java.nio.channels._
-import java.io.FileOutputStream
-
-/**
- * A utility for downloading the contents of a file to a specified location.
- */
-trait DownloadSupport {
-  /**
-   * Download a file located at the given URL to the specified destination file.
-   * The file type of the downloadDestination should match the file type
-   * of the file located at fileUrl. Throws a FileNotFoundException if the
-   * fileUrl or downloadDestination are invalid.
-   *
-   * @param fileUrl A URL for the file to be downloaded
-   * @param destinationUrl Location to download the file to (e.g. /tmp/file.txt)
-   *
-   * @return The URL representing the location of the downloaded file
-   */
-  def downloadFile(fileUrl: URL, destinationUrl: URL): URL = {
-    val rbc = Channels.newChannel(fileUrl.openStream())
-    val fos = new FileOutputStream(destinationUrl.getPath)
-    fos.getChannel.transferFrom(rbc, 0, Long.MaxValue)
-
-    destinationUrl
-  }
-
-  /**
-   * Download a file given a URL string to the specified downloadDestination.
-   *
-   * @param fileToDownload A URL in string format (e.g. file:///tmp/foo, http://ibm.com)
-   * @param destination Location to download the file to (e.g. /tmp/file.txt)
-   *
-   * @return The URL representing the location of the downloaded file
-   */
-  def downloadFile(fileToDownload: String, destination: String): URL = {
-    downloadFile(new URL(fileToDownload), new URL(destination))
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/DynamicReflectionSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/DynamicReflectionSupport.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/DynamicReflectionSupport.scala
deleted file mode 100644
index 73e02b6..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/DynamicReflectionSupport.scala
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import language.dynamics
-import language.existentials
-
-import java.lang.reflect.Method
-
-/**
- * Represents dynamic support capabilities for a class. Provides field and
- * method catchers to reflectively execute potentially-missing cases.
- * @param klass The class whose fields and methods to access
- * @param instance The specific instance whose fields and methods to access
- */
-case class DynamicReflectionSupport(
-  private val klass: Class[_], private val instance: Any
-) extends Dynamic {
-
-  /**
-   * Handles cases of field access not found from type-checks. Attempts to
-   * reflectively access field from provided class (or instance). Will first
-   * check for a method signature matching field name due to Scala
-   * transformation process.
-   * @param name The name of the field
-   * @return The content held by the field
-   */
-  def selectDynamic(name: String): Any = {
-    val method = getMethod(name, Nil)
-    method match {
-      case Some(m) => invokeMethod(m, Nil)
-      case _ =>
-        try {
-          val field = klass.getDeclaredField(name)
-          field.setAccessible(true)
-          field.get(instance)
-        } catch {
-          case ex: NoSuchFieldException =>
-            throw new NoSuchFieldException(
-              klass.getName + "." + name + " does not exist!"
-            )
-          case ex: Throwable => throw ex
-        }
-    }
-  }
-
-  /**
-   * Handles cases of method not found from type-checks. Attempts to
-   * reflectively execute the method from the provided class (or instance).
-   * Will search for a method signature that has matching parameters with
-   * arguments allowed to be subclasses of parameter types.
-   *
-   * @note Chaining in not supported. You must first cast the result of the
-   *       execution before attempting to apply a method upon it.
-   *
-   * @param name The name of the method
-   * @param args The list of arguments for the method
-   * @return The result of the method's execution
-   */
-  def applyDynamic(name: String)(args: Any*) = {
-    val method = getMethod(name, args.toList)
-
-    method match {
-      case Some(m) => invokeMethod(m, args.toList)
-      case _ =>
-        throw new NoSuchMethodException(
-          klass.getName + "." + name +
-            "(" + args.map(_.getClass.getName).mkString(",") + ")"
-        )
-    }
-  }
-
-  private def getMethod(name: String, args: Any*): Option[Method] = {
-    val flatArgs = flatten(args)
-    val potentialMethods = klass.getDeclaredMethods.filter(_.getName == name)
-    val method: Option[Method] =
-      potentialMethods.foldLeft[Option[Method]](None) {
-        (current, m) =>
-          if (current != None) current
-          else if (m.getParameterTypes.size != flatArgs.size) current
-          else if (!m.getParameterTypes.zipWithIndex.forall {
-            case (c, i) => isCompatible(c, flatArgs(i).getClass)
-          }) current
-          else Some(m)
-      }
-
-    method
-  }
-
-  private def invokeMethod(method: Method, args: Any*) = {
-    val flatArgs = flatten(args).map(_.asInstanceOf[AnyRef])
-    method.invoke(instance, flatArgs: _*)
-  }
-
-  private def flatten(l: Seq[Any]): Seq[Any] = {
-    l.flatMap {
-      case newList: List[_] => flatten(newList)
-      case newSeq: Seq[_] => flatten(newSeq)
-      case x => List(x)
-    }
-  }
-
-  private def isCompatible(klazz1: Class[_], klazz2: Class[_]): Boolean = {
-    var result =
-      klazz1.isAssignableFrom(klazz2) ||
-      klazz1.isInstance(klazz2) ||
-      klazz1.isInstanceOf[klazz2.type]
-
-    if (!result) {
-      try {
-        klazz1.asInstanceOf[klazz2.type]
-        result = true
-      } catch {
-        case _: Throwable => result = false
-      }
-    }
-
-    result
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/KeyValuePairUtils.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/KeyValuePairUtils.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/KeyValuePairUtils.scala
deleted file mode 100644
index 7869aa6..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/KeyValuePairUtils.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.utils
-
-import joptsimple.util.KeyValuePair
-
-/**
- * Provides utility methods for jsimple-opt key pair values.
- */
-object KeyValuePairUtils {
-  val DefaultDelimiter = ","
-
-  /**
-   * Transforms the provided string into a list of KeyValuePair objects.
-   * @param keyValuePairString The string representing the series of keys and
-   *                           values
-   * @param delimiter The delimiter used for splitting up the string
-   * @return The list of KeyValuePair objects
-   */
-  def stringToKeyValuePairSeq(
-    keyValuePairString: String,
-    delimiter: String = DefaultDelimiter
-  ): Seq[KeyValuePair] = {
-    require(keyValuePairString != null, "KeyValuePair string cannot be null!")
-
-    keyValuePairString
-      .split(delimiter)
-      .map(_.trim)
-      .filterNot(_.isEmpty)
-      .map(KeyValuePair.valueOf)
-      .toSeq
-  }
-
-  /**
-   * Transforms the provided list of KeyValuePair elements into a string.
-   * @param keyValuePairSeq The sequence of KeyValuePair objects
-   * @param delimiter The separator between string KeyValuePair
-   * @return The resulting string from the list of KeyValuePair objects
-   */
-  def keyValuePairSeqToString(
-    keyValuePairSeq: Seq[KeyValuePair],
-    delimiter: String = DefaultDelimiter
-  ): String = {
-    require(keyValuePairSeq != null, "KeyValuePair sequence cannot be null!")
-
-    keyValuePairSeq
-      .map(pair => pair.key.trim + "=" + pair.value.trim)
-      .mkString(delimiter)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/MultiClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/MultiClassLoader.scala
deleted file mode 100644
index 9ee4da1..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/MultiClassLoader.scala
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.lang.reflect.Method
-import java.net.{URL, URLClassLoader}
-import java.util
-import org.slf4j.LoggerFactory
-
-import scala.collection.JavaConverters._
-import scala.util.{Failure, Success, Try}
-
-import scala.language.existentials
-
-/**
- * Represents a class loader that supports delegating to multiple class loaders.
- *
- * @note Implements URLClassLoader purely to support the Guava requirement for
- *       detecting all classes.
- *
- * @param urls The URLs to use for the underlying URLClassLoader
- * @param classLoaders The class loaders to use as the underlying
- *                     implementations of this class loader
- */
-class MultiClassLoader(
-  private val urls: Seq[URL],
-  private val classLoaders: Seq[ClassLoader]
-) extends URLClassLoader(
-  classLoaders.flatMap({
-    case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.toSeq
-    case _                              => Nil
-  }).distinct.toArray,
-  /* Create a parent chain based on a each classloader's parent */ {
-    val parents = classLoaders.flatMap(cl => Option(cl.getParent))
-
-    // If multiple parents, set the parent to another multi class loader
-    if (parents.size > 1) new MultiClassLoader(Nil, parents)
-
-    // If a single parent, set the parent to that single parent
-    else if (parents.size == 1) parents.head
-
-    // If no parent, set to null (default if parent not provided)
-    else null
-  }: ClassLoader
-) { self =>
-  private val logger = LoggerFactory.getLogger(this.getClass)
-
-  /**
-   * Creates a new multi class loader with no URLs of its own, although it may
-   * still expose URLs from provided class loaders.
-   *
-   * @param classLoaders The class loaders to use as the underlying
-   *                     implementations of this class loader
-   */
-  def this(classLoaders: ClassLoader*) = {
-    this(Nil, classLoaders)
-  }
-
-  override protected def findClass(name: String): Class[_] = {
-    @inline def tryFindClass(classLoader: ClassLoader, name: String) = {
-      Try(Class.forName(name, false, classLoader))
-    }
-
-    // NOTE: Using iterator to evaluate elements one at a time
-    classLoaders.toIterator
-      .map(classLoader => tryFindClass(classLoader, name))
-      .find(_.isSuccess)
-      .map(_.get)
-      .getOrElse(throw new ClassNotFoundException(name))
-  }
-
-  override protected def findResource(name: String): URL = {
-    // NOTE: Using iterator to evaluate elements one at a time
-    classLoaders.toIterator.map(cl => _findResource(cl, name)).find(_ != null)
-      .getOrElse(super.findResource(name))
-  }
-
-  override protected def findResources(name: String): util.Enumeration[URL] = {
-    val internalResources = classLoaders
-      .flatMap(cl => Try(_findResources(cl, name)).toOption)
-      .map(_.asScala)
-      .reduce(_ ++ _)
-
-    (
-      internalResources
-      ++
-      Try(super.findResources(name)).map(_.asScala).getOrElse(Nil)
-    ).asJavaEnumeration
-  }
-
-  private def _findResource[T <: ClassLoader](classLoader: T, name: String) = {
-    _getDeclaredMethod(classLoader.getClass, "findResource", classOf[String])
-      .invoke(classLoader, name).asInstanceOf[URL]
-  }
-
-  private def _findResources[T <: ClassLoader](classLoader: T, name: String) = {
-    _getDeclaredMethod(classLoader.getClass, "findResources", classOf[String])
-      .invoke(classLoader, name).asInstanceOf[util.Enumeration[URL]]
-  }
-
-  private def _loadClass[T <: ClassLoader](
-    classLoader: T,
-    name: String,
-    resolve: Boolean
-  ) = {
-    _getDeclaredMethod(classLoader.getClass, "loadClass",
-      classOf[String], classOf[Boolean]
-    ).invoke(classLoader, name, resolve: java.lang.Boolean).asInstanceOf[Class[_]]
-  }
-
-  private def _getDeclaredMethod(
-    klass: Class[_],
-    name: String,
-    classes: Class[_]*
-  ): Method = {
-    // Attempt to retrieve the method (public/protected/private) for the class,
-    // trying the super class if the method is not available
-    val potentialMethod = Try(klass.getDeclaredMethod(name, classes: _*))
-      .orElse(Try(_getDeclaredMethod(klass.getSuperclass, name, classes: _*)))
-
-    // Allow access to protected/private methods
-    potentialMethod.foreach(_.setAccessible(true))
-
-    potentialMethod match {
-      case Success(method)  => method
-      case Failure(error)   => throw error
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/MultiOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/MultiOutputStream.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/MultiOutputStream.scala
deleted file mode 100644
index 6ebaf3e..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/MultiOutputStream.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.io.OutputStream
-
-case class MultiOutputStream(val outputStreams: List[OutputStream])
-  extends OutputStream
-{
-  require(outputStreams != null)
-
-  override def write(cbuf: Array[Byte]): Unit =
-    outputStreams.foreach(outputStream => outputStream.write(cbuf))
-
-  override def write(cbuf: Array[Byte], off: Int, len: Int): Unit =
-    outputStreams.foreach(outputStream => outputStream.write(cbuf, off, len))
-
-  override def write(b: Int): Unit =
-    outputStreams.foreach(outputStream => outputStream.write(b))
-
-  override def flush() =
-    outputStreams.foreach(outputStream => outputStream.flush())
-
-  override def close() =
-    outputStreams.foreach(outputStream => outputStream.close())
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/ScheduledTaskManager.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/ScheduledTaskManager.scala
deleted file mode 100644
index a91e2ba..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/ScheduledTaskManager.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.utils
-
-import scala.language.existentials
-import java.util.concurrent._
-import java.util.UUID
-import ScheduledTaskManager._
-
-import scala.util.Try
-
-/**
- * Constructs timing-based events that are periodically executed. Does not
- * support hard-killing tasks that are not interruptable.
- * @param totalThreads The total threads to create for the underlying thread
- *                     pool
- * @param defaultExecutionDelay The default delay to use before all added tasks
- * @param defaultTimeInterval The default time interval between tasks in
- *                            milliseconds
- */
-class ScheduledTaskManager(
-  private val totalThreads: Int = DefaultMaxThreads,
-  private val defaultExecutionDelay: Long = DefaultExecutionDelay,
-  private val defaultTimeInterval: Long = DefaultTimeInterval
-) {
-  private[utils] val _scheduler = new ScheduledThreadPoolExecutor(totalThreads)
-  _scheduler.setRemoveOnCancelPolicy(true)
-
-  private val _taskMap = new ConcurrentHashMap[String, ScheduledFuture[_]]()
-
-  /**
-   * Adds the specified task to the queued list to execute at the specified
-   * time interval.
-   * @param executionDelay The time delay (in milliseconds) before starting
-   * @param timeInterval The time interval (in milliseconds)
-   * @param task The task to execute
-   * @tparam T The type of return result (currently ignored)
-   * @return The id of the task
-   */
-  def addTask[T](
-    executionDelay: Long = defaultExecutionDelay,
-    timeInterval: Long = defaultTimeInterval,
-    task: => T
-  ) = {
-    val taskId = UUID.randomUUID().toString
-    val runnable: Runnable = new Runnable {
-      override def run(): Unit = Try(task)
-    }
-
-    // Schedule our task at the desired interval
-    _taskMap.put(taskId, _scheduler.scheduleAtFixedRate(
-      runnable, executionDelay, timeInterval, TimeUnit.MILLISECONDS))
-
-    taskId
-  }
-
-  /**
-   * Removes the specified task from the manager.
-   * @param taskId The id of the task to remove
-   * @return True if the task was removed, otherwise false
-   */
-  def removeTask(taskId: String): Boolean = {
-    // Exit if the task with the given id does not exist
-    if (taskId == null || !_taskMap.containsKey(taskId)) return false
-
-    val future = _taskMap.remove(taskId)
-
-    // Stop the future, but allow the current task to finish
-    future.cancel(false)
-
-    true
-  }
-
-  /**
-   * Shuts down the thread pool used for task execution.
-   */
-  def stop() = {
-    _taskMap.clear()
-    _scheduler.shutdown()
-  }
-}
-
-object ScheduledTaskManager {
-  val DefaultMaxThreads = 4
-  val DefaultExecutionDelay = 10 // 10 milliseconds
-  val DefaultTimeInterval = 100 // 100 milliseconds
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/com/ibm/spark/utils/TaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/com/ibm/spark/utils/TaskManager.scala b/kernel-api/src/main/scala/com/ibm/spark/utils/TaskManager.scala
deleted file mode 100644
index c3a43fc..0000000
--- a/kernel-api/src/main/scala/com/ibm/spark/utils/TaskManager.scala
+++ /dev/null
@@ -1,237 +0,0 @@
-package com.ibm.spark.utils
-
-import java.util.concurrent.atomic.AtomicInteger
-
-import org.slf4j.LoggerFactory
-
-import scala.concurrent.{promise, Future}
-import java.util.concurrent._
-
-import com.ibm.spark.security.KernelSecurityManager._
-import TaskManager._
-
-import scala.util.Try
-
-/**
- * Represents a processor of tasks that has X worker threads dedicated to
- * executing the tasks.
- *
- * @param threadGroup The thread group to use with all worker threads
- * @param minimumWorkers The number of workers to spawn initially and keep
- *                       alive even when idle
- * @param maximumWorkers The max number of worker threads to spawn, defaulting
- *                   to the number of processors on the machine
- * @param keepAliveTime The maximum time in milliseconds for workers to remain
- *                      idle before shutting down
- */
-class TaskManager(
-  private val threadGroup: ThreadGroup = DefaultThreadGroup,
-  private val maxTasks: Int = DefaultMaxTasks,
-  private val minimumWorkers: Int = DefaultMinimumWorkers,
-  private val maximumWorkers: Int = DefaultMaximumWorkers,
-  private val keepAliveTime: Long = DefaultKeepAliveTime
-) {
-  protected val logger = LoggerFactory.getLogger(this.getClass.getName)
-
-  private class TaskManagerThreadFactory extends ThreadFactory {
-    override def newThread(r: Runnable): Thread = {
-      val thread = new Thread(threadGroup, r)
-
-      logger.trace(s"Creating new thread named ${thread.getName}!")
-
-      thread
-    }
-  }
-
-  private[utils] class ScalingThreadPoolExecutor extends ThreadPoolExecutor(
-    minimumWorkers,
-    maximumWorkers,
-    keepAliveTime,
-    TimeUnit.MILLISECONDS,
-    taskQueue,
-    taskManagerThreadFactory
-  ) {
-    protected val logger = LoggerFactory.getLogger(this.getClass.getName)
-
-    /** Used to keep track of tasks separately from the task queue. */
-    private val taskCount = new AtomicInteger(0)
-
-    /**
-     * Syncs the core pool size of the executor with the current number of
-     * tasks, using the minimum worker size and maximum worker size as the
-     * bounds.
-     */
-    private def syncPoolLimits(): Unit = {
-      val totalTasks = taskCount.get()
-      val newCorePoolSize =
-        math.max(minimumWorkers, math.min(totalTasks, maximumWorkers))
-
-      logger.trace(Seq(
-        s"Task execution count is $totalTasks!",
-        s"Updating core pool size to $newCorePoolSize!"
-      ).mkString(" "))
-      executor.foreach(_.setCorePoolSize(newCorePoolSize))
-    }
-
-    override def execute(r: Runnable): Unit = {
-      synchronized {
-        if (taskCount.incrementAndGet() > maximumWorkers)
-          logger.warn(s"Exceeded $maximumWorkers workers during processing!")
-
-        syncPoolLimits()
-      }
-
-      super.execute(r)
-    }
-
-    override def afterExecute(r: Runnable, t: Throwable): Unit = {
-      super.afterExecute(r, t)
-
-      synchronized {
-        taskCount.decrementAndGet()
-        syncPoolLimits()
-      }
-    }
-  }
-
-  private val taskManagerThreadFactory = new TaskManagerThreadFactory
-  private val taskQueue = new ArrayBlockingQueue[Runnable](maxTasks)
-
-  @volatile
-  private[utils] var executor: Option[ScalingThreadPoolExecutor] = None
-
-  /**
-   * Adds a new task to the list to execute.
-   *
-   * @param taskFunction The new task as a block of code
-   *
-   * @return Future representing the return value (or error) from the task
-   */
-  def add[T <: Any](taskFunction: => T): Future[T] = {
-    assert(executor.nonEmpty, "Task manager not started!")
-
-    val taskPromise = promise[T]()
-
-    // Construct runnable that completes the promise
-    logger.trace(s"Queueing new task to be processed!")
-    executor.foreach(_.execute(new Runnable {
-      override def run(): Unit = {
-        var threadName: String = "???"
-        try {
-          threadName = Try(Thread.currentThread().getName).getOrElse(threadName)
-          logger.trace(s"(Thread $threadName) Executing task!")
-          val result = taskFunction
-
-          logger.trace(s"(Thread $threadName) Task finished successfully!")
-          taskPromise.success(result)
-        } catch {
-          case ex: Throwable =>
-            val exName = ex.getClass.getName
-            val exMessage = Option(ex.getLocalizedMessage).getOrElse("???")
-            logger.trace(
-              s"(Thread $threadName) Task failed: ($exName) = $exMessage")
-            taskPromise.tryFailure(ex)
-        }
-      }
-    }))
-
-    taskPromise.future
-  }
-
-  /**
-   * Returns the count of tasks including the currently-running ones.
-   *
-   * @return The count of tasks
-   */
-  def size: Int = taskQueue.size() + executor.map(_.getActiveCount).getOrElse(0)
-
-  /**
-   * Returns whether or not there is a task in the queue to be processed.
-   *
-   * @return True if the internal queue is not empty, otherwise false
-   */
-  def hasTaskInQueue: Boolean = !taskQueue.isEmpty
-
-  /**
-   * Whether or not there is a task being executed currently.
-   *
-   * @return True if there is a task being executed, otherwise false
-   */
-  def isExecutingTask: Boolean = executor.exists(_.getActiveCount > 0)
-
-  /**
-   * Block execution (by sleeping) until all tasks currently queued up for
-   * execution are processed.
-   */
-  def await(): Unit =
-    while (!taskQueue.isEmpty || isExecutingTask) Thread.sleep(1)
-
-  /**
-   * Starts the task manager (begins processing tasks). Creates X new threads
-   * in the process.
-   */
-  def start(): Unit = {
-    logger.trace(
-      s"""
-         |Initializing with the following settings:
-         |- $minimumWorkers core worker pool
-         |- $maximumWorkers maximum workers
-         |- $keepAliveTime milliseconds keep alive time
-       """.stripMargin.trim)
-    executor = Some(new ScalingThreadPoolExecutor)
-  }
-
-  /**
-   * Restarts internal processing of tasks (removing current task).
-   */
-  def restart(): Unit = {
-    stop()
-    start()
-  }
-
-  /**
-   * Stops internal processing of tasks.
-   */
-  def stop(): Unit = {
-    executor.foreach(_.shutdownNow())
-    executor = None
-  }
-}
-
-/**
- * Represents constants associated with the task manager.
- */
-object TaskManager {
-  /** The default thread group to use with all worker threads. */
-  val DefaultThreadGroup = new ThreadGroup(RestrictedGroupName)
-
-  /** The default number of maximum tasks accepted by the task manager. */
-  val DefaultMaxTasks = 200
-
-  /**
-   * The default number of workers to spawn initially and keep alive
-   * even when idle.
-   */
-  val DefaultMinimumWorkers = 1
-
-  /** The default maximum number of workers to spawn. */
-  val DefaultMaximumWorkers = Runtime.getRuntime.availableProcessors()
-
-  /** The default timeout in milliseconds for workers waiting for tasks. */
-  val DefaultKeepAliveTime = 1000
-
-  /**
-   * The default timeout in milliseconds to wait before stopping a thread
-   * if it cannot be interrupted.
-   */
-  val InterruptTimeout = 5000
-
-  /** The maximum time to wait to add a task to the queue in milliseconds. */
-  val MaximumTaskQueueTimeout = 10000
-
-  /**
-   * The maximum time in milliseconds to wait to queue up a thread in the
-   * thread factory.
-   */
-  val MaximumThreadQueueTimeout = 10000
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
new file mode 100644
index 0000000..2f31cbe
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.dependencies
+
+import java.io.PrintStream
+import java.net.URL
+
+abstract class DependencyDownloader(repositoryUrl: String, baseDir: String) {
+
+  /**
+   * Retrieves the dependency and all of its dependencies as jars.
+   *
+   * @param groupId The group id associated with the main dependency
+   * @param artifactId The id of the dependency artifact
+   * @param version The version of the main dependency
+   * @param transitive If true, downloads all dependencies of the specified
+   *                   dependency
+   * @param excludeBaseDependencies If true, will exclude any dependencies
+   *                                included in the build of the kernel
+   *
+   * @return The sequence of strings pointing to the retrieved dependency jars
+   */
+  def retrieve(
+    groupId: String, artifactId: String, version: String,
+    transitive: Boolean = true, excludeBaseDependencies: Boolean = true
+  ): Seq[URL]
+
+  /**
+   * Sets the printstream to log to.
+   *
+   * @param printStream The new print stream to use for output logging
+   */
+  def setPrintStream(printStream: PrintStream): Unit
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
new file mode 100644
index 0000000..2465b0e
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.dependencies
+
+import java.io.{File, PrintStream}
+import java.net.URL
+
+import org.apache.ivy.Ivy
+import org.apache.ivy.core.module.descriptor._
+import org.apache.ivy.core.module.id.{ArtifactId, ModuleId, ModuleRevisionId}
+import org.apache.ivy.core.resolve.ResolveOptions
+import org.apache.ivy.core.retrieve.RetrieveOptions
+import org.apache.ivy.core.settings.IvySettings
+import org.apache.ivy.plugins.matcher.RegexpPatternMatcher
+import org.apache.ivy.plugins.parser.xml.{XmlModuleDescriptorParser, XmlModuleDescriptorWriter}
+import org.apache.ivy.plugins.resolver.IBiblioResolver
+import org.apache.ivy.util.{DefaultMessageLogger, Message}
+import org.springframework.core.io.support._
+
+
+class IvyDependencyDownloader(repositoryUrl: String, baseDirectory: String)
+  extends DependencyDownloader(repositoryUrl, baseDirectory)
+{
+  private val ivySettings = new IvySettings()
+  private val resolver = new IBiblioResolver
+
+  resolver.setUsepoms(true)
+  resolver.setM2compatible(true)
+  resolver.setName("central")
+
+  // Add our resolver as the main resolver (IBiblio goes to Maven Central)
+  ivySettings.addResolver(resolver)
+
+  // Mark our resolver as the default one to use
+  ivySettings.setDefaultResolver(resolver.getName)
+
+  // Set the destination
+  ivySettings.setBaseDir(new File(baseDirectory))
+  ivySettings.setDefaultResolutionCacheBasedir(baseDirectory)
+  ivySettings.setDefaultRepositoryCacheBasedir(baseDirectory)
+
+  //creates an Ivy instance with settings
+  val ivy = Ivy.newInstance(ivySettings)
+
+  private def getBaseDependencies: Iterable[DependencyDescriptor] = {
+    val xmlModuleDescriptor = XmlModuleDescriptorParser.getInstance()
+    val getDependencies = (url: URL) => xmlModuleDescriptor.parseDescriptor(
+      new IvySettings(), url, false
+    ).getDependencies
+
+    // Find all of the *ivy.xml files on the classpath.
+    val ivyFiles = new PathMatchingResourcePatternResolver().getResources(
+      "classpath*:**/*ivy.xml"
+    )
+    val classpathURLs = ivyFiles.map(_.getURI.toURL)
+
+    // Get all of the dependencies from the *ivy.xml files
+    val dependencies = classpathURLs.map(getDependencies).flatten
+
+    // Remove duplicates based on artifact name
+    val distinctDependencies =
+      dependencies.groupBy(_.getDependencyId.getName).map(_._2.head)
+
+    distinctDependencies
+  }
+
+  override def retrieve(
+    groupId: String, artifactId: String, version: String,
+    transitive: Boolean = true, excludeBaseDependencies: Boolean = true
+  ): Seq[URL] = {
+    // Start building the ivy.xml file
+    val ivyFile = File.createTempFile("ivy-custom", ".xml")
+    ivyFile.deleteOnExit()
+
+    val md = DefaultModuleDescriptor.newDefaultInstance(
+      ModuleRevisionId.newInstance("com.ibm.spark", "spark-kernel", "working")
+    )
+
+    // Exclude all sources artifacts i.e. artifactId-version-sources.jar
+    val moduleId = new ModuleId("*", "*")
+    val sourcesArtifactId = new ArtifactId(moduleId, "*", "source", "*")
+    val sourcesExclusion = new DefaultExcludeRule(
+      sourcesArtifactId, new RegexpPatternMatcher(), null
+    )
+
+    // Exclude all javadoc artifacts i.e. artifactId-version-javadoc.jar
+    val javadocArtifactId = new ArtifactId(moduleId, "*", "javadoc", "*")
+    val javadocExclusion = new DefaultExcludeRule(
+      javadocArtifactId, new RegexpPatternMatcher(), null
+    )
+
+    // TODO: figure out why this is not excluded. It's in our build.sbt file
+    // TODO: and we exclude all deps there. Need to get rid of this hard-code
+    val scalaCompilerModuleId = new ModuleId("org.scala-lang", "*")
+    val scalaCompilerArtifactId = new ArtifactId(
+      scalaCompilerModuleId, "*", "*", "*"
+    )
+    val scalaCompilerExclusion = new DefaultExcludeRule(
+      scalaCompilerArtifactId, new RegexpPatternMatcher(), null
+    )
+
+    // Create our dependency descriptor
+    val dependencyDescriptor = new DefaultDependencyDescriptor(
+      md, ModuleRevisionId.newInstance(groupId, artifactId, version),
+      false, false, true
+    )
+
+    md.addDependency(dependencyDescriptor)
+
+    // Add any and all exclusions
+    md.addExcludeRule(sourcesExclusion)
+    md.addExcludeRule(javadocExclusion)
+    md.addExcludeRule(scalaCompilerExclusion)
+
+    // Exclude our base dependencies if marked to do so
+    if (excludeBaseDependencies) {
+      getBaseDependencies.foreach(dep => {
+        val depRevId = dep.getDependencyRevisionId
+        val moduleId = new ModuleId(depRevId.getOrganisation, depRevId.getName)
+        val artifactId = new ArtifactId(moduleId, "*", "*", "*")
+        val excludeRule = new DefaultExcludeRule(
+          artifactId, new RegexpPatternMatcher(), null)
+        md.addExcludeRule(excludeRule)
+      })
+    }
+
+    // Creates our ivy configuration file
+    XmlModuleDescriptorWriter.write(md, ivyFile)
+
+    // Grab our dependencies (and theirs, etc) recursively
+    val resolveOptions = new ResolveOptions()
+      .setTransitive(transitive)
+      .setDownload(true)
+
+    // Init resolve report (has what was downloaded, etc)
+    val report = ivy.resolve(ivyFile.toURI.toURL, resolveOptions)
+
+    // Get the jar libraries
+    val artifactURLs = report.getAllArtifactsReports
+      .map(report => new URL("file:" + report.getLocalFile.getCanonicalPath))
+
+    val moduleDescriptor = report.getModuleDescriptor
+    ivy.retrieve(
+      moduleDescriptor.getModuleRevisionId,
+      baseDirectory + "/[artifact](-[classifier]).[ext]",
+      new RetrieveOptions().setConfs(Seq("default").toArray)
+    )
+
+    artifactURLs
+  }
+
+  /**
+   * Uses our printstream in Ivy's LoggingEngine
+   * @param printStream the print stream to use
+   */
+  override def setPrintStream(printStream: PrintStream): Unit = {
+    ivy.getLoggerEngine.setDefaultLogger(
+      new DefaultMessageLogger(Message.MSG_INFO) {
+        override def doEndProgress(msg: String): Unit =
+          printStream.println(msg)
+
+        override def doProgress(): Unit =
+          printStream.print(".")
+
+        override def log(msg: String, level: Int): Unit =
+          if (level <= this.getLevel)
+            printStream.println(msg)
+      }
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala b/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
new file mode 100644
index 0000000..973c000
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.global
+
+import java.io.{InputStream, OutputStream, PrintStream}
+
+/**
+ * Represents the global state for input and output streams used to communicate
+ * standard input and output.
+ */
+object StreamState {
+  private val _baseInputStream = System.in
+  private val _baseOutputStream = System.out
+  private val _baseErrorStream = System.err
+
+  @volatile private var _inputStream = _baseInputStream
+  @volatile private var _outputStream = _baseOutputStream
+  @volatile private var _errorStream = _baseErrorStream
+
+  private def init(in: InputStream, out: OutputStream, err: OutputStream) =
+    synchronized {
+      System.setIn(in)
+      Console.setIn(in)
+
+      System.setOut(new PrintStream(out))
+      Console.setOut(out)
+
+      System.setErr(new PrintStream(err))
+      Console.setErr(err)
+    }
+
+  private def reset(): Unit = synchronized {
+    System.setIn(_baseInputStream)
+    Console.setIn(_baseInputStream)
+
+    System.setOut(_baseOutputStream)
+    Console.setOut(_baseOutputStream)
+
+    System.setErr(_baseErrorStream)
+    Console.setErr(_baseErrorStream)
+  }
+
+  /**
+   * Sets the internal streams to be used with the stream block.
+   *
+   * @param inputStream The input stream to map standard in
+   * @param outputStream The output stream to map standard out
+   * @param errorStream The output stream to map standard err
+   */
+  def setStreams(
+    inputStream: InputStream = _inputStream,
+    outputStream: OutputStream = _outputStream,
+    errorStream: OutputStream = _errorStream
+  ) = {
+    _inputStream = inputStream
+    _outputStream = new PrintStream(outputStream)
+    _errorStream = new PrintStream(errorStream)
+  }
+
+  /**
+   * Execute code block, mapping all input and output to the provided streams.
+   */
+  def withStreams[T](thunk: => T): T = {
+    init(_inputStream, _outputStream, _errorStream)
+
+    val returnValue = thunk
+
+    reset()
+
+    returnValue
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
new file mode 100644
index 0000000..8103536
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter
+
+/**
+ * Represents a generic failure in execution.
+ */
+sealed abstract class ExecuteFailure
+
+/**
+ * Represents an error resulting from interpret execution.
+ * @param name The name of the error
+ * @param value The message provided from the error
+ * @param stackTrace The stack trace as a list of strings representing lines
+ *                   in the stack trace
+ */
+case class ExecuteError(
+  name: String, value: String, stackTrace: List[String]
+) extends ExecuteFailure {
+  override def toString: String =
+    "Name: " + name + "\n" +
+    "Message: " + value + "\n" +
+    "StackTrace: " + stackTrace.mkString("\n")
+}
+
+// TODO: Replace with object?
+/**
+ * Represents an aborted execution.
+ */
+class ExecuteAborted extends ExecuteFailure

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
new file mode 100644
index 0000000..6200b9b
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter
+
+import java.net.URL
+
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+
+import scala.tools.nsc.interpreter._
+
+trait Interpreter {
+
+  /**
+   * Initializes the interpreter.
+   * @param kernel The kernel
+   * @return The newly initialized interpreter
+   */
+  def init(kernel: KernelLike): Interpreter
+
+  /**
+   * Starts the interpreter, initializing any internal state.
+   * @return A reference to the interpreter
+   */
+  def start(): Interpreter
+
+  /**
+   * Interrupts the current code being interpreted.
+   * @return A reference to the interpreter
+   */
+  def interrupt(): Interpreter
+
+  /**
+   * Stops the interpreter, removing any previous internal state.
+   * @return A reference to the interpreter
+   */
+  def stop(): Interpreter
+
+  /**
+   * Adds external jars to the internal classpaths of the interpreter.
+   * @param jars The list of jar locations
+   */
+  def addJars(jars: URL*): Unit
+
+  /**
+   * Executes the provided code with the option to silence output.
+   * @param code The code to execute
+   * @param silent Whether or not to execute the code silently (no output)
+   * @return The success/failure of the interpretation and the output from the
+   *         execution or the failure
+   */
+  def interpret(code: String, silent: Boolean = false):
+    (Results.Result, Either[ExecuteOutput, ExecuteFailure])
+
+  /**
+   * @return Returns a string to reference the URI of where the interpreted class files are created
+   */
+  def classServerURI: String
+
+  /**
+   * Executes body and will not print anything to the console during the execution
+   * @param body The function to execute
+   * @tparam T The return type of body
+   * @return The return value of body
+   */
+  def doQuietly[T](body: => T): T
+
+  /**
+   * Binds the SparkContext instance to the interpreter's namespace.
+   *
+   * @param sparkContext The SparkContext to bind
+   */
+  def bindSparkContext(sparkContext: SparkContext): Unit
+
+  /**
+   * Binds the SQLContext instance to the interpreter's namespace.
+   *
+   * @param sqlContext The SQLContext to bind
+   */
+  def bindSqlContext(sqlContext: SQLContext): Unit
+
+  /**
+   * Binds a variable in the interpreter to a value.
+   * @param variableName The name to expose the value in the interpreter
+   * @param typeName The type of the variable, must be the fully qualified class name
+   * @param value The value of the variable binding
+   * @param modifiers Any annotation, scoping modifiers, etc on the variable
+   */
+  def bind(variableName: String, typeName: String, value: Any, modifiers: List[String])
+
+  /**
+   * Retrieves the contents of the variable with the provided name from the
+   * interpreter.
+   * @param variableName The name of the variable whose contents to read
+   * @return An option containing the variable contents or None if the
+   *         variable does not exist
+   */
+  def read(variableName: String): Option[AnyRef]
+
+  /**
+   * Mask the Console and System objects with our wrapper implementations
+   * and dump the Console methods into the public namespace (similar to
+   * the Predef approach).
+   * @param in The new input stream
+   * @param out The new output stream
+   * @param err The new error stream
+   */
+  def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream)
+
+  /**
+   * Attempts to perform code completion via the <TAB> command.
+   * @param code The current cell to complete
+   * @param pos The cursor position
+   * @return The cursor position and list of possible completions
+   */
+  def completion(code: String, pos: Int): (Int, List[String] )
+
+  /**
+   * Returns the name of the variable created from the last execution.
+   * @return Some String name if a variable was created, otherwise None
+   */
+  def lastExecutionVariableName: Option[String]
+
+  /**
+   * Returns the class loader used by this interpreter.
+   * @return The runtime class loader used by this interpreter
+   */
+  def classLoader: ClassLoader
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
new file mode 100644
index 0000000..7ecee65
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter
+
+/**
+ * Contains all types associated with the interpreter interface.
+ */
+object InterpreterTypes {
+  /**
+   * Represents the output from an interpret execution.
+   */
+  type ExecuteOutput = String
+}



[03/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreter.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreter.scala
deleted file mode 100644
index ca9bd7a..0000000
--- a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreter.scala
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.scala
-
-import java.io.{BufferedReader, ByteArrayOutputStream, InputStreamReader, PrintStream}
-import java.net.{URL, URLClassLoader}
-import java.nio.charset.Charset
-import java.util.concurrent.ExecutionException
-
-import akka.actor.Actor
-import akka.actor.Actor.Receive
-import com.ibm.spark.global.StreamState
-import com.ibm.spark.interpreter
-import com.ibm.spark.interpreter._
-import com.ibm.spark.interpreter.imports.printers.{WrapperConsole, WrapperSystem}
-import com.ibm.spark.kernel.api.{KernelLike, KernelOptions}
-import com.ibm.spark.utils.{MultiOutputStream, TaskManager}
-import org.apache.spark.SparkContext
-import org.apache.spark.repl.{SparkCommandLine, SparkIMain, SparkJLineCompletion}
-import org.apache.spark.sql.SQLContext
-import org.slf4j.LoggerFactory
-
-import scala.annotation.tailrec
-import scala.concurrent.{Await, Future}
-import scala.language.reflectiveCalls
-import scala.tools.nsc.backend.JavaPlatform
-import scala.tools.nsc.interpreter.{OutputStream, IR, JPrintWriter, InputStream}
-import scala.tools.nsc.io.AbstractFile
-import scala.tools.nsc.util.{ClassPath, MergedClassPath}
-import scala.tools.nsc.{Global, Settings, io}
-import scala.util.{Try => UtilTry}
-
-class ScalaInterpreter() extends Interpreter {
-
-  protected val logger = LoggerFactory.getLogger(this.getClass.getName)
-
-  private val ExecutionExceptionName = "lastException"
-  protected var settings: Settings = null
-
-  protected val _thisClassloader = this.getClass.getClassLoader
-  protected val _runtimeClassloader =
-    new URLClassLoader(Array(), _thisClassloader) {
-      def addJar(url: URL) = this.addURL(url)
-    }
-
-
-  protected val lastResultOut = new ByteArrayOutputStream()
-  protected val multiOutputStream = MultiOutputStream(List(Console.out, lastResultOut))
-  private var taskManager: TaskManager = _
-  var sparkIMain: SparkIMain = _
-  protected var jLineCompleter: SparkJLineCompletion = _
-
-  protected def newSparkIMain(
-    settings: Settings, out: JPrintWriter
-  ): SparkIMain = {
-    val s = new SparkIMain(settings, out)
-    s.initializeSynchronous()
-
-    s
-  }
-
-  private var maxInterpreterThreads:Int = TaskManager.DefaultMaximumWorkers
-
-  protected def newTaskManager(): TaskManager =
-    new TaskManager(maximumWorkers = maxInterpreterThreads)
-
-  protected def newSettings(args: List[String]): Settings =
-    new SparkCommandLine(args).settings
-
-  /**
-   * Adds jars to the runtime and compile time classpaths. Does not work with
-   * directories or expanding star in a path.
-   * @param jars The list of jar locations
-   */
-  override def addJars(jars: URL*): Unit = {
-    // Enable Scala class support
-    reinitializeSymbols()
-
-    jars.foreach(_runtimeClassloader.addJar)
-    updateCompilerClassPath(jars : _*)
-
-    // Refresh all of our variables
-    refreshDefinitions()
-  }
-
-  // TODO: Need to figure out a better way to compare the representation of
-  //       an annotation (contained in AnnotationInfo) with various annotations
-  //       like scala.transient
-  protected def convertAnnotationsToModifiers(
-    annotationInfos: List[Global#AnnotationInfo]
-  ) = annotationInfos map {
-    case a if a.toString == "transient" => "@transient"
-    case a =>
-      logger.debug(s"Ignoring unknown annotation: $a")
-      ""
-  } filterNot {
-    _.isEmpty
-  }
-
-  protected def convertScopeToModifiers(scopeSymbol: Global#Symbol) = {
-    (if (scopeSymbol.isImplicit) "implicit" else "") ::
-      Nil
-  }
-
-  protected def buildModifierList(termNameString: String) = {
-    import scala.language.existentials
-    val termSymbol = sparkIMain.symbolOfTerm(termNameString)
-
-
-    convertAnnotationsToModifiers(
-      if (termSymbol.hasAccessorFlag) termSymbol.accessed.annotations
-      else termSymbol.annotations
-    ) ++ convertScopeToModifiers(termSymbol)
-  }
-
-  protected def refreshDefinitions(): Unit = {
-    sparkIMain.definedTerms.foreach(termName => {
-      val termNameString = termName.toString
-      val termTypeString = sparkIMain.typeOfTerm(termNameString).toLongString
-      sparkIMain.valueOfTerm(termNameString) match {
-        case Some(termValue)  =>
-          val modifiers = buildModifierList(termNameString)
-          logger.debug(s"Rebinding of $termNameString as " +
-            s"${modifiers.mkString(" ")} $termTypeString")
-          UtilTry(sparkIMain.beSilentDuring {
-            sparkIMain.bind(
-              termNameString, termTypeString, termValue, modifiers
-            )
-          })
-        case None             =>
-          logger.debug(s"Ignoring rebinding of $termNameString")
-      }
-    })
-  }
-
-  protected def reinitializeSymbols(): Unit = {
-    val global = sparkIMain.global
-    import global._
-    new Run // Initializes something needed for Scala classes
-  }
-
-  protected def updateCompilerClassPath( jars: URL*): Unit = {
-    require(!sparkIMain.global.forMSIL) // Only support JavaPlatform
-
-    val platform = sparkIMain.global.platform.asInstanceOf[JavaPlatform]
-
-    val newClassPath = mergeJarsIntoClassPath(platform, jars:_*)
-    logger.debug(s"newClassPath: ${newClassPath}")
-
-    // TODO: Investigate better way to set this... one thought is to provide
-    //       a classpath in the currentClassPath (which is merged) that can be
-    //       replaced using updateClasspath, but would that work more than once?
-    val fieldSetter = platform.getClass.getMethods
-      .find(_.getName.endsWith("currentClassPath_$eq")).get
-    fieldSetter.invoke(platform, Some(newClassPath))
-
-    // Reload all jars specified into our compiler
-    sparkIMain.global.invalidateClassPathEntries(jars.map(_.getPath): _*)
-  }
-
-  protected def mergeJarsIntoClassPath(platform: JavaPlatform, jars: URL*): MergedClassPath[AbstractFile] = {
-    // Collect our new jars and add them to the existing set of classpaths
-    val allClassPaths = (
-      platform.classPath
-        .asInstanceOf[MergedClassPath[AbstractFile]].entries
-        ++
-        jars.map(url =>
-          platform.classPath.context.newClassPath(
-            io.AbstractFile.getFile(url.getPath))
-        )
-      ).distinct
-
-    // Combine all of our classpaths (old and new) into one merged classpath
-    new MergedClassPath(
-      allClassPaths,
-      platform.classPath.context
-    )
-  }
-
-  override def init(kernel: KernelLike): Interpreter = {
-    val args = interpreterArgs(kernel)
-    this.settings = newSettings(args)
-
-    this.settings.classpath.value = buildClasspath(_thisClassloader)
-    this.settings.embeddedDefaults(_runtimeClassloader)
-
-    maxInterpreterThreads = maxInterpreterThreads(kernel)
-
-    start()
-    bindKernelVarialble(kernel)
-
-    this
-  }
-
-  protected[scala] def buildClasspath(classLoader: ClassLoader): String = {
-
-    def toClassLoaderList( classLoader: ClassLoader ): Seq[ClassLoader] = {
-      @tailrec
-      def toClassLoaderListHelper( aClassLoader: ClassLoader, theList: Seq[ClassLoader]):Seq[ClassLoader] = {
-        if( aClassLoader == null )
-          return theList
-
-        toClassLoaderListHelper( aClassLoader.getParent, aClassLoader +: theList )
-      }
-      toClassLoaderListHelper(classLoader, Seq())
-    }
-
-    val urls = toClassLoaderList(classLoader).flatMap{
-        case cl: java.net.URLClassLoader => cl.getURLs.toList
-        case a => List()
-    }
-
-    urls.foldLeft("")((l, r) => ClassPath.join(l, r.toString))
-  }
-
-  protected def interpreterArgs(kernel: KernelLike): List[String] = {
-    import scala.collection.JavaConverters._
-    kernel.config.getStringList("interpreter_args").asScala.toList
-  }
-
-  protected def maxInterpreterThreads(kernel: KernelLike): Int = {
-    kernel.config.getInt("max_interpreter_threads")
-  }
-
-  protected def bindKernelVarialble(kernel: KernelLike): Unit = {
-    doQuietly {
-      bind(
-        "kernel", "com.ibm.spark.kernel.api.Kernel",
-        kernel, List( """@transient implicit""")
-      )
-    }
-  }
-
-  override def interrupt(): Interpreter = {
-    require(sparkIMain != null && taskManager != null)
-
-    // Force dumping of current task (begin processing new tasks)
-    taskManager.restart()
-
-    this
-  }
-
-  override def interpret(code: String, silent: Boolean = false):
-  (Results.Result, Either[ExecuteOutput, ExecuteFailure]) = {
-    val starting = (Results.Success, Left(""))
-    interpretRec(code.trim.split("\n").toList, false, starting)
-  }
-
-  def truncateResult(result:String, showType:Boolean =false, noTruncate: Boolean = false): String = {
-    val resultRX="""(?s)(res\d+):\s+(.+)\s+=\s+(.*)""".r
-
-    result match {
-      case resultRX(varName,varType,resString) => {
-          var returnStr=resString
-          if (noTruncate)
-          {
-            val r=read(varName)
-            returnStr=r.getOrElse("").toString
-          }
-
-          if (showType)
-            returnStr=varType+" = "+returnStr
-
-        returnStr
-
-      }
-      case _ => ""
-    }
-
-
-  }
-
-  protected def interpretRec(lines: List[String], silent: Boolean = false, results: (Results.Result, Either[ExecuteOutput, ExecuteFailure])): (Results.Result, Either[ExecuteOutput, ExecuteFailure]) = {
-    lines match {
-      case Nil => results
-      case x :: xs =>
-        val output = interpretLine(x)
-
-        output._1 match {
-          // if success, keep interpreting and aggregate ExecuteOutputs
-          case Results.Success =>
-            val result = for {
-              originalResult <- output._2.left
-            } yield(truncateResult(originalResult, KernelOptions.showTypes,KernelOptions.noTruncation))
-            interpretRec(xs, silent, (output._1, result))
-
-          // if incomplete, keep combining incomplete statements
-          case Results.Incomplete =>
-            xs match {
-              case Nil => interpretRec(Nil, silent, (Results.Incomplete, results._2))
-              case _ => interpretRec(x + "\n" + xs.head :: xs.tail, silent, results)
-            }
-
-          //
-          case Results.Aborted =>
-            output
-             //interpretRec(Nil, silent, output)
-
-          // if failure, stop interpreting and return the error
-          case Results.Error =>
-            val result = for {
-              curr <- output._2.right
-            } yield curr
-            interpretRec(Nil, silent, (output._1, result))
-        }
-    }
-  }
-
-
-  protected def interpretLine(line: String, silent: Boolean = false):
-    (Results.Result, Either[ExecuteOutput, ExecuteFailure]) =
-  {
-    require(sparkIMain != null && taskManager != null)
-    logger.trace(s"Interpreting line: $line")
-
-    val futureResult = interpretAddTask(line, silent)
-
-    // Map the old result types to our new types
-    val mappedFutureResult = interpretMapToCustomResult(futureResult)
-
-    // Determine whether to provide an error or output
-    val futureResultAndOutput = interpretMapToResultAndOutput(mappedFutureResult)
-
-    val futureResultAndExecuteInfo =
-      interpretMapToResultAndExecuteInfo(futureResultAndOutput)
-
-    // Block indefinitely until our result has arrived
-    import scala.concurrent.duration._
-    Await.result(futureResultAndExecuteInfo, Duration.Inf)
-  }
-
-  protected def interpretAddTask(code: String, silent: Boolean) = {
-    taskManager.add {
-      // Add a task using the given state of our streams
-      StreamState.withStreams {
-        if (silent) {
-          sparkIMain.beSilentDuring {
-            sparkIMain.interpret(code)
-          }
-        } else {
-          sparkIMain.interpret(code)
-        }
-      }
-    }
-  }
-
-
-  protected def interpretMapToCustomResult(future: Future[IR.Result]) = {
-    import scala.concurrent.ExecutionContext.Implicits.global
-    future map {
-      case IR.Success             => Results.Success
-      case IR.Error               => Results.Error
-      case IR.Incomplete          => Results.Incomplete
-    } recover {
-      case ex: ExecutionException => Results.Aborted
-    }
-  }
-
-  protected def interpretMapToResultAndOutput(future: Future[Results.Result]) = {
-    import scala.concurrent.ExecutionContext.Implicits.global
-    future map {
-      result =>
-        val output =
-          lastResultOut.toString(Charset.forName("UTF-8").name()).trim
-        lastResultOut.reset()
-        (result, output)
-    }
-  }
-
-  protected def interpretMapToResultAndExecuteInfo(
-    future: Future[(Results.Result, String)]
-  ): Future[(Results.Result, Either[ExecuteOutput, ExecuteFailure])] =
-  {
-    import scala.concurrent.ExecutionContext.Implicits.global
-    future map {
-      case (Results.Success, output)    => (Results.Success, Left(output))
-      case (Results.Incomplete, output) => (Results.Incomplete, Left(output))
-      case (Results.Aborted, output)    => (Results.Aborted, Right(null))
-      case (Results.Error, output)      =>
-        val x = sparkIMain.valueOfTerm(ExecutionExceptionName)
-        (
-          Results.Error,
-          Right(
-            interpretConstructExecuteError(
-              sparkIMain.valueOfTerm(ExecutionExceptionName),
-              output
-            )
-          )
-        )
-    }
-  }
-
-  protected def interpretConstructExecuteError(value: Option[AnyRef], output: String) =
-    value match {
-      // Runtime error
-      case Some(e) if e != null =>
-        val ex = e.asInstanceOf[Throwable]
-        // Clear runtime error message
-        sparkIMain.directBind(
-          ExecutionExceptionName,
-          classOf[Throwable].getName,
-          null
-        )
-        ExecuteError(
-          ex.getClass.getName,
-          ex.getLocalizedMessage,
-          ex.getStackTrace.map(_.toString).toList
-        )
-      // Compile time error, need to check internal reporter
-      case _ =>
-        if (sparkIMain.isReportingErrors)
-        // TODO: This wrapper is not needed when just getting compile
-        // error that we are not parsing... maybe have it be purely
-        // output and have the error check this?
-          ExecuteError(
-            "Compile Error", output, List()
-          )
-        else
-          ExecuteError("Unknown", "Unable to retrieve error!", List())
-    }
-
-
-  override def start() = {
-    require(sparkIMain == null && taskManager == null)
-
-    taskManager = newTaskManager()
-
-    logger.debug("Initializing task manager")
-    taskManager.start()
-
-    sparkIMain =
-      newSparkIMain(settings, new JPrintWriter(multiOutputStream, true))
-
-
-    //logger.debug("Initializing interpreter")
-    //sparkIMain.initializeSynchronous()
-
-    logger.debug("Initializing completer")
-    jLineCompleter = new SparkJLineCompletion(sparkIMain)
-
-    sparkIMain.beQuietDuring {
-      //logger.info("Rerouting Console and System related input and output")
-      //updatePrintStreams(System.in, multiOutputStream, multiOutputStream)
-
-//   ADD IMPORTS generates too many classes, client is responsible for adding import
-      logger.debug("Adding org.apache.spark.SparkContext._ to imports")
-      sparkIMain.addImports("org.apache.spark.SparkContext._")
-    }
-
-    this
-  }
-
-  override def updatePrintStreams(
-    in: InputStream, out: OutputStream, err: OutputStream
-  ): Unit = {
-    val inReader = new BufferedReader(new InputStreamReader(in))
-    val outPrinter = new PrintStream(out)
-    val errPrinter = new PrintStream(err)
-
-    sparkIMain.beQuietDuring {
-      sparkIMain.bind(
-        "Console", classOf[WrapperConsole].getName,
-        new WrapperConsole(inReader, outPrinter, errPrinter),
-        List("""@transient""")
-      )
-      sparkIMain.bind(
-        "System", classOf[WrapperSystem].getName,
-        new WrapperSystem(in, out, err),
-        List("""@transient""")
-      )
-      sparkIMain.addImports("Console._")
-    }
-  }
-
-  // NOTE: Convention is to force parentheses if a side effect occurs.
-  override def stop() = {
-    logger.info("Shutting down interpreter")
-
-    // Shut down the task manager (kills current execution
-    if (taskManager != null) taskManager.stop()
-    taskManager = null
-
-    // Erase our completer
-    jLineCompleter = null
-
-    // Close the entire interpreter (loses all state)
-    if (sparkIMain != null) sparkIMain.close()
-    sparkIMain = null
-
-    this
-  }
-
-  def classServerURI = {
-    require(sparkIMain != null)
-    sparkIMain.classServerUri
-  }
-
-  override def doQuietly[T](body: => T): T = {
-    require(sparkIMain != null)
-    sparkIMain.beQuietDuring[T](body)
-  }
-
-  override def bindSparkContext(sparkContext: SparkContext) = {
-    val bindName = "sc"
-
-    doQuietly {
-      logger.debug(s"Binding SparkContext into interpreter as $bindName")
-      bind(
-        bindName,
-        "org.apache.spark.SparkContext",
-        sparkContext,
-        List( """@transient""")
-      )
-
-      // NOTE: This is needed because interpreter blows up after adding
-      //       dependencies to SparkContext and Interpreter before the
-      //       cluster has been used... not exactly sure why this is the case
-      // TODO: Investigate why the cluster has to be initialized in the kernel
-      //       to avoid the kernel's interpreter blowing up (must be done
-      //       inside the interpreter)
-      logger.debug("Initializing Spark cluster in interpreter")
-
-      doQuietly {
-        interpret(Seq(
-          "val $toBeNulled = {",
-          "  var $toBeNulled = sc.emptyRDD.collect()",
-          "  $toBeNulled = null",
-          "}"
-        ).mkString("\n").trim())
-      }
-    }
-  }
-
-  override def bindSqlContext(sqlContext: SQLContext): Unit = {
-    val bindName = "sqlContext"
-
-    doQuietly {
-      // TODO: This only adds the context to the main interpreter AND
-      //       is limited to the Scala interpreter interface
-      logger.debug(s"Binding SQLContext into interpreter as $bindName")
-      bind(
-        bindName,
-        classOf[SQLContext].getName,
-        sqlContext,
-        List( """@transient""")
-      )
-
-      sqlContext
-    }
-  }
-
-  override def bind(
-    variableName: String, typeName: String,
-    value: Any, modifiers: List[String]
-  ): Unit = {
-    require(sparkIMain != null)
-    sparkIMain.bind(variableName, typeName, value, modifiers)
-  }
-
-  override def read(variableName: String): Option[AnyRef] = {
-    require(sparkIMain != null)
-    val variable = sparkIMain.valueOfTerm(variableName)
-    if (variable == null || variable.isEmpty) None
-    else variable
-  }
-
-  override def lastExecutionVariableName: Option[String] = {
-    require(sparkIMain != null)
-
-    // TODO: Get this API method changed back to public in Apache Spark
-    val lastRequestMethod = classOf[SparkIMain].getDeclaredMethod("lastRequest")
-    lastRequestMethod.setAccessible(true)
-
-    val request =
-      lastRequestMethod.invoke(sparkIMain).asInstanceOf[SparkIMain#Request]
-
-    val mostRecentVariableName = sparkIMain.mostRecentVar
-
-    request.definedNames.map(_.toString).find(_ == mostRecentVariableName)
-  }
-
-  override def completion(code: String, pos: Int): (Int, List[String]) = {
-    require(jLineCompleter != null)
-
-    logger.debug(s"Attempting code completion for ${code}")
-    val regex = """[0-9a-zA-Z._]+$""".r
-    val parsedCode = (regex findAllIn code).mkString("")
-
-    logger.debug(s"Attempting code completion for ${parsedCode}")
-    val result = jLineCompleter.completer().complete(parsedCode, pos)
-
-    (result.cursor, result.candidates)
-  }
-
-  override def classLoader: ClassLoader = _runtimeClassloader
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SettingsProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SettingsProducerLike.scala b/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SettingsProducerLike.scala
deleted file mode 100644
index c6c95af..0000000
--- a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SettingsProducerLike.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.scala
-
-import org.apache.spark.repl.SparkCommandLine
-
-import scala.tools.nsc.Settings
-
-trait SettingsProducerLike {
-  /**
-   * Creates a new Settings instance.
-   *
-   * @param args The list of command-line arguments to associate with Settings
-   *
-   * @return The new instance of Settings
-   */
-  def newSettings(args: List[String]): Settings
-}
-
-trait StandardSettingsProducer extends SettingsProducerLike {
-  override def newSettings(args: List[String]): Settings =
-    new SparkCommandLine(args).settings
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SparkIMainProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SparkIMainProducerLike.scala b/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SparkIMainProducerLike.scala
deleted file mode 100644
index d175b80..0000000
--- a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/SparkIMainProducerLike.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.scala
-
-import org.apache.spark.repl.SparkIMain
-
-import scala.tools.nsc.interpreter.JPrintWriter
-import scala.tools.nsc.{Settings, interpreter}
-
-trait SparkIMainProducerLike {
-  /**
-   * Constructs a new instance of SparkIMain.
-   *
-   * @param settings The settings associated with the SparkIMain instance
-   * @param out The output writer associated with the SparkIMain instance
-   *
-   * @return The new SparkIMain instance
-   */
-  def newSparkIMain(settings: Settings, out: interpreter.JPrintWriter): SparkIMain
-}
-
-trait StandardSparkIMainProducer extends SparkIMainProducerLike {
-  override def newSparkIMain(
-    settings: Settings, out: JPrintWriter
-  ): SparkIMain = {
-    val s = new SparkIMain(settings, out)
-    s.initializeSynchronous()
-
-    s
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/TaskManagerProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/TaskManagerProducerLike.scala b/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/TaskManagerProducerLike.scala
deleted file mode 100644
index 9025316..0000000
--- a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/TaskManagerProducerLike.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.scala
-
-import com.ibm.spark.utils.TaskManager
-
-trait TaskManagerProducerLike {
-  /**
-   * Creates a new instance of TaskManager.
-   *
-   * @return The new TaskManager instance
-   */
-  def newTaskManager(): TaskManager
-}
-
-trait StandardTaskManagerProducer extends TaskManagerProducerLike {
-  override def newTaskManager(): TaskManager = new TaskManager
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Scala.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Scala.scala b/scala-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Scala.scala
deleted file mode 100644
index c850926..0000000
--- a/scala-interpreter/src/main/scala/com/ibm/spark/magic/builtin/Scala.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError}
-import com.ibm.spark.kernel.interpreter.scala.{ScalaException, ScalaInterpreter}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.dependencies.IncludeKernel
-import com.ibm.spark.magic.{CellMagic, CellMagicOutput}
-
-/**
- * Represents the magic interface to use the Scala interpreter.
- */
-class Scala extends CellMagic with IncludeKernel {
-  override def execute(code: String): CellMagicOutput = {
-    val scala = kernel.interpreter("Scala")
-
-    if (scala.isEmpty || scala.get == null)
-      throw new ScalaException("Scala is not available!")
-
-    scala.get match {
-      case scalaInterpreter: ScalaInterpreter =>
-        val (_, output) = scalaInterpreter.interpret(code)
-        output match {
-          case Left(executeOutput) =>
-            CellMagicOutput(MIMEType.PlainText -> executeOutput)
-          case Right(executeFailure) => executeFailure match {
-            case executeAborted: ExecuteAborted =>
-              throw new ScalaException("Scala code was aborted!")
-            case executeError: ExecuteError =>
-              throw new ScalaException(executeError.value)
-          }
-        }
-      case otherInterpreter =>
-        val className = otherInterpreter.getClass.getName
-        throw new ScalaException(s"Invalid Scala interpreter: $className")
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
new file mode 100644
index 0000000..978cf90
--- /dev/null
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.scala
+
+/**
+ * Represents a generic Scala exception.
+ *
+ * @param message The message to associate with the exception
+ */
+class ScalaException(message: String) extends Throwable(message)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
new file mode 100644
index 0000000..ca9bd7a
--- /dev/null
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
@@ -0,0 +1,611 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.scala
+
+import java.io.{BufferedReader, ByteArrayOutputStream, InputStreamReader, PrintStream}
+import java.net.{URL, URLClassLoader}
+import java.nio.charset.Charset
+import java.util.concurrent.ExecutionException
+
+import akka.actor.Actor
+import akka.actor.Actor.Receive
+import com.ibm.spark.global.StreamState
+import com.ibm.spark.interpreter
+import com.ibm.spark.interpreter._
+import com.ibm.spark.interpreter.imports.printers.{WrapperConsole, WrapperSystem}
+import com.ibm.spark.kernel.api.{KernelLike, KernelOptions}
+import com.ibm.spark.utils.{MultiOutputStream, TaskManager}
+import org.apache.spark.SparkContext
+import org.apache.spark.repl.{SparkCommandLine, SparkIMain, SparkJLineCompletion}
+import org.apache.spark.sql.SQLContext
+import org.slf4j.LoggerFactory
+
+import scala.annotation.tailrec
+import scala.concurrent.{Await, Future}
+import scala.language.reflectiveCalls
+import scala.tools.nsc.backend.JavaPlatform
+import scala.tools.nsc.interpreter.{OutputStream, IR, JPrintWriter, InputStream}
+import scala.tools.nsc.io.AbstractFile
+import scala.tools.nsc.util.{ClassPath, MergedClassPath}
+import scala.tools.nsc.{Global, Settings, io}
+import scala.util.{Try => UtilTry}
+
+class ScalaInterpreter() extends Interpreter {
+
+  protected val logger = LoggerFactory.getLogger(this.getClass.getName)
+
+  private val ExecutionExceptionName = "lastException"
+  protected var settings: Settings = null
+
+  protected val _thisClassloader = this.getClass.getClassLoader
+  protected val _runtimeClassloader =
+    new URLClassLoader(Array(), _thisClassloader) {
+      def addJar(url: URL) = this.addURL(url)
+    }
+
+
+  protected val lastResultOut = new ByteArrayOutputStream()
+  protected val multiOutputStream = MultiOutputStream(List(Console.out, lastResultOut))
+  private var taskManager: TaskManager = _
+  var sparkIMain: SparkIMain = _
+  protected var jLineCompleter: SparkJLineCompletion = _
+
+  protected def newSparkIMain(
+    settings: Settings, out: JPrintWriter
+  ): SparkIMain = {
+    val s = new SparkIMain(settings, out)
+    s.initializeSynchronous()
+
+    s
+  }
+
+  private var maxInterpreterThreads:Int = TaskManager.DefaultMaximumWorkers
+
+  protected def newTaskManager(): TaskManager =
+    new TaskManager(maximumWorkers = maxInterpreterThreads)
+
+  protected def newSettings(args: List[String]): Settings =
+    new SparkCommandLine(args).settings
+
+  /**
+   * Adds jars to the runtime and compile time classpaths. Does not work with
+   * directories or expanding star in a path.
+   * @param jars The list of jar locations
+   */
+  override def addJars(jars: URL*): Unit = {
+    // Enable Scala class support
+    reinitializeSymbols()
+
+    jars.foreach(_runtimeClassloader.addJar)
+    updateCompilerClassPath(jars : _*)
+
+    // Refresh all of our variables
+    refreshDefinitions()
+  }
+
+  // TODO: Need to figure out a better way to compare the representation of
+  //       an annotation (contained in AnnotationInfo) with various annotations
+  //       like scala.transient
+  protected def convertAnnotationsToModifiers(
+    annotationInfos: List[Global#AnnotationInfo]
+  ) = annotationInfos map {
+    case a if a.toString == "transient" => "@transient"
+    case a =>
+      logger.debug(s"Ignoring unknown annotation: $a")
+      ""
+  } filterNot {
+    _.isEmpty
+  }
+
+  protected def convertScopeToModifiers(scopeSymbol: Global#Symbol) = {
+    (if (scopeSymbol.isImplicit) "implicit" else "") ::
+      Nil
+  }
+
+  protected def buildModifierList(termNameString: String) = {
+    import scala.language.existentials
+    val termSymbol = sparkIMain.symbolOfTerm(termNameString)
+
+
+    convertAnnotationsToModifiers(
+      if (termSymbol.hasAccessorFlag) termSymbol.accessed.annotations
+      else termSymbol.annotations
+    ) ++ convertScopeToModifiers(termSymbol)
+  }
+
+  protected def refreshDefinitions(): Unit = {
+    sparkIMain.definedTerms.foreach(termName => {
+      val termNameString = termName.toString
+      val termTypeString = sparkIMain.typeOfTerm(termNameString).toLongString
+      sparkIMain.valueOfTerm(termNameString) match {
+        case Some(termValue)  =>
+          val modifiers = buildModifierList(termNameString)
+          logger.debug(s"Rebinding of $termNameString as " +
+            s"${modifiers.mkString(" ")} $termTypeString")
+          UtilTry(sparkIMain.beSilentDuring {
+            sparkIMain.bind(
+              termNameString, termTypeString, termValue, modifiers
+            )
+          })
+        case None             =>
+          logger.debug(s"Ignoring rebinding of $termNameString")
+      }
+    })
+  }
+
+  protected def reinitializeSymbols(): Unit = {
+    val global = sparkIMain.global
+    import global._
+    new Run // Initializes something needed for Scala classes
+  }
+
+  protected def updateCompilerClassPath( jars: URL*): Unit = {
+    require(!sparkIMain.global.forMSIL) // Only support JavaPlatform
+
+    val platform = sparkIMain.global.platform.asInstanceOf[JavaPlatform]
+
+    val newClassPath = mergeJarsIntoClassPath(platform, jars:_*)
+    logger.debug(s"newClassPath: ${newClassPath}")
+
+    // TODO: Investigate better way to set this... one thought is to provide
+    //       a classpath in the currentClassPath (which is merged) that can be
+    //       replaced using updateClasspath, but would that work more than once?
+    val fieldSetter = platform.getClass.getMethods
+      .find(_.getName.endsWith("currentClassPath_$eq")).get
+    fieldSetter.invoke(platform, Some(newClassPath))
+
+    // Reload all jars specified into our compiler
+    sparkIMain.global.invalidateClassPathEntries(jars.map(_.getPath): _*)
+  }
+
+  protected def mergeJarsIntoClassPath(platform: JavaPlatform, jars: URL*): MergedClassPath[AbstractFile] = {
+    // Collect our new jars and add them to the existing set of classpaths
+    val allClassPaths = (
+      platform.classPath
+        .asInstanceOf[MergedClassPath[AbstractFile]].entries
+        ++
+        jars.map(url =>
+          platform.classPath.context.newClassPath(
+            io.AbstractFile.getFile(url.getPath))
+        )
+      ).distinct
+
+    // Combine all of our classpaths (old and new) into one merged classpath
+    new MergedClassPath(
+      allClassPaths,
+      platform.classPath.context
+    )
+  }
+
+  override def init(kernel: KernelLike): Interpreter = {
+    val args = interpreterArgs(kernel)
+    this.settings = newSettings(args)
+
+    this.settings.classpath.value = buildClasspath(_thisClassloader)
+    this.settings.embeddedDefaults(_runtimeClassloader)
+
+    maxInterpreterThreads = maxInterpreterThreads(kernel)
+
+    start()
+    bindKernelVarialble(kernel)
+
+    this
+  }
+
+  protected[scala] def buildClasspath(classLoader: ClassLoader): String = {
+
+    def toClassLoaderList( classLoader: ClassLoader ): Seq[ClassLoader] = {
+      @tailrec
+      def toClassLoaderListHelper( aClassLoader: ClassLoader, theList: Seq[ClassLoader]):Seq[ClassLoader] = {
+        if( aClassLoader == null )
+          return theList
+
+        toClassLoaderListHelper( aClassLoader.getParent, aClassLoader +: theList )
+      }
+      toClassLoaderListHelper(classLoader, Seq())
+    }
+
+    val urls = toClassLoaderList(classLoader).flatMap{
+        case cl: java.net.URLClassLoader => cl.getURLs.toList
+        case a => List()
+    }
+
+    urls.foldLeft("")((l, r) => ClassPath.join(l, r.toString))
+  }
+
+  protected def interpreterArgs(kernel: KernelLike): List[String] = {
+    import scala.collection.JavaConverters._
+    kernel.config.getStringList("interpreter_args").asScala.toList
+  }
+
+  protected def maxInterpreterThreads(kernel: KernelLike): Int = {
+    kernel.config.getInt("max_interpreter_threads")
+  }
+
+  protected def bindKernelVarialble(kernel: KernelLike): Unit = {
+    doQuietly {
+      bind(
+        "kernel", "com.ibm.spark.kernel.api.Kernel",
+        kernel, List( """@transient implicit""")
+      )
+    }
+  }
+
+  override def interrupt(): Interpreter = {
+    require(sparkIMain != null && taskManager != null)
+
+    // Force dumping of current task (begin processing new tasks)
+    taskManager.restart()
+
+    this
+  }
+
+  override def interpret(code: String, silent: Boolean = false):
+  (Results.Result, Either[ExecuteOutput, ExecuteFailure]) = {
+    val starting = (Results.Success, Left(""))
+    interpretRec(code.trim.split("\n").toList, false, starting)
+  }
+
+  def truncateResult(result:String, showType:Boolean =false, noTruncate: Boolean = false): String = {
+    val resultRX="""(?s)(res\d+):\s+(.+)\s+=\s+(.*)""".r
+
+    result match {
+      case resultRX(varName,varType,resString) => {
+          var returnStr=resString
+          if (noTruncate)
+          {
+            val r=read(varName)
+            returnStr=r.getOrElse("").toString
+          }
+
+          if (showType)
+            returnStr=varType+" = "+returnStr
+
+        returnStr
+
+      }
+      case _ => ""
+    }
+
+
+  }
+
+  protected def interpretRec(lines: List[String], silent: Boolean = false, results: (Results.Result, Either[ExecuteOutput, ExecuteFailure])): (Results.Result, Either[ExecuteOutput, ExecuteFailure]) = {
+    lines match {
+      case Nil => results
+      case x :: xs =>
+        val output = interpretLine(x)
+
+        output._1 match {
+          // if success, keep interpreting and aggregate ExecuteOutputs
+          case Results.Success =>
+            val result = for {
+              originalResult <- output._2.left
+            } yield(truncateResult(originalResult, KernelOptions.showTypes,KernelOptions.noTruncation))
+            interpretRec(xs, silent, (output._1, result))
+
+          // if incomplete, keep combining incomplete statements
+          case Results.Incomplete =>
+            xs match {
+              case Nil => interpretRec(Nil, silent, (Results.Incomplete, results._2))
+              case _ => interpretRec(x + "\n" + xs.head :: xs.tail, silent, results)
+            }
+
+          //
+          case Results.Aborted =>
+            output
+             //interpretRec(Nil, silent, output)
+
+          // if failure, stop interpreting and return the error
+          case Results.Error =>
+            val result = for {
+              curr <- output._2.right
+            } yield curr
+            interpretRec(Nil, silent, (output._1, result))
+        }
+    }
+  }
+
+
+  protected def interpretLine(line: String, silent: Boolean = false):
+    (Results.Result, Either[ExecuteOutput, ExecuteFailure]) =
+  {
+    require(sparkIMain != null && taskManager != null)
+    logger.trace(s"Interpreting line: $line")
+
+    val futureResult = interpretAddTask(line, silent)
+
+    // Map the old result types to our new types
+    val mappedFutureResult = interpretMapToCustomResult(futureResult)
+
+    // Determine whether to provide an error or output
+    val futureResultAndOutput = interpretMapToResultAndOutput(mappedFutureResult)
+
+    val futureResultAndExecuteInfo =
+      interpretMapToResultAndExecuteInfo(futureResultAndOutput)
+
+    // Block indefinitely until our result has arrived
+    import scala.concurrent.duration._
+    Await.result(futureResultAndExecuteInfo, Duration.Inf)
+  }
+
+  protected def interpretAddTask(code: String, silent: Boolean) = {
+    taskManager.add {
+      // Add a task using the given state of our streams
+      StreamState.withStreams {
+        if (silent) {
+          sparkIMain.beSilentDuring {
+            sparkIMain.interpret(code)
+          }
+        } else {
+          sparkIMain.interpret(code)
+        }
+      }
+    }
+  }
+
+
+  protected def interpretMapToCustomResult(future: Future[IR.Result]) = {
+    import scala.concurrent.ExecutionContext.Implicits.global
+    future map {
+      case IR.Success             => Results.Success
+      case IR.Error               => Results.Error
+      case IR.Incomplete          => Results.Incomplete
+    } recover {
+      case ex: ExecutionException => Results.Aborted
+    }
+  }
+
+  protected def interpretMapToResultAndOutput(future: Future[Results.Result]) = {
+    import scala.concurrent.ExecutionContext.Implicits.global
+    future map {
+      result =>
+        val output =
+          lastResultOut.toString(Charset.forName("UTF-8").name()).trim
+        lastResultOut.reset()
+        (result, output)
+    }
+  }
+
+  protected def interpretMapToResultAndExecuteInfo(
+    future: Future[(Results.Result, String)]
+  ): Future[(Results.Result, Either[ExecuteOutput, ExecuteFailure])] =
+  {
+    import scala.concurrent.ExecutionContext.Implicits.global
+    future map {
+      case (Results.Success, output)    => (Results.Success, Left(output))
+      case (Results.Incomplete, output) => (Results.Incomplete, Left(output))
+      case (Results.Aborted, output)    => (Results.Aborted, Right(null))
+      case (Results.Error, output)      =>
+        val x = sparkIMain.valueOfTerm(ExecutionExceptionName)
+        (
+          Results.Error,
+          Right(
+            interpretConstructExecuteError(
+              sparkIMain.valueOfTerm(ExecutionExceptionName),
+              output
+            )
+          )
+        )
+    }
+  }
+
+  protected def interpretConstructExecuteError(value: Option[AnyRef], output: String) =
+    value match {
+      // Runtime error
+      case Some(e) if e != null =>
+        val ex = e.asInstanceOf[Throwable]
+        // Clear runtime error message
+        sparkIMain.directBind(
+          ExecutionExceptionName,
+          classOf[Throwable].getName,
+          null
+        )
+        ExecuteError(
+          ex.getClass.getName,
+          ex.getLocalizedMessage,
+          ex.getStackTrace.map(_.toString).toList
+        )
+      // Compile time error, need to check internal reporter
+      case _ =>
+        if (sparkIMain.isReportingErrors)
+        // TODO: This wrapper is not needed when just getting compile
+        // error that we are not parsing... maybe have it be purely
+        // output and have the error check this?
+          ExecuteError(
+            "Compile Error", output, List()
+          )
+        else
+          ExecuteError("Unknown", "Unable to retrieve error!", List())
+    }
+
+
+  override def start() = {
+    require(sparkIMain == null && taskManager == null)
+
+    taskManager = newTaskManager()
+
+    logger.debug("Initializing task manager")
+    taskManager.start()
+
+    sparkIMain =
+      newSparkIMain(settings, new JPrintWriter(multiOutputStream, true))
+
+
+    //logger.debug("Initializing interpreter")
+    //sparkIMain.initializeSynchronous()
+
+    logger.debug("Initializing completer")
+    jLineCompleter = new SparkJLineCompletion(sparkIMain)
+
+    sparkIMain.beQuietDuring {
+      //logger.info("Rerouting Console and System related input and output")
+      //updatePrintStreams(System.in, multiOutputStream, multiOutputStream)
+
+//   ADD IMPORTS generates too many classes, client is responsible for adding import
+      logger.debug("Adding org.apache.spark.SparkContext._ to imports")
+      sparkIMain.addImports("org.apache.spark.SparkContext._")
+    }
+
+    this
+  }
+
+  override def updatePrintStreams(
+    in: InputStream, out: OutputStream, err: OutputStream
+  ): Unit = {
+    val inReader = new BufferedReader(new InputStreamReader(in))
+    val outPrinter = new PrintStream(out)
+    val errPrinter = new PrintStream(err)
+
+    sparkIMain.beQuietDuring {
+      sparkIMain.bind(
+        "Console", classOf[WrapperConsole].getName,
+        new WrapperConsole(inReader, outPrinter, errPrinter),
+        List("""@transient""")
+      )
+      sparkIMain.bind(
+        "System", classOf[WrapperSystem].getName,
+        new WrapperSystem(in, out, err),
+        List("""@transient""")
+      )
+      sparkIMain.addImports("Console._")
+    }
+  }
+
+  // NOTE: Convention is to force parentheses if a side effect occurs.
+  override def stop() = {
+    logger.info("Shutting down interpreter")
+
+    // Shut down the task manager (kills current execution
+    if (taskManager != null) taskManager.stop()
+    taskManager = null
+
+    // Erase our completer
+    jLineCompleter = null
+
+    // Close the entire interpreter (loses all state)
+    if (sparkIMain != null) sparkIMain.close()
+    sparkIMain = null
+
+    this
+  }
+
+  def classServerURI = {
+    require(sparkIMain != null)
+    sparkIMain.classServerUri
+  }
+
+  override def doQuietly[T](body: => T): T = {
+    require(sparkIMain != null)
+    sparkIMain.beQuietDuring[T](body)
+  }
+
+  override def bindSparkContext(sparkContext: SparkContext) = {
+    val bindName = "sc"
+
+    doQuietly {
+      logger.debug(s"Binding SparkContext into interpreter as $bindName")
+      bind(
+        bindName,
+        "org.apache.spark.SparkContext",
+        sparkContext,
+        List( """@transient""")
+      )
+
+      // NOTE: This is needed because interpreter blows up after adding
+      //       dependencies to SparkContext and Interpreter before the
+      //       cluster has been used... not exactly sure why this is the case
+      // TODO: Investigate why the cluster has to be initialized in the kernel
+      //       to avoid the kernel's interpreter blowing up (must be done
+      //       inside the interpreter)
+      logger.debug("Initializing Spark cluster in interpreter")
+
+      doQuietly {
+        interpret(Seq(
+          "val $toBeNulled = {",
+          "  var $toBeNulled = sc.emptyRDD.collect()",
+          "  $toBeNulled = null",
+          "}"
+        ).mkString("\n").trim())
+      }
+    }
+  }
+
+  override def bindSqlContext(sqlContext: SQLContext): Unit = {
+    val bindName = "sqlContext"
+
+    doQuietly {
+      // TODO: This only adds the context to the main interpreter AND
+      //       is limited to the Scala interpreter interface
+      logger.debug(s"Binding SQLContext into interpreter as $bindName")
+      bind(
+        bindName,
+        classOf[SQLContext].getName,
+        sqlContext,
+        List( """@transient""")
+      )
+
+      sqlContext
+    }
+  }
+
+  override def bind(
+    variableName: String, typeName: String,
+    value: Any, modifiers: List[String]
+  ): Unit = {
+    require(sparkIMain != null)
+    sparkIMain.bind(variableName, typeName, value, modifiers)
+  }
+
+  override def read(variableName: String): Option[AnyRef] = {
+    require(sparkIMain != null)
+    val variable = sparkIMain.valueOfTerm(variableName)
+    if (variable == null || variable.isEmpty) None
+    else variable
+  }
+
+  override def lastExecutionVariableName: Option[String] = {
+    require(sparkIMain != null)
+
+    // TODO: Get this API method changed back to public in Apache Spark
+    val lastRequestMethod = classOf[SparkIMain].getDeclaredMethod("lastRequest")
+    lastRequestMethod.setAccessible(true)
+
+    val request =
+      lastRequestMethod.invoke(sparkIMain).asInstanceOf[SparkIMain#Request]
+
+    val mostRecentVariableName = sparkIMain.mostRecentVar
+
+    request.definedNames.map(_.toString).find(_ == mostRecentVariableName)
+  }
+
+  override def completion(code: String, pos: Int): (Int, List[String]) = {
+    require(jLineCompleter != null)
+
+    logger.debug(s"Attempting code completion for ${code}")
+    val regex = """[0-9a-zA-Z._]+$""".r
+    val parsedCode = (regex findAllIn code).mkString("")
+
+    logger.debug(s"Attempting code completion for ${parsedCode}")
+    val result = jLineCompleter.completer().complete(parsedCode, pos)
+
+    (result.cursor, result.candidates)
+  }
+
+  override def classLoader: ClassLoader = _runtimeClassloader
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
new file mode 100644
index 0000000..c6c95af
--- /dev/null
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.scala
+
+import org.apache.spark.repl.SparkCommandLine
+
+import scala.tools.nsc.Settings
+
+trait SettingsProducerLike {
+  /**
+   * Creates a new Settings instance.
+   *
+   * @param args The list of command-line arguments to associate with Settings
+   *
+   * @return The new instance of Settings
+   */
+  def newSettings(args: List[String]): Settings
+}
+
+trait StandardSettingsProducer extends SettingsProducerLike {
+  override def newSettings(args: List[String]): Settings =
+    new SparkCommandLine(args).settings
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
new file mode 100644
index 0000000..d175b80
--- /dev/null
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.scala
+
+import org.apache.spark.repl.SparkIMain
+
+import scala.tools.nsc.interpreter.JPrintWriter
+import scala.tools.nsc.{Settings, interpreter}
+
+trait SparkIMainProducerLike {
+  /**
+   * Constructs a new instance of SparkIMain.
+   *
+   * @param settings The settings associated with the SparkIMain instance
+   * @param out The output writer associated with the SparkIMain instance
+   *
+   * @return The new SparkIMain instance
+   */
+  def newSparkIMain(settings: Settings, out: interpreter.JPrintWriter): SparkIMain
+}
+
+trait StandardSparkIMainProducer extends SparkIMainProducerLike {
+  override def newSparkIMain(
+    settings: Settings, out: JPrintWriter
+  ): SparkIMain = {
+    val s = new SparkIMain(settings, out)
+    s.initializeSynchronous()
+
+    s
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
new file mode 100644
index 0000000..9025316
--- /dev/null
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.scala
+
+import com.ibm.spark.utils.TaskManager
+
+trait TaskManagerProducerLike {
+  /**
+   * Creates a new instance of TaskManager.
+   *
+   * @return The new TaskManager instance
+   */
+  def newTaskManager(): TaskManager
+}
+
+trait StandardTaskManagerProducer extends TaskManagerProducerLike {
+  override def newTaskManager(): TaskManager = new TaskManager
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala b/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
new file mode 100644
index 0000000..c850926
--- /dev/null
+++ b/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError}
+import com.ibm.spark.kernel.interpreter.scala.{ScalaException, ScalaInterpreter}
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic.dependencies.IncludeKernel
+import com.ibm.spark.magic.{CellMagic, CellMagicOutput}
+
+/**
+ * Represents the magic interface to use the Scala interpreter.
+ */
+class Scala extends CellMagic with IncludeKernel {
+  override def execute(code: String): CellMagicOutput = {
+    val scala = kernel.interpreter("Scala")
+
+    if (scala.isEmpty || scala.get == null)
+      throw new ScalaException("Scala is not available!")
+
+    scala.get match {
+      case scalaInterpreter: ScalaInterpreter =>
+        val (_, output) = scalaInterpreter.interpret(code)
+        output match {
+          case Left(executeOutput) =>
+            CellMagicOutput(MIMEType.PlainText -> executeOutput)
+          case Right(executeFailure) => executeFailure match {
+            case executeAborted: ExecuteAborted =>
+              throw new ScalaException("Scala code was aborted!")
+            case executeError: ExecuteError =>
+              throw new ScalaException(executeError.value)
+          }
+        }
+      case otherInterpreter =>
+        val className = otherInterpreter.getClass.getName
+        throw new ScalaException(s"Invalid Scala interpreter: $className")
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/test/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreterSpec.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/test/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreterSpec.scala b/scala-interpreter/src/test/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreterSpec.scala
deleted file mode 100644
index 1b89df3..0000000
--- a/scala-interpreter/src/test/scala/com/ibm/spark/kernel/interpreter/scala/ScalaInterpreterSpec.scala
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.scala
-
-import java.io.{File, InputStream, OutputStream}
-import java.net.{URLClassLoader, URL}
-
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.utils.TaskManager
-import org.apache.spark.SparkConf
-import org.apache.spark.repl.SparkIMain
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.mockito.invocation.InvocationOnMock
-import org.mockito.stubbing.Answer
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-
-import scala.concurrent.Future
-import scala.tools.nsc.Settings
-import scala.tools.nsc.interpreter.{JPrintWriter, IR}
-import scala.tools.nsc.util.ClassPath
-
-class ScalaInterpreterSpec extends FunSpec
-  with Matchers with MockitoSugar with BeforeAndAfter
-{
-  private var interpreter: ScalaInterpreter               = _
-  private var interpreterNoPrintStreams: ScalaInterpreter = _
-  private var mockSparkIMain: SparkIMain                  = _
-  private var mockTaskManager: TaskManager                = _
-  private var mockSettings: Settings                      = _
-
-  trait StubbedUpdatePrintStreams extends Interpreter {
-    override def updatePrintStreams(
-      in: InputStream,
-      out: OutputStream,
-      err: OutputStream
-    ): Unit = {}
-  }
-
-  trait SingleLineInterpretLineRec extends StubbedStartInterpreter {
-    override protected def interpretRec(lines: List[String], silent: Boolean, results: (Result, Either[ExecuteOutput, ExecuteFailure])): (Result, Either[ExecuteOutput, ExecuteFailure]) =
-      interpretLine(lines.mkString("\n"))
-  }
-
-  trait StubbedInterpretAddTask extends StubbedStartInterpreter {
-    override protected def interpretAddTask(code: String, silent: Boolean) =
-      mock[Future[IR.Result]]
-  }
-
-  trait StubbedInterpretMapToCustomResult extends StubbedStartInterpreter {
-    override protected def interpretMapToCustomResult(future: Future[IR.Result]) =
-      mock[Future[Results.Result with Product with Serializable]]
-  }
-
-  trait StubbedInterpretMapToResultAndOutput extends StubbedStartInterpreter {
-    override protected def interpretMapToResultAndOutput(future: Future[Results.Result]) =
-      mock[Future[(Results.Result, String)]]
-  }
-
-  trait StubbedInterpretMapToResultAndExecuteInfo extends StubbedStartInterpreter {
-    override protected def interpretMapToResultAndExecuteInfo(future: Future[(Results.Result, String)]) =
-      mock[Future[(
-        Results.Result with Product with Serializable,
-        Either[ExecuteOutput, ExecuteFailure] with Product with Serializable
-      )]]
-  }
-
-  trait StubbedInterpretConstructExecuteError extends StubbedStartInterpreter {
-    override protected def interpretConstructExecuteError(value: Option[AnyRef], output: String) =
-      mock[ExecuteError]
-  }
-
-  class StubbedStartInterpreter
-    extends ScalaInterpreter
-  {
-    override def newSparkIMain(settings: Settings, out: JPrintWriter): SparkIMain = mockSparkIMain
-    override def newTaskManager(): TaskManager = mockTaskManager
-    override def newSettings(args: List[String]): Settings = mockSettings
-
-    // Stubbed out (not testing this)
-    override protected def updateCompilerClassPath(jars: URL*): Unit = {}
-
-    override protected def reinitializeSymbols(): Unit = {}
-
-    override protected def refreshDefinitions(): Unit = {}
-  }
-
-  before {
-    mockSparkIMain  = mock[SparkIMain]
-
-    mockTaskManager = mock[TaskManager]
-
-    val mockSettingsClasspath = mock[Settings#PathSetting]
-    doNothing().when(mockSettingsClasspath).value_=(any[Settings#PathSetting#T])
-
-    mockSettings    = mock[Settings]
-    doReturn(mockSettingsClasspath).when(mockSettings).classpath
-    doNothing().when(mockSettings).embeddedDefaults(any[ClassLoader])
-
-    interpreter = new StubbedStartInterpreter
-
-    interpreterNoPrintStreams =
-      new StubbedStartInterpreter with StubbedUpdatePrintStreams
-  }
-
-  after {
-    mockSparkIMain  = null
-    mockTaskManager = null
-    mockSettings    = null
-    interpreter     = null
-  }
-
-  describe("ScalaInterpreter") {
-    describe("#addJars") {
-      it("should add each jar URL to the runtime classloader") {
-        // Needed to access runtimeClassloader method
-        import scala.language.reflectiveCalls
-
-        // Create a new interpreter exposing the internal runtime classloader
-        val itInterpreter = new StubbedStartInterpreter {
-          // Expose the runtime classloader
-          def runtimeClassloader = _runtimeClassloader
-        }
-
-        val url = new URL("file://expected")
-        itInterpreter.addJars(url)
-
-        itInterpreter.runtimeClassloader.getURLs should contain (url)
-      }
-
-      it("should add each jar URL to the interpreter classpath") {
-        val url = new URL("file://expected")
-        interpreter.addJars(url)
-      }
-    }
-
-    describe("#buildClasspath") {
-      it("should return classpath based on classloader hierarchy") {
-        // Needed to access runtimeClassloader method
-        import scala.language.reflectiveCalls
-
-        // Create a new interpreter exposing the internal runtime classloader
-        val itInterpreter = new StubbedStartInterpreter
-
-        val parentUrls = Array(
-          new URL("file:/some/dir/a.jar"),
-          new URL("file:/some/dir/b.jar"),
-          new URL("file:/some/dir/c.jar")
-        )
-
-        val theParentClassloader = new URLClassLoader(parentUrls, null)
-
-        val urls = Array(
-          new URL("file:/some/dir/1.jar"),
-          new URL("file:/some/dir/2.jar"),
-          new URL("file:/some/dir/3.jar")
-        )
-
-        val theClassloader = new URLClassLoader(urls, theParentClassloader)
-
-        val expected = ClassPath.join((parentUrls ++ urls).map(_.toString) :_*)
-
-        itInterpreter.buildClasspath(theClassloader) should be(expected)
-      }
-    }
-
-    describe("#interrupt") {
-      it("should fail a require if the interpreter is not started") {
-        intercept[IllegalArgumentException] {
-          interpreter.interrupt()
-        }
-      }
-
-      it("should call restart() on the task manager") {
-        interpreterNoPrintStreams.start()
-
-        interpreterNoPrintStreams.interrupt()
-
-        verify(mockTaskManager).restart()
-      }
-    }
-
-    // TODO: Provide testing for the helper functions that return various
-    //       mapped futures -- this was too difficult for me to figure out
-    //       in a short amount of time
-    describe("#interpret") {
-      it("should fail if not started") {
-        intercept[IllegalArgumentException] {
-          interpreter.interpret("val x = 3")
-        }
-      }
-
-      it("should add a new task to the task manager") {
-        var taskManagerAddCalled = false
-        val itInterpreter =
-          new StubbedStartInterpreter
-          with SingleLineInterpretLineRec
-          with StubbedUpdatePrintStreams
-          //with StubbedInterpretAddTask
-          with StubbedInterpretMapToCustomResult
-          with StubbedInterpretMapToResultAndOutput
-          with StubbedInterpretMapToResultAndExecuteInfo
-          with StubbedInterpretConstructExecuteError
-          with TaskManagerProducerLike
-        {
-          // Must override this way since cannot figure out the signature
-          // to verify this as a mock
-          override def newTaskManager(): TaskManager = new TaskManager {
-            override def add[T](taskFunction: => T): Future[T] = {
-              taskManagerAddCalled = true
-              mock[TaskManager].add(taskFunction)
-            }
-          }
-        }
-
-        itInterpreter.start()
-
-        itInterpreter.interpret("val x = 3")
-
-        taskManagerAddCalled should be (true)
-      }
-    }
-
-    describe("#start") {
-      it("should initialize the task manager") {
-        interpreterNoPrintStreams.start()
-
-        verify(mockTaskManager).start()
-      }
-
-      // TODO: Figure out how to trigger sparkIMain.beQuietDuring { ... }
-      /*it("should add an import for SparkContext._") {
-        interpreterNoPrintStreams.start()
-
-        verify(mockSparkIMain).addImports("org.apache.spark.SparkContext._")
-      }*/
-    }
-
-    describe("#stop") {
-      describe("when interpreter already started") {
-        it("should stop the task manager") {
-          interpreterNoPrintStreams.start()
-          interpreterNoPrintStreams.stop()
-
-          verify(mockTaskManager).stop()
-        }
-
-        it("should stop the SparkIMain") {
-          interpreterNoPrintStreams.start()
-          interpreterNoPrintStreams.stop()
-
-          verify(mockSparkIMain).close()
-        }
-      }
-    }
-
-    describe("#updatePrintStreams") {
-      // TODO: Figure out how to trigger sparkIMain.beQuietDuring { ... }
-    }
-
-    describe("#classServerUri") {
-      it("should fail a require if the interpreter is not started") {
-        intercept[IllegalArgumentException] {
-          interpreter.classServerURI
-        }
-      }
-
-      // TODO: Find better way to test this
-      it("should invoke the underlying SparkIMain implementation") {
-        // Using hack to access private class
-        val securityManagerClass =
-          java.lang.Class.forName("org.apache.spark.SecurityManager")
-        val httpServerClass =
-          java.lang.Class.forName("org.apache.spark.HttpServer")
-        val httpServerConstructor = httpServerClass.getDeclaredConstructor(
-          classOf[SparkConf], classOf[File], securityManagerClass, classOf[Int],
-          classOf[String])
-        val httpServer = httpServerConstructor.newInstance(
-          null, null, null, 0: java.lang.Integer, "")
-
-        // Return the server instance (cannot mock a private class)
-        // NOTE: Can mock the class through reflection, but cannot verify
-        //       a method was called on it since treated as type Any
-        //val mockHttpServer = org.mockito.Mockito.mock(httpServerClass)
-        doAnswer(new Answer[String] {
-          override def answer(invocation: InvocationOnMock): String = {
-            val exceptionClass =
-              java.lang.Class.forName("org.apache.spark.ServerStateException")
-            val exception = exceptionClass
-              .getConstructor(classOf[String])
-              .newInstance("")
-              .asInstanceOf[Exception]
-            throw exception
-          }
-        }
-        ).when(mockSparkIMain).classServerUri
-
-        interpreterNoPrintStreams.start()
-
-        // Not going to dig so deeply that we actually start a web server for
-        // this to work... just throwing this specific exception proves that
-        // we have called the uri method of the server
-        try {
-          interpreterNoPrintStreams.classServerURI
-          fail()
-        } catch {
-          // Have to catch this way because... of course... the exception is
-          // also private
-          case ex: Throwable  =>
-            ex.getClass.getName should be ("org.apache.spark.ServerStateException")
-        }
-      }
-    }
-
-    describe("#read") {
-      it("should fail a require if the interpreter is not started") {
-        intercept[IllegalArgumentException] {
-          interpreter.read("someVariable")
-        }
-      }
-
-      it("should execute the underlying valueOfTerm method") {
-        interpreter.start()
-        interpreter.read("someVariable")
-
-        verify(mockSparkIMain).valueOfTerm(anyString())
-      }
-    }
-
-    describe("#doQuietly") {
-      it("should fail a require if the interpreter is not started") {
-        intercept[IllegalArgumentException] {
-          interpreter.doQuietly {}
-        }
-      }
-
-      // TODO: Figure out how to verify sparkIMain.beQuietDuring { ... }
-      /*it("should invoke the underlying SparkIMain implementation") {
-        interpreterNoPrintStreams.start()
-        interpreterNoPrintStreams.doQuietly {}
-
-        verify(mockSparkIMain).beQuietDuring(any[IR.Result])
-      }*/
-    }
-
-    describe("#bind") {
-      it("should fail a require if the interpreter is not started") {
-        intercept[IllegalArgumentException] {
-          interpreter.bind("", "", null, null)
-        }
-      }
-
-      it("should invoke the underlying SparkIMain implementation") {
-        interpreterNoPrintStreams.start()
-        interpreterNoPrintStreams.bind("", "", null, null)
-
-        verify(mockSparkIMain).bind(
-          anyString(), anyString(), any[Any], any[List[String]])
-      }
-    }
-
-    describe("#truncateResult") {
-      it("should truncate result of res result") {
-        //  Results that match
-        interpreter.truncateResult("res7: Int = 38") should be("38")
-        interpreter.truncateResult("res7: Int = 38",true) should be("Int = 38")
-        interpreter.truncateResult("res4: String = \nVector(1\n, 2\n)") should be ("Vector(1\n, 2\n)")
-        interpreter.truncateResult("res4: String = \nVector(1\n, 2\n)",true) should be ("String = Vector(1\n, 2\n)")
-        interpreter.truncateResult("res123") should be("")
-        interpreter.truncateResult("res1") should be("")
-        //  Results that don't match
-        interpreter.truncateResult("resabc: Int = 38") should be("")
-      }
-
-      it("should truncate res results that have tuple values") {
-        interpreter.truncateResult("res0: (String, Int) = (hello,1)") should
-          be("(hello,1)")
-      }
-
-      it("should truncate res results that have parameterized types") {
-        interpreter.truncateResult(
-          "res0: Class[_ <: (String, Int)] = class scala.Tuple2"
-        ) should be("class scala.Tuple2")
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala b/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
new file mode 100644
index 0000000..1b89df3
--- /dev/null
+++ b/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
@@ -0,0 +1,403 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.scala
+
+import java.io.{File, InputStream, OutputStream}
+import java.net.{URLClassLoader, URL}
+
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.interpreter._
+import com.ibm.spark.utils.TaskManager
+import org.apache.spark.SparkConf
+import org.apache.spark.repl.SparkIMain
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.mockito.invocation.InvocationOnMock
+import org.mockito.stubbing.Answer
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+
+import scala.concurrent.Future
+import scala.tools.nsc.Settings
+import scala.tools.nsc.interpreter.{JPrintWriter, IR}
+import scala.tools.nsc.util.ClassPath
+
+class ScalaInterpreterSpec extends FunSpec
+  with Matchers with MockitoSugar with BeforeAndAfter
+{
+  private var interpreter: ScalaInterpreter               = _
+  private var interpreterNoPrintStreams: ScalaInterpreter = _
+  private var mockSparkIMain: SparkIMain                  = _
+  private var mockTaskManager: TaskManager                = _
+  private var mockSettings: Settings                      = _
+
+  trait StubbedUpdatePrintStreams extends Interpreter {
+    override def updatePrintStreams(
+      in: InputStream,
+      out: OutputStream,
+      err: OutputStream
+    ): Unit = {}
+  }
+
+  trait SingleLineInterpretLineRec extends StubbedStartInterpreter {
+    override protected def interpretRec(lines: List[String], silent: Boolean, results: (Result, Either[ExecuteOutput, ExecuteFailure])): (Result, Either[ExecuteOutput, ExecuteFailure]) =
+      interpretLine(lines.mkString("\n"))
+  }
+
+  trait StubbedInterpretAddTask extends StubbedStartInterpreter {
+    override protected def interpretAddTask(code: String, silent: Boolean) =
+      mock[Future[IR.Result]]
+  }
+
+  trait StubbedInterpretMapToCustomResult extends StubbedStartInterpreter {
+    override protected def interpretMapToCustomResult(future: Future[IR.Result]) =
+      mock[Future[Results.Result with Product with Serializable]]
+  }
+
+  trait StubbedInterpretMapToResultAndOutput extends StubbedStartInterpreter {
+    override protected def interpretMapToResultAndOutput(future: Future[Results.Result]) =
+      mock[Future[(Results.Result, String)]]
+  }
+
+  trait StubbedInterpretMapToResultAndExecuteInfo extends StubbedStartInterpreter {
+    override protected def interpretMapToResultAndExecuteInfo(future: Future[(Results.Result, String)]) =
+      mock[Future[(
+        Results.Result with Product with Serializable,
+        Either[ExecuteOutput, ExecuteFailure] with Product with Serializable
+      )]]
+  }
+
+  trait StubbedInterpretConstructExecuteError extends StubbedStartInterpreter {
+    override protected def interpretConstructExecuteError(value: Option[AnyRef], output: String) =
+      mock[ExecuteError]
+  }
+
+  class StubbedStartInterpreter
+    extends ScalaInterpreter
+  {
+    override def newSparkIMain(settings: Settings, out: JPrintWriter): SparkIMain = mockSparkIMain
+    override def newTaskManager(): TaskManager = mockTaskManager
+    override def newSettings(args: List[String]): Settings = mockSettings
+
+    // Stubbed out (not testing this)
+    override protected def updateCompilerClassPath(jars: URL*): Unit = {}
+
+    override protected def reinitializeSymbols(): Unit = {}
+
+    override protected def refreshDefinitions(): Unit = {}
+  }
+
+  before {
+    mockSparkIMain  = mock[SparkIMain]
+
+    mockTaskManager = mock[TaskManager]
+
+    val mockSettingsClasspath = mock[Settings#PathSetting]
+    doNothing().when(mockSettingsClasspath).value_=(any[Settings#PathSetting#T])
+
+    mockSettings    = mock[Settings]
+    doReturn(mockSettingsClasspath).when(mockSettings).classpath
+    doNothing().when(mockSettings).embeddedDefaults(any[ClassLoader])
+
+    interpreter = new StubbedStartInterpreter
+
+    interpreterNoPrintStreams =
+      new StubbedStartInterpreter with StubbedUpdatePrintStreams
+  }
+
+  after {
+    mockSparkIMain  = null
+    mockTaskManager = null
+    mockSettings    = null
+    interpreter     = null
+  }
+
+  describe("ScalaInterpreter") {
+    describe("#addJars") {
+      it("should add each jar URL to the runtime classloader") {
+        // Needed to access runtimeClassloader method
+        import scala.language.reflectiveCalls
+
+        // Create a new interpreter exposing the internal runtime classloader
+        val itInterpreter = new StubbedStartInterpreter {
+          // Expose the runtime classloader
+          def runtimeClassloader = _runtimeClassloader
+        }
+
+        val url = new URL("file://expected")
+        itInterpreter.addJars(url)
+
+        itInterpreter.runtimeClassloader.getURLs should contain (url)
+      }
+
+      it("should add each jar URL to the interpreter classpath") {
+        val url = new URL("file://expected")
+        interpreter.addJars(url)
+      }
+    }
+
+    describe("#buildClasspath") {
+      it("should return classpath based on classloader hierarchy") {
+        // Needed to access runtimeClassloader method
+        import scala.language.reflectiveCalls
+
+        // Create a new interpreter exposing the internal runtime classloader
+        val itInterpreter = new StubbedStartInterpreter
+
+        val parentUrls = Array(
+          new URL("file:/some/dir/a.jar"),
+          new URL("file:/some/dir/b.jar"),
+          new URL("file:/some/dir/c.jar")
+        )
+
+        val theParentClassloader = new URLClassLoader(parentUrls, null)
+
+        val urls = Array(
+          new URL("file:/some/dir/1.jar"),
+          new URL("file:/some/dir/2.jar"),
+          new URL("file:/some/dir/3.jar")
+        )
+
+        val theClassloader = new URLClassLoader(urls, theParentClassloader)
+
+        val expected = ClassPath.join((parentUrls ++ urls).map(_.toString) :_*)
+
+        itInterpreter.buildClasspath(theClassloader) should be(expected)
+      }
+    }
+
+    describe("#interrupt") {
+      it("should fail a require if the interpreter is not started") {
+        intercept[IllegalArgumentException] {
+          interpreter.interrupt()
+        }
+      }
+
+      it("should call restart() on the task manager") {
+        interpreterNoPrintStreams.start()
+
+        interpreterNoPrintStreams.interrupt()
+
+        verify(mockTaskManager).restart()
+      }
+    }
+
+    // TODO: Provide testing for the helper functions that return various
+    //       mapped futures -- this was too difficult for me to figure out
+    //       in a short amount of time
+    describe("#interpret") {
+      it("should fail if not started") {
+        intercept[IllegalArgumentException] {
+          interpreter.interpret("val x = 3")
+        }
+      }
+
+      it("should add a new task to the task manager") {
+        var taskManagerAddCalled = false
+        val itInterpreter =
+          new StubbedStartInterpreter
+          with SingleLineInterpretLineRec
+          with StubbedUpdatePrintStreams
+          //with StubbedInterpretAddTask
+          with StubbedInterpretMapToCustomResult
+          with StubbedInterpretMapToResultAndOutput
+          with StubbedInterpretMapToResultAndExecuteInfo
+          with StubbedInterpretConstructExecuteError
+          with TaskManagerProducerLike
+        {
+          // Must override this way since cannot figure out the signature
+          // to verify this as a mock
+          override def newTaskManager(): TaskManager = new TaskManager {
+            override def add[T](taskFunction: => T): Future[T] = {
+              taskManagerAddCalled = true
+              mock[TaskManager].add(taskFunction)
+            }
+          }
+        }
+
+        itInterpreter.start()
+
+        itInterpreter.interpret("val x = 3")
+
+        taskManagerAddCalled should be (true)
+      }
+    }
+
+    describe("#start") {
+      it("should initialize the task manager") {
+        interpreterNoPrintStreams.start()
+
+        verify(mockTaskManager).start()
+      }
+
+      // TODO: Figure out how to trigger sparkIMain.beQuietDuring { ... }
+      /*it("should add an import for SparkContext._") {
+        interpreterNoPrintStreams.start()
+
+        verify(mockSparkIMain).addImports("org.apache.spark.SparkContext._")
+      }*/
+    }
+
+    describe("#stop") {
+      describe("when interpreter already started") {
+        it("should stop the task manager") {
+          interpreterNoPrintStreams.start()
+          interpreterNoPrintStreams.stop()
+
+          verify(mockTaskManager).stop()
+        }
+
+        it("should stop the SparkIMain") {
+          interpreterNoPrintStreams.start()
+          interpreterNoPrintStreams.stop()
+
+          verify(mockSparkIMain).close()
+        }
+      }
+    }
+
+    describe("#updatePrintStreams") {
+      // TODO: Figure out how to trigger sparkIMain.beQuietDuring { ... }
+    }
+
+    describe("#classServerUri") {
+      it("should fail a require if the interpreter is not started") {
+        intercept[IllegalArgumentException] {
+          interpreter.classServerURI
+        }
+      }
+
+      // TODO: Find better way to test this
+      it("should invoke the underlying SparkIMain implementation") {
+        // Using hack to access private class
+        val securityManagerClass =
+          java.lang.Class.forName("org.apache.spark.SecurityManager")
+        val httpServerClass =
+          java.lang.Class.forName("org.apache.spark.HttpServer")
+        val httpServerConstructor = httpServerClass.getDeclaredConstructor(
+          classOf[SparkConf], classOf[File], securityManagerClass, classOf[Int],
+          classOf[String])
+        val httpServer = httpServerConstructor.newInstance(
+          null, null, null, 0: java.lang.Integer, "")
+
+        // Return the server instance (cannot mock a private class)
+        // NOTE: Can mock the class through reflection, but cannot verify
+        //       a method was called on it since treated as type Any
+        //val mockHttpServer = org.mockito.Mockito.mock(httpServerClass)
+        doAnswer(new Answer[String] {
+          override def answer(invocation: InvocationOnMock): String = {
+            val exceptionClass =
+              java.lang.Class.forName("org.apache.spark.ServerStateException")
+            val exception = exceptionClass
+              .getConstructor(classOf[String])
+              .newInstance("")
+              .asInstanceOf[Exception]
+            throw exception
+          }
+        }
+        ).when(mockSparkIMain).classServerUri
+
+        interpreterNoPrintStreams.start()
+
+        // Not going to dig so deeply that we actually start a web server for
+        // this to work... just throwing this specific exception proves that
+        // we have called the uri method of the server
+        try {
+          interpreterNoPrintStreams.classServerURI
+          fail()
+        } catch {
+          // Have to catch this way because... of course... the exception is
+          // also private
+          case ex: Throwable  =>
+            ex.getClass.getName should be ("org.apache.spark.ServerStateException")
+        }
+      }
+    }
+
+    describe("#read") {
+      it("should fail a require if the interpreter is not started") {
+        intercept[IllegalArgumentException] {
+          interpreter.read("someVariable")
+        }
+      }
+
+      it("should execute the underlying valueOfTerm method") {
+        interpreter.start()
+        interpreter.read("someVariable")
+
+        verify(mockSparkIMain).valueOfTerm(anyString())
+      }
+    }
+
+    describe("#doQuietly") {
+      it("should fail a require if the interpreter is not started") {
+        intercept[IllegalArgumentException] {
+          interpreter.doQuietly {}
+        }
+      }
+
+      // TODO: Figure out how to verify sparkIMain.beQuietDuring { ... }
+      /*it("should invoke the underlying SparkIMain implementation") {
+        interpreterNoPrintStreams.start()
+        interpreterNoPrintStreams.doQuietly {}
+
+        verify(mockSparkIMain).beQuietDuring(any[IR.Result])
+      }*/
+    }
+
+    describe("#bind") {
+      it("should fail a require if the interpreter is not started") {
+        intercept[IllegalArgumentException] {
+          interpreter.bind("", "", null, null)
+        }
+      }
+
+      it("should invoke the underlying SparkIMain implementation") {
+        interpreterNoPrintStreams.start()
+        interpreterNoPrintStreams.bind("", "", null, null)
+
+        verify(mockSparkIMain).bind(
+          anyString(), anyString(), any[Any], any[List[String]])
+      }
+    }
+
+    describe("#truncateResult") {
+      it("should truncate result of res result") {
+        //  Results that match
+        interpreter.truncateResult("res7: Int = 38") should be("38")
+        interpreter.truncateResult("res7: Int = 38",true) should be("Int = 38")
+        interpreter.truncateResult("res4: String = \nVector(1\n, 2\n)") should be ("Vector(1\n, 2\n)")
+        interpreter.truncateResult("res4: String = \nVector(1\n, 2\n)",true) should be ("String = Vector(1\n, 2\n)")
+        interpreter.truncateResult("res123") should be("")
+        interpreter.truncateResult("res1") should be("")
+        //  Results that don't match
+        interpreter.truncateResult("resabc: Int = 38") should be("")
+      }
+
+      it("should truncate res results that have tuple values") {
+        interpreter.truncateResult("res0: (String, Int) = (hello,1)") should
+          be("(hello,1)")
+      }
+
+      it("should truncate res results that have parameterized types") {
+        interpreter.truncateResult(
+          "res0: Class[_ <: (String, Int)] = class scala.Tuple2"
+        ) should be("class scala.Tuple2")
+      }
+    }
+  }
+}



[38/51] [abbrv] incubator-toree git commit: Internal rename of object and changes to entrypoint script

Posted by lb...@apache.org.
Internal rename of object and changes to entrypoint script


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/39cdd690
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/39cdd690
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/39cdd690

Branch: refs/heads/TestBranch
Commit: 39cdd690ded7f88f23514519a4704852c3ed4106
Parents: ac330ed
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Fri Jan 15 11:50:29 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Fri Jan 15 11:50:29 2016 -0600

----------------------------------------------------------------------
 etc/bin/spark-kernel                            | 35 --------------------
 etc/bin/toree-kernel                            |  2 +-
 .../src/main/scala/org/apache/toree/Main.scala  |  2 +-
 3 files changed, 2 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/39cdd690/etc/bin/spark-kernel
----------------------------------------------------------------------
diff --git a/etc/bin/spark-kernel b/etc/bin/spark-kernel
deleted file mode 100755
index 836201b..0000000
--- a/etc/bin/spark-kernel
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# Copyright 2015 IBM Corp.
-#
-# 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.
-#
-                                           ``
-PROG_HOME="$(cd "`dirname "$0"`"/..; pwd)"
-
-if [ -z "$SPARK_HOME" ]; then
-  echo "SPARK_HOME must be set to the location of a Spark distribution!"
-  exit 1
-fi
-
-echo "Starting Spark Kernel with SPARK_HOME=$SPARK_HOME"
-
-KERNEL_ASSEMBLY=`(cd ${PROG_HOME}/lib; ls -1 kernel-assembly-*.jar;)`
-
-# disable randomized hash for string in Python 3.3+
-export PYTHONHASHSEED=0
-
-exec "$SPARK_HOME"/bin/spark-submit \
-  ${SPARK_OPTS} \
-  --class org.apache.toree.SparkKernel $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/39cdd690/etc/bin/toree-kernel
----------------------------------------------------------------------
diff --git a/etc/bin/toree-kernel b/etc/bin/toree-kernel
index 87b4ca1..71831bf 100755
--- a/etc/bin/toree-kernel
+++ b/etc/bin/toree-kernel
@@ -32,4 +32,4 @@ export PYTHONHASHSEED=0
 
 exec "$SPARK_HOME"/bin/spark-submit \
   ${SPARK_OPTS} \
-  --class org.apache.toree.SparkKernel $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"
+  --class org.apache.toree.Main $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/39cdd690/kernel/src/main/scala/org/apache/toree/Main.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/Main.scala b/kernel/src/main/scala/org/apache/toree/Main.scala
index 1a8ac40..27e914d 100644
--- a/kernel/src/main/scala/org/apache/toree/Main.scala
+++ b/kernel/src/main/scala/org/apache/toree/Main.scala
@@ -20,7 +20,7 @@ import org.apache.toree.boot.layer._
 import org.apache.toree.boot.{CommandLineOptions, KernelBootstrap}
 import org.apache.toree.kernel.BuildInfo
 
-object SparkKernel extends App {
+object Main extends App {
   private val options = new CommandLineOptions(args)
 
   if (options.help) {


[19/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/api/StreamMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/api/StreamMethods.scala b/kernel/src/main/scala/com/ibm/spark/kernel/api/StreamMethods.scala
deleted file mode 100644
index 35c4960..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/api/StreamMethods.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.api
-
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-
-/**
- * Represents the methods available to stream data from the kernel to the
- * client.
- */
-class StreamMethods(actorLoader: ActorLoader, parentMessage: KernelMessage)
-  extends StreamMethodsLike
-{
-  private[api] val kmBuilder = v5.KMBuilder()
-    .withParent(parentMessage)
-    .withIds(Seq(v5.content.StreamContent.toTypeString))
-    .withHeader(v5.content.StreamContent.toTypeString)
-
-  /**
-   * Sends all text provided as one stream message to the client.
-   * @param text The text to wrap in a stream message
-   */
-  override def sendAll(text: String): Unit = {
-    val streamContent = v5.content.StreamContent(
-      "stdout", text
-    )
-
-    val kernelMessage = kmBuilder.withContentString(streamContent).build
-
-    actorLoader.load(v5.SystemActorType.KernelMessageRelay) ! kernelMessage
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatch.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatch.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatch.scala
deleted file mode 100644
index 144b067..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/dispatch/StatusDispatch.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.dispatch
-
-import akka.actor.Actor
-import com.ibm.spark.kernel.protocol.v5.KernelStatusType.KernelStatusType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.KernelStatus
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.LogLike
-import play.api.libs.json.Json
-
-class StatusDispatch(actorLoader: ActorLoader) extends Actor with LogLike {
-  private def sendStatusMessage(kernelStatus: KernelStatusType, parentHeader: Header) {
-    //  Create the status message and send it to the relay
-    val km : KernelMessage = KMBuilder()
-      .withIds(Seq(MessageType.Outgoing.Status.toString))
-      .withSignature("")
-      .withHeader(MessageType.Outgoing.Status)
-      .withParentHeader(parentHeader)
-      .withContentString(KernelStatus(kernelStatus.toString)).build
-
-    actorLoader.load(SystemActorType.KernelMessageRelay) ! km
-  }
-
-  override def receive: Receive = {
-    case (status: KernelStatusType, null) =>
-      //  TODO Determine if this should be null or an empty parent header
-      sendStatusMessage(status, null)
-
-    case (status: KernelStatusType, parentHeader: Header) =>
-      sendStatusMessage( status, parentHeader )
-
-    case status: KernelStatusType =>
-      sendStatusMessage(status , HeaderBuilder.empty)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/BaseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/BaseHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/BaseHandler.scala
deleted file mode 100644
index abbf6d3..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/BaseHandler.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.MessageLogSupport
-
-import scala.concurrent.Future
-
-abstract class BaseHandler(actorLoader: ActorLoader) extends OrderedSupport
-  with MessageLogSupport {
-  /**
-   * Implements the receive method, sending a busy message out before
-   * processing the message and sending an idle message out once finished.
-   *
-   * @return The Akka partial function n
-   */
-  final def receive = {
-    // NOTE: Not using withProcessing as the finishedProcessing call is inside
-    //       a future (not triggered immediately)
-    case kernelMessage: KernelMessage =>
-      startProcessing()
-      // Send the busy message before we process the message
-      logKernelMessageAction("Sending Busy message for", kernelMessage)
-      actorLoader.load(SystemActorType.StatusDispatch) !
-        Tuple2(KernelStatusType.Busy, kernelMessage.header)
-
-      // Process the message
-      logKernelMessageAction("Processing", kernelMessage)
-      import scala.concurrent.ExecutionContext.Implicits.global
-      val processFuture = process(kernelMessage)
-
-      // Send the idle message since message has been processed
-      logKernelMessageAction("Sending Idle message for", kernelMessage)
-      processFuture onComplete {
-        case _ =>
-          actorLoader.load(SystemActorType.StatusDispatch) !
-            Tuple2(KernelStatusType.Idle, kernelMessage.header)
-          finishedProcessing()
-      }
-  }
-
-  override def orderedTypes() : Seq[Class[_]] = {Seq(classOf[KernelMessage])}
-
-  /**
-   * Processes the provided kernel message.
-   *
-   * @param kernelMessage The kernel message instance to process
-   */
-  def process(kernelMessage: KernelMessage): Future[_]
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandler.scala
deleted file mode 100644
index c3b38ee..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CodeCompleteHandler.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.pattern.ask
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import Utilities._
-import com.ibm.spark.utils.{MessageLogSupport, LogLike}
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, Json}
-
-import scala.concurrent.ExecutionContext.Implicits.global
-import scala.concurrent.Future
-import scala.util.Success
-
-class CodeCompleteHandler(actorLoader: ActorLoader)
-  extends BaseHandler(actorLoader) with MessageLogSupport
-{
-  override def process(kernelMessage: KernelMessage): Future[_] = {
-    logKernelMessageAction("Generating code completion for", kernelMessage)
-    Utilities.parseAndHandle(
-      kernelMessage.contentString,
-      CompleteRequest.completeRequestReads,
-      completeRequest(kernelMessage, _ : CompleteRequest)
-    )
-  }
-
-  private def completeRequest(km: KernelMessage, cr: CompleteRequest):
-                              Future[(Int, List[String])] = {
-    val interpreterActor = actorLoader.load(SystemActorType.Interpreter)
-    val codeCompleteFuture = ask(interpreterActor, cr).mapTo[(Int, List[String])]
-    codeCompleteFuture.onComplete {
-      case Success(tuple) =>
-        val reply = CompleteReplyOk(tuple._2, cr.cursor_pos,
-                                    tuple._1, Metadata())
-        val completeReplyType = MessageType.Outgoing.CompleteReply.toString
-        logKernelMessageAction("Sending code complete reply for", km)
-        actorLoader.load(SystemActorType.KernelMessageRelay) !
-          km.copy(
-            header = HeaderBuilder.create(completeReplyType),
-            parentHeader = km.header,
-            contentString = Json.toJson(reply).toString
-          )
-      case _ =>
-        new Exception("Parse error in CodeCompleteHandler")
-    }
-    codeCompleteFuture
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandler.scala
deleted file mode 100644
index 2c87dd7..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommCloseHandler.scala
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import com.ibm.spark.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.content.CommClose
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.MessageLogSupport
-import play.api.data.validation.ValidationError
-import play.api.libs.json.JsPath
-
-import scala.concurrent.Future
-import scala.concurrent.future
-import scala.concurrent.ExecutionContext.Implicits.global
-
-/**
- * Represents the handler for comm_close messages.
- *
- * @param actorLoader The actor loader to use for actor communication
- * @param commRegistrar The Comm registrar used for unlinking
- * @param commStorage The Comm storage used for close callbacks
- */
-class CommCloseHandler(
-  actorLoader: ActorLoader, commRegistrar: CommRegistrar,
-  commStorage: CommStorage
-) extends BaseHandler(actorLoader) with MessageLogSupport
-{
-  override def process(kernelMessage: KernelMessage): Future[_] = future {
-    logKernelMessageAction("Initiating Comm Close for", kernelMessage)
-
-    val kmBuilder = KMBuilder().withParent(kernelMessage)
-
-    Utilities.parseAndHandle(
-      kernelMessage.contentString,
-      CommClose.commCloseReads,
-      handler = handleCommClose(kmBuilder),
-      errHandler = handleParseError
-    )
-  }
-
-  private def handleCommClose(kmBuilder: KMBuilder)(commClose: CommClose) = {
-    val commId = commClose.comm_id
-    val data = commClose.data
-
-    logger.debug(s"Received comm_close with id '$commId'")
-
-    val commWriter = new KernelCommWriter(actorLoader, kmBuilder, commId)
-
-    commStorage.getCommIdCallbacks(commId) match {
-      case None             =>
-        logger.warn(s"Received invalid id for Comm Close: $commId")
-      case Some(callbacks)  =>
-        logger.debug(s"Executing close callbacks for id '$commId'")
-
-        // TODO: Should we be checking the return values? Probably not.
-        callbacks.executeCloseCallbacks(commWriter, commId, data)
-          .filter(_.isFailure).map(_.failed).foreach(throwable => {
-            logger.error("Comm close callback encountered an error!", throwable)
-          })
-    }
-  }
-
-  private def handleParseError(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
-    // TODO: Determine proper response for a parse failure
-    logger.warn("Parse error for Comm Close! Not responding!")
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandler.scala
deleted file mode 100644
index 03baef9..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommMsgHandler.scala
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import com.ibm.spark.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.content.CommMsg
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.MessageLogSupport
-import play.api.data.validation.ValidationError
-import play.api.libs.json.JsPath
-
-import scala.concurrent.Future
-import scala.concurrent.future
-import scala.concurrent.ExecutionContext.Implicits.global
-
-/**
- * Represents the handler for comm_msg messages.
- *
- * @param actorLoader The actor loader to use for actor communication
- * @param commRegistrar The Comm registrar (unused)
- * @param commStorage The Comm storage used for msg callbacks
- */
-class CommMsgHandler(
-  actorLoader: ActorLoader, commRegistrar: CommRegistrar,
-  commStorage: CommStorage
-) extends BaseHandler(actorLoader) with MessageLogSupport
-{
-  override def process(kernelMessage: KernelMessage): Future[_] = future {
-    logKernelMessageAction("Initiating Comm Msg for", kernelMessage)
-
-    val kmBuilder = KMBuilder().withParent(kernelMessage)
-
-    Utilities.parseAndHandle(
-      kernelMessage.contentString,
-      CommMsg.commMsgReads,
-      handler = handleCommMsg(kmBuilder),
-      errHandler = handleParseError
-    )
-  }
-
-  private def handleCommMsg(kmBuilder: KMBuilder)(commMsg: CommMsg) = {
-    val commId = commMsg.comm_id
-    val data = commMsg.data
-
-    logger.debug(s"Received comm_msg with id '$commId'")
-
-    val commWriter = new KernelCommWriter(actorLoader, kmBuilder, commId)
-
-    commStorage.getCommIdCallbacks(commId) match {
-      case None             =>
-        logger.warn(s"Received invalid id for Comm Msg: $commId")
-      case Some(callbacks)  =>
-        logger.debug(s"Executing msg callbacks for id '$commId'")
-
-        // TODO: Should we be checking the return values? Probably not.
-        callbacks.executeMsgCallbacks(commWriter, commId, data)
-          .filter(_.isFailure).map(_.failed).foreach(throwable => {
-            logger.error("Comm msg callback encountered an error!", throwable)
-          })
-    }
-  }
-
-  private def handleParseError(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
-    // TODO: Determine proper response for a parse failure
-    logger.warn("Parse error for Comm Msg! Not responding!")
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandler.scala
deleted file mode 100644
index 80e2b35..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/CommOpenHandler.scala
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import com.ibm.spark.comm.{KernelCommWriter, CommStorage, CommRegistrar, CommWriter}
-import com.ibm.spark.kernel.protocol.v5.content.CommOpen
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.MessageLogSupport
-import play.api.data.validation.ValidationError
-import play.api.libs.json.JsPath
-
-import scala.concurrent.Future
-import scala.concurrent.future
-import scala.concurrent.ExecutionContext.Implicits.global
-
-/**
- * Represents the handler for comm_open messages.
- *
- * @param actorLoader The actor loader to use for actor communication
- * @param commRegistrar The Comm registrar used for linking
- * @param commStorage The Comm storage used for open callbacks
- */
-class CommOpenHandler(
-  actorLoader: ActorLoader, commRegistrar: CommRegistrar,
-  commStorage: CommStorage
-) extends BaseHandler(actorLoader) with MessageLogSupport
-{
-  override def process(kernelMessage: KernelMessage): Future[_] = future {
-    logKernelMessageAction("Initiating Comm Open for", kernelMessage)
-
-    val kmBuilder = KMBuilder().withParent(kernelMessage)
-
-    Utilities.parseAndHandle(
-      kernelMessage.contentString,
-      CommOpen.commOpenReads,
-      handler = handleCommOpen(kmBuilder),
-      errHandler = handleParseError
-    )
-  }
-
-  private def handleCommOpen(kmBuilder: KMBuilder)(commOpen: CommOpen) = {
-    val commId = commOpen.comm_id
-    val targetName = commOpen.target_name
-    val data = commOpen.data
-
-    logger.debug(
-      s"Received comm_open for target '$targetName' with id '$commId'")
-
-    val commWriter = new KernelCommWriter(actorLoader, kmBuilder, commId)
-
-    commStorage.getTargetCallbacks(targetName) match {
-      case None             =>
-        logger.warn(s"Received invalid target for Comm Open: $targetName")
-
-        commWriter.close()
-      case Some(callbacks)  =>
-        logger.debug(s"Executing open callbacks for id '$commId'")
-
-        // TODO: Should we be checking the return values? Probably not.
-        callbacks.executeOpenCallbacks(commWriter, commId, targetName, data)
-          .filter(_.isFailure).map(_.failed).foreach(throwable => {
-            logger.error("Comm open callback encountered an error!", throwable)
-          })
-    }
-  }
-
-  private def handleParseError(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
-    // TODO: Determine proper response for a parse failure
-    logger.warn("Parse error for Comm Open! Not responding!")
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
deleted file mode 100644
index c066d98..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.actor.ActorSelection
-import akka.pattern.ask
-import com.ibm.spark.global.{ExecuteRequestState, ExecutionCounter}
-import com.ibm.spark.kernel.api.{Kernel, KernelLike}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
-import com.ibm.spark.{global => kernelGlobal}
-import Utilities._
-import com.ibm.spark.utils._
-import play.api.data.validation.ValidationError
-import play.api.libs.json.JsPath
-
-import scala.concurrent.ExecutionContext.Implicits.global
-import scala.concurrent._
-import scala.util.{Failure, Success}
-
-/**
- * Receives an ExecuteRequest KernelMessage and forwards the ExecuteRequest
- * to the interpreter actor.
- *
- * @param actorLoader The loader to use when needing to retrieve actors for
- *                    code execution and output
- * @param kernel The kernel whose factory methods to use
- */
-class ExecuteRequestHandler(
-  private val actorLoader: ActorLoader,
-  private val kernel: Kernel
-) extends BaseHandler(actorLoader) with LogLike {
-  override def process(km: KernelMessage): Future[_] = {
-    // Mark the message as our new incoming kernel message for execution
-    ExecuteRequestState.processIncomingKernelMessage(km)
-
-    val skeletonBuilder = KMBuilder().withParent(km).withIds(km.ids)
-    val executionCount = ExecutionCounter.incr(km.header.session)
-    val relayActor = actorLoader.load(SystemActorType.KernelMessageRelay)
-
-    def handleExecuteRequest(executeRequest: ExecuteRequest):
-                             Future[(ExecuteReply, ExecuteResult)] = {
-      //  Send an ExecuteInput to the client saying we are executing something
-      val executeInputMessage = skeletonBuilder
-        .withHeader(MessageType.Outgoing.ExecuteInput)
-        .withContentString(ExecuteInput(executeRequest.code, executionCount)).build
-
-      relayMsg(executeInputMessage, relayActor)
-
-      // Construct our new set of streams
-      // TODO: Add support for error streams
-      val outputStream = kernel.factory(
-        parentMessage = km,
-        kmBuilder = skeletonBuilder
-      ).newKernelOutputStream()
-      val executeFuture = ask(
-        actorLoader.load(SystemActorType.ExecuteRequestRelay),
-        (executeRequest, km, outputStream)
-      ).mapTo[(ExecuteReply, ExecuteResult)]
-
-      // Flush the output stream after code execution completes to ensure
-      // stream messages are sent prior to idle status messages.
-      executeFuture andThen { case result =>
-        outputStream.flush()
-        result
-      } andThen {
-        case Success(tuple) =>
-          val (executeReply, executeResult) = updateCount(tuple, executionCount)
-
-          //  Send an ExecuteReply to the client
-          val executeReplyMsg = skeletonBuilder
-            .withHeader(MessageType.Outgoing.ExecuteReply)
-            .withContentString(executeReply).build
-          relayMsg(executeReplyMsg, relayActor)
-
-          //  Send an ExecuteResult with the result of the code execution
-          if (executeResult.hasContent) {
-            val executeResultMsg = skeletonBuilder
-              .withIds(Seq(MessageType.Outgoing.ExecuteResult.toString))
-              .withHeader(MessageType.Outgoing.ExecuteResult)
-              .withContentString(executeResult).build
-            relayMsg(executeResultMsg, relayActor)
-          }
-
-        case Failure(error: Throwable) =>
-          //  Send an ExecuteReplyError to the client on the Shell socket
-          val replyError: ExecuteReply = ExecuteReplyError(
-            executionCount,
-            Option(error.getClass.getCanonicalName),
-            Option(error.getMessage),
-            Option(error.getStackTrace.map(_.toString).toList))
-          relayErrorMessages(relayActor, replyError, skeletonBuilder)
-      }
-    }
-
-    def parseErrorHandler(invalid: Seq[(JsPath, Seq[ValidationError])]) = {
-      val errs = invalid.map (e => s"JSPath ${e._1} has error ${e._2}").toList
-      logger.error(s"Validation errors when parsing ExecuteRequest: ${errs}")
-      val replyError: ExecuteReply = ExecuteReplyError(
-        executionCount,
-        Option("JsonParseException"),
-        Option("Error parsing fields"),
-        Option(errs)
-      )
-      future { relayErrorMessages(relayActor, replyError, skeletonBuilder) }
-    }
-
-    Utilities.parseAndHandle(
-      km.contentString,
-      ExecuteRequest.executeRequestReads,
-      handler    = handleExecuteRequest,
-      errHandler = parseErrorHandler)
-  }
-
-  private def updateCount(tuple: (ExecuteReply, ExecuteResult), n: Int) =
-    (tuple._1.copy(execution_count = n), tuple._2.copy(execution_count = n))
-
-  /**
-   * Sends an ExecuteReplyError and and Error message to the given actor.
-   * @param relayActor The relay to send kernelMessages through
-   * @param replyError The reply error to build the error kernelMessages from.
-   * @param skeletonBuilder A builder with common base KernelMessage parameters.
-   */
-  def relayErrorMessages(relayActor: ActorSelection,
-                         replyError: ExecuteReply,
-                         skeletonBuilder: KMBuilder) {
-    val executeReplyMsg = skeletonBuilder
-      .withHeader(MessageType.Outgoing.ExecuteReply)
-      .withContentString(replyError).build
-
-    val errorContent: ErrorContent =  ErrorContent(
-      replyError.ename.get, replyError.evalue.get, replyError.traceback.get)
-
-    val errorMsg = skeletonBuilder
-      .withHeader(MessageType.Outgoing.Error)
-      .withContentString(errorContent).build
-
-    relayMsg(executeReplyMsg, relayActor)
-    //  Send the Error to the client on the IOPub socket
-    relayMsg(errorMsg, relayActor)
-  }
-
-  private def relayMsg(km: KernelMessage, relayActor: ActorSelection) = {
-    logKernelMessageAction("Sending to KernelMessageRelay.", km)
-    relayActor ! km
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
deleted file mode 100644
index 834f632..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.{MessageLogSupport, LogLike}
-
-/**
- * All KernelMessage leaving the kernel for the client will exit the relay in a similar pattern. This class is meant
- * to encapsulate this behaviour into one generic method. This class should be used by mapping a
- * {@link com.ibm.spark.kernel.protocol.MessageType} to the {@link com.ibm.spark.kernel.protocol.SocketType} constructor
- * parameter. This will map MessageTypes to their corresponding SocketTypes. An example us of this class would be
- *
- * actorSystem.actorOf(
- *      //  Tells the handler to forward anything it receives to the Control socket
- *      Props(classOf[GenericSocketMessageHandler], actorLoader, SocketType.Control),
- *
- *      // Creates the Actor with the name of the message type, this allows the Relay to route messages here
- *      name = MessageType.KernelInfoReply.toString
- *   )
- *
- * @param actorLoader The ActorLoader used to load the socket actors
- * @param socketType The type of socket, mapping to an Actor for this class to pass messages along to
- */
-class GenericSocketMessageHandler(actorLoader: ActorLoader, socketType: Enumeration#Value)
-  extends Actor with LogLike with OrderedSupport {
-  override def receive: Receive = {
-    case message: KernelMessage => withProcessing {
-      logger.debug(s"Sending KernelMessage ${message.header.msg_id} of type " +
-        s"${message.header.msg_type} to ${socketType} socket")
-      actorLoader.load(socketType) ! message
-    }
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[KernelMessage])
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
deleted file mode 100644
index dba0eef..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import akka.actor.ActorRef
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.{SystemActorType, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.content.{InputReply, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.utils.MessageLogSupport
-import play.api.libs.json.Json
-
-import scala.concurrent.{Promise, Future}
-
-/**
- * Represents the handler for both input request and input reply messages. Does
- * not extend BaseHandler because it does not send busy/idle status messages.
- *
- * @param actorLoader The actor loader to use for actor communication
- * @param responseMap The map used to maintain the links to responses
- */
-class InputRequestReplyHandler(
-  actorLoader: ActorLoader,
-  responseMap: collection.mutable.Map[String, ActorRef]
-) extends OrderedSupport with MessageLogSupport
-{
-  // TODO: Is there a better way than storing actor refs?
-  def receive = {
-    case kernelMessage: KernelMessage =>
-      startProcessing()
-
-      val kernelMessageType = kernelMessage.header.msg_type
-      val inputRequestType = v5.MessageType.Outgoing.InputRequest.toString
-      val inputReplyType = v5.MessageType.Incoming.InputReply.toString
-
-      // Is this an outgoing message to request data?
-      if (kernelMessageType == inputRequestType) {
-        val session = kernelMessage.parentHeader.session
-        responseMap(session) = sender
-
-        logger.debug("Associating input request with session " + session)
-
-        actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelMessage
-
-      // Is this an incoming response to a previous request for data?
-      } else if (kernelMessageType == inputReplyType) {
-        val session = kernelMessage.header.session
-        val inputReply = Json.parse(kernelMessage.contentString).as[InputReply]
-
-        logger.debug(s"Received input reply for session $session with value " +
-          s"'${inputReply.value}'")
-
-        responseMap(session) ! inputReply.value
-        responseMap.remove(session)
-      }
-
-      finishedProcessing()
-  }
-
-  override def orderedTypes() : Seq[Class[_]] = {Seq(classOf[KernelMessage])}
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
deleted file mode 100644
index 854a759..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.handler
-
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.KernelInfoReply
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.LogLike
-import play.api.libs.json.Json
-
-import scala.concurrent._
-
-/**
- * Receives a KernelInfoRequest KernelMessage and returns a KernelInfoReply
- * KernelMessage.
- */
-class KernelInfoRequestHandler(actorLoader: ActorLoader)
-  extends BaseHandler(actorLoader) with LogLike
-{
-  def process(kernelMessage: KernelMessage): Future[_] = {
-    import scala.concurrent.ExecutionContext.Implicits.global
-    future {
-      logger.debug("Sending kernel info reply message")
-
-      val kernelInfo = SparkKernelInfo
-      val kernelInfoReply = KernelInfoReply(
-        kernelInfo.protocolVersion,
-        kernelInfo.implementation,
-        kernelInfo.implementationVersion,
-        kernelInfo.language_info,
-        kernelInfo.languageVersion,
-        kernelInfo.banner
-      )
-
-      // TODO could we use HeaderBuilder here?
-      val replyHeader = Header(
-        java.util.UUID.randomUUID.toString,
-        "",
-        java.util.UUID.randomUUID.toString,
-        MessageType.Outgoing.KernelInfoReply.toString,
-        kernelInfo.protocolVersion
-      )
-
-      val kernelResponseMessage = KMBuilder()
-        .withIds(kernelMessage.ids)
-        .withSignature("")
-        .withHeader(replyHeader)
-        .withParent(kernelMessage)
-        .withContentString(kernelInfoReply).build
-
-      actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelResponseMessage
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ShutdownHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ShutdownHandler.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ShutdownHandler.scala
deleted file mode 100644
index a0a2001..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/handler/ShutdownHandler.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.handler
-
-import com.ibm.spark.comm.{CommRegistrar, CommStorage, KernelCommWriter}
-import com.ibm.spark.kernel.protocol.v5.content.{ShutdownReply, ShutdownRequest, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.utils.MessageLogSupport
-import play.api.data.validation.ValidationError
-import play.api.libs.json.JsPath
-
-import scala.concurrent.ExecutionContext.Implicits.global
-import scala.concurrent.{Future, future}
-
-/**
- * Represents the handler to shutdown the kernel
- *
- * @param actorLoader The actor loader to use for actor communication
- */
-class ShutdownHandler(
-  actorLoader: ActorLoader
-) extends BaseHandler(actorLoader) with MessageLogSupport
-{
-  override def process(kernelMessage: KernelMessage): Future[_] = future {
-    logKernelMessageAction("Initiating Shutdown request for", kernelMessage)
-
-    val shutdownReply = ShutdownReply(false)
-
-    val replyHeader = Header(
-      java.util.UUID.randomUUID.toString,
-      "",
-      java.util.UUID.randomUUID.toString,
-      ShutdownReply.toTypeString,
-      "")
-
-    val kernelResponseMessage = KMBuilder()
-      .withIds(kernelMessage.ids)
-      .withSignature("")
-      .withHeader(replyHeader)
-      .withParent(kernelMessage)
-      .withContentString(shutdownReply).build
-
-    logger.debug("Attempting graceful shutdown.")
-    actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelResponseMessage
-    System.exit(0)
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/InterpreterActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/InterpreterActor.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/InterpreterActor.scala
deleted file mode 100644
index b5ae174..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/InterpreterActor.scala
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.interpreter
-
-import java.io.OutputStream
-
-import akka.actor.{Actor, ActorRef, Props}
-import akka.pattern.{ask, pipe}
-import akka.util.Timeout
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.interpreter.tasks._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.interpreter._
-import com.ibm.spark.utils.LogLike
-
-import scala.concurrent.duration._
-
-object InterpreterActor {
-  def props(interpreter: Interpreter): Props =
-    Props(classOf[InterpreterActor], interpreter)
-}
-
-// TODO: Investigate restart sequence
-//
-// http://doc.akka.io/docs/akka/2.2.3/general/supervision.html
-//
-// "create new actor instance by invoking the originally provided factory again"
-//
-// Does this mean that the interpreter instance is not gc and is passed in?
-//
-class InterpreterActor(
-  interpreterTaskFactory: InterpreterTaskFactory
-) extends Actor with LogLike {
-  // NOTE: Required to provide the execution context for futures with akka
-  import context._
-
-  // NOTE: Required for ask (?) to function... maybe can define elsewhere?
-  implicit val timeout = Timeout(21474835.seconds)
-
-  //
-  // List of child actors that the interpreter contains
-  //
-  private var executeRequestTask: ActorRef = _
-  private var completeCodeTask: ActorRef = _
-
-  /**
-   * Initializes all child actors performing tasks for the interpreter.
-   */
-  override def preStart = {
-    executeRequestTask = interpreterTaskFactory.ExecuteRequestTask(
-      context, InterpreterChildActorType.ExecuteRequestTask.toString)
-    completeCodeTask = interpreterTaskFactory.CodeCompleteTask(
-      context, InterpreterChildActorType.CodeCompleteTask.toString)
-  }
-
-  override def receive: Receive = {
-    case (executeRequest: ExecuteRequest, parentMessage: KernelMessage,
-      outputStream: OutputStream) =>
-      val data = (executeRequest, parentMessage, outputStream)
-      (executeRequestTask ? data) recover {
-        case ex: Throwable =>
-          logger.error(s"Could not execute code ${executeRequest.code} because "
-            + s"of exception: ${ex.getMessage}")
-          Right(ExecuteError(
-            ex.getClass.getName,
-            ex.getLocalizedMessage,
-            ex.getStackTrace.map(_.toString).toList)
-          )
-      } pipeTo sender
-    case (completeRequest: CompleteRequest) =>
-      logger.debug(s"InterpreterActor requesting code completion for code " +
-        s"${completeRequest.code}")
-      (completeCodeTask ? completeRequest) recover {
-        case ex: Throwable =>
-          logger.error(s"Could not complete code ${completeRequest.code}: " +
-            s"${ex.getMessage}")
-          Right(ExecuteError(
-            ex.getClass.getName,
-            ex.getLocalizedMessage,
-            ex.getStackTrace.map(_.toString).toList)
-          )
-      } pipeTo sender
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/package.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/package.scala
deleted file mode 100644
index 6738520..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/package.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-package object interpreter {
-  object InterpreterChildActorType extends Enumeration {
-    type InterpreterChildActorType = Value
-
-    val ExecuteRequestTask = Value("execute_request_task")
-    val CodeCompleteTask = Value("code_complete_task")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
deleted file mode 100644
index 87f37b0..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
-
-import akka.actor.{Actor, Props}
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.protocol.v5.content.CompleteRequest
-import com.ibm.spark.utils.LogLike
-
-object CodeCompleteTaskActor {
-  def props(interpreter: Interpreter): Props =
-    Props(classOf[CodeCompleteTaskActor], interpreter)
-}
-
-class CodeCompleteTaskActor(interpreter: Interpreter)
-  extends Actor with LogLike {
-  require(interpreter != null)
-
-  override def receive: Receive = {
-    case completeRequest: CompleteRequest =>
-      logger.debug("Invoking the interpreter completion")
-      sender ! interpreter.completion(completeRequest.code, completeRequest.cursor_pos)
-    case _ =>
-      sender ! "Unknown message" // TODO: Provide a failure message type to be passed around?
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
deleted file mode 100644
index dc22b21..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
-
-import java.io.OutputStream
-
-import akka.actor.{Props, Actor}
-import com.ibm.spark.global.StreamState
-import com.ibm.spark.interpreter.{ExecuteAborted, Results, ExecuteError, Interpreter}
-import com.ibm.spark.kernel.api.StreamInfo
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.security.KernelSecurityManager
-import com.ibm.spark.utils.{ConditionalOutputStream, MultiOutputStream, LogLike}
-
-object ExecuteRequestTaskActor {
-  def props(interpreter: Interpreter): Props =
-    Props(classOf[ExecuteRequestTaskActor], interpreter)
-}
-
-class ExecuteRequestTaskActor(interpreter: Interpreter) extends Actor with LogLike {
-  require(interpreter != null)
-
-  override def receive: Receive = {
-    case (executeRequest: ExecuteRequest, parentMessage: KernelMessage,
-      outputStream: OutputStream) =>
-      // If the cell is not empty, then interpret.
-      if(executeRequest.code.trim != "") {
-        //interpreter.updatePrintStreams(System.in, outputStream, outputStream)
-        val newInputStream = System.in
-        val newOutputStream = buildOutputStream(outputStream, System.out)
-        val newErrorStream = buildOutputStream(outputStream, System.err)
-
-        // Update our global streams to be used by future output
-        // NOTE: This is not async-safe! This is expected to be broken when
-        //       running asynchronously! Use an alternative for data
-        //       communication!
-        StreamState.setStreams(newInputStream, newOutputStream, newErrorStream)
-
-        val (success, result) = {
-            // Add our parent message with StreamInfo type included
-//            interpreter.doQuietly {
-//              interpreter.bind(
-//                "$streamInfo",
-//                "com.ibm.spark.kernel.api.StreamInfo",
-//                new KernelMessage(
-//                  ids = parentMessage.ids,
-//                  signature = parentMessage.signature,
-//                  header = parentMessage.header,
-//                  parentHeader = parentMessage.parentHeader,
-//                  metadata = parentMessage.metadata,
-//                  contentString = parentMessage.contentString
-//                ) with StreamInfo,
-//                List( """@transient""", """implicit""")
-//              )
-              // TODO: Think of a cleaner wrapper to handle updating the Console
-              //       input and output streams
-//              interpreter.interpret(
-//                """val $updateOutput = {
-//                Console.setIn(System.in)
-//                Console.setOut(System.out)
-//                Console.setErr(System.err)
-//              }""".trim)
-//            }
-            interpreter.interpret(executeRequest.code.trim)
-          }
-
-        logger.debug(s"Interpreter execution result was ${success}")
-        success match {
-          case Results.Success =>
-            val output = result.left.get
-            sender ! Left(output)
-          case Results.Error =>
-            val error = result.right.get
-            sender ! Right(error)
-          case Results.Aborted =>
-            sender ! Right(new ExecuteAborted)
-          case Results.Incomplete =>
-            // If we get an incomplete it's most likely a syntax error, so
-            // let the user know.
-            sender ! Right(new ExecuteError("Syntax Error.", "", List()))
-        }
-      } else {
-        // If we get empty code from a cell then just return ExecuteReplyOk
-        sender ! Left("")
-      }
-    case unknownValue =>
-      logger.warn(s"Received unknown message type ${unknownValue}")
-      sender ! "Unknown message" // TODO: Provide a failure message type to be passed around?
-  }
-
-  private def buildOutputStream(
-    newOutput: OutputStream,
-    defaultOutput: OutputStream
-  ) = {
-    def isRestrictedThread = {
-      val currentGroup = Thread.currentThread().getThreadGroup
-      val restrictedGroupName =
-        KernelSecurityManager.RestrictedGroupName
-
-      currentGroup != null && currentGroup.getName == restrictedGroupName
-    }
-
-    new MultiOutputStream(List[OutputStream](
-      new ConditionalOutputStream(newOutput, isRestrictedThread),
-      new ConditionalOutputStream(defaultOutput, !isRestrictedThread)
-    ))
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
deleted file mode 100644
index 5f5a7ad..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.interpreter.tasks
-
-import akka.actor.{ActorRefFactory, ActorRef}
-import com.ibm.spark.interpreter.Interpreter
-
-class InterpreterTaskFactory(interpreter: Interpreter) {
-  /**
-   * Creates a new actor representing this specific task.
-   * @param actorRefFactory The factory used to task actor will belong
-   * @return The ActorRef created for the task
-   */
-  def ExecuteRequestTask(actorRefFactory: ActorRefFactory, name: String): ActorRef =
-    actorRefFactory.actorOf(ExecuteRequestTaskActor.props(interpreter), name)
-
-  /**
-   *
-   */
-  def CodeCompleteTask(actorRefFactory: ActorRefFactory, name: String): ActorRef =
-    actorRefFactory.actorOf(CodeCompleteTaskActor.props(interpreter), name)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoader.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoader.scala
deleted file mode 100644
index 171934d..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/ActorLoader.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel
-
-import akka.actor.{ActorRefFactory, ActorSelection}
-
-/**
- * This trait defines the interface for loading actors based on some value
- * (enum, attribute, etc...). The thought is to allow external consumers
- * acquire actors through a common interface, minimizing the spread of the
- * logic about the Actors, ActorSystem, and other similar concepts.
- */
-trait ActorLoader {
-  /**
-   * This method is meant to find an actor associated with an enum value. This
-   * enum value can map to an actor associated with handling a specific kernel
-   * message, a socket type, or other functionality.
-   *
-   * @param actorEnum The enum value used to load the actor
-   *
-   * @return An ActorSelection to pass messages to
-   */
-  def load(actorEnum: Enumeration#Value): ActorSelection
-}
-
-case class SimpleActorLoader(actorRefFactory: ActorRefFactory)
-  extends ActorLoader
-{
-  private val userActorDirectory: String = "/user/%s"
-
-  override def load(actorEnum: Enumeration#Value): ActorSelection = {
-    actorRefFactory.actorSelection(
-      userActorDirectory.format(actorEnum.toString)
-    )
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/Utilities.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/Utilities.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/Utilities.scala
deleted file mode 100644
index 73cf1b1..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/Utilities.scala
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel
-
-import java.nio.charset.Charset
-
-import akka.util.{ByteString, Timeout}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.utils.LogLike
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, Json, Reads}
-
-import scala.concurrent.duration._
-
-object Utilities extends LogLike {
-  //
-  // NOTE: This is brought in to remove feature warnings regarding the use of
-  //       implicit conversions regarding the following:
-  //
-  //       1. ByteStringToString
-  //       2. ZMQMessageToKernelMessage
-  //
-  import scala.language.implicitConversions
-
-  /**
-   * This timeout needs to be defined for the Akka asks to timeout
-   */
-  implicit val timeout = Timeout(21474835.seconds)
-
-  implicit def ByteStringToString(byteString : ByteString) : String = {
-    new String(byteString.toArray, Charset.forName("UTF-8"))
-  }
-
-  implicit def StringToByteString(string : String) : ByteString = {
-    ByteString(string.getBytes)
-  }
-
-  implicit def ZMQMessageToKernelMessage(message: ZMQMessage): KernelMessage = {
-    val delimiterIndex: Int =
-      message.frames.indexOf(ByteString("<IDS|MSG>".getBytes))
-    //  TODO Handle the case where there is no delimiter
-    val ids: Seq[String] =
-      message.frames.take(delimiterIndex).map(
-        (byteString : ByteString) =>  { new String(byteString.toArray) }
-      )
-    val header = Json.parse(message.frames(delimiterIndex + 2)).as[Header]
-    // TODO: Investigate better solution than setting parentHeader to null for {}
-    val parentHeader = parseAndHandle(message.frames(delimiterIndex + 3),
-                                  ParentHeader.headerReads,
-                                  handler = (valid: ParentHeader) => valid,
-                                  errHandler = _ => null
-    )
-    val metadata = Json.parse(message.frames(delimiterIndex + 4)).as[Metadata]
-
-    KMBuilder().withIds(ids.toList)
-               .withSignature(message.frame(delimiterIndex + 1))
-               .withHeader(header)
-               .withParentHeader(parentHeader)
-               .withMetadata(metadata)
-               .withContentString(message.frame(delimiterIndex + 5)).build(false)
-  }
-
-  implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = {
-    val frames: scala.collection.mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer()
-    kernelMessage.ids.map((id : String) => frames += id )
-    frames += "<IDS|MSG>"
-    frames += kernelMessage.signature
-    frames += Json.toJson(kernelMessage.header).toString()
-    frames += Json.toJson(kernelMessage.parentHeader).toString()
-    frames += Json.toJson(kernelMessage.metadata).toString
-    frames += kernelMessage.contentString
-    ZMQMessage(frames  : _*)
-  }
-
-  def parseAndHandle[T, U](json: String, reads: Reads[T],
-                           handler: T => U) : U = {
-    parseAndHandle(json, reads, handler,
-      (invalid: Seq[(JsPath, Seq[ValidationError])]) => {
-        logger.error(s"Could not parse JSON, ${json}")
-        throw new Throwable(s"Could not parse JSON, ${json}")
-      }
-    )
-  }
-
-  def parseAndHandle[T, U](json: String, reads: Reads[T],
-                           handler: T => U,
-                           errHandler: Seq[(JsPath, Seq[ValidationError])] => U) : U = {
-    Json.parse(json).validate[T](reads).fold(
-      errHandler,
-      (content: T) => handler(content)
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Control.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Control.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Control.scala
deleted file mode 100644
index df42b03..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Control.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import com.ibm.spark.kernel.protocol.v5.SystemActorType
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-
-/**
- * The server endpoint for control messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- * @param actorLoader The actor loader to use to load the relay for kernel
- *                    messages
- */
-class Control(socketFactory: SocketFactory, actorLoader: ActorLoader)
-  extends ZeromqKernelMessageSocket(
-    socketFactory.Control,
-    () => actorLoader.load(SystemActorType.KernelMessageRelay)
-  )
-{
-  logger.trace("Created new Control actor")
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Heartbeat.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Heartbeat.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Heartbeat.scala
deleted file mode 100644
index d17c360..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Heartbeat.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import akka.actor.Actor
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.utils.LogLike
-
-/**
- * The server endpoint for heartbeat messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- */
-class Heartbeat(socketFactory : SocketFactory) extends Actor with LogLike {
-  logger.debug("Created new Heartbeat actor")
-  val socket = socketFactory.Heartbeat(context.system, self)
-
-  override def receive: Receive = {
-    case message: ZMQMessage =>
-      logger.trace("Heartbeat received message: " +
-        message.frames.map((byteString: ByteString) =>
-          new String(byteString.toArray)).mkString("\n"))
-      socket ! message
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPub.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPub.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPub.scala
deleted file mode 100644
index d2ff8e9..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/IOPub.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import akka.actor.Actor
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities
-import Utilities._
-import com.ibm.spark.utils.{MessageLogSupport, LogLike}
-
-/**
- * The server endpoint for IOPub messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- */
-class IOPub(socketFactory: SocketFactory)
-  extends Actor with MessageLogSupport with OrderedSupport
-{
-  logger.trace("Created new IOPub actor")
-  val socket = socketFactory.IOPub(context.system)
-  override def receive: Receive = {
-    case message: KernelMessage => withProcessing {
-      val zmqMessage: ZMQMessage = message
-      logMessage(message)
-      socket ! zmqMessage
-    }
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[KernelMessage])
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Shell.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Shell.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Shell.scala
deleted file mode 100644
index b5c4bfb..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Shell.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.SystemActorType
-
-/**
- * The server endpoint for shell messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- * @param actorLoader The actor loader to use to load the relay for kernel
- *                    messages
- */
-class Shell(socketFactory: SocketFactory, actorLoader: ActorLoader)
-  extends ZeromqKernelMessageSocket(
-    socketFactory.Shell,
-    () => actorLoader.load(SystemActorType.KernelMessageRelay)
-  )
-{
-  logger.trace("Created new Shell actor")
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfig.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfig.scala
deleted file mode 100644
index 5fe3e39..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConfig.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import com.typesafe.config.Config
-import play.api.libs.json.Json
-
-case class SocketConfig (
-  stdin_port: Int,
-  control_port: Int,
-  hb_port: Int,
-  shell_port: Int,
-  iopub_port: Int,
-  ip : String,
-  transport: String,
-  signature_scheme: String,
-  key: String
-)
-
-object SocketConfig {
-  implicit val socketConfigReads = Json.reads[SocketConfig]
-  implicit val socketConfigWrites = Json.writes[SocketConfig]
-
-  def fromConfig(config: Config) = {
-    new SocketConfig(
-      config.getInt("stdin_port"),
-      config.getInt("control_port"),
-      config.getInt("hb_port"),
-      config.getInt("shell_port"),
-      config.getInt("iopub_port"),
-      config.getString("ip"),
-      config.getString("transport"),
-      config.getString("signature_scheme"),
-      config.getString("key")
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnection.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnection.scala
deleted file mode 100644
index 865c383..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketConnection.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-object SocketConnection {
-  def apply(protocol: String, ip: String, port: Int) = new SocketConnection(protocol, ip, port)
-}
-
-/**
- * Represent a connection string for a socket
- * @param protocol The protocol portion of the connection (e.g. tcp, akka, udp)
- * @param ip The hostname or ip address to bind on (e.g. *, myhost, 127.0.0.1)
- * @param port The port for the socket to listen on
- */
-class SocketConnection(protocol: String, ip: String, port: Int) {
-  private val SocketConnectionString : String = "%s://%s:%d"
-
-  override def toString: String = {
-    SocketConnectionString.format(protocol, ip, port)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactory.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactory.scala
deleted file mode 100644
index ef2001f..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/SocketFactory.scala
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import akka.actor.{Props, ActorRef, ActorSystem}
-import com.ibm.spark.communication.actors.{RouterSocketActor, RepSocketActor, PubSocketActor}
-
-object SocketFactory {
-  def apply(socketConfig: SocketConfig) = {
-    new SocketFactory(socketConfig)
-  }
-}
-
-/**
- * A Factory class to provide various socket connections for IPython Kernel Spec
- * @param socketConfig The configuration for the sockets to be properly
- *                     instantiated
- */
-class SocketFactory(socketConfig: SocketConfig) {
-  val HeartbeatConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.hb_port)
-  val ShellConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.shell_port)
-  val ControlConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.control_port)
-  val IOPubConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.iopub_port)
-  val StdinConnection = SocketConnection(
-    socketConfig.transport, socketConfig.ip, socketConfig.stdin_port)
-
-  /**
-   * Creates a ZeroMQ reply socket representing the server endpoint for
-   * heartbeat messages
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   * @return The ActorRef created for the socket connection
-   */
-  def Heartbeat(system: ActorSystem, listener: ActorRef) : ActorRef =
-    system.actorOf(Props(classOf[RepSocketActor], HeartbeatConnection.toString, listener))
-//    ZeroMQExtension(system).newRepSocket(
-//      Array(Listener(listener), Bind(HeartbeatConnection.toString))
-//    )
-
-  /**
-   * Creates a ZeroMQ reply socket representing the server endpoint for shell
-   * messages
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   * @return The ActorRef created for the socket connection
-   */
-  def Shell(system: ActorSystem, listener: ActorRef) : ActorRef =
-    system.actorOf(Props(classOf[RouterSocketActor], ShellConnection.toString, listener))
-//    ZeroMQExtension(system).newRouterSocket(
-//      Array(Listener(listener), Bind(ShellConnection.toString))
-//    )
-
-  /**
-   * Creates a ZeroMQ reply socket representing the server endpoint for control
-   * messages
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   * @return The ActorRef created for the socket connection
-   */
-  def Control(system: ActorSystem, listener: ActorRef) : ActorRef =
-    system.actorOf(Props(classOf[RouterSocketActor], ControlConnection.toString, listener))
-
-  /**
-   * Creates a ZeroMQ reply socket representing the server endpoint for stdin
-   * messages
-   * @param system The actor system the socket actor will belong
-   * @param listener The actor who will receive
-   * @return The ActorRef created for the socket connection
-   */
-  def Stdin(system: ActorSystem, listener: ActorRef) : ActorRef =
-    system.actorOf(Props(classOf[RouterSocketActor], StdinConnection.toString, listener))
-//    ZeroMQExtension(system).newRouterSocket(
-//      Array(Listener(listener), Bind(StdinConnection.toString))
-//    )
-
-  /**
-   * Creates a ZeroMQ reply socket representing the server endpoint for IOPub
-   * messages
-   * @param system The actor system the socket actor will belong
-   * @return The ActorRef created for the socket connection
-   */
-  def IOPub(system: ActorSystem) : ActorRef =
-    system.actorOf(Props(classOf[PubSocketActor], IOPubConnection.toString))
-//    ZeroMQExtension(system).newPubSocket(
-//      Bind(IOPubConnection.toString)
-//    )
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Stdin.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Stdin.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Stdin.scala
deleted file mode 100644
index 261151e..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/Stdin.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.SystemActorType
-
-/**
- * The server endpoint for stdin messages specified in the IPython Kernel Spec
- * @param socketFactory A factory to create the ZeroMQ socket connection
- * @param actorLoader The actor loader to use to load the relay for kernel
- *                    messages
- */
-class Stdin(socketFactory: SocketFactory, actorLoader: ActorLoader)
-  extends ZeromqKernelMessageSocket(
-    socketFactory.Stdin,
-    () => actorLoader.load(SystemActorType.KernelMessageRelay)
-  )
-{
-  logger.trace("Created new Stdin actor")
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
deleted file mode 100644
index 3d02f0b..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.kernel.socket
-
-import java.nio.charset.Charset
-
-import akka.actor.{ActorSelection, ActorSystem, ActorRef, Actor}
-import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-
-//import com.ibm.spark.kernel.protocol.v5.kernel.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities._
-import com.ibm.spark.utils.MessageLogSupport
-
-/**
- * Represents a generic socket geared toward two-way communication using
- * ZeroMQ and KernelMessage structures.
- * @param actorSocketFunc The function used to retrieve the actor for outgoing
- *                        communication via sockets
- * @param actorForwardFunc The function used to retrieve the actor for incoming
- *                         kernel messages
- */
-abstract class ZeromqKernelMessageSocket(
-  actorSocketFunc: (ActorSystem, ActorRef) => ActorRef,
-  actorForwardFunc: () => ActorSelection
-) extends Actor with MessageLogSupport {
-  val actorSocketRef = actorSocketFunc(context.system, self)
-  val actorForwardRef = actorForwardFunc()
-
-  override def receive: Receive = {
-    case message: ZMQMessage =>
-      val kernelMessage: KernelMessage = message
-      logMessage(kernelMessage)
-
-      // Grab the strings to use for signature verification
-      val zmqStrings = message.frames.map((byteString: ByteString) =>
-        new String(byteString.toArray, Charset.forName("UTF-8"))
-      ).takeRight(4) // TODO: This assumes NO extra buffers, refactor?
-
-      // Forward along our message (along with the strings used for
-      // signatures)
-      actorForwardRef ! ((zmqStrings, kernelMessage))
-
-    case message: KernelMessage =>
-      val zmqMessage: ZMQMessage = message
-      logMessage(message)
-      actorSocketRef ! zmqMessage
-  }
-}


[04/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
new file mode 100644
index 0000000..2ff561d
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InspectRequestSpec extends FunSpec with Matchers {
+  val inspectRequestJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "cursor_pos": 999,
+    "detail_level": 1
+  }
+  """)
+
+  val inspectRequest: InspectRequest = InspectRequest(
+    "<STRING>", 999, 1
+  )
+
+  describe("InspectRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InspectRequest.toTypeString should be ("inspect_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectRequestJson.as[InspectRequest] should be (inspectRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectRequest = inspectRequestJson.asOpt[InspectRequest]
+
+        newInspectRequest.get should be (inspectRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectRequestResults = inspectRequestJson.validate[InspectRequest]
+
+        InspectRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectRequest) => valid
+        ) should be (inspectRequest)
+      }
+
+      it("should implicitly convert from a InspectRequest instance to valid json") {
+        Json.toJson(inspectRequest) should be (inspectRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
new file mode 100644
index 0000000..7d704e2
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class KernelInfoReplySpec extends FunSpec with Matchers {
+  val kernelInfoReplyJson: JsValue = Json.parse("""
+  {
+    "protocol_version": "x.y.z",
+    "implementation": "<name>",
+    "implementation_version": "z.y.x",
+    "language_info": { "name": "<some language>" },
+    "language_version": "a.b.c",
+    "banner": "<some banner>"
+  }
+  """)
+
+  val kernelInfoReply: KernelInfoReply = KernelInfoReply(
+    "x.y.z", "<name>", "z.y.x", Map("name" -> "<some language>"), "a.b.c", "<some banner>"
+  )
+
+  describe("KernelInfoReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        KernelInfoReply.toTypeString should be ("kernel_info_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a kernelInfoReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        kernelInfoReplyJson.as[KernelInfoReply] should be (kernelInfoReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newKernelInfoReply = kernelInfoReplyJson.asOpt[KernelInfoReply]
+
+        newKernelInfoReply.get should be (kernelInfoReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val kernelInfoReplyResults = kernelInfoReplyJson.validate[KernelInfoReply]
+
+        kernelInfoReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: KernelInfoReply) => valid
+        ) should be (kernelInfoReply)
+      }
+
+      it("should implicitly convert from a kernelInfoReply instance to valid json") {
+        Json.toJson(kernelInfoReply) should be (kernelInfoReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
new file mode 100644
index 0000000..e63b4c3
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class KernelInfoRequestSpec extends FunSpec with Matchers {
+  val kernelInfoRequestJson: JsValue = Json.parse("""
+  {}
+  """)
+
+  val kernelInfoRequest: KernelInfoRequest = KernelInfoRequest()
+
+  describe("KernelInfoRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        KernelInfoRequest.toTypeString should be ("kernel_info_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a KernelInfoRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        // This is the least safe way to convert as an error is thrown if it fails
+        kernelInfoRequestJson.as[KernelInfoRequest] should be (kernelInfoRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newKernelInfoRequest = kernelInfoRequestJson.asOpt[KernelInfoRequest]
+
+        newKernelInfoRequest.get should be (kernelInfoRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val KernelInfoRequestResults = kernelInfoRequestJson.validate[KernelInfoRequest]
+
+        KernelInfoRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: KernelInfoRequest) => valid
+        ) should be (kernelInfoRequest)
+      }
+
+      it("should implicitly convert from a KernelInfoRequest instance to valid json") {
+        Json.toJson(kernelInfoRequest) should be (kernelInfoRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
new file mode 100644
index 0000000..4663d98
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, JsValue, Json}
+
+class KernelStatusSpec extends FunSpec with Matchers {
+  val kernelStatusJson: JsValue = Json.parse("""
+  {
+    "execution_state": "<STRING>"
+  }
+  """)
+
+  val kernelStatus: KernelStatus = KernelStatus("<STRING>")
+
+  describe("KernelStatus") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        KernelStatus.toTypeString should be ("status")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a kernelStatus instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        kernelStatusJson.as[KernelStatus] should be (kernelStatus)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newKernelStatus = kernelStatusJson.asOpt[KernelStatus]
+
+        newKernelStatus.get should be (kernelStatus)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val kernelStatusResults = kernelStatusJson.validate[KernelStatus]
+
+        kernelStatusResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: KernelStatus) => valid
+        ) should be (kernelStatus)
+      }
+
+      it("should implicitly convert from a kernelStatus instance to valid json") {
+        Json.toJson(kernelStatus) should be (kernelStatusJson)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
new file mode 100644
index 0000000..15e8eba
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ShutdownReplySpec extends FunSpec with Matchers {
+  val shutdownReplyJson: JsValue = Json.parse("""
+  {
+    "restart": true
+  }
+  """)
+
+  val shutdownReply: ShutdownReply = ShutdownReply(
+    true
+  )
+
+  describe("ShutdownReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ShutdownReply.toTypeString should be ("shutdown_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ShutdownReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        shutdownReplyJson.as[ShutdownReply] should be (shutdownReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newShutdownReply = shutdownReplyJson.asOpt[ShutdownReply]
+
+        newShutdownReply.get should be (shutdownReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ShutdownReplyResults = shutdownReplyJson.validate[ShutdownReply]
+
+        ShutdownReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ShutdownReply) => valid
+        ) should be (shutdownReply)
+      }
+
+      it("should implicitly convert from a ShutdownReply instance to valid json") {
+        Json.toJson(shutdownReply) should be (shutdownReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
new file mode 100644
index 0000000..fdc063d
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ShutdownRequestSpec extends FunSpec with Matchers {
+  val shutdownRequestJson: JsValue = Json.parse("""
+  {
+    "restart": true
+  }
+  """)
+
+  val shutdownRequest: ShutdownRequest = ShutdownRequest(
+    true
+  )
+
+  describe("ShutdownRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ShutdownRequest.toTypeString should be ("shutdown_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ShutdownRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        shutdownRequestJson.as[ShutdownRequest] should be (shutdownRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newShutdownRequest = shutdownRequestJson.asOpt[ShutdownRequest]
+
+        newShutdownRequest.get should be (shutdownRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ShutdownRequestResults = shutdownRequestJson.validate[ShutdownRequest]
+
+        ShutdownRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ShutdownRequest) => valid
+        ) should be (shutdownRequest)
+      }
+
+      it("should implicitly convert from a ShutdownRequest instance to valid json") {
+        Json.toJson(shutdownRequest) should be (shutdownRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
new file mode 100644
index 0000000..5c435a8
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class StreamContentSpec extends FunSpec with Matchers {
+  val streamJson: JsValue = Json.parse("""
+  {
+    "text": "<STRING>",
+    "name": "<STRING>"
+  }
+  """)
+
+  val stream = StreamContent("<STRING>", "<STRING>")
+
+  describe("StreamContent") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        StreamContent.toTypeString should be ("stream")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a StreamContent instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        streamJson.as[StreamContent] should be (stream)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = streamJson.asOpt[StreamContent]
+
+        newCompleteRequest.get should be (stream)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = streamJson.validate[StreamContent]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: StreamContent) => valid
+        ) should be (stream)
+      }
+
+      it("should implicitly convert from a StreamContent instance to valid json") {
+        Json.toJson(stream) should be (streamJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
new file mode 100644
index 0000000..0174f9b
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol
+
+//import akka.zeromq.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.{CompleteRequest, ExecuteRequest}
+import play.api.libs.json.Json
+
+package object v5Test {
+  //  The header for the message
+  val MockHeader : Header = Header("<UUID>","<USER>","<SESSION>",
+    MessageType.Outgoing.ClearOutput.toString, "<VERSION>")
+  //  The parent header for the message
+  val MockParenHeader: Header = Header("<PARENT-UUID>","<PARENT-USER>","<PARENT-SESSION>",
+    MessageType.Outgoing.ClearOutput.toString, "<PARENT-VERSION>")
+  //  The actual kernel message
+  val MockKernelMessage : KernelMessage = KernelMessage(Seq("<ID>"), "<SIGNATURE>", MockHeader,
+    MockParenHeader, Metadata(), "<CONTENT>")
+  //  Use the implicit to convert the KernelMessage to ZMQMessage
+  //val MockZMQMessage : ZMQMessage = MockKernelMessage
+
+  val MockExecuteRequest: ExecuteRequest =
+    ExecuteRequest("spark code", false, true, Map(), false)
+  val MockExecuteRequestKernelMessage = MockKernelMessage.copy(
+    contentString =  Json.toJson(MockExecuteRequest).toString
+  )
+  val MockKernelMessageWithBadExecuteRequest = new KernelMessage(
+    Seq[String](), "test message", MockHeader, MockParenHeader, Map[String, String](),
+    """
+        {"code" : 124 }
+    """
+  )
+  val MockCompleteRequest: CompleteRequest = CompleteRequest("", 0)
+  val MockCompleteRequestKernelMessage: KernelMessage = MockKernelMessage.copy(contentString = Json.toJson(MockCompleteRequest).toString)
+  val MockKernelMessageWithBadJSON: KernelMessage = MockKernelMessage.copy(contentString = "inval1d")
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkBridge.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkBridge.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkBridge.scala
deleted file mode 100644
index e0e8f60..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkBridge.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, SQLContextProducerLike, JavaSparkContextProducerLike}
-import com.ibm.spark.interpreter.broker.{BrokerState, BrokerBridge}
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.SparkContext
-
-/**
- * Represents constants for the PySpark bridge.
- */
-object PySparkBridge {
-  /** Represents the maximum amount of code that can be queued for Python. */
-  val MaxQueuedCode = 500
-
-  /**
-   * Creates a new PySparkBridge instance.
-   *
-   * @param brokerState The container of broker state to expose
-   * @param kernel The kernel API to expose through the bridge
-   *
-   * @return The new PySpark bridge
-   */
-  def apply(
-    brokerState: BrokerState,
-    kernel: KernelLike
-  ): PySparkBridge = {
-    new PySparkBridge(
-      _brokerState = brokerState,
-      _kernel = kernel
-    ) with StandardJavaSparkContextProducer with StandardSQLContextProducer
-  }
-}
-
-/**
- * Represents the API available to PySpark to act as the bridge for data
- * between the JVM and Python.
- *
- * @param _brokerState The container of broker state to expose
- * @param _kernel The kernel API to expose through the bridge
- */
-class PySparkBridge private (
-  private val _brokerState: BrokerState,
-  private val _kernel: KernelLike
-) extends BrokerBridge(_brokerState, _kernel) {
-  override val brokerName: String = "PySpark"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkException.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkException.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkException.scala
deleted file mode 100644
index 664c806..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkException.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.BrokerException
-
-/**
- * Represents a generic PySpark exception.
- *
- * @param message The message to associate with the exception
- */
-class PySparkException(message: String) extends BrokerException(message)
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkInterpreter.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkInterpreter.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkInterpreter.scala
deleted file mode 100644
index 615ed19..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkInterpreter.scala
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import java.net.URL
-
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
-import org.slf4j.LoggerFactory
-import py4j.GatewayServer
-
-import scala.concurrent.Await
-import scala.concurrent.duration._
-import scala.tools.nsc.interpreter.{InputStream, OutputStream}
-
-/**
- * Represents an interpreter interface to PySpark. Requires a properly-set
- * SPARK_HOME, PYTHONPATH pointing to Spark's Python source, and py4j installed
- * where it is accessible to the Spark Kernel.
- *
- */
-class PySparkInterpreter(
-) extends Interpreter {
-  private val logger = LoggerFactory.getLogger(this.getClass)
-  private var _kernel:KernelLike = _
-
-  // TODO: Replace hard-coded maximum queue count
-  /** Represents the state used by this interpreter's Python instance. */
-  private lazy val pySparkState = new PySparkState(500)
-
-  /** Represents the bridge used by this interpreter's Python interface. */
-  private lazy val pySparkBridge = PySparkBridge(
-    pySparkState,
-    _kernel
-  )
-
-
-  /** Represents the interface for Python to talk to JVM Spark components. */
-  private lazy val gatewayServer = new GatewayServer(pySparkBridge, 0)
-
-  /** Represents the process handler used for the PySpark process. */
-  private lazy val pySparkProcessHandler: PySparkProcessHandler =
-    new PySparkProcessHandler(
-      pySparkBridge,
-      restartOnFailure = true,
-      restartOnCompletion = true
-    )
-
-  private lazy val pySparkService = new PySparkService(
-    gatewayServer,
-    pySparkBridge,
-    pySparkProcessHandler
-  )
-  private lazy val pySparkTransformer = new PySparkTransformer
-
-  /**
-   * Initializes the interpreter.
-   * @param kernel The kernel
-   * @return The newly initialized interpreter
-   */
-  override def init(kernel: KernelLike): Interpreter = {
-    _kernel = kernel
-    this
-  }
-
-  // Unsupported (but can be invoked)
-  override def bindSparkContext(sparkContext: SparkContext): Unit = {}
-
-  // Unsupported (but can be invoked)
-  override def bindSqlContext(sqlContext: SQLContext): Unit = {}
-
-  /**
-   * Executes the provided code with the option to silence output.
-   * @param code The code to execute
-   * @param silent Whether or not to execute the code silently (no output)
-   * @return The success/failure of the interpretation and the output from the
-   *         execution or the failure
-   */
-  override def interpret(code: String, silent: Boolean):
-    (Result, Either[ExecuteOutput, ExecuteFailure]) =
-  {
-    if (!pySparkService.isRunning) pySparkService.start()
-
-    val futureResult = pySparkTransformer.transformToInterpreterResult(
-      pySparkService.submitCode(code)
-    )
-
-    Await.result(futureResult, Duration.Inf)
-  }
-
-  /**
-   * Starts the interpreter, initializing any internal state.
-   * @return A reference to the interpreter
-   */
-  override def start(): Interpreter = {
-    pySparkService.start()
-
-    this
-  }
-
-  /**
-   * Stops the interpreter, removing any previous internal state.
-   * @return A reference to the interpreter
-   */
-  override def stop(): Interpreter = {
-    pySparkService.stop()
-
-    this
-  }
-
-  /**
-   * Returns the class loader used by this interpreter.
-   *
-   * @return The runtime class loader used by this interpreter
-   */
-  override def classLoader: ClassLoader = this.getClass.getClassLoader
-
-  // Unsupported (but can be invoked)
-  override def lastExecutionVariableName: Option[String] = None
-
-  // Unsupported (but can be invoked)
-  override def read(variableName: String): Option[AnyRef] = None
-
-  // Unsupported (but can be invoked)
-  override def completion(code: String, pos: Int): (Int, List[String]) =
-    (pos, Nil)
-
-  // Unsupported
-  override def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit = ???
-
-  // Unsupported
-  override def classServerURI: String = ""
-
-  // Unsupported
-  override def interrupt(): Interpreter = ???
-
-  // Unsupported
-  override def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit = ???
-
-  // Unsupported
-  override def addJars(jars: URL*): Unit = ???
-
-  // Unsupported
-  override def doQuietly[T](body: => T): T = ???
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcess.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcess.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcess.scala
deleted file mode 100644
index ace6635..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcess.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import java.io.{FileOutputStream, File}
-
-import com.ibm.spark.interpreter.broker.BrokerProcess
-import org.apache.commons.exec.environment.EnvironmentUtils
-import org.apache.commons.exec._
-import org.apache.commons.io.IOUtils
-import org.apache.spark.SparkContext
-import org.slf4j.LoggerFactory
-
-/**
- * Represents the Python process used to evaluate PySpark code.
- *
- * @param pySparkBridge The bridge to use to retrieve kernel output streams
- *                      and the Spark version to be verified
- * @param pySparkProcessHandler The handler to use when the process fails or
- *                              completes
- * @param port The port to provide to the PySpark process to use to connect
- *             back to the JVM
- * @param sparkVersion The version of Spark that the process will be using
- */
-class PySparkProcess(
-  private val pySparkBridge: PySparkBridge,
-  private val pySparkProcessHandler: PySparkProcessHandler,
-  private val port: Int,
-  private val sparkVersion: String
-) extends BrokerProcess(
-  processName = "python",
-  entryResource = "PySpark/pyspark_runner.py",
-  otherResources = Nil,
-  brokerBridge = pySparkBridge,
-  brokerProcessHandler = pySparkProcessHandler,
-  arguments = Seq(port.toString, sparkVersion)
-) {
-
-  override val brokerName: String = "PySpark"
-  private val logger = LoggerFactory.getLogger(this.getClass)
-
-  private val sparkHome = Option(System.getenv("SPARK_HOME"))
-    .orElse(Option(System.getProperty("spark.home")))
-  private val pythonPath = Option(System.getenv("PYTHONPATH"))
-
-  assert(sparkHome.nonEmpty, "PySpark process requires Spark Home to be set!")
-  if (pythonPath.isEmpty) logger.warn("PYTHONPATH not provided for PySpark!")
-
-  /**
-   * Creates a new process environment to be used for environment variable
-   * retrieval by the new process.
-   *
-   * @return The map of environment variables and their respective values
-   */
-  override protected def newProcessEnvironment(): Map[String, String] = {
-    val baseEnvironment = super.newProcessEnvironment()
-
-    import java.io.File.pathSeparator
-
-    val baseSparkHome = sparkHome.get
-    val basePythonPath = pythonPath.getOrElse("")
-    val updatedPythonPath =
-      (basePythonPath.split(pathSeparator) :+ s"$baseSparkHome/python/")
-        .map(_.trim)
-        .filter(_.nonEmpty)
-        .map(new File(_))
-        .distinct
-        .mkString(pathSeparator)
-
-    // Note: Adding the new map values should override the old ones
-    baseEnvironment ++ Map(
-      "SPARK_HOME" -> baseSparkHome,
-      "PYTHONPATH" -> updatedPythonPath
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcessHandler.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcessHandler.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcessHandler.scala
deleted file mode 100644
index ab2aeb1..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkProcessHandler.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.BrokerProcessHandler
-
-/**
- * Represents the handler for events triggered by the PySpark process.
- *
- * @param pySparkBridge The bridge to reset when the process fails or completes
- * @param restartOnFailure If true, restarts the process if it fails
- * @param restartOnCompletion If true, restarts the process if it completes
- */
-class PySparkProcessHandler(
-  private val pySparkBridge: PySparkBridge,
-  private val restartOnFailure: Boolean,
-  private val restartOnCompletion: Boolean
-  ) extends BrokerProcessHandler(
-  pySparkBridge,
-  restartOnFailure,
-  restartOnCompletion
-) {
-  override val brokerName: String = "PySpark"
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkService.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkService.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkService.scala
deleted file mode 100644
index ec264e2..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkService.scala
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.BrokerService
-import com.ibm.spark.kernel.interpreter.pyspark.PySparkTypes._
-import org.apache.spark.SparkContext
-import org.slf4j.LoggerFactory
-import py4j.GatewayServer
-
-import scala.concurrent.Future
-
-/**
- * Represents the service that provides the high-level interface between the
- * JVM and Python.
- *
- * @param gatewayServer The backend to start to communicate between the JVM and
- *                      Python
- * @param pySparkBridge The bridge to use for communication between the JVM and
- *                      Python
- * @param pySparkProcessHandler The handler used for events that occur with
- *                              the PySpark process
- */
-class PySparkService(
-  private val gatewayServer: GatewayServer,
-  private val pySparkBridge: PySparkBridge,
-  private val pySparkProcessHandler: PySparkProcessHandler
-) extends BrokerService {
-  private val logger = LoggerFactory.getLogger(this.getClass)
-  @volatile private var _isRunning: Boolean = false
-  override def isRunning: Boolean = _isRunning
-
-
-  /** Represents the process used to execute Python code via the bridge. */
-  private lazy val pySparkProcess = {
-    val p = new PySparkProcess(
-      pySparkBridge,
-      pySparkProcessHandler,
-      gatewayServer.getListeningPort,
-      org.apache.spark.SPARK_VERSION
-    )
-
-    // Update handlers to correctly reset and restart the process
-    pySparkProcessHandler.setResetMethod(message => {
-      p.stop()
-      pySparkBridge.state.reset(message)
-    })
-    pySparkProcessHandler.setRestartMethod(() => p.start())
-
-    p
-  }
-
-  /** Starts the PySpark service. */
-  def start(): Unit = {
-    // Start without forking the gateway server (needs to have access to
-    // SparkContext in current JVM)
-    logger.debug("Starting gateway server")
-    gatewayServer.start()
-
-    val port = gatewayServer.getListeningPort
-    logger.debug(s"Gateway server running on port $port")
-
-    // Start the Python process used to execute code
-    logger.debug("Launching process to execute Python code")
-    pySparkProcess.start()
-
-    _isRunning = true
-  }
-
-  /**
-   * Submits code to the PySpark service to be executed and return a result.
-   *
-   * @param code The code to execute
-   *
-   * @return The result as a future to eventually return
-   */
-  def submitCode(code: Code): Future[CodeResults] = {
-    pySparkBridge.state.pushCode(code)
-  }
-
-  /** Stops the running PySpark service. */
-  def stop(): Unit = {
-    // Stop the Python process used to execute code
-    pySparkProcess.stop()
-
-    // Stop the server used as an entrypoint for Python
-    gatewayServer.shutdown()
-
-    _isRunning = false
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkState.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkState.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkState.scala
deleted file mode 100644
index 2d0f63f..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkState.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.BrokerState
-
-/**
- * Represents the state structure of PySpark.
- *
- * @param maxQueuedCode The maximum amount of code to support being queued
- *                      at the same time for PySpark execution
- */
-class PySparkState(private val maxQueuedCode: Int)
-  extends BrokerState(maxQueuedCode)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTransformer.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTransformer.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTransformer.scala
deleted file mode 100644
index 146ca8e..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTransformer.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.BrokerTransformer
-
-/**
- * Represents a utility that can transform raw PySpark information to
- * kernel information.
- */
-class PySparkTransformer extends BrokerTransformer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTypes.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTypes.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTypes.scala
deleted file mode 100644
index 1004a1f..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/PySparkTypes.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.pyspark
-
-import com.ibm.spark.interpreter.broker.BrokerTypesProvider
-
-/**
- * Represents all types associated with the PySpark interface.
- */
-object PySparkTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/package.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/package.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/package.scala
deleted file mode 100644
index 618a678..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/pyspark/package.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter
-
-import com.ibm.spark.interpreter.broker.{BrokerCode, BrokerPromise}
-
-/**
- * Contains aliases to broker types.
- */
-package object pyspark {
-  /**
-   * Represents a promise made regarding the completion of PySpark code
-   * execution.
-   */
-  type PySparkPromise = BrokerPromise
-
-  /**
-   * Represents a block of PyPython code to be evaluated.
-   */
-  type PySparkCode = BrokerCode
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/com/ibm/spark/magic/builtin/PySpark.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/com/ibm/spark/magic/builtin/PySpark.scala b/pyspark-interpreter/src/main/scala/com/ibm/spark/magic/builtin/PySpark.scala
deleted file mode 100644
index a0a79b5..0000000
--- a/pyspark-interpreter/src/main/scala/com/ibm/spark/magic/builtin/PySpark.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
-import com.ibm.spark.kernel.interpreter.pyspark.{PySparkInterpreter, PySparkException}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
-import com.ibm.spark.magic.dependencies.IncludeKernel
-
-/**
- * Represents the magic interface to use the PySpark interpreter.
- */
-class PySpark extends CellMagic with IncludeKernel {
-  override def execute(code: String): CellMagicOutput = {
-    val pySpark = kernel.interpreter("PySpark")
-
-    if (pySpark.isEmpty || pySpark.get == null)
-      throw new PySparkException("PySpark is not available!")
-
-    pySpark.get match {
-      case pySparkInterpreter: PySparkInterpreter =>
-        val (_, output) = pySparkInterpreter.interpret(code)
-        output match {
-          case Left(executeOutput) =>
-            CellMagicOutput(MIMEType.PlainText -> executeOutput)
-          case Right(executeFailure) => executeFailure match {
-            case executeAborted: ExecuteAborted =>
-              throw new PySparkException("PySpark code was aborted!")
-            case executeError: ExecuteError =>
-              throw new PySparkException(executeError.value)
-          }
-        }
-      case otherInterpreter =>
-        val className = otherInterpreter.getClass.getName
-        throw new PySparkException(s"Invalid PySpark interpreter: $className")
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
new file mode 100644
index 0000000..e0e8f60
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.producer.{StandardSQLContextProducer, StandardJavaSparkContextProducer, SQLContextProducerLike, JavaSparkContextProducerLike}
+import com.ibm.spark.interpreter.broker.{BrokerState, BrokerBridge}
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.SparkContext
+
+/**
+ * Represents constants for the PySpark bridge.
+ */
+object PySparkBridge {
+  /** Represents the maximum amount of code that can be queued for Python. */
+  val MaxQueuedCode = 500
+
+  /**
+   * Creates a new PySparkBridge instance.
+   *
+   * @param brokerState The container of broker state to expose
+   * @param kernel The kernel API to expose through the bridge
+   *
+   * @return The new PySpark bridge
+   */
+  def apply(
+    brokerState: BrokerState,
+    kernel: KernelLike
+  ): PySparkBridge = {
+    new PySparkBridge(
+      _brokerState = brokerState,
+      _kernel = kernel
+    ) with StandardJavaSparkContextProducer with StandardSQLContextProducer
+  }
+}
+
+/**
+ * Represents the API available to PySpark to act as the bridge for data
+ * between the JVM and Python.
+ *
+ * @param _brokerState The container of broker state to expose
+ * @param _kernel The kernel API to expose through the bridge
+ */
+class PySparkBridge private (
+  private val _brokerState: BrokerState,
+  private val _kernel: KernelLike
+) extends BrokerBridge(_brokerState, _kernel) {
+  override val brokerName: String = "PySpark"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
new file mode 100644
index 0000000..664c806
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.BrokerException
+
+/**
+ * Represents a generic PySpark exception.
+ *
+ * @param message The message to associate with the exception
+ */
+class PySparkException(message: String) extends BrokerException(message)
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
new file mode 100644
index 0000000..615ed19
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import java.net.URL
+
+import com.ibm.spark.interpreter.Results.Result
+import com.ibm.spark.interpreter._
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.SparkContext
+import org.apache.spark.sql.SQLContext
+import org.slf4j.LoggerFactory
+import py4j.GatewayServer
+
+import scala.concurrent.Await
+import scala.concurrent.duration._
+import scala.tools.nsc.interpreter.{InputStream, OutputStream}
+
+/**
+ * Represents an interpreter interface to PySpark. Requires a properly-set
+ * SPARK_HOME, PYTHONPATH pointing to Spark's Python source, and py4j installed
+ * where it is accessible to the Spark Kernel.
+ *
+ */
+class PySparkInterpreter(
+) extends Interpreter {
+  private val logger = LoggerFactory.getLogger(this.getClass)
+  private var _kernel:KernelLike = _
+
+  // TODO: Replace hard-coded maximum queue count
+  /** Represents the state used by this interpreter's Python instance. */
+  private lazy val pySparkState = new PySparkState(500)
+
+  /** Represents the bridge used by this interpreter's Python interface. */
+  private lazy val pySparkBridge = PySparkBridge(
+    pySparkState,
+    _kernel
+  )
+
+
+  /** Represents the interface for Python to talk to JVM Spark components. */
+  private lazy val gatewayServer = new GatewayServer(pySparkBridge, 0)
+
+  /** Represents the process handler used for the PySpark process. */
+  private lazy val pySparkProcessHandler: PySparkProcessHandler =
+    new PySparkProcessHandler(
+      pySparkBridge,
+      restartOnFailure = true,
+      restartOnCompletion = true
+    )
+
+  private lazy val pySparkService = new PySparkService(
+    gatewayServer,
+    pySparkBridge,
+    pySparkProcessHandler
+  )
+  private lazy val pySparkTransformer = new PySparkTransformer
+
+  /**
+   * Initializes the interpreter.
+   * @param kernel The kernel
+   * @return The newly initialized interpreter
+   */
+  override def init(kernel: KernelLike): Interpreter = {
+    _kernel = kernel
+    this
+  }
+
+  // Unsupported (but can be invoked)
+  override def bindSparkContext(sparkContext: SparkContext): Unit = {}
+
+  // Unsupported (but can be invoked)
+  override def bindSqlContext(sqlContext: SQLContext): Unit = {}
+
+  /**
+   * Executes the provided code with the option to silence output.
+   * @param code The code to execute
+   * @param silent Whether or not to execute the code silently (no output)
+   * @return The success/failure of the interpretation and the output from the
+   *         execution or the failure
+   */
+  override def interpret(code: String, silent: Boolean):
+    (Result, Either[ExecuteOutput, ExecuteFailure]) =
+  {
+    if (!pySparkService.isRunning) pySparkService.start()
+
+    val futureResult = pySparkTransformer.transformToInterpreterResult(
+      pySparkService.submitCode(code)
+    )
+
+    Await.result(futureResult, Duration.Inf)
+  }
+
+  /**
+   * Starts the interpreter, initializing any internal state.
+   * @return A reference to the interpreter
+   */
+  override def start(): Interpreter = {
+    pySparkService.start()
+
+    this
+  }
+
+  /**
+   * Stops the interpreter, removing any previous internal state.
+   * @return A reference to the interpreter
+   */
+  override def stop(): Interpreter = {
+    pySparkService.stop()
+
+    this
+  }
+
+  /**
+   * Returns the class loader used by this interpreter.
+   *
+   * @return The runtime class loader used by this interpreter
+   */
+  override def classLoader: ClassLoader = this.getClass.getClassLoader
+
+  // Unsupported (but can be invoked)
+  override def lastExecutionVariableName: Option[String] = None
+
+  // Unsupported (but can be invoked)
+  override def read(variableName: String): Option[AnyRef] = None
+
+  // Unsupported (but can be invoked)
+  override def completion(code: String, pos: Int): (Int, List[String]) =
+    (pos, Nil)
+
+  // Unsupported
+  override def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit = ???
+
+  // Unsupported
+  override def classServerURI: String = ""
+
+  // Unsupported
+  override def interrupt(): Interpreter = ???
+
+  // Unsupported
+  override def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit = ???
+
+  // Unsupported
+  override def addJars(jars: URL*): Unit = ???
+
+  // Unsupported
+  override def doQuietly[T](body: => T): T = ???
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
new file mode 100644
index 0000000..ace6635
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import java.io.{FileOutputStream, File}
+
+import com.ibm.spark.interpreter.broker.BrokerProcess
+import org.apache.commons.exec.environment.EnvironmentUtils
+import org.apache.commons.exec._
+import org.apache.commons.io.IOUtils
+import org.apache.spark.SparkContext
+import org.slf4j.LoggerFactory
+
+/**
+ * Represents the Python process used to evaluate PySpark code.
+ *
+ * @param pySparkBridge The bridge to use to retrieve kernel output streams
+ *                      and the Spark version to be verified
+ * @param pySparkProcessHandler The handler to use when the process fails or
+ *                              completes
+ * @param port The port to provide to the PySpark process to use to connect
+ *             back to the JVM
+ * @param sparkVersion The version of Spark that the process will be using
+ */
+class PySparkProcess(
+  private val pySparkBridge: PySparkBridge,
+  private val pySparkProcessHandler: PySparkProcessHandler,
+  private val port: Int,
+  private val sparkVersion: String
+) extends BrokerProcess(
+  processName = "python",
+  entryResource = "PySpark/pyspark_runner.py",
+  otherResources = Nil,
+  brokerBridge = pySparkBridge,
+  brokerProcessHandler = pySparkProcessHandler,
+  arguments = Seq(port.toString, sparkVersion)
+) {
+
+  override val brokerName: String = "PySpark"
+  private val logger = LoggerFactory.getLogger(this.getClass)
+
+  private val sparkHome = Option(System.getenv("SPARK_HOME"))
+    .orElse(Option(System.getProperty("spark.home")))
+  private val pythonPath = Option(System.getenv("PYTHONPATH"))
+
+  assert(sparkHome.nonEmpty, "PySpark process requires Spark Home to be set!")
+  if (pythonPath.isEmpty) logger.warn("PYTHONPATH not provided for PySpark!")
+
+  /**
+   * Creates a new process environment to be used for environment variable
+   * retrieval by the new process.
+   *
+   * @return The map of environment variables and their respective values
+   */
+  override protected def newProcessEnvironment(): Map[String, String] = {
+    val baseEnvironment = super.newProcessEnvironment()
+
+    import java.io.File.pathSeparator
+
+    val baseSparkHome = sparkHome.get
+    val basePythonPath = pythonPath.getOrElse("")
+    val updatedPythonPath =
+      (basePythonPath.split(pathSeparator) :+ s"$baseSparkHome/python/")
+        .map(_.trim)
+        .filter(_.nonEmpty)
+        .map(new File(_))
+        .distinct
+        .mkString(pathSeparator)
+
+    // Note: Adding the new map values should override the old ones
+    baseEnvironment ++ Map(
+      "SPARK_HOME" -> baseSparkHome,
+      "PYTHONPATH" -> updatedPythonPath
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
new file mode 100644
index 0000000..ab2aeb1
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.BrokerProcessHandler
+
+/**
+ * Represents the handler for events triggered by the PySpark process.
+ *
+ * @param pySparkBridge The bridge to reset when the process fails or completes
+ * @param restartOnFailure If true, restarts the process if it fails
+ * @param restartOnCompletion If true, restarts the process if it completes
+ */
+class PySparkProcessHandler(
+  private val pySparkBridge: PySparkBridge,
+  private val restartOnFailure: Boolean,
+  private val restartOnCompletion: Boolean
+  ) extends BrokerProcessHandler(
+  pySparkBridge,
+  restartOnFailure,
+  restartOnCompletion
+) {
+  override val brokerName: String = "PySpark"
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
new file mode 100644
index 0000000..ec264e2
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.BrokerService
+import com.ibm.spark.kernel.interpreter.pyspark.PySparkTypes._
+import org.apache.spark.SparkContext
+import org.slf4j.LoggerFactory
+import py4j.GatewayServer
+
+import scala.concurrent.Future
+
+/**
+ * Represents the service that provides the high-level interface between the
+ * JVM and Python.
+ *
+ * @param gatewayServer The backend to start to communicate between the JVM and
+ *                      Python
+ * @param pySparkBridge The bridge to use for communication between the JVM and
+ *                      Python
+ * @param pySparkProcessHandler The handler used for events that occur with
+ *                              the PySpark process
+ */
+class PySparkService(
+  private val gatewayServer: GatewayServer,
+  private val pySparkBridge: PySparkBridge,
+  private val pySparkProcessHandler: PySparkProcessHandler
+) extends BrokerService {
+  private val logger = LoggerFactory.getLogger(this.getClass)
+  @volatile private var _isRunning: Boolean = false
+  override def isRunning: Boolean = _isRunning
+
+
+  /** Represents the process used to execute Python code via the bridge. */
+  private lazy val pySparkProcess = {
+    val p = new PySparkProcess(
+      pySparkBridge,
+      pySparkProcessHandler,
+      gatewayServer.getListeningPort,
+      org.apache.spark.SPARK_VERSION
+    )
+
+    // Update handlers to correctly reset and restart the process
+    pySparkProcessHandler.setResetMethod(message => {
+      p.stop()
+      pySparkBridge.state.reset(message)
+    })
+    pySparkProcessHandler.setRestartMethod(() => p.start())
+
+    p
+  }
+
+  /** Starts the PySpark service. */
+  def start(): Unit = {
+    // Start without forking the gateway server (needs to have access to
+    // SparkContext in current JVM)
+    logger.debug("Starting gateway server")
+    gatewayServer.start()
+
+    val port = gatewayServer.getListeningPort
+    logger.debug(s"Gateway server running on port $port")
+
+    // Start the Python process used to execute code
+    logger.debug("Launching process to execute Python code")
+    pySparkProcess.start()
+
+    _isRunning = true
+  }
+
+  /**
+   * Submits code to the PySpark service to be executed and return a result.
+   *
+   * @param code The code to execute
+   *
+   * @return The result as a future to eventually return
+   */
+  def submitCode(code: Code): Future[CodeResults] = {
+    pySparkBridge.state.pushCode(code)
+  }
+
+  /** Stops the running PySpark service. */
+  def stop(): Unit = {
+    // Stop the Python process used to execute code
+    pySparkProcess.stop()
+
+    // Stop the server used as an entrypoint for Python
+    gatewayServer.shutdown()
+
+    _isRunning = false
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
new file mode 100644
index 0000000..2d0f63f
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.BrokerState
+
+/**
+ * Represents the state structure of PySpark.
+ *
+ * @param maxQueuedCode The maximum amount of code to support being queued
+ *                      at the same time for PySpark execution
+ */
+class PySparkState(private val maxQueuedCode: Int)
+  extends BrokerState(maxQueuedCode)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
new file mode 100644
index 0000000..146ca8e
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.BrokerTransformer
+
+/**
+ * Represents a utility that can transform raw PySpark information to
+ * kernel information.
+ */
+class PySparkTransformer extends BrokerTransformer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
new file mode 100644
index 0000000..1004a1f
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter.pyspark
+
+import com.ibm.spark.interpreter.broker.BrokerTypesProvider
+
+/**
+ * Represents all types associated with the PySpark interface.
+ */
+object PySparkTypes extends BrokerTypesProvider

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
new file mode 100644
index 0000000..618a678
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.interpreter
+
+import com.ibm.spark.interpreter.broker.{BrokerCode, BrokerPromise}
+
+/**
+ * Contains aliases to broker types.
+ */
+package object pyspark {
+  /**
+   * Represents a promise made regarding the completion of PySpark code
+   * execution.
+   */
+  type PySparkPromise = BrokerPromise
+
+  /**
+   * Represents a block of PyPython code to be evaluated.
+   */
+  type PySparkCode = BrokerCode
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
new file mode 100644
index 0000000..a0a79b5
--- /dev/null
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.magic.builtin
+
+import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
+import com.ibm.spark.kernel.interpreter.pyspark.{PySparkInterpreter, PySparkException}
+import com.ibm.spark.kernel.protocol.v5.MIMEType
+import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
+import com.ibm.spark.magic.dependencies.IncludeKernel
+
+/**
+ * Represents the magic interface to use the PySpark interpreter.
+ */
+class PySpark extends CellMagic with IncludeKernel {
+  override def execute(code: String): CellMagicOutput = {
+    val pySpark = kernel.interpreter("PySpark")
+
+    if (pySpark.isEmpty || pySpark.get == null)
+      throw new PySparkException("PySpark is not available!")
+
+    pySpark.get match {
+      case pySparkInterpreter: PySparkInterpreter =>
+        val (_, output) = pySparkInterpreter.interpret(code)
+        output match {
+          case Left(executeOutput) =>
+            CellMagicOutput(MIMEType.PlainText -> executeOutput)
+          case Right(executeFailure) => executeFailure match {
+            case executeAborted: ExecuteAborted =>
+              throw new PySparkException("PySpark code was aborted!")
+            case executeError: ExecuteError =>
+              throw new PySparkException(executeError.value)
+          }
+        }
+      case otherInterpreter =>
+        val className = otherInterpreter.getClass.getName
+        throw new PySparkException(s"Invalid PySpark interpreter: $className")
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaException.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaException.scala b/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaException.scala
deleted file mode 100644
index 978cf90..0000000
--- a/scala-interpreter/src/main/scala/com/ibm/spark/kernel/interpreter/scala/ScalaException.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.kernel.interpreter.scala
-
-/**
- * Represents a generic Scala exception.
- *
- * @param message The message to associate with the exception
- */
-class ScalaException(message: String) extends Throwable(message)


[18/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParser.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParser.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParser.scala
deleted file mode 100644
index a24c062..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/MagicParser.scala
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.ibm.spark.kernel.protocol.v5.magic
-
-import com.ibm.spark.magic.MagicLoader
-
-class MagicParser(magicLoader: MagicLoader) {
-  private val magicRegex = """^[%]{1,2}(\w+)""".r
-  protected[magic] val kernelObjectName = "kernel.magics"
-
-  /**
-   * Determines whether a given line of code represents a line magic.
-   * @param codeLine a single line of code
-   * @return
-   */
-  private def isLineMagic(codeLine: String) = codeLine.startsWith("%") &&
-    !isCellMagic(codeLine)
-
-  /**
-   * Determines whether a given string of code represents a cell magic.
-   * @param codeBlob a string of code separated by newlines
-   * @return
-   */
-  private def isCellMagic(codeBlob: String) = codeBlob.startsWith("%%")
-
-  /**
-   * Finds the first occurrence of a "magic string" i.e. "%%magic" or "%magic"
-   * in a given code string, and separates the magic name from the code that
-   * follows it.
-   *
-   * E.g.
-   * "%magic foo bar" -> ("magic", "foo bar")
-   * @param codeBlob a string of code separated by newlines
-   * @return (magicName, args)
-   */
-  protected[magic] def parseMagic(codeBlob: String): Option[(String, String)] = {
-    val matchData =
-      magicRegex.findFirstMatchIn(codeBlob)
-
-    matchData match {
-      case Some(m) => Some((m.group(1), m.after(1).toString.trim))
-      case None => None
-    }
-  }
-
-  /**
-   * Given a line of code representing a magic invocation determines whether
-   * the magic has an implementation.
-   * @param codeLine a single line of code
-   * @return true if the magic exists and is a line magic
-   */
-  protected[magic] def isValidLineMagic(codeLine: String): Boolean = {
-    parseMagic(codeLine) match {
-      case Some((magicName, _)) =>
-        isLineMagic(codeLine) && magicLoader.hasLineMagic(magicName)
-      case None => false
-    }
-  }
-
-  /**
-   * Given a blob of code, finds any magic invocations of magics that don't
-   * exist.
-   * @param codeBlob a string of code separated by newlines
-   * @return invalid magic names from the given code blob
-   */
-  protected[magic] def parseOutInvalidMagics(codeBlob: String): List[String] = {
-    val lineMagics = codeBlob.split("\n").toList.filter(isLineMagic)
-    lineMagics.filterNot(isValidLineMagic).map(line => {
-      val (magicName, _) = parseMagic(line).get
-      magicName
-    })
-  }
-
-  /**
-   * Formats a given magic name and args to code for a kernel method call.
-   * @param magicName the name of the magic
-   * @param args the arguments to the magic
-   * @return equivalent kernel method call
-   */
-  protected[magic] def substitute(magicName: String, args: String): String =
-    s"""$kernelObjectName.$magicName(\"\"\"$args\"\"\")"""
-
-  /**
-   * Formats a given line of code representing a line magic invocation into an
-   * equivalent kernel object call if the magic invocation is valid.
-   * @param codeLine the line of code to convert.
-   * @return a substituted line of code if valid else the original line
-   */
-  protected[magic] def substituteLine(codeLine: String): String = {
-    isValidLineMagic(codeLine) match {
-      case true =>
-        val (magicName, args) = parseMagic(codeLine).get
-        substitute(magicName, args)
-      case false => codeLine
-    }
-  }
-
-  /**
-   * Formats a given code blob representing a cell magic invocation into an
-   * equivalent kernel object call if the cell magic invocation is valid. An
-   * error message is returned if not.
-   * @param codeBlob the blob of code representing a cell magic invocation
-   * @return Left(the substituted code) or Right(error message)
-   */
-  protected[magic] def parseCell(codeBlob: String): Either[String, String] = {
-    parseMagic(codeBlob.trim) match {
-      case Some((cellMagicName, args)) =>
-        magicLoader.hasCellMagic(cellMagicName) match {
-          case true => Left(substitute(cellMagicName, args))
-          case false => Right(s"Magic $cellMagicName does not exist!")
-        }
-      case None => Left(codeBlob)
-    }
-  }
-
-  /**
-   * Parses all lines in a given code blob and either substitutes equivalent
-   * kernel object calls for each line magic in the code blob OR returns
-   * an error message if any of the line magic invocations were invalid.
-   * @param codeBlob a string of code separated by newlines
-   * @return Left(code blob with substitutions) or Right(error message)
-   */
-  protected[magic] def parseLines(codeBlob: String): Either[String, String] = {
-    val invalidMagics = parseOutInvalidMagics(codeBlob.trim)
-    invalidMagics match {
-      case Nil =>
-        val substitutedCode = codeBlob.trim.split("\n").map(substituteLine)
-        Left(substitutedCode.mkString("\n"))
-      case _ =>
-        Right(s"Magics [${invalidMagics.mkString(", ")}] do not exist!")
-    }
-  }
-
-  /**
-   * Parses a given code blob and returns an equivalent blob with substitutions
-   * for magic invocations, if any, or an error string.
-   * @param codeBlob the blob of code to parse
-   * @return Left(parsed code) or Right(error message)
-   */
-  def parse(codeBlob: String): Either[String, String] = {
-    val trimCodeBlob = codeBlob.trim
-    isCellMagic(trimCodeBlob) match {
-      case true => parseCell(trimCodeBlob)
-      case false => parseLines(trimCodeBlob)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessor.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessor.scala
deleted file mode 100644
index 73c3c9f..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/magic/PostProcessor.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.ibm.spark.kernel.protocol.v5.magic
-
-import com.ibm.spark.interpreter.{ExecuteOutput, Interpreter}
-import com.ibm.spark.kernel.protocol.v5.{Data, MIMEType}
-import com.ibm.spark.magic.{CellMagicOutput, LineMagicOutput}
-import com.ibm.spark.utils.LogLike
-
-class PostProcessor(interpreter: Interpreter) extends LogLike {
-  val defaultErr = "Something went wrong in postprocessor!"
-
-  def process(codeOutput: ExecuteOutput): Data = {
-    interpreter.lastExecutionVariableName.flatMap(interpreter.read) match {
-      case Some(l: Left[_, _]) => matchCellMagic(codeOutput, l)
-      case Some(r: Right[_, _]) => matchLineMagic(codeOutput, r)
-      case _ => Data(MIMEType.PlainText -> codeOutput)
-    }
-  }
-
-  protected[magic] def matchCellMagic(code: String, l: Left[_,_]) =
-    l.left.getOrElse(None) match {
-      case cmo: CellMagicOutput => cmo
-      case _ => Data(MIMEType.PlainText -> code)
-    }
-
-  protected[magic] def matchLineMagic(code: String, r: Right[_,_]) =
-    r.right.getOrElse(None) match {
-      case lmo: LineMagicOutput => processLineMagic(code)
-      case _ => Data(MIMEType.PlainText -> code)
-    }
-
-  protected[magic] def processLineMagic(code: String): Data = {
-    val parts = code.split("\n")
-    Data(MIMEType.PlainText -> parts.take(parts.size - 1).mkString("\n"))
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelay.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
deleted file mode 100644
index a1b846a..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.relay
-
-import java.io.OutputStream
-
-import akka.actor.Actor
-import akka.pattern._
-import akka.util.Timeout
-import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError, ExecuteFailure, ExecuteOutput}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.{PostProcessor, MagicParser}
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.utils.LogLike
-
-import scala.concurrent.Future
-import scala.concurrent.duration._
-
-case class ExecuteRequestRelay(
-  actorLoader: ActorLoader,
-  magicLoader: MagicLoader,
-  magicParser: MagicParser,
-  postProcessor: PostProcessor
-)
-  extends Actor with LogLike
-{
-  import context._
-  implicit val timeout = Timeout(21474835.seconds)
-
-  /**
-   * Takes an ExecuteFailure and (ExecuteReply, ExecuteResult) with contents
-   * dictated by the type of failure (either an error or an abort).
-   * @param failure the failure
-   * @return (ExecuteReply, ExecuteResult)
-   */
-  private def failureMatch(failure: ExecuteFailure) =
-    failure match {
-      case err: ExecuteError =>
-        val error = ExecuteReplyError(
-          1, Some(err.name), Some(err.value), Some(err.stackTrace)
-        )
-        val result =
-          ExecuteResult(1, Data(MIMEType.PlainText -> err.toString), Metadata())
-        (error, result)
-
-      case _: ExecuteAborted =>
-        val abort = ExecuteReplyAbort(1)
-        val result = ExecuteResult(1, Data(), Metadata())
-        (abort, result)
-    }
-
-  /**
-   * Packages the response into an ExecuteReply,ExecuteResult tuple.
-   * @param future The future containing either the output or failure
-   * @return The tuple representing the proper response
-   */
-  private def packageFutureResponse(
-    future: Future[Either[ExecuteOutput, ExecuteFailure]]
-  ): Future[(ExecuteReply, ExecuteResult)] = future.map { value =>
-    if (value.isLeft) {
-      val output = value.left.get
-      val data = postProcessor.process(output)
-      (
-        ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())),
-        ExecuteResult(1, data, Metadata())
-      )
-    } else {
-      failureMatch(value.right.get)
-    }
-  }
-
-  override def receive: Receive = {
-    case (executeRequest: ExecuteRequest, parentMessage: KernelMessage,
-      outputStream: OutputStream) =>
-      val interpreterActor = actorLoader.load(SystemActorType.Interpreter)
-
-      // Store our old sender so we don't lose it in the callback
-      // NOTE: Should point back to our KernelMessageRelay
-      val oldSender = sender()
-
-      // Sets the outputStream for this particular ExecuteRequest
-      magicLoader.dependencyMap.setOutputStream(outputStream)
-
-      // Parse the code for magics before sending it to the interpreter and
-      // pipe the response to sender
-      (magicParser.parse(executeRequest.code) match {
-        case Left(code) =>
-          val parsedRequest =
-            (executeRequest.copy(code = code), parentMessage, outputStream)
-          val interpreterFuture = (interpreterActor ? parsedRequest)
-            .mapTo[Either[ExecuteOutput, ExecuteFailure]]
-          packageFutureResponse(interpreterFuture)
-
-        case Right(error) =>
-          val failure = ExecuteError("Error parsing magics!", error, Nil)
-          Future { failureMatch(failure) }
-      }) pipeTo oldSender
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelay.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelay.scala
deleted file mode 100644
index cc45479..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/relay/KernelMessageRelay.scala
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.relay
-
-import akka.pattern.ask
-import akka.util.Timeout
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-import com.ibm.spark.kernel.protocol.v5.content.ShutdownRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, MessageType, _}
-import com.ibm.spark.utils.MessageLogSupport
-import scala.collection.immutable.HashMap
-import scala.concurrent.duration._
-import scala.util.{Random, Failure, Success}
-
-/**
- * This class is meant to be a relay for send KernelMessages through kernel
- * system.
- * @param actorLoader The ActorLoader used by this class for finding actors for
- *                    relaying messages
- * @param incomingSpecialCases The special cases for incoming messages
- * @param outgoingSpecialCases The special cases for outgoing messages
- * @param useSignatureManager Whether or not to use signature verification and
- *                            generation
- */
-case class KernelMessageRelay(
-  actorLoader: ActorLoader,
-  useSignatureManager: Boolean,
-  incomingSpecialCases: Map[String, String] = new HashMap[String, String](),
-  outgoingSpecialCases: Map[String, String] = new HashMap[String, String]()
-) extends OrderedSupport with MessageLogSupport  {
-  // NOTE: Required to provide the execution context for futures with akka
-  import context._
-
-  // NOTE: Required for ask (?) to function... maybe can define elsewhere?
-  implicit val timeout = Timeout(5.seconds)
-
-  // Flag indicating if can receive messages (or add them to buffer)
-  var isReady = false
-
-  def this(actorLoader: ActorLoader) =
-    this(actorLoader, true)
-
-  /**
-   * Relays a KernelMessage to a specific actor to handle that message.
-   *
-   * @param messageType The enumeration representing the message type
-   * @param kernelMessage The message to relay
-   */
-  private def relay(messageType: MessageType, kernelMessage: KernelMessage) = {
-    logger.debug("Relaying message type of " + messageType.toString)
-    logKernelMessageAction("Relaying", kernelMessage)
-    actorLoader.load(messageType) ! kernelMessage
-  }
-
-  private def incomingRelay(kernelMessage: KernelMessage) = {
-    var messageTypeString = kernelMessage.header.msg_type
-
-    // If this is a special case, transform the message type accordingly
-    if (incomingSpecialCases.contains(messageTypeString)) {
-      logger.debug(s"$messageTypeString is a special incoming case!")
-      messageTypeString = incomingSpecialCases(messageTypeString)
-    }
-
-    relay(MessageType.withName(messageTypeString), kernelMessage)
-  }
-
-  private def outgoingRelay(kernelMessage: KernelMessage) = {
-    var messageTypeString = kernelMessage.header.msg_type
-
-    // If this is a special case, transform the message type accordingly
-    if (outgoingSpecialCases.contains(messageTypeString)) {
-      logger.debug(s"$messageTypeString is a special outgoing case!")
-      messageTypeString = outgoingSpecialCases(messageTypeString)
-    }
-
-    relay(MessageType.withName(messageTypeString), kernelMessage)
-  }
-
-
-  /**
-   * This actor will receive and handle two types; ZMQMessage and KernelMessage.
-   * These messages will be forwarded to the actors that are responsible for them.
-   */
-  override def receive = {
-    // TODO: How to restore this when the actor dies?
-    // Update ready status
-    case ready: Boolean =>
-      isReady = ready
-      if (isReady) {
-        logger.info("Unstashing all messages received!")
-        unstashAll()
-        logger.info("Relay is now fully ready to receive messages!")
-      } else {
-        logger.info("Relay is now disabled!")
-      }
-
-
-    // Add incoming messages (when not ready) to buffer to be processed
-    case (zmqStrings: Seq[_], kernelMessage: KernelMessage) if !isReady && kernelMessage.header.msg_type != ShutdownRequest.toTypeString =>
-      logger.info("Not ready for messages! Stashing until ready!")
-      stash()
-
-    // Assuming these messages are incoming messages
-    case (zmqStrings: Seq[_], kernelMessage: KernelMessage) if isReady || kernelMessage.header.msg_type == ShutdownRequest.toTypeString =>
-      startProcessing()
-      if (useSignatureManager) {
-        logger.trace(s"Verifying signature for incoming message " +
-          s"${kernelMessage.header.msg_id}")
-        val signatureManager =
-          actorLoader.load(SecurityActorType.SignatureManager)
-        val signatureVerificationFuture = signatureManager ? (
-          (kernelMessage.signature, zmqStrings)
-        )
-
-        signatureVerificationFuture.mapTo[Boolean].onComplete {
-          case Success(true) =>
-            incomingRelay(kernelMessage)
-            finishedProcessing()
-          case Success(false) =>
-            // TODO: Figure out what the failure message structure should be!
-            logger.error(s"Invalid signature received from message " +
-              s"${kernelMessage.header.msg_id}!")
-            finishedProcessing()
-          case Failure(t) =>
-            logger.error("Failure when verifying signature!", t)
-            finishedProcessing()
-        }
-      } else {
-        logger.debug(s"Relaying incoming message " +
-          s"${kernelMessage.header.msg_id} without SignatureManager")
-        incomingRelay(kernelMessage)
-        finishedProcessing()
-      }
-
-    // Assuming all kernel messages without zmq strings are outgoing
-    case kernelMessage: KernelMessage =>
-      startProcessing()
-      if (useSignatureManager) {
-        logger.trace(s"Creating signature for outgoing message " +
-          s"${kernelMessage.header.msg_id}")
-        val signatureManager = actorLoader.load(SecurityActorType.SignatureManager)
-        val signatureInsertFuture = signatureManager ? kernelMessage
-
-        // TODO: Handle error case for mapTo and non-present onFailure
-        signatureInsertFuture.mapTo[KernelMessage] onSuccess {
-          case message =>
-            outgoingRelay(message)
-            finishedProcessing()
-        }
-      } else {
-        logger.debug(s"Relaying outgoing message " +
-          s"${kernelMessage.header.msg_id} without SignatureManager")
-        outgoingRelay(kernelMessage)
-        finishedProcessing()
-      }
-  }
-
-  override def orderedTypes(): Seq[Class[_]] = Seq(
-    classOf[(Seq[_], KernelMessage)],
-    classOf[KernelMessage]
-  )
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStream.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStream.scala
deleted file mode 100644
index e57fd84..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelInputStream.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.stream
-
-import java.io.InputStream
-import java.nio.charset.Charset
-
-import akka.pattern.ask
-import com.ibm.spark.kernel.protocol.v5.content.InputRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities.timeout
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, MessageType}
-
-import scala.collection.mutable.ListBuffer
-import scala.concurrent.{Await, Future}
-
-import KernelInputStream._
-
-object KernelInputStream {
-  val DefaultPrompt = ""
-  val DefaultPassword = false
-}
-
-/**
- * Represents an OutputStream that sends data back to the clients connect to the
- * kernel instance.
- *
- * @param actorLoader The actor loader used to access the message relay
- * @param kmBuilder The KMBuilder used to construct outgoing kernel messages
- * @param prompt The prompt to use for input requests
- * @param password Whether or not the input request is for a password
- */
-class KernelInputStream(
-  actorLoader: ActorLoader,
-  kmBuilder: KMBuilder,
-  prompt: String = DefaultPrompt,
-  password: Boolean = DefaultPassword
-) extends InputStream {
-  private val EncodingType = Charset.forName("UTF-8")
-  @volatile private var internalBytes: ListBuffer[Byte] = ListBuffer()
-
-  /**
-   * Returns the number of bytes available before the next request is made
-   * for more data.
-   * @return The total number of bytes in the internal buffer
-   */
-  override def available(): Int = internalBytes.length
-
-  /**
-   * Requests the next byte of data from the client. If the buffer containing
-   * @return The byte of data as an integer
-   */
-  override def read(): Int = {
-    if (!this.hasByte) this.requestBytes()
-
-    this.nextByte()
-  }
-
-  private def hasByte: Boolean = internalBytes.nonEmpty
-
-  private def nextByte(): Int = {
-    val byte = internalBytes.head
-
-    internalBytes = internalBytes.tail
-
-    byte
-  }
-
-  private def requestBytes(): Unit = {
-    val inputRequest = InputRequest(prompt, password)
-    // NOTE: Assuming already provided parent header and correct ids
-    val kernelMessage = kmBuilder
-      .withHeader(MessageType.Outgoing.InputRequest)
-      .withContentString(inputRequest)
-      .build
-
-    // NOTE: The same handler is being used in both request and reply
-    val responseFuture: Future[String] =
-      (actorLoader.load(MessageType.Incoming.InputReply) ? kernelMessage)
-      .mapTo[String]
-
-    // Block until we get a response
-    import scala.concurrent.duration._
-    internalBytes ++=
-      Await.result(responseFuture, Duration.Inf).getBytes(EncodingType)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOutputStream.scala b/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOutputStream.scala
deleted file mode 100644
index 56b0cbb..0000000
--- a/kernel/src/main/scala/com/ibm/spark/kernel/protocol/v5/stream/KernelOutputStream.scala
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.stream
-
-import java.io.OutputStream
-import java.nio.charset.Charset
-
-import com.ibm.spark.kernel.protocol.v5.content.StreamContent
-import com.ibm.spark.kernel.protocol.v5.{SystemActorType, MessageType, KMBuilder}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.{LogLike, ScheduledTaskManager}
-import scala.collection.mutable.ListBuffer
-import KernelOutputStream._
-
-object KernelOutputStream {
-  val DefaultStreamType = "stdout"
-  val DefaultSendEmptyOutput = false
-}
-
-/**
- * Represents an OutputStream that sends data back to the clients connect to the
- * kernel instance.
- *
- * @param actorLoader The actor loader used to access the message relay
- * @param kmBuilder The KMBuilder used to construct outgoing kernel messages
- * @param scheduledTaskManager The task manager used to schedule periodic
- *                             flushes to send data across the wire
- * @param streamType The type of stream (stdout/stderr)
- * @param sendEmptyOutput If true, will allow empty output to be flushed and
- *                        sent out to listening clients
- */
-class KernelOutputStream(
-  private val actorLoader: ActorLoader,
-  private val kmBuilder: KMBuilder,
-  private val scheduledTaskManager: ScheduledTaskManager,
-  private val streamType: String = DefaultStreamType,
-  private val sendEmptyOutput: Boolean = DefaultSendEmptyOutput
-) extends OutputStream with LogLike {
-  private val EncodingType = Charset.forName("UTF-8")
-  @volatile private var internalBytes: ListBuffer[Byte] = ListBuffer()
-
-  private var taskId: String = _
-
-  private def enableAutoFlush() =
-    if (taskId == null) {
-      logger.trace("Enabling auto flush")
-      taskId = scheduledTaskManager.addTask(task = this.flush())
-    }
-
-  private def disableAutoFlush() =
-    if (taskId != null) {
-      logger.trace("Disabling auto flush")
-      scheduledTaskManager.removeTask(taskId)
-      taskId = null
-    }
-
-  /**
-   * Takes the current byte array contents in memory, packages them up into a
-   * KernelMessage, and sends the message to the KernelMessageRelay.
-   */
-  override def flush(): Unit = {
-    val contents = internalBytes.synchronized {
-      logger.trace("Getting content to flush")
-      val bytesToString = new String(internalBytes.toArray, EncodingType)
-
-      // Clear the internal buffer
-      internalBytes.clear()
-
-      // Stop the auto-flushing
-      disableAutoFlush()
-
-      bytesToString
-    }
-
-    // Avoid building and sending a kernel message if the contents (when
-    // trimmed) are empty and the flag to send anyway is disabled
-    if (!sendEmptyOutput && contents.trim.isEmpty) {
-      val contentsWithVisibleWhitespace = contents
-        .replace("\n", "\\n")
-        .replace("\t", "\\t")
-        .replace("\r", "\\r")
-        .replace(" ", "\\s")
-      logger.warn(s"Suppressing empty output: '$contentsWithVisibleWhitespace'")
-      return
-    }
-
-    logger.trace(s"Content to flush: '$contents'")
-
-    val streamContent = StreamContent(
-      streamType, contents
-    )
-
-    val kernelMessage = kmBuilder
-      .withIds(Seq(MessageType.Outgoing.Stream.toString))
-      .withHeader(MessageType.Outgoing.Stream)
-      .withContentString(streamContent).build
-
-    actorLoader.load(SystemActorType.KernelMessageRelay) ! kernelMessage
-
-    // Ensure any underlying implementation is processed
-    super.flush()
-  }
-
-  /**
-   * Adds the specified byte to the end of the internal buffer. The most
-   * significant 24 bits are ignored. Only the least significant 8 bits
-   * are appended.
-   * @param b The byte whose least significant 8 bits are to be appended
-   */
-  override def write(b: Int): Unit = internalBytes.synchronized {
-    // Begin periodic flushing if this is a new set of bytes
-    enableAutoFlush()
-
-    internalBytes += b.toByte
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddDeps.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddDeps.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddDeps.scala
deleted file mode 100644
index 5555c08..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddDeps.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.PrintStream
-
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies._
-import com.ibm.spark.utils.ArgumentParsingSupport
-
-class AddDeps extends LineMagic with IncludeInterpreter
-  with IncludeOutputStream with IncludeSparkContext with ArgumentParsingSupport
-  with IncludeDependencyDownloader with IncludeKernel
-{
-
-  private lazy val printStream = new PrintStream(outputStream)
-
-  val _transitive =
-    parser.accepts("transitive", "retrieve dependencies recursively")
-
-  /**
-   * Execute a magic representing a line magic.
-   * @param code The single line of code
-   * @return The output of the magic
-   */
-  override def execute(code: String): Unit = {
-    val nonOptionArgs = parseArgs(code)
-    dependencyDownloader.setPrintStream(printStream)
-
-    // TODO: require a version or use the most recent if omitted?
-    if (nonOptionArgs.size == 3) {
-      // get the jars and hold onto the paths at which they reside
-      val urls = dependencyDownloader.retrieve(
-        nonOptionArgs(0), nonOptionArgs(1), nonOptionArgs(2), _transitive)
-
-      // add the jars to the interpreter and spark context
-      interpreter.addJars(urls:_*)
-      urls.foreach(url => sparkContext.addJar(url.getPath))
-    } else {
-      printHelp(printStream, """%AddDeps my.company artifact-id version""")
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddJar.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddJar.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddJar.scala
deleted file mode 100644
index bdfdbe2..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/AddJar.scala
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.{File, PrintStream}
-import java.net.URL
-import java.nio.file.{Files, Paths}
-
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.builtin.AddJar._
-import com.ibm.spark.magic.dependencies._
-import com.ibm.spark.utils.{ArgumentParsingSupport, DownloadSupport, LogLike}
-import com.typesafe.config.Config
-
-object AddJar {
-
-  private var jarDir:Option[String] = None
-  def getJarDir(config: Config): String = {
-    jarDir.getOrElse({
-      jarDir = Some(
-        if(config.hasPath("jar_dir") && Files.exists(Paths.get(config.getString("jar_dir")))) {
-          config.getString("jar_dir")
-        } else {
-          Files.createTempDirectory("spark_kernel_add_jars").toFile.getAbsolutePath
-        }
-      )
-      jarDir.get
-    })
-  }
-}
-
-class AddJar
-  extends LineMagic with IncludeInterpreter with IncludeSparkContext
-  with IncludeOutputStream with DownloadSupport with ArgumentParsingSupport
-  with IncludeKernel with IncludeMagicLoader with IncludeConfig with LogLike
-{
-  // Option to mark re-downloading of jars
-  private val _force =
-    parser.accepts("f", "forces re-download of specified jar")
-
-  // Option to mark re-downloading of jars
-  private val _magic =
-    parser.accepts("magic", "loads jar as a magic extension")
-
-  // Lazy because the outputStream is not provided at construction
-  private lazy val printStream = new PrintStream(outputStream)
-
-  /**
-   * Retrieves file name from URL.
-   *
-   * @param location The remote location (URL) 
-   * @return The name of the remote URL, or an empty string if one does not exist
-   */
-  def getFileFromLocation(location: String): String = {
-    val url = new URL(location)
-    val file = url.getFile.split("/")
-    if (file.length > 0) {
-        file.last
-    } else {
-        ""
-    }
-  }
-
-  /**
-   * Downloads and adds the specified jar to the
-   * interpreter/compiler/cluster classpaths.
-   *
-   * @param code The line containing the location of the jar
-   */
-  override def execute(code: String): Unit = {
-    val nonOptionArgs = parseArgs(code.trim)
-
-    // Check valid arguments
-    if (nonOptionArgs.length != 1) {
-      printHelp(printStream, """%AddJar <jar_url>""")
-      return
-    }
-
-    // Check if the jar we want to download is valid
-    val jarRemoteLocation = nonOptionArgs(0)
-    if (jarRemoteLocation.isEmpty) {
-      printHelp(printStream, """%AddJar <jar_url>""")
-      return
-    }
-
-    // Get the destination of the jar
-    val jarName = getFileFromLocation(jarRemoteLocation)
-
-    // Ensure the URL actually contains a jar or zip file
-    if (!jarName.endsWith(".jar") && !jarName.endsWith(".zip")) {
-        throw new IllegalArgumentException(s"The jar file $jarName must end in .jar or .zip.")
-    }
-
-    val downloadLocation = getJarDir(config) + "/" + jarName
-
-    logger.debug( "Downloading jar to %s".format(downloadLocation) )
-
-    val fileDownloadLocation = new File(downloadLocation)
-
-    // Check if exists in cache or force applied
-    if (_force || !fileDownloadLocation.exists()) {
-      // Report beginning of download
-      printStream.println(s"Starting download from $jarRemoteLocation")
-
-      downloadFile(
-        new URL(jarRemoteLocation),
-        new File(downloadLocation).toURI.toURL
-      )
-
-      // Report download finished
-      printStream.println(s"Finished download of $jarName")
-    } else {
-      printStream.println(s"Using cached version of $jarName")
-    }
-
-
-    if (_magic)
-    {
-
-      magicLoader.addJar(fileDownloadLocation.toURI.toURL)
-
-    }
-    else
-    {
-      interpreter.addJars(fileDownloadLocation.toURI.toURL)
-      sparkContext.addJar(fileDownloadLocation.getCanonicalPath)
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/BuiltinLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/BuiltinLoader.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/BuiltinLoader.scala
deleted file mode 100644
index aecc90f..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/BuiltinLoader.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.google.common.reflect.ClassPath
-import com.google.common.reflect.ClassPath.ClassInfo
-import com.ibm.spark.magic.InternalClassLoader
-import com.google.common.base.Strings._
-import scala.collection.JavaConversions._
-
-/**
- * Represents a class loader that loads classes from the builtin package.
- */
-class BuiltinLoader
-  extends InternalClassLoader(classOf[BuiltinLoader].getClassLoader) {
-
-  private val pkgName = this.getClass.getPackage.getName
-
-  /**
-   * Provides a list of ClassInfo objects for each class in the specified
-   * package.
-   * @param pkg package name
-   * @return list of ClassInfo objects
-   */
-  def getClasses(pkg: String = pkgName): List[ClassInfo] = {
-    isNullOrEmpty(pkg) match {
-      case true =>
-        List()
-      case false =>
-        // TODO: Decide if this.getClass.getClassLoader should just be this
-        val classPath = ClassPath.from(this.getClass.getClassLoader)
-        classPath.getTopLevelClasses(pkg).filter(
-          _.getSimpleName != this.getClass.getSimpleName
-        ).toList
-    }
-  }
-
-  /**
-   * Provides a list of Class[_] objects for each class in the specified
-   * package.
-   * @param pkg package name
-   * @return list of Class[_] objects
-   */
-  def loadClasses(pkg: String = pkgName): List[Class[_]] =
-    getClasses(pkg).map(_.load())
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/Html.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/Html.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/Html.scala
deleted file mode 100644
index 95fa31a..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/Html.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.PrintStream
-
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-import com.ibm.spark.utils.ArgumentParsingSupport
-import com.google.common.base.Strings
-
-class Html extends CellMagic with ArgumentParsingSupport
-  with IncludeOutputStream {
-
-  // Lazy because the outputStream is not provided at construction
-  private lazy val printStream = new PrintStream(outputStream)
-
-  override def execute(code: String): CellMagicOutput = {
-    def printHelpAndReturn: CellMagicOutput = {
-      printHelp(printStream, """%%Html <string_code>""")
-      CellMagicOutput()
-    }
-
-    Strings.isNullOrEmpty(code) match {
-      case true => printHelpAndReturn
-      case false => CellMagicOutput(MIMEType.TextHtml -> code)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/JavaScript.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/JavaScript.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/JavaScript.scala
deleted file mode 100644
index 42772c1..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/JavaScript.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.PrintStream
-
-import com.google.common.base.Strings
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-import com.ibm.spark.utils.ArgumentParsingSupport
-import org.slf4j.LoggerFactory
-
-class JavaScript extends CellMagic with ArgumentParsingSupport
-  with IncludeOutputStream {
-
-  // Lazy because the outputStream is not provided at construction
-  private lazy val printStream = new PrintStream(outputStream)
-
-  override def execute(code: String): CellMagicOutput = {
-    def printHelpAndReturn: CellMagicOutput = {
-      printHelp(printStream, """%JavaScript <string_code>""")
-      CellMagicOutput()
-    }
-
-    Strings.isNullOrEmpty(code) match {
-      case true => printHelpAndReturn
-      case false => CellMagicOutput(MIMEType.ApplicationJavaScript -> code)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/LSMagic.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/LSMagic.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/LSMagic.scala
deleted file mode 100644
index db99cc1..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/LSMagic.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import java.io.PrintStream
-
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-
-class LSMagic extends LineMagic with IncludeOutputStream {
-
-  private lazy val printStream = new PrintStream(outputStream)
-
-  /**
-   * Lists all available magics.
-   * @param code The single line of code
-   * @return The output of the magic
-   */
-  override def execute(code: String): Unit = {
-    val classes = new BuiltinLoader().loadClasses().toList
-    val lineMagics = magicNames("%", classOf[LineMagic], classes)
-      .mkString(" ").toLowerCase
-    val cellMagics = magicNames("%%", classOf[CellMagic], classes)
-      .mkString(" ").toLowerCase
-    val message =
-      s"""|Available line magics:
-           |$lineMagics
-           |
-           |Available cell magics:
-           |$cellMagics
-           |
-           |Type %<magic_name> for usage info.
-         """.stripMargin
-
-    printStream.println(message)
-  }
-
-  /**
-   * Provides a list of class names from the given list that implement
-   * the specified interface, with the specified prefix prepended.
-   * @param prefix prepended to each name, e.g. "%%"
-   * @param interface a magic interface, e.g. classOf[LineMagic]
-   * @param classes a list of magic classes
-   * @return list of class names with prefix
-   */
-  protected[magic] def magicNames(prefix: String, interface: Class[_],
-                                  classes: List[Class[_]]) : List[String] = {
-    val filteredClasses = classes.filter(_.getInterfaces.contains(interface))
-    filteredClasses.map(c => s"${prefix}${c.getSimpleName}")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/RDD.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/RDD.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/RDD.scala
deleted file mode 100644
index dbee517..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/RDD.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.interpreter.{ExecuteFailure, Results, ExecuteAborted, ExecuteError}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
-import com.ibm.spark.utils.LogLike
-import com.ibm.spark.utils.json.RddToJson
-import org.apache.spark.sql.SchemaRDD
-
-/**
- * Temporary magic to show an RDD as JSON
- */
-class RDD extends CellMagic with IncludeKernelInterpreter with LogLike {
-
-  private def convertToJson(code: String) = {
-    val (result, message) = kernelInterpreter.interpret(code)
-    result match {
-      case Results.Success =>
-        val rddVarName = kernelInterpreter.lastExecutionVariableName.getOrElse("")
-        kernelInterpreter.read(rddVarName).map(rddVal => {
-          try{
-            CellMagicOutput(MIMEType.ApplicationJson -> RddToJson.convert(rddVal.asInstanceOf[SchemaRDD]))
-          } catch {
-            case _: Throwable =>
-              CellMagicOutput(MIMEType.PlainText -> s"Could note convert RDD to JSON: ${rddVarName}->${rddVal}")
-          }
-        }).getOrElse(CellMagicOutput(MIMEType.PlainText -> "No RDD Value found!"))
-      case _ =>
-        val errorMessage = message.right.toOption match {
-          case Some(executeFailure) => executeFailure match {
-            case _: ExecuteAborted => throw new Exception("RDD magic aborted!")
-            case executeError: ExecuteError => throw new Exception(executeError.value)
-          }
-          case _ =>  "No error information available!"
-        }
-        logger.error(s"Error retrieving RDD value: ${errorMessage}")
-        CellMagicOutput(MIMEType.PlainText ->
-          (s"An error occurred converting RDD to JSON.\n${errorMessage}"))
-    }
-  }
-
-  override def execute(code: String): CellMagicOutput =
-    convertToJson(code)
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/ShowTypes.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/ShowTypes.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/ShowTypes.scala
deleted file mode 100644
index 47d4f65..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/ShowTypes.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.magic.LineMagic
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-import java.io.PrintStream
-import com.ibm.spark.kernel.api.KernelOptions
-
-
-class ShowTypes extends LineMagic with IncludeOutputStream {
-  private lazy val printStream = new PrintStream(outputStream)
-
-  override def execute(code: String): Unit = {
-    code match {
-      case "on" =>
-        printStream.println(s"Types will be printed.")
-        KernelOptions.showTypes = true
-      case "off" =>
-        printStream.println(s"Types will not be printed")
-        KernelOptions.showTypes = false
-      case "" =>
-        printStream.println(s"ShowTypes is currently ${if (KernelOptions.showTypes) "on" else "off"} ")
-      case other =>
-        printStream.println(s"${other} is not a valid option for the ShowTypes magic.")
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/magic/builtin/Truncation.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/magic/builtin/Truncation.scala b/kernel/src/main/scala/com/ibm/spark/magic/builtin/Truncation.scala
deleted file mode 100644
index d30736e..0000000
--- a/kernel/src/main/scala/com/ibm/spark/magic/builtin/Truncation.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.magic.builtin
-
-import com.ibm.spark.magic.LineMagic
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-import java.io.PrintStream
-import com.ibm.spark.kernel.api.KernelOptions
-
-
-class Truncation extends LineMagic with IncludeOutputStream {
-  private lazy val printStream = new PrintStream(outputStream)
-
-  override def execute(code: String): Unit = {
-    code match {
-      case "on" =>
-        printStream.println(s"Output WILL be truncated.")
-        KernelOptions.noTruncation = false
-      case "off" =>
-        printStream.println(s"Output will NOT be truncated")
-        KernelOptions.noTruncation = true
-      case "" =>
-        printStream.println(s"Truncation is currently ${if (KernelOptions.noTruncation) "off" else "on"} ")
-      case other =>
-        printStream.println(s"${other} is not a valid option for the NoTruncation magic.")
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/utils/MessageLogSupport.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/utils/MessageLogSupport.scala b/kernel/src/main/scala/com/ibm/spark/utils/MessageLogSupport.scala
deleted file mode 100644
index 05c2216..0000000
--- a/kernel/src/main/scala/com/ibm/spark/utils/MessageLogSupport.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import com.ibm.spark.kernel.protocol.v5.{MessageType, KernelMessage}
-
-trait MessageLogSupport extends LogLike {
-  /**
-   * Logs various pieces of a KernelMessage at different levels of logging.
-   * @param km
-   */
-  def logMessage(km: KernelMessage): Unit = {
-    logger.trace(s"Kernel message ids: ${km.ids}")
-    logger.trace(s"Kernel message signature: ${km.signature}")
-    logger.debug(s"Kernel message header id: ${km.header.msg_id}")
-    logger.debug(s"Kernel message header type: ${km.header.msg_type}")
-    val incomingMessage = isIncomingMessage(km.header.msg_type)
-    (km.parentHeader, incomingMessage) match {
-      case (null, true)   =>  //  Don't do anything, this is expected
-      case (null, false)  =>  //  Messages coming from the kernel should have parent headers
-        logger.warn(s"Parent header is null for message ${km.header.msg_id} " +
-          s"of type ${km.header.msg_type}")
-      case _ =>
-        logger.trace(s"Kernel message parent id: ${km.parentHeader.msg_id}")
-        logger.trace(s"Kernel message parent type: ${km.parentHeader.msg_type}")
-    }
-    logger.trace(s"Kernel message metadata: ${km.metadata}")
-    logger.trace(s"Kernel message content: ${km.contentString}")
-  }
-
-  /**
-   * Logs an action, along with message id and type for a KernelMessage.
-   * @param action
-   * @param km
-   */
-  def logKernelMessageAction(action: String, km: KernelMessage): Unit = {
-    logger.debug(s"${action} KernelMessage ${km.header.msg_id} " +
-      s"of type ${km.header.msg_type}")
-  }
-
-  // TODO: Migrate this to a helper method in MessageType.Incoming
-  /**
-   * This method is used to determine if a message is being received by the
-   * kernel or being sent from the kernel.
-   * @return true if the message is received by the kernel, false otherwise.
-   */
-  private def isIncomingMessage(messageType: String): Boolean ={
-    MessageType.Incoming.CompleteRequest.toString.equals(messageType) ||
-      MessageType.Incoming.ConnectRequest.toString.equals(messageType) ||
-      MessageType.Incoming.ExecuteRequest.toString.equals(messageType) ||
-      MessageType.Incoming.HistoryRequest.toString.equals(messageType) ||
-      MessageType.Incoming.InspectRequest.toString.equals(messageType) ||
-      MessageType.Incoming.ShutdownRequest.toString.equals(messageType)||
-      MessageType.Incoming.KernelInfoRequest.toString.equals(messageType) ||
-      MessageType.Incoming.CommOpen.toString.equals(messageType) ||
-      MessageType.Incoming.CommMsg.toString.equals(messageType) ||
-      MessageType.Incoming.CommClose.toString.equals(messageType)
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/com/ibm/spark/utils/json/RddToJson.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/com/ibm/spark/utils/json/RddToJson.scala b/kernel/src/main/scala/com/ibm/spark/utils/json/RddToJson.scala
deleted file mode 100644
index 3439d0d..0000000
--- a/kernel/src/main/scala/com/ibm/spark/utils/json/RddToJson.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils.json
-
-import org.apache.spark.sql.{DataFrame, SchemaRDD}
-import play.api.libs.json.{JsObject, JsString, Json}
-
-/**
- * Utility to convert RDD to JSON.
- */
-object RddToJson {
-
-  /**
-   * Converts a SchemaRDD to a JSON table format.
-   *
-   * @param rdd The schema rdd (now a dataframe) to convert
-   *
-   * @return The resulting string representing the JSON
-   */
-  def convert(rdd: DataFrame, limit: Int = 10): String =
-    JsObject(Seq(
-      "type" -> JsString("rdd/schema"),
-      "columns" -> Json.toJson(rdd.schema.fieldNames),
-      "rows" -> Json.toJson(rdd.map(row =>
-        row.toSeq.map(_.toString).toArray).take(limit))
-    )).toString()
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/SparkKernel.scala b/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
new file mode 100644
index 0000000..f532de9
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark
+
+import com.ibm.spark.boot.layer._
+import com.ibm.spark.boot.{CommandLineOptions, KernelBootstrap}
+import com.ibm.spark.kernel.BuildInfo
+
+object SparkKernel extends App {
+  private val options = new CommandLineOptions(args)
+
+  if (options.help) {
+    options.printHelpOn(System.out)
+  } else if (options.version) {
+    println(s"Kernel Version:       ${BuildInfo.version}")
+    println(s"Build Date:           ${BuildInfo.buildDate}")
+    println(s"Scala Version:        ${BuildInfo.scalaVersion}")
+    println(s"Apache Spark Version: ${BuildInfo.sparkVersion}")
+  } else {
+    (new KernelBootstrap(options.toConfig)
+      with StandardBareInitialization
+      with StandardComponentInitialization
+      with StandardHandlerInitialization
+      with StandardHookInitialization)
+      .initialize()
+      .waitForTermination()
+      .shutdown()
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
new file mode 100644
index 0000000..a5acbc2
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.boot
+
+import java.io.{File, OutputStream}
+
+import com.ibm.spark.utils.KeyValuePairUtils
+import com.typesafe.config.{Config, ConfigFactory}
+import joptsimple.util.KeyValuePair
+import joptsimple.{OptionParser, OptionSpec}
+
+import scala.collection.JavaConverters._
+
+class CommandLineOptions(args: Seq[String]) {
+  private val parser = new OptionParser()
+  parser.allowsUnrecognizedOptions()
+
+  /*
+   * Options supported by our kernel.
+   */
+  private val _help =
+    parser.acceptsAll(Seq("help", "h").asJava, "display help information").forHelp()
+
+  private val _version =
+    parser.acceptsAll(Seq("version", "v").asJava, "display version information")
+
+  private val _profile =
+    parser.accepts("profile", "path to IPython JSON connection file")
+      .withRequiredArg().ofType(classOf[File])
+
+  private val _ip =
+    parser.accepts("ip", "ip used to bind sockets")
+      .withRequiredArg().ofType(classOf[String])
+
+  private val _stdin_port = parser.accepts(
+    "stdin-port", "port of the stdin socket"
+  ).withRequiredArg().ofType(classOf[Int])
+
+  private val _shell_port = parser.accepts(
+    "shell-port", "port of the shell socket"
+  ).withRequiredArg().ofType(classOf[Int])
+
+  private val _iopub_port = parser.accepts(
+    "iopub-port", "port of the iopub socket"
+  ).withRequiredArg().ofType(classOf[Int])
+
+  private val _control_port = parser.accepts(
+    "control-port", "port of the control socket"
+  ).withRequiredArg().ofType(classOf[Int])
+
+  private val _heartbeat_port = parser.accepts(
+    "heartbeat-port", "port of the heartbeat socket"
+  ).withRequiredArg().ofType(classOf[Int])
+
+  private val _spark_configuration = parser.acceptsAll(
+    Seq("spark-configuration", "S").asJava,
+    "configuration setting for Apache Spark"
+  ).withRequiredArg().ofType(classOf[KeyValuePair])
+
+  private val _magic_url =
+    parser.accepts("magic-url", "path to a magic jar")
+      .withRequiredArg().ofType(classOf[String])
+
+  private val _max_interpreter_threads = parser.accepts(
+    "max-interpreter-threads",
+    "total number of worker threads to use to execute code"
+  ).withRequiredArg().ofType(classOf[Int])
+
+  private val _jar_dir = parser.accepts(
+    "jar-dir",
+    "directory where user added jars are stored (MUST EXIST)"
+  ).withRequiredArg().ofType(classOf[String])
+
+  private val _default_interpreter =
+    parser.accepts("default-interpreter", "default interpreter for the kernel")
+      .withRequiredArg().ofType(classOf[String])
+
+  private val _nosparkcontext =
+    parser.accepts("nosparkcontext", "kernel should not create a spark context")
+
+  private val _interpreter_plugin = parser.accepts(
+    "interpreter-plugin"
+  ).withRequiredArg().ofType(classOf[String])
+
+  private val options = parser.parse(args.map(_.trim): _*)
+
+  /*
+   * Helpers to determine if an option is provided and the value with which it
+   * was provided.
+   */
+
+  private def has[T](spec: OptionSpec[T]): Boolean =
+    options.has(spec)
+
+  private def get[T](spec: OptionSpec[T]): Option[T] =
+    Some(options.valueOf(spec)).filter(_ != null)
+
+  private def getAll[T](spec: OptionSpec[T]): Option[List[T]] =
+    Some(options.valuesOf(spec).asScala.toList).filter(_ != null)
+
+  /*
+   * Expose options in terms of their existence/value.
+   */
+
+  val help: Boolean = has(_help)
+
+  val version: Boolean = has(_version)
+
+  /*
+   * Config object has 3 levels and fallback in this order
+   * 1. Comandline Args
+   * 2. --profile file
+   * 3. Defaults
+   */
+  def toConfig: Config = {
+    val profileConfig: Config = get(_profile) match {
+      case Some(x) =>
+        ConfigFactory.parseFile(x)
+      case None =>
+        ConfigFactory.empty()
+    }
+
+    val commandLineConfig: Config = ConfigFactory.parseMap(Map(
+      "stdin_port" -> get(_stdin_port),
+      "shell_port" -> get(_shell_port),
+      "iopub_port" -> get(_iopub_port),
+      "control_port" -> get(_control_port),
+      "hb_port" -> get(_heartbeat_port),
+      "ip" -> get(_ip),
+      "interpreter_args" -> interpreterArgs,
+      "magic_urls" -> getAll(_magic_url).map(_.asJava)
+        .flatMap(list => if (list.isEmpty) None else Some(list)),
+      "spark_configuration" -> getAll(_spark_configuration)
+        .map(list => KeyValuePairUtils.keyValuePairSeqToString(list))
+        .flatMap(str => if (str.nonEmpty) Some(str) else None),
+      "max_interpreter_threads" -> get(_max_interpreter_threads),
+      "jar_dir" -> get(_jar_dir),
+      "default_interpreter" -> get(_default_interpreter),
+      "nosparkcontext" -> (if (has(_nosparkcontext)) Some(true) else Some(false)),
+      "interpreter_plugins" -> interpreterPlugins
+    ).flatMap(removeEmptyOptions).asInstanceOf[Map[String, AnyRef]].asJava)
+
+    commandLineConfig.withFallback(profileConfig).withFallback(ConfigFactory.load)
+  }
+
+  private val removeEmptyOptions: ((String, Option[Any])) => Iterable[(String, Any)] = {
+    pair => if (pair._2.isDefined) Some((pair._1, pair._2.get)) else None
+  }
+
+  /**
+   *
+   * @return
+   */
+  private def interpreterArgs: Option[java.util.List[String]] = {
+    args.dropWhile(_ != "--").drop(1).toList match {
+      case Nil => None
+      case list: List[String] => Some(list.asJava)
+    }
+  }
+
+  private def interpreterPlugins: Option[java.util.List[String]] = {
+    //val defaults = getAll(_default_interpreter_plugin).getOrElse(List())
+    //val defaults = List[String](
+    //  "PySpark:com.ibm.spark.kernel.interpreter.pyspark.PySparkInterpreter",
+    //  "SparkR:com.ibm.spark.kernel.interpreter.sparkr.SparkRInterpreter",
+    //  "SQL:com.ibm.spark.kernel.interpreter.sql.SqlInterpreter"
+    //)
+
+    val userDefined = getAll(_interpreter_plugin) match {
+      case Some(l) => l
+      case _ => List[String]()
+    }
+
+    //val p = defaults ++ userDefined
+    Some(userDefined.asJava)
+  }
+
+  /**
+   * Prints the help message to the output stream provided.
+   * @param out The output stream to direct the help message
+   */
+  def printHelpOn(out: OutputStream) =
+    parser.printHelpOn(out)
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala b/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
new file mode 100644
index 0000000..1e7927c
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.boot
+
+import akka.actor.{ActorRef, ActorSystem}
+import com.ibm.spark.boot.layer._
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.kernel.api.Kernel
+import com.ibm.spark.kernel.protocol.v5.KernelStatusType._
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.security.KernelSecurityManager
+import com.ibm.spark.utils.LogLike
+import com.typesafe.config.Config
+import org.apache.spark.SparkContext
+import org.zeromq.ZMQ
+
+import scala.util.Try
+
+class KernelBootstrap(config: Config) extends LogLike {
+  this: BareInitialization with ComponentInitialization
+    with HandlerInitialization with HookInitialization =>
+
+  private val DefaultAppName                    = SparkKernelInfo.banner
+  private val DefaultActorSystemName            = "spark-kernel-actor-system"
+
+  private var actorSystem: ActorSystem          = _
+  private var actorLoader: ActorLoader          = _
+  private var kernelMessageRelayActor: ActorRef = _
+  private var statusDispatch: ActorRef          = _
+  private var kernel: Kernel                    = _
+
+  private var sparkContext: SparkContext        = _
+  private var interpreters: Seq[Interpreter]    = Nil
+
+  /**
+   * Initializes all kernel systems.
+   */
+  def initialize() = {
+    // TODO: Investigate potential to initialize System out/err/in to capture
+    //       Console DynamicVariable initialization (since takes System fields)
+    //       and redirect it to a workable location (like an actor) with the
+    //       thread's current information attached
+    //
+    // E.G. System.setOut(customPrintStream) ... all new threads will have
+    //      customPrintStream as their initial Console.out value
+    //
+
+    displayVersionInfo()
+
+    // Do this first to support shutting down quickly before entire system
+    // is ready
+    initializeShutdownHook()
+
+    // Initialize the bare minimum to report a starting message
+    val (actorSystem, actorLoader, kernelMessageRelayActor, statusDispatch) =
+      initializeBare(
+        config = config,
+        actorSystemName = DefaultActorSystemName
+      )
+
+    this.actorSystem = actorSystem
+    this.actorLoader = actorLoader
+    this.kernelMessageRelayActor = kernelMessageRelayActor
+    this.statusDispatch = statusDispatch
+
+    // Indicate that the kernel is now starting
+    publishStatus(KernelStatusType.Starting)
+
+    // Initialize components needed elsewhere
+    val (commStorage, commRegistrar, commManager, interpreter,
+      kernel, dependencyDownloader,
+      magicLoader, responseMap) =
+      initializeComponents(
+        config      = config,
+        appName     = DefaultAppName,
+        actorLoader = actorLoader
+      )
+    //this.sparkContext = sparkContext
+    this.interpreters ++= Seq(interpreter)
+
+    this.kernel = kernel
+
+    // Initialize our handlers that take care of processing messages
+    initializeHandlers(
+      actorSystem   = actorSystem,
+      actorLoader   = actorLoader,
+      kernel        = kernel,
+      interpreter   = interpreter,
+      commRegistrar = commRegistrar,
+      commStorage   = commStorage,
+      magicLoader   = magicLoader,
+      responseMap   = responseMap
+    )
+
+    // Initialize our non-shutdown hooks that handle various JVM events
+    initializeHooks(
+      interpreter = interpreter
+    )
+
+    logger.debug("Initializing security manager")
+    System.setSecurityManager(new KernelSecurityManager)
+
+    logger.info("Marking relay as ready for receiving messages")
+    kernelMessageRelayActor ! true
+
+    this
+  }
+
+  /**
+   * Shuts down all kernel systems.
+   */
+  def shutdown() = {
+    logger.info("Shutting down Spark Context")
+    Try(kernel.sparkContext.stop()).failed.foreach(
+      logger.error("Failed to shutdown Spark Context", _: Throwable)
+    )
+
+    logger.info("Shutting down interpreters")
+    Try(interpreters.foreach(_.stop())).failed.foreach(
+      logger.error("Failed to shutdown interpreters", _: Throwable)
+    )
+
+    logger.info("Shutting down actor system")
+    Try(actorSystem.shutdown()).failed.foreach(
+      logger.error("Failed to shutdown actor system", _: Throwable)
+    )
+
+    this
+  }
+
+  /**
+   * Waits for the main actor system to terminate.
+   */
+  def waitForTermination() = {
+    logger.debug("Waiting for actor system to terminate")
+    actorSystem.awaitTermination()
+
+    this
+  }
+
+  private def publishStatus(
+    status: KernelStatusType,
+    parentHeader: Option[ParentHeader] = None
+  ): Unit = {
+    parentHeader match {
+      case Some(header) => statusDispatch ! ((status, header))
+      case None         => statusDispatch ! status
+    }
+  }
+
+  @inline private def displayVersionInfo() = {
+    logger.info("Kernel version: " + SparkKernelInfo.implementationVersion)
+    logger.info("Scala version: " + SparkKernelInfo.languageVersion)
+    logger.info("ZeroMQ (JeroMQ) version: " + ZMQ.getVersionString)
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
new file mode 100644
index 0000000..d2d6ab9
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.boot.layer
+
+import akka.actor.{ActorRef, Props, ActorSystem}
+import com.ibm.spark.kernel.protocol.v5.dispatch.StatusDispatch
+import com.ibm.spark.kernel.protocol.v5.handler.{GenericSocketMessageHandler, ShutdownHandler}
+import com.ibm.spark.kernel.protocol.v5.kernel.{SimpleActorLoader, ActorLoader}
+import com.ibm.spark.communication.security.{SecurityActorType, SignatureManagerActor}
+import com.ibm.spark.kernel.protocol.v5.kernel.socket._
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen}
+import com.ibm.spark.kernel.protocol.v5.relay.KernelMessageRelay
+import com.ibm.spark.utils.LogLike
+import com.typesafe.config.Config
+import play.api.libs.json.Json
+
+/**
+ * Represents the raw initialization needed to send a "starting" message.
+ */
+trait BareInitialization {
+  /**
+   * Initializes and registers all objects needed to get the kernel to send a
+   * "starting" message.
+   *
+   * @param config The config used for initialization
+   * @param actorSystemName The name to use for the actor system
+   */
+  def initializeBare(config: Config, actorSystemName: String):
+    (ActorSystem, ActorLoader, ActorRef, ActorRef)
+}
+
+/**
+ * Represents the standard implementation of BareInitialization.
+ */
+trait StandardBareInitialization extends BareInitialization { this: LogLike =>
+  /**
+   * Initializes and registers all objects needed to get the kernel to send a
+   * "starting" message.
+   *
+   * @param config The config used for initialization
+   * @param actorSystemName The name to use for the actor system
+   */
+  def initializeBare(config: Config, actorSystemName: String) = {
+    val actorSystem = createActorSystem(actorSystemName)
+    val actorLoader = createActorLoader(actorSystem)
+    val (kernelMessageRelayActor, _, statusDispatch, _, _) =
+      initializeCoreActors(config, actorSystem, actorLoader)
+    createSockets(config, actorSystem, actorLoader)
+
+    (actorSystem, actorLoader, kernelMessageRelayActor, statusDispatch)
+  }
+
+  protected def createActorSystem(actorSystemName: String): ActorSystem = {
+    logger.info("Initializing internal actor system")
+    ActorSystem(actorSystemName)
+  }
+
+  protected def createActorLoader(actorSystem: ActorSystem): ActorLoader = {
+    logger.debug("Creating Simple Actor Loader")
+    SimpleActorLoader(actorSystem)
+  }
+
+  /**
+   * Does minimal setup in order to send the "starting" status message over
+   * the IOPub socket
+   */
+  protected def initializeCoreActors(
+    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader
+  ) = {
+    logger.debug("Creating kernel message relay actor")
+    val kernelMessageRelayActor = actorSystem.actorOf(
+      Props(
+        classOf[KernelMessageRelay], actorLoader, true,
+        Map(
+          CommOpen.toTypeString -> MessageType.Incoming.CommOpen.toString,
+          CommMsg.toTypeString -> MessageType.Incoming.CommMsg.toString,
+          CommClose.toTypeString -> MessageType.Incoming.CommClose.toString
+        ),
+        Map(
+          CommOpen.toTypeString -> MessageType.Outgoing.CommOpen.toString,
+          CommMsg.toTypeString -> MessageType.Outgoing.CommMsg.toString,
+          CommClose.toTypeString -> MessageType.Outgoing.CommClose.toString
+        )
+      ),
+      name = SystemActorType.KernelMessageRelay.toString
+    )
+
+    logger.debug("Creating signature manager actor")
+    val sigKey = config.getString("key")
+    val sigScheme = config.getString("signature_scheme")
+    logger.debug("Key = " + sigKey)
+    logger.debug("Scheme = " + sigScheme)
+    val signatureManagerActor = actorSystem.actorOf(
+      Props(
+        classOf[SignatureManagerActor], sigKey, sigScheme.replace("-", "")
+      ),
+      name = SecurityActorType.SignatureManager.toString
+    )
+
+    logger.debug("Creating status dispatch actor")
+    val statusDispatch = actorSystem.actorOf(
+      Props(classOf[StatusDispatch], actorLoader),
+      name = SystemActorType.StatusDispatch.toString
+    )
+
+    logger.debug("Creating shutdown handler and sender actors")
+    val shutdownHandler = actorSystem.actorOf(
+      Props(classOf[ShutdownHandler], actorLoader),
+      name = MessageType.Incoming.ShutdownRequest.toString
+    )
+    val shutdownSender = actorSystem.actorOf(
+      Props(classOf[GenericSocketMessageHandler], actorLoader, SocketType.Control),
+      name = MessageType.Outgoing.ShutdownReply.toString
+    )
+
+    (kernelMessageRelayActor, signatureManagerActor, statusDispatch, shutdownHandler, shutdownSender)
+  }
+
+  protected def createSockets(
+    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader
+  ): Unit = {
+    logger.debug("Creating sockets")
+
+    val socketConfig: SocketConfig = SocketConfig.fromConfig(config)
+    logger.info("Connection Profile: "
+      + Json.prettyPrint(Json.toJson(socketConfig)))
+
+    logger.debug("Constructing ServerSocketFactory")
+    val socketFactory = new SocketFactory(socketConfig)
+
+    logger.debug("Initializing Heartbeat on port " +
+      socketConfig.hb_port)
+    val heartbeatActor = actorSystem.actorOf(
+      Props(classOf[Heartbeat], socketFactory),
+      name = SocketType.Heartbeat.toString
+    )
+
+    logger.debug("Initializing Stdin on port " +
+      socketConfig.stdin_port)
+    val stdinActor = actorSystem.actorOf(
+      Props(classOf[Stdin], socketFactory, actorLoader),
+      name = SocketType.StdIn.toString
+    )
+
+    logger.debug("Initializing Shell on port " +
+      socketConfig.shell_port)
+    val shellActor = actorSystem.actorOf(
+      Props(classOf[Shell], socketFactory, actorLoader),
+      name = SocketType.Shell.toString
+    )
+
+    logger.debug("Initializing Control on port " +
+      socketConfig.control_port)
+    val controlActor = actorSystem.actorOf(
+      Props(classOf[Control], socketFactory, actorLoader),
+      name = SocketType.Control.toString
+    )
+
+    logger.debug("Initializing IOPub on port " +
+      socketConfig.iopub_port)
+    val ioPubActor = actorSystem.actorOf(
+      Props(classOf[IOPub], socketFactory),
+      name = SocketType.IOPub.toString
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
new file mode 100644
index 0000000..939b896
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.boot.layer
+
+import java.util
+import java.util.concurrent.ConcurrentHashMap
+
+import akka.actor.ActorRef
+import com.ibm.spark.comm.{CommManager, KernelCommManager, CommRegistrar, CommStorage}
+import com.ibm.spark.dependencies.{DependencyDownloader, IvyDependencyDownloader}
+import com.ibm.spark.global
+import com.ibm.spark.interpreter._
+import com.ibm.spark.kernel.api.{KernelLike, Kernel}
+import com.ibm.spark.kernel.protocol.v5.KMBuilder
+import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
+import com.ibm.spark.magic.MagicLoader
+import com.ibm.spark.magic.builtin.BuiltinLoader
+import com.ibm.spark.magic.dependencies.DependencyMap
+import com.ibm.spark.utils.{MultiClassLoader, TaskManager, KeyValuePairUtils, LogLike}
+import com.typesafe.config.Config
+import org.apache.spark.sql.SQLContext
+import org.apache.spark.{SparkContext, SparkConf}
+
+import scala.collection.JavaConverters._
+
+import scala.util.Try
+
+/**
+ * Represents the component initialization. All component-related pieces of the
+ * kernel (non-actors) should be created here. Limited items should be exposed.
+ */
+trait ComponentInitialization {
+  /**
+   * Initializes and registers all components (not needed by bare init).
+   *
+   * @param config The config used for initialization
+   * @param appName The name of the "application" for Spark
+   * @param actorLoader The actor loader to use for some initialization
+   */
+  def initializeComponents(
+    config: Config, appName: String, actorLoader: ActorLoader
+  ): (CommStorage, CommRegistrar, CommManager, Interpreter,
+    Kernel, DependencyDownloader, MagicLoader,
+    collection.mutable.Map[String, ActorRef])
+}
+
+/**
+ * Represents the standard implementation of ComponentInitialization.
+ */
+trait StandardComponentInitialization extends ComponentInitialization {
+  this: LogLike =>
+
+  /**
+   * Initializes and registers all components (not needed by bare init).
+   *
+   * @param config The config used for initialization
+   * @param appName The name of the "application" for Spark
+   * @param actorLoader The actor loader to use for some initialization
+   */
+  def initializeComponents(
+    config: Config, appName: String, actorLoader: ActorLoader
+  ) = {
+    val (commStorage, commRegistrar, commManager) =
+      initializeCommObjects(actorLoader)
+
+    val manager =  InterpreterManager(config)
+    val scalaInterpreter = manager.interpreters.get("Scala").orNull
+
+    val dependencyDownloader = initializeDependencyDownloader(config)
+    val magicLoader = initializeMagicLoader(
+      config, scalaInterpreter, dependencyDownloader)
+
+    val kernel = initializeKernel(
+      config, actorLoader, manager, commManager, magicLoader
+    )
+
+    val responseMap = initializeResponseMap()
+
+    initializeSparkContext(config, kernel, appName)
+
+    (commStorage, commRegistrar, commManager,
+      manager.defaultInterpreter.orNull, kernel,
+      dependencyDownloader, magicLoader, responseMap)
+
+  }
+
+
+  def initializeSparkContext(config:Config, kernel:Kernel, appName:String) = {
+    if(!config.getBoolean("nosparkcontext")) {
+      kernel.createSparkContext(config.getString("spark.master"), appName)
+    }
+  }
+
+  private def initializeCommObjects(actorLoader: ActorLoader) = {
+    logger.debug("Constructing Comm storage")
+    val commStorage = new CommStorage()
+
+    logger.debug("Constructing Comm registrar")
+    val commRegistrar = new CommRegistrar(commStorage)
+
+    logger.debug("Constructing Comm manager")
+    val commManager = new KernelCommManager(
+      actorLoader, KMBuilder(), commRegistrar)
+
+    (commStorage, commRegistrar, commManager)
+  }
+
+  private def initializeDependencyDownloader(config: Config) = {
+    val dependencyDownloader = new IvyDependencyDownloader(
+      "http://repo1.maven.org/maven2/", config.getString("ivy_local")
+    )
+
+    dependencyDownloader
+  }
+
+  protected def initializeResponseMap(): collection.mutable.Map[String, ActorRef] =
+    new ConcurrentHashMap[String, ActorRef]().asScala
+
+  private def initializeKernel(
+    config: Config,
+    actorLoader: ActorLoader,
+    interpreterManager: InterpreterManager,
+    commManager: CommManager,
+    magicLoader: MagicLoader
+  ) = {
+    val kernel = new Kernel(
+      config,
+      actorLoader,
+      interpreterManager,
+      commManager,
+      magicLoader
+    )
+    /*
+    interpreter.doQuietly {
+      interpreter.bind(
+        "kernel", "com.ibm.spark.kernel.api.Kernel",
+        kernel, List( """@transient implicit""")
+      )
+    }
+    */
+    magicLoader.dependencyMap.setKernel(kernel)
+
+    kernel
+  }
+
+  private def initializeMagicLoader(
+    config: Config, interpreter: Interpreter,
+    dependencyDownloader: DependencyDownloader
+  ) = {
+    logger.debug("Constructing magic loader")
+
+    logger.debug("Building dependency map")
+    val dependencyMap = new DependencyMap()
+      .setInterpreter(interpreter)
+      .setKernelInterpreter(interpreter) // This is deprecated
+      .setDependencyDownloader(dependencyDownloader)
+      .setConfig(config)
+
+    logger.debug("Creating BuiltinLoader")
+    val builtinLoader = new BuiltinLoader()
+
+    val magicUrlArray = config.getStringList("magic_urls").asScala
+      .map(s => new java.net.URL(s)).toArray
+
+    if (magicUrlArray.isEmpty)
+      logger.warn("No external magics provided to MagicLoader!")
+    else
+      logger.info("Using magics from the following locations: " +
+        magicUrlArray.map(_.getPath).mkString(","))
+
+    val multiClassLoader = new MultiClassLoader(
+      builtinLoader,
+      interpreter.classLoader
+    )
+
+    logger.debug("Creating MagicLoader")
+    val magicLoader = new MagicLoader(
+      dependencyMap = dependencyMap,
+      urls = magicUrlArray,
+      parentLoader = multiClassLoader
+    )
+    magicLoader.dependencyMap.setMagicLoader(magicLoader)
+    magicLoader
+  }
+}



[26/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
new file mode 100644
index 0000000..994360f
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication
+
+import java.util.UUID
+import java.util.concurrent.ConcurrentHashMap
+import com.ibm.spark.communication.socket._
+import org.zeromq.ZMQ
+
+import scala.collection.JavaConverters._
+
+/**
+ * Represents the factory for sockets that also manages ZMQ contexts and
+ * facilitates closing of sockets created by the factory.
+ */
+class SocketManager {
+  /**
+   * Creates a new ZMQ context with a single IO thread.
+   *
+   * @return The new ZMQ context
+   */
+  protected def newZmqContext(): ZMQ.Context = ZMQ.context(1)
+
+  private val socketToContextMap =
+    new ConcurrentHashMap[SocketLike, ZMQ.Context]().asScala
+
+  /**
+   * Provides and registers a new ZMQ context, used for creating a new socket.
+   * @param mkSocket a function that creates a socket using a given context
+   * @return the new socket
+   * @see newZmqContext
+   */
+  private def withNewContext[A <: SocketLike](mkSocket: ZMQ.Context => A): A = {
+    val ctx = newZmqContext()
+    val socket = mkSocket(ctx)
+    socketToContextMap.put(socket, ctx)
+    socket
+  }
+
+  /**
+   * Closes the socket provided and also closes the context if no more sockets
+   * are using the context.
+   *
+   * @param socket The socket to close
+   */
+  def closeSocket(socket: SocketLike) = {
+    socket.close()
+
+    socketToContextMap.remove(socket).foreach(context => {
+      if (!socketToContextMap.values.exists(_ == context)) context.close()
+    })
+  }
+
+  /**
+   * Creates a new request socket.
+   *
+   * @param address The address to associate with the socket
+   * @param inboundMessageCallback The callback to use for incoming messages
+   *
+   * @return The new socket instance
+   */
+  def newReqSocket(
+    address: String,
+    inboundMessageCallback: (Seq[String]) => Unit
+  ): SocketLike = withNewContext{ ctx =>
+     new JeroMQSocket(new ReqSocketRunnable(
+      ctx,
+      Some(inboundMessageCallback),
+      Connect(address),
+      Linger(0)
+    ))
+  }
+
+  /**
+   * Creates a new reply socket.
+   *
+   * @param address The address to associate with the socket
+   * @param inboundMessageCallback The callback to use for incoming messages
+   *
+   * @return The new socket instance
+   */
+  def newRepSocket(
+    address: String,
+    inboundMessageCallback: (Seq[String]) => Unit
+  ): SocketLike = withNewContext{ ctx =>
+    new JeroMQSocket(new ZeroMQSocketRunnable(
+      ctx,
+      RepSocket,
+      Some(inboundMessageCallback),
+      Bind(address),
+      Linger(0)
+    ))
+  }
+
+  /**
+   * Creates a new publish socket.
+   *
+   * @param address The address to associate with the socket
+   *
+   * @return The new socket instance
+   */
+  def newPubSocket(
+    address: String
+  ): SocketLike = withNewContext{ ctx =>
+    new JeroMQSocket(new PubSocketRunnable(
+      ctx,
+      Bind(address),
+      Linger(0)
+    ))
+  }
+
+  /**
+   * Creates a new subscribe socket.
+   *
+   * @param address The address to associate with the socket
+   * @param inboundMessageCallback The callback to use for incoming messages
+   *
+   * @return The new socket instance
+   */
+  def newSubSocket(
+    address: String,
+    inboundMessageCallback: (Seq[String]) => Unit
+  ): SocketLike = withNewContext { ctx =>
+    new JeroMQSocket(new ZeroMQSocketRunnable(
+      ctx,
+      SubSocket,
+      Some(inboundMessageCallback),
+      Connect(address),
+      Linger(0),
+      Subscribe.all
+    ))
+  }
+
+  /**
+   * Creates a new router socket.
+   *
+   * @param address The address to associate with the socket
+   * @param inboundMessageCallback The callback to use for incoming messages
+   *
+   * @return The new socket instance
+   */
+  def newRouterSocket(
+    address: String,
+    inboundMessageCallback: (Seq[String]) => Unit
+  ): SocketLike = withNewContext { ctx =>
+    new JeroMQSocket(new ZeroMQSocketRunnable(
+      ctx,
+      RouterSocket,
+      Some(inboundMessageCallback),
+      Bind(address),
+      Linger(0)
+    ))
+  }
+
+  /**
+   * Creates a new dealer socket.
+   *
+   * @param address The address to associate with the socket
+   * @param inboundMessageCallback The callback to use for incoming messages
+   *
+   * @return The new socket instance
+   */
+  def newDealerSocket(
+    address: String,
+    inboundMessageCallback: (Seq[String]) => Unit,
+    identity: String = UUID.randomUUID().toString
+  ): SocketLike = withNewContext{ ctx =>
+    new JeroMQSocket(new ZeroMQSocketRunnable(
+      ctx,
+      DealerSocket,
+      Some(inboundMessageCallback),
+      Connect(address),
+      Linger(0),
+      Identity(identity.getBytes(ZMQ.CHARSET))
+    ))
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala b/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
new file mode 100644
index 0000000..ffa7705
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication
+
+import akka.util.ByteString
+
+/**
+ * Represents a ZeroMQ message containing a collection of Akka ByteString
+ * instances.
+ *
+ * @note This is left in for backwards compatibility!
+ *
+ * @param frames The collection of Akka ByteString instances
+ */
+case class ZMQMessage(frames: ByteString*) {
+  def frame(i: Int) = frames(i)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
new file mode 100644
index 0000000..0f0497d
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.actors
+
+import akka.actor.{Actor, ActorRef}
+import akka.util.ByteString
+import com.ibm.spark.communication.{ZMQMessage, SocketManager}
+import com.ibm.spark.utils.LogLike
+import org.zeromq.ZMQ
+
+/**
+ * Represents an actor containing a dealer socket.
+ *
+ * @param connection The address to connect to
+ * @param listener The actor to send incoming messages back to
+ */
+class DealerSocketActor(connection: String, listener: ActorRef)
+  extends Actor with LogLike
+{
+  logger.debug(s"Initializing dealer socket actor for $connection")
+  private val manager: SocketManager = new SocketManager
+  private val socket = manager.newDealerSocket(connection, (message: Seq[String]) => {
+    listener ! ZMQMessage(message.map(ByteString.apply): _*)
+  })
+
+  override def postStop(): Unit = {
+    manager.closeSocket(socket)
+  }
+
+  override def receive: Actor.Receive = {
+    case zmqMessage: ZMQMessage =>
+      val frames = zmqMessage.frames.map(byteString =>
+        new String(byteString.toArray, ZMQ.CHARSET))
+      socket.send(frames: _*)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
new file mode 100644
index 0000000..f74764e
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.actors
+
+import akka.actor.Actor
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.communication.{SocketManager, ZMQMessage}
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.utils.LogLike
+import org.zeromq.ZMQ
+
+/**
+ * Represents an actor containing a publish socket.
+ *
+ * Note: OrderedSupport is used to ensure correct processing order.
+ *       A similar pattern may be useful for other socket actors if
+ *       issues arise in the future.
+ *
+ * @param connection The address to bind to
+ */
+class PubSocketActor(connection: String)
+  extends Actor with LogLike with OrderedSupport
+{
+  logger.debug(s"Initializing publish socket actor for $connection")
+  private val manager: SocketManager = new SocketManager
+  private val socket = manager.newPubSocket(connection)
+
+  override def postStop(): Unit = {
+    manager.closeSocket(socket)
+  }
+
+  override def receive: Actor.Receive = {
+    case zmqMessage: ZMQMessage => withProcessing {
+      val frames = zmqMessage.frames.map(byteString =>
+        new String(byteString.toArray, ZMQ.CHARSET))
+
+      socket.send(frames: _*)
+    }
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[ZMQMessage])
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
new file mode 100644
index 0000000..b8643f5
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.actors
+
+import akka.actor.{Actor, ActorRef}
+import akka.util.ByteString
+import com.ibm.spark.communication.{SocketManager, ZMQMessage}
+import com.ibm.spark.utils.LogLike
+import org.zeromq.ZMQ
+
+/**
+ * Represents an actor containing a reply socket.
+ *
+ * @param connection The address to bind to
+ * @param listener The actor to send incoming messages back to
+ */
+class RepSocketActor(connection: String, listener: ActorRef)
+  extends Actor with LogLike
+{
+  logger.debug(s"Initializing reply socket actor for $connection")
+  private val manager: SocketManager = new SocketManager
+  private val socket = manager.newRepSocket(connection, (message: Seq[String]) => {
+    listener ! ZMQMessage(message.map(ByteString.apply): _*)
+  })
+
+  override def postStop(): Unit = {
+    manager.closeSocket(socket)
+  }
+
+  override def receive: Actor.Receive = {
+    case zmqMessage: ZMQMessage =>
+      val frames = zmqMessage.frames.map(byteString =>
+        new String(byteString.toArray, ZMQ.CHARSET))
+      socket.send(frames: _*)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
new file mode 100644
index 0000000..e38f2a0
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.actors
+
+import akka.actor.{Actor, ActorRef}
+import akka.util.ByteString
+import com.ibm.spark.communication.{ZMQMessage, SocketManager}
+import com.ibm.spark.utils.LogLike
+import org.zeromq.ZMQ
+
+/**
+ * Represents an actor containing a request socket.
+ *
+ * @param connection The address to connect to
+ * @param listener The actor to send incoming messages back to
+ */
+class ReqSocketActor(connection: String, listener: ActorRef)
+  extends Actor with LogLike
+{
+  logger.debug(s"Initializing request socket actor for $connection")
+  private val manager: SocketManager = new SocketManager
+  private val socket = manager.newReqSocket(connection, (message: Seq[String]) => {
+    listener ! ZMQMessage(message.map(ByteString.apply): _*)
+  })
+
+  override def postStop(): Unit = {
+    manager.closeSocket(socket)
+  }
+
+  override def receive: Actor.Receive = {
+    case zmqMessage: ZMQMessage =>
+      val frames = zmqMessage.frames.map(byteString =>
+        new String(byteString.toArray, ZMQ.CHARSET))
+      socket.send(frames: _*)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
new file mode 100644
index 0000000..6aa3bc5
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.actors
+
+import akka.actor.{Actor, ActorRef}
+import akka.util.ByteString
+import com.ibm.spark.communication.{SocketManager, ZMQMessage}
+import com.ibm.spark.utils.LogLike
+import org.zeromq.ZMQ
+
+/**
+ * Represents an actor containing a router socket.
+ *
+ * @param connection The address to bind to
+ * @param listener The actor to send incoming messages back to
+ */
+class RouterSocketActor(connection: String, listener: ActorRef)
+  extends Actor with LogLike
+{
+  logger.debug(s"Initializing router socket actor for $connection")
+  private val manager: SocketManager = new SocketManager
+  private val socket = manager.newRouterSocket(connection, (message: Seq[String]) => {
+    listener ! ZMQMessage(message.map(ByteString.apply): _*)
+  })
+
+  override def postStop(): Unit = {
+    manager.closeSocket(socket)
+  }
+
+  override def receive: Actor.Receive = {
+    case zmqMessage: ZMQMessage =>
+      val frames = zmqMessage.frames.map(byteString =>
+        new String(byteString.toArray, ZMQ.CHARSET))
+      socket.send(frames: _*)
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
new file mode 100644
index 0000000..8fef496
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.actors
+
+import akka.actor.{Actor, ActorRef}
+import akka.util.ByteString
+import com.ibm.spark.communication.{ZMQMessage, SocketManager}
+import com.ibm.spark.utils.LogLike
+
+/**
+ * Represents an actor containing a subscribe socket.
+ *
+ * @param connection The address to connect to
+ * @param listener The actor to send incoming messages back to
+ */
+class SubSocketActor(connection: String, listener: ActorRef)
+  extends Actor with LogLike
+{
+  logger.debug(s"Initializing subscribe socket actor for $connection")
+  private val manager: SocketManager = new SocketManager
+  private val socket = manager.newSubSocket(connection, (message: Seq[String]) => {
+    listener ! ZMQMessage(message.map(ByteString.apply): _*)
+  })
+
+  override def postStop(): Unit = {
+    manager.closeSocket(socket)
+  }
+
+  override def receive: Actor.Receive = {
+    case _ =>
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala b/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
new file mode 100644
index 0000000..9f44177
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.security
+
+import javax.crypto.Mac
+import javax.crypto.spec.SecretKeySpec
+
+import com.ibm.spark.communication.security.HmacAlgorithm.HmacAlgorithm
+
+object HmacAlgorithm extends Enumeration {
+  type HmacAlgorithm = Value
+
+  def apply(key: String) = Value(key)
+
+  val MD5     = Value("HmacMD5")
+  val SHA1    = Value("HmacSHA1")
+  val SHA256  = Value("HmacSHA256")
+}
+
+object Hmac {
+  
+  def apply(key: String, algorithm: HmacAlgorithm = HmacAlgorithm.SHA256) =
+    new Hmac(key, algorithm)
+  
+  def newMD5(key: String): Hmac     = this(key, HmacAlgorithm.MD5)
+  def newSHA1(key: String): Hmac    = this(key, HmacAlgorithm.SHA1)
+  def newSHA256(key: String): Hmac  = this(key, HmacAlgorithm.SHA256)
+}
+
+class Hmac(
+  val key: String,
+  val algorithm: HmacAlgorithm = HmacAlgorithm.SHA256
+) {
+
+  private var mac: Mac = _
+  private var secretKeySpec: SecretKeySpec = _
+
+  if (key.nonEmpty) {
+    mac = Mac.getInstance(algorithm.toString)
+    secretKeySpec = new SecretKeySpec(key.getBytes, algorithm.toString)
+    mac.init(secretKeySpec)
+  }
+
+  def apply(items: String*): String = digest(items)
+
+  def digest(items: Seq[String]): String = if (key.nonEmpty) {
+    mac synchronized {
+      items.map(_.getBytes("UTF-8")).foreach(mac.update)
+      mac.doFinal().map("%02x" format _).mkString
+    }
+  } else ""
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
new file mode 100644
index 0000000..c3fabd7
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.security
+
+import akka.actor.Actor
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.utils.LogLike
+
+/**
+ * Verifies whether or not a kernel message has a valid signature.
+ * @param hmac The HMAC to use for signature validation
+ */
+class SignatureCheckerActor(
+  private val hmac: Hmac
+) extends Actor with LogLike with OrderedSupport {
+  override def receive: Receive = {
+    case (signature: String, blob: Seq[_]) => withProcessing {
+      val stringBlob: Seq[String] = blob.map(_.toString)
+      val hmacString = hmac(stringBlob: _*)
+      val isValidSignature = hmacString == signature
+      logger.trace(s"Signature ${signature} validity checked against " +
+        s"hmac ${hmacString} with outcome ${isValidSignature}")
+      sender ! isValidSignature
+    }
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[(String, Seq[_])])
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
new file mode 100644
index 0000000..f381644
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.security
+
+import akka.actor.{Props, ActorRef, Actor}
+import akka.util.Timeout
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.utils.LogLike
+
+import scala.concurrent.duration._
+import akka.pattern.ask
+import akka.pattern.pipe
+
+class SignatureManagerActor(
+  key: String, scheme: String
+) extends Actor with LogLike with OrderedSupport {
+  private val hmac = Hmac(key, HmacAlgorithm(scheme))
+
+  def this(key: String) = this(key, HmacAlgorithm.SHA256.toString)
+
+  // NOTE: Required to provide the execution context for futures with akka
+  import context._
+
+  // NOTE: Required for ask (?) to function... maybe can define elsewhere?
+  implicit val timeout = Timeout(5.seconds)
+
+  //
+  // List of child actors that the signature manager contains
+  //
+  private var signatureChecker: ActorRef = _
+  private var signatureProducer: ActorRef = _
+
+  /**
+   * Initializes all child actors performing tasks for the interpreter.
+   */
+  override def preStart() = {
+    signatureChecker = context.actorOf(
+      Props(classOf[SignatureCheckerActor], hmac),
+      name = SignatureManagerChildActorType.SignatureChecker.toString
+    )
+    signatureProducer = context.actorOf(
+      Props(classOf[SignatureProducerActor], hmac),
+      name = SignatureManagerChildActorType.SignatureProducer.toString
+    )
+  }
+
+  override def receive: Receive = {
+    // Check blob strings for matching digest
+    case (signature: String, blob: Seq[_]) =>
+      startProcessing()
+      val destActor = sender()
+      val sigFuture = signatureChecker ? ((signature, blob))
+
+      sigFuture foreach { case isValid =>
+          destActor ! isValid
+          finishedProcessing()
+      }
+
+    case message: KernelMessage =>
+      startProcessing()
+      val destActor = sender()
+
+      // TODO: Proper error handling for possible exception from mapTo
+      val sigFuture = (signatureProducer ? message).mapTo[String].map(
+        result => message.copy(signature = result)
+      )
+
+      sigFuture foreach { case kernelMessage =>
+        destActor ! kernelMessage
+        finishedProcessing()
+      }
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  override def orderedTypes(): Seq[Class[_]] = Seq(
+    classOf[(String, Seq[_])],
+    classOf[KernelMessage]
+  )
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
new file mode 100644
index 0000000..36b5688
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.security
+
+import akka.actor.Actor
+import com.ibm.spark.communication.utils.OrderedSupport
+import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import com.ibm.spark.utils.LogLike
+import play.api.libs.json.Json
+
+/**
+ * Constructs a signature from any kernel message received.
+ * @param hmac The HMAC to use for signature construction
+ */
+class SignatureProducerActor(
+  private val hmac: Hmac
+) extends Actor with LogLike with OrderedSupport {
+  override def receive: Receive = {
+    case message: KernelMessage => withProcessing {
+      val signature = hmac(
+        Json.stringify(Json.toJson(message.header)),
+        Json.stringify(Json.toJson(message.parentHeader)),
+        Json.stringify(Json.toJson(message.metadata)),
+        message.contentString
+      )
+      sender ! signature
+    }
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[KernelMessage])
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/security/package.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/package.scala b/communication/src/main/scala/org/apache/toree/communication/security/package.scala
new file mode 100644
index 0000000..5c5b1d5
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/security/package.scala
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication
+
+package object security {
+  object SecurityActorType extends Enumeration {
+    type SecurityActorType = Value
+
+    val SignatureManager    = Value("signature_manager")
+  }
+
+  object SignatureManagerChildActorType extends Enumeration {
+    type SignatureManagerChildActorType = Value
+
+    val SignatureChecker  = Value("signature_checker")
+    val SignatureProducer = Value("signature_producer")
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala b/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
new file mode 100644
index 0000000..c95eb69
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.zeromq.ZMsg
+
+/**
+ * Represents a socket implemented using JeroMQ.
+ *
+ * @param runnable The underlying ZeroMQ socket runnable to use for the thread
+ *                 managed by this socket
+ */
+class JeroMQSocket(private val runnable: ZeroMQSocketRunnable)
+  extends SocketLike {
+
+  private val socketThread = new Thread(runnable)
+  socketThread.start()
+
+  /**
+   * Sends a message using this socket.
+   *
+   * @param message The message to send
+   */
+  override def send(message: String*): Unit = {
+    assert(isAlive, "Socket is not alive to be able to send messages!")
+
+    runnable.offer(ZMsg.newStringMsg(message: _*))
+  }
+
+  /**
+   * Closes the socket by closing the runnable and waiting for the underlying
+   * thread to close.
+   */
+  override def close(): Unit = {
+    runnable.close()
+    socketThread.join()
+  }
+
+  /**
+   * Indicates whether or not this socket is alive.
+   *
+   * @return True if alive (thread running), otherwise false
+   */
+  override def isAlive: Boolean = socketThread.isAlive
+
+  /**
+   * Indicates whether or not this socket is ready to send/receive messages.
+   *
+   * @return True if ready (runnable processing messages), otherwise false
+   */
+  override def isReady: Boolean = runnable.isProcessing
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
new file mode 100644
index 0000000..43f3f3d
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.zeromq.ZMQ.{Socket, Context}
+
+/**
+ * Represents the runnable component of a socket specifically targeted towards
+ * publish sockets. No incoming messages are processed.
+ *
+ * @param context The ZMQ context to use with this runnable to create a socket
+ * @param socketOptions The options to use when creating the socket
+ */
+class PubSocketRunnable(
+  private val context: Context,
+  private val socketOptions: SocketOption*
+) extends ZeroMQSocketRunnable(
+  context,
+  PubSocket,
+  None,
+  socketOptions: _*
+) {
+  /** Does nothing. */
+  override protected def processNextInboundMessage(
+    socket: Socket,
+    flags: Int
+  ): Unit = {}
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
new file mode 100644
index 0000000..0aa527f
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.zeromq.ZMQ.{Socket, Context}
+
+/**
+ * Represents the runnable component of a socket that processes messages and
+ * sends messages placed on an outbound queue. Targeted towards the request
+ * socket, this runnable ensures that a message is sent out first and then a
+ * response is received before sending the next message.
+ *
+ * @param context The ZMQ context to use with this runnable to create a socket
+ * @param inboundMessageCallback The callback to invoke when receiving a message
+ *                               on the socket created
+ * @param socketOptions The options to use when creating the socket
+ */
+class ReqSocketRunnable(
+  private val context: Context,
+  private val inboundMessageCallback: Option[(Seq[String]) => Unit],
+  private val socketOptions: SocketOption*
+) extends ZeroMQSocketRunnable(
+  context,
+  ReqSocket,
+  inboundMessageCallback,
+  socketOptions: _*
+) {
+  /** Does nothing. */
+  override protected def processNextInboundMessage(
+    socket: Socket,
+    flags: Int
+  ): Unit = {}
+
+  /**
+   * Sends a message and then waits for an incoming response (if a message
+   * was sent from the outbound queue).
+   *
+   * @param socket The socket to use when sending the message
+   *
+   * @return True if a message was sent, otherwise false
+   */
+  override protected def processNextOutboundMessage(socket: Socket): Boolean = {
+    val shouldReceiveMessage = super.processNextOutboundMessage(socket)
+
+    if (shouldReceiveMessage) {
+      super.processNextInboundMessage(socket, 0)
+    }
+
+    shouldReceiveMessage
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
new file mode 100644
index 0000000..9bf752d
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+/**
+ * Represents a generic interface for socket communication.
+ */
+trait SocketLike {
+  /**
+   * Sends a message through the socket if alive.
+   *
+   * @throws AssertionError If the socket is not alive when attempting to send
+   *                        a message
+   *
+   * @param message The message to send
+   */
+  def send(message: String*): Unit
+
+  /**
+   * Closes the socket, marking it no longer able to process or send messages.
+   */
+  def close(): Unit
+
+  /**
+   * Returns whether or not the socket is alive (processing new messages and
+   * capable of sending out messages).
+   *
+   * @return True if alive, otherwise false
+   */
+  def isAlive: Boolean
+
+  /**
+   * Returns whether or not the socket is ready to send/receive messages.
+   *
+   * @return True if ready, otherwise false
+   */
+  def isReady: Boolean
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
new file mode 100644
index 0000000..7685239
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.zeromq.ZMQ
+
+/** Represents an option to provide to a socket. */
+sealed trait SocketOption
+
+/**
+ * Represents the linger option used to communicate the millisecond duration
+ * to continue processing messages after the socket has been told to close.
+ *
+ * @note Provide -1 as the duration to wait until all messages are processed
+ *
+ * @param milliseconds The duration in milliseconds
+ */
+case class Linger(milliseconds: Int) extends SocketOption
+
+/**
+ * Represents the subscribe option used to filter messages coming into a
+ * socket subscribing to a publisher. Uses the provided byte prefix to filter
+ * incoming messages.
+ *
+ * @param topic The array of bytes to use as a filter based on the
+ *              bytes at the beginning of incoming messages
+ */
+case class Subscribe(topic: Array[Byte]) extends SocketOption
+object Subscribe {
+  val all = Subscribe(ZMQ.SUBSCRIPTION_ALL)
+}
+
+/**
+ * Represents the identity option used to identify the socket.
+ *
+ * @param identity The identity to use with the socket
+ */
+case class Identity(identity: Array[Byte]) extends SocketOption
+
+/**
+ * Represents the bind option used to tell the socket what address to bind to.
+ *
+ * @param address The address for the socket to use
+ */
+case class Bind(address: String) extends SocketOption
+
+/**
+ * Represents the connect option used to tell the socket what address to
+ * connect to.
+ *
+ * @param address The address for the socket to use
+ */
+case class Connect(address: String) extends SocketOption

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
new file mode 100644
index 0000000..6c033cc
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import java.util.concurrent.ConcurrentLinkedQueue
+
+/**
+ * Represents the interface for a runnable used to send and receive messages
+ * for a socket.
+ *
+ * @param inboundMessageCallback The callback to use when receiving a message
+ *                               through this runnable
+ */
+abstract class SocketRunnable[T](
+   private val inboundMessageCallback: Option[(Seq[String]) => Unit]
+) extends Runnable {
+
+  /** The collection of messages to be sent out through the socket. */
+  val outboundMessages: ConcurrentLinkedQueue[T] =
+    new ConcurrentLinkedQueue[T]()
+
+  /**
+   * Attempts to add a new message to the outbound queue to be sent out.
+   *
+   * @param message The message to add to the queue
+   *
+   * @return True if successfully queued the message, otherwise false
+   */
+  def offer(message: T): Boolean = outboundMessages.offer(message)
+
+  /**
+   * Indicates whether or not the runnable is processing messages (both
+   * sending and receiving).
+   *
+   * @return True if processing, otherwise false
+   */
+  def isProcessing: Boolean
+
+  /**
+   * Closes the runnable such that it no longer processes messages and also
+   * closes the underlying socket associated with the runnable.
+   */
+  def close(): Unit
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
new file mode 100644
index 0000000..7062d85
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.zeromq.ZMQ
+
+/**
+ * Represents the type option used to indicate the type of socket to create.
+ *
+ * @param `type` The type as an integer
+ */
+sealed class SocketType(val `type`: Int)
+
+/** Represents a publish socket. */
+case object PubSocket extends SocketType(ZMQ.PUB)
+
+/** Represents a subscribe socket. */
+case object SubSocket extends SocketType(ZMQ.SUB)
+
+/** Represents a reply socket. */
+case object RepSocket extends SocketType(ZMQ.REP)
+
+/** Represents a request socket. */
+case object ReqSocket extends SocketType(ZMQ.REQ)
+
+/** Represents a router socket. */
+case object RouterSocket extends SocketType(ZMQ.ROUTER)
+
+/** Represents a dealer socket. */
+case object DealerSocket extends SocketType(ZMQ.DEALER)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
new file mode 100644
index 0000000..6fee716
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import com.ibm.spark.utils.LogLike
+import org.zeromq.{ZMsg, ZMQ}
+import org.zeromq.ZMQ.Context
+
+import scala.collection.JavaConverters._
+import scala.util.Try
+
+/**
+ * Represents the runnable component of a socket that processes messages and
+ * sends messages placed on an outbound queue.
+ *
+ * @param context The ZMQ context to use with this runnable to create a socket
+ * @param socketType The type of socket to create
+ * @param inboundMessageCallback The callback to invoke when receiving a message
+ *                               on the socket created
+ * @param socketOptions The options to use when creating the socket
+ */
+class ZeroMQSocketRunnable(
+  private val context: Context,
+  private val socketType: SocketType,
+  private val inboundMessageCallback: Option[(Seq[String]) => Unit],
+  private val socketOptions: SocketOption*
+) extends SocketRunnable[ZMsg](inboundMessageCallback)
+  with LogLike {
+  require(socketOptions.count {
+    case _: Bind    => true
+    case _: Connect => true
+    case _          => false
+  } == 1, "ZeroMQ socket needs exactly one bind or connect!")
+
+  @volatile private var notClosed: Boolean = true
+  @volatile private var _isProcessing: Boolean = false
+
+  /**
+   * Indicates the processing state of this runnable.
+   *
+   * @return True if processing messages, otherwise false
+   */
+  override def isProcessing: Boolean = _isProcessing
+
+  /**
+   * Processes the provided options, performing associated actions on the
+   * specified socket.
+   *
+   * @param socket The socket to apply actions on
+   */
+  protected def processOptions(socket: ZMQ.Socket): Unit = {
+    val socketOptionsString = socketOptions.map("\n- " + _.toString).mkString("")
+    logger.trace(
+      s"Processing options for socket $socketType: $socketOptionsString"
+    )
+
+    // Split our options based on connection (bind/connect) and everything else
+    val (connectionOptions, otherOptions) = socketOptions.partition {
+      case Bind(_) | Connect(_) => true
+      case _ => false
+    }
+
+    // Apply non-connection options first since some (like identity) must be
+    // run before the socket does a bind/connect
+    otherOptions.foreach {
+      case Linger(milliseconds) => socket.setLinger(milliseconds)
+      case Subscribe(topic)     => socket.subscribe(topic)
+      case Identity(identity)   => socket.setIdentity(identity)
+      case option               => logger.warn(s"Unknown option: $option")
+    }
+
+    // Perform our bind or connect
+    connectionOptions.foreach {
+      case Bind(address)        => socket.bind(address)
+      case Connect(address)     => socket.connect(address)
+      case option               =>
+        logger.warn(s"Unknown connection option: $option")
+    }
+
+    _isProcessing = true
+  }
+
+  /**
+   * Sends the next outbound message from the outbound message queue.
+   *
+   * @param socket The socket to use when sending the message
+   *
+   * @return True if a message was sent, otherwise false
+   */
+  protected def processNextOutboundMessage(socket: ZMQ.Socket): Boolean = {
+    val message = Option(outboundMessages.poll())
+
+    message.foreach(_.send(socket))
+
+    message.nonEmpty
+  }
+
+  /**
+   * Retrieves the next inbound message (if available) and invokes the
+   * inbound message callback.
+   *
+   * @param socket The socket whose next incoming message to retrieve
+   */
+  protected def processNextInboundMessage(
+    socket: ZMQ.Socket,
+    flags: Int = ZMQ.DONTWAIT
+  ): Unit = {
+    Option(ZMsg.recvMsg(socket, flags)).foreach(zMsg => {
+      inboundMessageCallback.foreach(_(zMsg.asScala.toSeq
+        .map(zFrame => new String(zFrame.getData, ZMQ.CHARSET))
+      ))
+    })
+  }
+
+  /**
+   * Creates a new instance of a ZMQ Socket.
+   *
+   * @param zmqContext The context to use to create the socket
+   * @param socketType The type of socket to create
+   *
+   * @return The new ZMQ.Socket instance
+   */
+  protected def newZmqSocket(zmqContext: ZMQ.Context, socketType: Int) =
+    zmqContext.socket(socketType)
+
+  override def run(): Unit = {
+    val socket = newZmqSocket(context, socketType.`type`)//context.socket(socketType.`type`)
+
+    try {
+      processOptions(socket)
+
+      while (notClosed) {
+        Try(processNextOutboundMessage(socket)).failed.foreach(
+          logger.error("Failed to send next outgoing message!", _: Throwable)
+        )
+        Try(processNextInboundMessage(socket)).failed.foreach(
+          logger.error("Failed to retrieve next incoming message!", _: Throwable)
+        )
+        Thread.sleep(1)
+      }
+    } catch {
+      case ex: Exception =>
+        logger.error("Unexpected exception in 0mq socket runnable!", ex)
+    } finally {
+      try{
+        socket.close()
+      } catch {
+        case ex: Exception =>
+          logger.error("Failed to close socket!", _: Throwable)
+      }
+    }
+  }
+
+  /**
+   * Marks the runnable as closed such that it eventually stops processing
+   * messages and closes the socket.
+   *
+   * @throws AssertionError If the runnable is not processing messages or has
+   *                        already been closed
+   */
+  override def close(): Unit = {
+    assert(_isProcessing && notClosed,
+      "Runnable is not processing or is closed!")
+
+    _isProcessing = false
+    notClosed = false
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
new file mode 100644
index 0000000..8f41861
--- /dev/null
+++ b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.utils
+
+import akka.actor.{Actor, Stash}
+import com.ibm.spark.utils.LogLike
+
+/**
+ * A trait to enforce ordered processing for messages of particular types.
+ */
+trait OrderedSupport extends Actor with Stash with LogLike {
+  /**
+   * Executes instead of the default receive when the Actor has begun
+   * processing. Stashes incoming messages of particular types, defined by
+   * {@link #orderedTypes() orderedTypes} function, for later processing. Uses
+   * the default receive method for all other types. Upon receiving a
+   * FinishedProcessing message, resumes processing all messages with the
+   * default receive.
+   * @return
+   */
+  def waiting : Receive = {
+    case FinishedProcessing =>
+      context.unbecome()
+      unstashAll()
+    case aVal: Any if (orderedTypes().contains(aVal.getClass)) =>
+      logger.trace(s"Stashing message ${aVal} of type ${aVal.getClass}.")
+      stash()
+    case aVal: Any =>
+      logger.trace(s"Forwarding message ${aVal} of type ${aVal.getClass} " +
+        "to default receive.")
+      receive(aVal)
+  }
+
+  /**
+   * Suspends the default receive method for types defined by the
+   * {@link #orderedTypes() orderedTypes} function.
+   */
+  def startProcessing(): Unit = {
+    logger.debug("Actor is in processing state and will stash messages of " +
+      s"types: ${orderedTypes.mkString(" ")}")
+    context.become(waiting, discardOld = false)
+  }
+
+  /**
+   * Resumes the default receive method for all message types.
+   */
+  def finishedProcessing(): Unit = {
+    logger.debug("Actor is no longer in processing state.")
+    self ! FinishedProcessing
+  }
+
+  /**
+   * Executes a block of code, wrapping it in start/finished processing
+   * needed for ordered execution.
+   *
+   * @param block The block to execute
+   * @tparam T The return type of the block
+   * @return The result of executing the block
+   */
+  def withProcessing[T](block: => T): T = {
+    startProcessing()
+    val results = block
+    finishedProcessing()
+    results
+  }
+
+  /**
+   * Defines the types that will be stashed by {@link #waiting() waiting}
+   * while the Actor is in processing state.
+   * @return
+   */
+  def orderedTypes(): Seq[Class[_]]
+
+  case object FinishedProcessing
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/com/ibm/spark/communication/security/HmacSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/com/ibm/spark/communication/security/HmacSpec.scala b/communication/src/test/scala/com/ibm/spark/communication/security/HmacSpec.scala
deleted file mode 100644
index aee869f..0000000
--- a/communication/src/test/scala/com/ibm/spark/communication/security/HmacSpec.scala
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.security
-
-import java.security.NoSuchAlgorithmException
-
-import org.scalatest.{FunSpec, Matchers}
-
-class HmacSpec extends FunSpec with Matchers {
-  describe("Hmac Object") {
-    describe("#apply") {
-      it("should fail if the algorithm is not available") {
-        val nonEmptyKey = "FILL"
-        val badAlgorithm = "One day, I want to be a real algorithm"
-
-        intercept[NoSuchAlgorithmException] {
-          val hmac = Hmac(nonEmptyKey, HmacAlgorithm(badAlgorithm))
-        }
-      }
-
-      it("should succeed if the algorithm is available") {
-        val goodAlgorithm = HmacAlgorithm.SHA256
-
-        val hmac = Hmac("", goodAlgorithm)
-        hmac.algorithm should be (goodAlgorithm)
-      }
-    }
-
-    describe("#newMD5") {
-      it("should produce an Hmac with the algorithm set to MD5") {
-        val hmac = Hmac.newMD5("")
-
-        hmac.algorithm should be(HmacAlgorithm.MD5)
-      }
-    }
-
-    describe("#newSHA1") {
-      it("should produce an Hmac with the algorithm set to SHA1") {
-        val hmac = Hmac.newSHA1("")
-
-        hmac.algorithm should be(HmacAlgorithm.SHA1)
-      }
-    }
-
-    describe("#newSHA256") {
-      it("should produce an Hmac with the algorithm set to SHA256") {
-        val hmac = Hmac.newSHA256("")
-
-        hmac.algorithm should be(HmacAlgorithm.SHA256)
-      }
-    }
-  }
-
-  describe("Hmac Class") {
-    describe("#apply") {
-      // TODO: This should really be mocked since we don't care about the
-      //       results, just the send/receive to the underlying implementation
-      it("should produce the correct digest") {
-        val key = "12345"
-        val message = "This is a test of SHA256 in action."
-        val expected =
-          "e60e1494b0650875fa5eb8384e357d731358c3559c1f223d69dc43ffe13570bc"
-        val hmac = new Hmac(key, HmacAlgorithm.SHA256)
-
-        hmac(message) should be(expected)
-      }
-    }
-
-    describe("#digest") {
-      // TODO: This should really be mocked since we don't care about the
-      //       results, just the send/receive to the underlying implementation
-      it("should produce the correct digest") {
-        val key = "12345"
-        val message = List("This is a test of SHA256 in action.")
-        val expected =
-          "e60e1494b0650875fa5eb8384e357d731358c3559c1f223d69dc43ffe13570bc"
-        val hmac = new Hmac(key, HmacAlgorithm.SHA256)
-
-        hmac.digest(message) should be(expected)
-      }
-    }
-  }
-
-  describe("HmacAlgorithm") {
-    describe("#apply") {
-      it("should return a value wrapping the string input") {
-        val resultTypeName = HmacAlgorithm("").getClass.getName
-
-        // NOTE: Test written this way since unable to check directly against
-        //       the Scala enumeration value
-        resultTypeName should be ("scala.Enumeration$Val")
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/com/ibm/spark/communication/socket/JeroMQSocketSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/com/ibm/spark/communication/socket/JeroMQSocketSpec.scala b/communication/src/test/scala/com/ibm/spark/communication/socket/JeroMQSocketSpec.scala
deleted file mode 100644
index a052fcd..0000000
--- a/communication/src/test/scala/com/ibm/spark/communication/socket/JeroMQSocketSpec.scala
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.mockito.invocation.InvocationOnMock
-import org.mockito.stubbing.Answer
-import org.scalatest.{Matchers, BeforeAndAfter, OneInstancePerTest, FunSpec}
-import org.scalatest.mock.MockitoSugar
-import org.mockito.Mockito._
-import org.zeromq.ZMsg
-
-class JeroMQSocketSpec extends FunSpec with MockitoSugar
-  with OneInstancePerTest with BeforeAndAfter with Matchers
-{
-  private val runnable = mock[ZeroMQSocketRunnable]
-  @volatile private var running = true
-  //  Mock the running of the runnable for the tests
-  doAnswer(new Answer[Unit] {
-    override def answer(invocation: InvocationOnMock): Unit = while (running) {
-      Thread.sleep(1)
-    }
-  }).when(runnable).run()
-
-
-  //  Mock the close of the runnable to shutdown
-  doAnswer(new Answer[Unit] {
-    override def answer(invocation: InvocationOnMock): Unit = running = false
-  }).when(runnable).close()
-
-  private val socket: JeroMQSocket = new JeroMQSocket(runnable)
-
-  after {
-    running = false
-  }
-
-  describe("JeroMQSocket") {
-    describe("#send") {
-      it("should offer a message to the runnable") {
-        val message: String = "Some Message"
-        val expected = ZMsg.newStringMsg(message)
-
-        socket.send(message)
-        verify(runnable).offer(expected)
-      }
-
-      it("should thrown and AssertionError when socket is no longer alive") {
-        socket.close()
-
-        intercept[AssertionError] {
-          socket.send("")
-        }
-      }
-    }
-
-    describe("#close") {
-      it("should close the runnable") {
-        socket.close()
-
-        verify(runnable).close()
-      }
-
-      it("should close the socket thread") {
-        socket.close()
-
-        socket.isAlive should be (false)
-      }
-    }
-
-    describe("#isAlive") {
-      it("should evaluate to true when the socket thread is alive") {
-        socket.isAlive should be (true)
-      }
-
-      it("should evaluate to false when the socket thread is dead") {
-        socket.close()
-
-        socket.isAlive should be (false)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnableSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnableSpec.scala b/communication/src/test/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnableSpec.scala
deleted file mode 100644
index 90c509c..0000000
--- a/communication/src/test/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnableSpec.scala
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.scalatest.concurrent.Eventually
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.time.{Milliseconds, Span}
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-import org.zeromq.ZMQ
-import org.zeromq.ZMQ.{Socket, Context}
-
-import scala.util.Try
-
-class ZeroMQSocketRunnableSpec extends FunSpec with Matchers
-  with MockitoSugar with Eventually with BeforeAndAfter {
-
-  implicit override val patienceConfig = PatienceConfig(
-    timeout = scaled(Span(2000, Milliseconds)),
-    interval = scaled(Span(5, Milliseconds))
-  )
-
-  private val TestAddress = "inproc://test-address"
-  private var mockSocketType: SocketType = _
-  private var zmqContext: ZMQ.Context = _
-  private var pubSocket: ZMQ.Socket = _
-
-  private class TestRunnable(
-    private val socket: ZMQ.Socket,
-    private val context: Context,
-    private val socketType: SocketType,
-    private val inboundMessageCallback: Option[(Seq[String]) => Unit],
-    private val socketOptions: SocketOption*
-  ) extends ZeroMQSocketRunnable(
-    context,
-    socketType,
-    inboundMessageCallback,
-    socketOptions: _*
-  ) {
-    override protected def newZmqSocket(zmqContext: Context, socketType: Int): Socket = socket
-  }
-
-  before {
-    mockSocketType = mock[SocketType]
-    zmqContext = ZMQ.context(1)
-    pubSocket = zmqContext.socket(PubSocket.`type`)
-  }
-
-  after {
-    Try(zmqContext.close())
-  }
-
-  describe("ZeroMQSocketRunnable") {
-    describe("constructor") {
-      it("should throw an exception if there is no bind or connect") {
-        intercept[IllegalArgumentException] {
-          new ZeroMQSocketRunnable(zmqContext, mockSocketType, None)
-        }
-        pubSocket.close()
-      }
-
-      it("should throw an exception if there is more than one connect") {
-        intercept[IllegalArgumentException] {
-          new ZeroMQSocketRunnable(
-            zmqContext,
-            mockSocketType,
-            None,
-            Connect(TestAddress),
-            Connect(TestAddress)
-          )
-        }
-        pubSocket.close()
-      }
-
-      it("should throw an exception if there is more than one bind") {
-        intercept[IllegalArgumentException] {
-          new ZeroMQSocketRunnable(
-            zmqContext,
-            mockSocketType,
-            None,
-            Bind(TestAddress),
-            Bind(TestAddress)
-          )
-        }
-        pubSocket.close()
-      }
-
-      it("should throw an exception if there is a connect and bind") {
-        intercept[IllegalArgumentException] {
-          new ZeroMQSocketRunnable(
-            zmqContext,
-            mockSocketType,
-            None,
-            Connect(""),
-            Bind("")
-          )
-        }
-        pubSocket.close()
-      }
-    }
-
-    describe("#run"){
-      it("should set the linger option when provided") {
-        val expected = 999
-
-        val runnable: TestRunnable = new TestRunnable(
-          pubSocket,
-          zmqContext,
-          PubSocket,
-          None,
-          Connect(TestAddress),
-          Linger(expected)
-        )
-        val thread = new Thread(runnable)
-
-        thread.start()
-
-        eventually {
-          val actual = pubSocket.getLinger
-          actual should be (expected)
-        }
-
-        runnable.close()
-      }
-
-      it("should set the identity option when provided") {
-        val expected = "my identity".getBytes(ZMQ.CHARSET)
-
-        val runnable: TestRunnable = new TestRunnable(
-          pubSocket,
-          zmqContext,
-          PubSocket,
-          None,
-          Connect(TestAddress),
-          Identity(expected)
-        )
-        val thread = new Thread(runnable)
-
-        thread.start()
-
-        eventually {
-          val actual = pubSocket.getIdentity
-          actual should be (expected)
-        }
-
-        runnable.close()
-      }
-
-      it("should close the thread when closed"){
-        val runnable = new TestRunnable(
-          pubSocket,
-          zmqContext,
-          PubSocket,
-          None,
-          Connect(TestAddress)
-        )
-
-        val thread = new Thread(runnable)
-
-        thread.start()
-
-        eventually {
-          runnable.isProcessing should be (true)
-        }
-
-        runnable.close()
-
-        eventually{
-          thread.isAlive should be (false)
-        }
-      }
-    }
-
-    describe("#isProcessing") {
-      it("should be false when the runnable is closed") {
-        val runnable = new TestRunnable(
-          pubSocket,
-          zmqContext,
-          PubSocket,
-          None,
-          Connect(TestAddress)
-        )
-
-        val thread = new Thread(runnable)
-
-        thread.start()
-
-        eventually {
-          runnable.isProcessing should be (true)
-        }
-
-        runnable.close()
-
-        eventually {
-          runnable.isProcessing should be (false)
-        }
-      }
-
-      it("should eventually be true when the runnable is started") {
-        val runnable = new TestRunnable(
-          pubSocket,
-          zmqContext,
-          PubSocket,
-          None,
-          Connect(TestAddress)
-        )
-
-        val thread = new Thread(runnable)
-
-        thread.start()
-
-        eventually{
-          runnable.isProcessing should be (true)
-        }
-
-        runnable.close()
-      }
-    }
-
-    describe("#close"){
-      it("should close the thread"){
-          val runnable = new TestRunnable(
-            pubSocket,
-            zmqContext,
-            PubSocket,
-            None,
-            Connect(TestAddress)
-          )
-
-          val thread = new Thread(runnable)
-
-          thread.start()
-
-          eventually {
-            runnable.isProcessing should be (true)
-          }
-
-          runnable.close()
-
-          eventually{
-            thread.isAlive should be(false)
-          }
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/com/ibm/spark/communication/utils/OrderedSupportSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/com/ibm/spark/communication/utils/OrderedSupportSpec.scala b/communication/src/test/scala/com/ibm/spark/communication/utils/OrderedSupportSpec.scala
deleted file mode 100644
index b10d4cb..0000000
--- a/communication/src/test/scala/com/ibm/spark/communication/utils/OrderedSupportSpec.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.utils
-
-import akka.actor._
-import akka.testkit.{ImplicitSender, TestKit}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpecLike, Matchers}
-
-case class OrderedType()
-case class NotOrderedType()
-case class FinishProcessingMessage()
-case class ReceiveMessageCount(count: Int)
-
-class TestOrderedSupport extends OrderedSupport {
-  var receivedCounter = 0
-  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[OrderedType])
-
-  override def receive: Receive = {
-    case OrderedType() =>
-      startProcessing()
-      receivedCounter = receivedCounter + 1
-      sender ! ReceiveMessageCount(receivedCounter)
-    case NotOrderedType() =>
-      receivedCounter = receivedCounter + 1
-      sender ! ReceiveMessageCount(receivedCounter)
-    case FinishProcessingMessage() =>
-      finishedProcessing()
-  }
-}
-
-class OrderedSupportSpec extends TestKit(ActorSystem("OrderedSupportSystem"))
-  with ImplicitSender with Matchers with FunSpecLike
-  with MockitoSugar  {
-
-  describe("OrderedSupport"){
-    describe("#waiting"){
-      it("should wait for types defined in orderedTypes"){
-      val testOrderedSupport = system.actorOf(Props[TestOrderedSupport])
-
-        // Send a message having a type in orderedTypes
-        // Starts processing and is handled with receive()
-        testOrderedSupport ! new OrderedType
-        // This message should be handled with waiting()
-        testOrderedSupport ! new OrderedType
-
-        // Verify receive was not called for the second OrderedType
-        expectMsg(ReceiveMessageCount(1))
-
-      }
-
-      it("should process types not defined in orderedTypes"){
-        val testOrderedSupport = system.actorOf(Props[TestOrderedSupport])
-
-        // Send a message that starts the processing
-        testOrderedSupport ! new OrderedType
-
-        // Send a message having a type not in orderedTypes
-        testOrderedSupport ! new NotOrderedType
-
-        // Verify receive did get called for NotOrderedType
-        expectMsg(ReceiveMessageCount(1))
-        expectMsg(ReceiveMessageCount(2))
-      }
-    }
-    describe("#finishedProcessing"){
-      it("should switch actor to receive method"){
-        val testOrderedSupport = system.actorOf(Props[TestOrderedSupport])
-        
-        //  Switch actor to waiting mode
-        testOrderedSupport ! new OrderedType
-
-        //  Call finishedProcessing
-        testOrderedSupport ! new FinishProcessingMessage
-
-        //  Sending something that would match in receive, and is in orderedTypes
-        testOrderedSupport ! new OrderedType
-
-        expectMsg(ReceiveMessageCount(1))
-        expectMsg(ReceiveMessageCount(2))
-
-      }
-
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala b/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
new file mode 100644
index 0000000..aee869f
--- /dev/null
+++ b/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.communication.security
+
+import java.security.NoSuchAlgorithmException
+
+import org.scalatest.{FunSpec, Matchers}
+
+class HmacSpec extends FunSpec with Matchers {
+  describe("Hmac Object") {
+    describe("#apply") {
+      it("should fail if the algorithm is not available") {
+        val nonEmptyKey = "FILL"
+        val badAlgorithm = "One day, I want to be a real algorithm"
+
+        intercept[NoSuchAlgorithmException] {
+          val hmac = Hmac(nonEmptyKey, HmacAlgorithm(badAlgorithm))
+        }
+      }
+
+      it("should succeed if the algorithm is available") {
+        val goodAlgorithm = HmacAlgorithm.SHA256
+
+        val hmac = Hmac("", goodAlgorithm)
+        hmac.algorithm should be (goodAlgorithm)
+      }
+    }
+
+    describe("#newMD5") {
+      it("should produce an Hmac with the algorithm set to MD5") {
+        val hmac = Hmac.newMD5("")
+
+        hmac.algorithm should be(HmacAlgorithm.MD5)
+      }
+    }
+
+    describe("#newSHA1") {
+      it("should produce an Hmac with the algorithm set to SHA1") {
+        val hmac = Hmac.newSHA1("")
+
+        hmac.algorithm should be(HmacAlgorithm.SHA1)
+      }
+    }
+
+    describe("#newSHA256") {
+      it("should produce an Hmac with the algorithm set to SHA256") {
+        val hmac = Hmac.newSHA256("")
+
+        hmac.algorithm should be(HmacAlgorithm.SHA256)
+      }
+    }
+  }
+
+  describe("Hmac Class") {
+    describe("#apply") {
+      // TODO: This should really be mocked since we don't care about the
+      //       results, just the send/receive to the underlying implementation
+      it("should produce the correct digest") {
+        val key = "12345"
+        val message = "This is a test of SHA256 in action."
+        val expected =
+          "e60e1494b0650875fa5eb8384e357d731358c3559c1f223d69dc43ffe13570bc"
+        val hmac = new Hmac(key, HmacAlgorithm.SHA256)
+
+        hmac(message) should be(expected)
+      }
+    }
+
+    describe("#digest") {
+      // TODO: This should really be mocked since we don't care about the
+      //       results, just the send/receive to the underlying implementation
+      it("should produce the correct digest") {
+        val key = "12345"
+        val message = List("This is a test of SHA256 in action.")
+        val expected =
+          "e60e1494b0650875fa5eb8384e357d731358c3559c1f223d69dc43ffe13570bc"
+        val hmac = new Hmac(key, HmacAlgorithm.SHA256)
+
+        hmac.digest(message) should be(expected)
+      }
+    }
+  }
+
+  describe("HmacAlgorithm") {
+    describe("#apply") {
+      it("should return a value wrapping the string input") {
+        val resultTypeName = HmacAlgorithm("").getClass.getName
+
+        // NOTE: Test written this way since unable to check directly against
+        //       the Scala enumeration value
+        resultTypeName should be ("scala.Enumeration$Val")
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
new file mode 100644
index 0000000..a052fcd
--- /dev/null
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.communication.socket
+
+import org.mockito.invocation.InvocationOnMock
+import org.mockito.stubbing.Answer
+import org.scalatest.{Matchers, BeforeAndAfter, OneInstancePerTest, FunSpec}
+import org.scalatest.mock.MockitoSugar
+import org.mockito.Mockito._
+import org.zeromq.ZMsg
+
+class JeroMQSocketSpec extends FunSpec with MockitoSugar
+  with OneInstancePerTest with BeforeAndAfter with Matchers
+{
+  private val runnable = mock[ZeroMQSocketRunnable]
+  @volatile private var running = true
+  //  Mock the running of the runnable for the tests
+  doAnswer(new Answer[Unit] {
+    override def answer(invocation: InvocationOnMock): Unit = while (running) {
+      Thread.sleep(1)
+    }
+  }).when(runnable).run()
+
+
+  //  Mock the close of the runnable to shutdown
+  doAnswer(new Answer[Unit] {
+    override def answer(invocation: InvocationOnMock): Unit = running = false
+  }).when(runnable).close()
+
+  private val socket: JeroMQSocket = new JeroMQSocket(runnable)
+
+  after {
+    running = false
+  }
+
+  describe("JeroMQSocket") {
+    describe("#send") {
+      it("should offer a message to the runnable") {
+        val message: String = "Some Message"
+        val expected = ZMsg.newStringMsg(message)
+
+        socket.send(message)
+        verify(runnable).offer(expected)
+      }
+
+      it("should thrown and AssertionError when socket is no longer alive") {
+        socket.close()
+
+        intercept[AssertionError] {
+          socket.send("")
+        }
+      }
+    }
+
+    describe("#close") {
+      it("should close the runnable") {
+        socket.close()
+
+        verify(runnable).close()
+      }
+
+      it("should close the socket thread") {
+        socket.close()
+
+        socket.isAlive should be (false)
+      }
+    }
+
+    describe("#isAlive") {
+      it("should evaluate to true when the socket thread is alive") {
+        socket.isAlive should be (true)
+      }
+
+      it("should evaluate to false when the socket thread is dead") {
+        socket.close()
+
+        socket.isAlive should be (false)
+      }
+    }
+  }
+}


[30/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
Moved scala files to new locations based on new package


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/68f7ddd6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/68f7ddd6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/68f7ddd6

Branch: refs/heads/TestBranch
Commit: 68f7ddd6198f786a310934e0564271ae4ad0a431
Parents: 1009109
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Fri Jan 15 08:57:52 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Fri Jan 15 11:22:55 2016 -0600

----------------------------------------------------------------------
 .../com/ibm/spark/comm/ClientCommManager.scala  |  47 --
 .../com/ibm/spark/comm/ClientCommWriter.scala   |  62 --
 .../kernel/protocol/v5/client/ActorLoader.scala |  48 --
 .../protocol/v5/client/SparkKernelClient.scala  | 140 -----
 .../kernel/protocol/v5/client/Utilities.scala   | 112 ----
 .../v5/client/boot/ClientBootstrap.scala        |  69 ---
 .../boot/layers/HandlerInitialization.scala     |  75 ---
 .../boot/layers/SystemInitialization.scala      | 137 -----
 .../v5/client/exception/ShellException.scala    |  21 -
 .../v5/client/execution/DeferredExecution.scala | 141 -----
 .../execution/DeferredExecutionManager.scala    |  44 --
 .../execution/DeferredExecutionTuple.scala      |  21 -
 .../client/execution/ExecuteRequestTuple.scala  |  21 -
 .../v5/client/handler/ExecuteHandler.scala      |  44 --
 .../v5/client/socket/HeartbeatClient.scala      |  70 ---
 .../protocol/v5/client/socket/IOPubClient.scala | 194 ------
 .../protocol/v5/client/socket/ShellClient.scala |  89 ---
 .../v5/client/socket/SocketConfig.scala         |  51 --
 .../v5/client/socket/SocketConnection.scala     |  36 --
 .../v5/client/socket/SocketFactory.scala        | 123 ----
 .../protocol/v5/client/socket/StdinClient.scala | 104 ----
 .../apache/toree/comm/ClientCommManager.scala   |  47 ++
 .../apache/toree/comm/ClientCommWriter.scala    |  62 ++
 .../kernel/protocol/v5/client/ActorLoader.scala |  48 ++
 .../protocol/v5/client/SparkKernelClient.scala  | 140 +++++
 .../kernel/protocol/v5/client/Utilities.scala   | 112 ++++
 .../v5/client/boot/ClientBootstrap.scala        |  69 +++
 .../boot/layers/HandlerInitialization.scala     |  75 +++
 .../boot/layers/SystemInitialization.scala      | 137 +++++
 .../v5/client/exception/ShellException.scala    |  21 +
 .../v5/client/execution/DeferredExecution.scala | 141 +++++
 .../execution/DeferredExecutionManager.scala    |  44 ++
 .../execution/DeferredExecutionTuple.scala      |  21 +
 .../client/execution/ExecuteRequestTuple.scala  |  21 +
 .../v5/client/handler/ExecuteHandler.scala      |  44 ++
 .../v5/client/socket/HeartbeatClient.scala      |  70 +++
 .../protocol/v5/client/socket/IOPubClient.scala | 194 ++++++
 .../protocol/v5/client/socket/ShellClient.scala |  89 +++
 .../v5/client/socket/SocketConfig.scala         |  51 ++
 .../v5/client/socket/SocketConnection.scala     |  36 ++
 .../v5/client/socket/SocketFactory.scala        | 123 ++++
 .../protocol/v5/client/socket/StdinClient.scala | 104 ++++
 .../ibm/spark/comm/ClientCommManagerSpec.scala  |  74 ---
 .../ibm/spark/comm/ClientCommWriterSpec.scala   | 272 ---------
 .../v5/client/SparkKernelClientSpec.scala       |  68 ---
 .../execution/DeferredExecutionTest.scala       | 235 -------
 .../v5/client/socket/HeartbeatClientSpec.scala  |  48 --
 .../v5/client/socket/IOPubClientSpec.scala      | 300 ---------
 .../v5/client/socket/ShellClientSpec.scala      |  79 ---
 .../v5/client/socket/StdinClientSpec.scala      | 160 -----
 .../toree/comm/ClientCommManagerSpec.scala      |  74 +++
 .../toree/comm/ClientCommWriterSpec.scala       | 272 +++++++++
 .../v5/client/SparkKernelClientSpec.scala       |  68 +++
 .../execution/DeferredExecutionTest.scala       | 235 +++++++
 .../v5/client/socket/HeartbeatClientSpec.scala  |  48 ++
 .../v5/client/socket/IOPubClientSpec.scala      | 300 +++++++++
 .../v5/client/socket/ShellClientSpec.scala      |  79 +++
 .../v5/client/socket/StdinClientSpec.scala      | 160 +++++
 .../ibm/spark/communication/SocketManager.scala | 190 ------
 .../ibm/spark/communication/ZMQMessage.scala    |  30 -
 .../actors/DealerSocketActor.scala              |  49 --
 .../communication/actors/PubSocketActor.scala   |  60 --
 .../communication/actors/RepSocketActor.scala   |  49 --
 .../communication/actors/ReqSocketActor.scala   |  49 --
 .../actors/RouterSocketActor.scala              |  49 --
 .../communication/actors/SubSocketActor.scala   |  45 --
 .../ibm/spark/communication/security/Hmac.scala |  66 --
 .../security/SignatureCheckerActor.scala        |  47 --
 .../security/SignatureManagerActor.scala        |  99 ---
 .../security/SignatureProducerActor.scala       |  50 --
 .../spark/communication/security/package.scala  |  32 -
 .../communication/socket/JeroMQSocket.scala     |  65 --
 .../socket/PubSocketRunnable.scala              |  41 --
 .../socket/ReqSocketRunnable.scala              |  65 --
 .../spark/communication/socket/SocketLike.scala |  52 --
 .../communication/socket/SocketOption.scala     |  66 --
 .../communication/socket/SocketRunnable.scala   |  57 --
 .../spark/communication/socket/SocketType.scala |  43 --
 .../socket/ZeroMQSocketRunnable.scala           | 181 ------
 .../communication/utils/OrderedSupport.scala    |  89 ---
 .../toree/communication/SocketManager.scala     | 190 ++++++
 .../apache/toree/communication/ZMQMessage.scala |  30 +
 .../actors/DealerSocketActor.scala              |  49 ++
 .../communication/actors/PubSocketActor.scala   |  60 ++
 .../communication/actors/RepSocketActor.scala   |  49 ++
 .../communication/actors/ReqSocketActor.scala   |  49 ++
 .../actors/RouterSocketActor.scala              |  49 ++
 .../communication/actors/SubSocketActor.scala   |  45 ++
 .../toree/communication/security/Hmac.scala     |  66 ++
 .../security/SignatureCheckerActor.scala        |  47 ++
 .../security/SignatureManagerActor.scala        |  99 +++
 .../security/SignatureProducerActor.scala       |  50 ++
 .../toree/communication/security/package.scala  |  32 +
 .../communication/socket/JeroMQSocket.scala     |  65 ++
 .../socket/PubSocketRunnable.scala              |  41 ++
 .../socket/ReqSocketRunnable.scala              |  65 ++
 .../toree/communication/socket/SocketLike.scala |  52 ++
 .../communication/socket/SocketOption.scala     |  66 ++
 .../communication/socket/SocketRunnable.scala   |  57 ++
 .../toree/communication/socket/SocketType.scala |  43 ++
 .../socket/ZeroMQSocketRunnable.scala           | 181 ++++++
 .../communication/utils/OrderedSupport.scala    |  89 +++
 .../spark/communication/security/HmacSpec.scala | 109 ----
 .../communication/socket/JeroMQSocketSpec.scala |  94 ---
 .../socket/ZeroMQSocketRunnableSpec.scala       | 259 --------
 .../utils/OrderedSupportSpec.scala              | 101 ---
 .../toree/communication/security/HmacSpec.scala | 109 ++++
 .../communication/socket/JeroMQSocketSpec.scala |  94 +++
 .../socket/ZeroMQSocketRunnableSpec.scala       | 259 ++++++++
 .../utils/OrderedSupportSpec.scala              | 101 +++
 .../dependencies/DependencyDownloader.scala     |  49 --
 .../dependencies/IvyDependencyDownloader.scala  | 185 ------
 .../com/ibm/spark/global/StreamState.scala      |  86 ---
 .../ibm/spark/interpreter/ExecuteFailure.scala  |  44 --
 .../com/ibm/spark/interpreter/Interpreter.scala | 144 -----
 .../spark/interpreter/InterpreterTypes.scala    |  27 -
 .../com/ibm/spark/interpreter/Results.scala     |  38 --
 .../spark/interpreter/broker/BrokerBridge.scala |  46 --
 .../spark/interpreter/broker/BrokerCode.scala   |  28 -
 .../interpreter/broker/BrokerException.scala    |  25 -
 .../spark/interpreter/broker/BrokerName.scala   |  26 -
 .../interpreter/broker/BrokerProcess.scala      | 220 -------
 .../broker/BrokerProcessHandler.scala           |  70 ---
 .../interpreter/broker/BrokerPromise.scala      |  29 -
 .../interpreter/broker/BrokerService.scala      |  48 --
 .../spark/interpreter/broker/BrokerState.scala  | 176 ------
 .../interpreter/broker/BrokerTransformer.scala  |  54 --
 .../spark/interpreter/broker/BrokerTypes.scala  |  22 -
 .../broker/BrokerTypesProvider.scala            |  31 -
 .../producer/JavaSparkContextProducerLike.scala |  42 --
 .../producer/SQLContextProducerLike.scala       |  42 --
 .../imports/printers/WrapperConsole.scala       |  47 --
 .../imports/printers/WrapperSystem.scala        |  48 --
 .../com/ibm/spark/interpreter/package.scala     |  27 -
 .../spark/kernel/api/FactoryMethodsLike.scala   |  34 --
 .../com/ibm/spark/kernel/api/KernelLike.scala   | 106 ----
 .../ibm/spark/kernel/api/KernelOptions.scala    |  22 -
 .../com/ibm/spark/kernel/api/StreamInfo.scala   |  28 -
 .../spark/kernel/api/StreamMethodsLike.scala    |  13 -
 .../scala/com/ibm/spark/magic/CellMagic.scala   |   8 -
 .../ibm/spark/magic/InternalClassLoader.scala   |  53 --
 .../scala/com/ibm/spark/magic/LineMagic.scala   |   9 -
 .../main/scala/com/ibm/spark/magic/Magic.scala  |  29 -
 .../com/ibm/spark/magic/MagicExecutor.scala     |  34 --
 .../scala/com/ibm/spark/magic/MagicLoader.scala | 137 -----
 .../magic/dependencies/DependencyMap.scala      | 170 ------
 .../magic/dependencies/IncludeConfig.scala      |  30 -
 .../IncludeDependencyDownloader.scala           |  29 -
 .../magic/dependencies/IncludeInterpreter.scala |  30 -
 .../magic/dependencies/IncludeKernel.scala      |  29 -
 .../dependencies/IncludeKernelInterpreter.scala |  31 -
 .../magic/dependencies/IncludeMagicLoader.scala |  30 -
 .../dependencies/IncludeOutputStream.scala      |  31 -
 .../magic/dependencies/IncludeSQLContext.scala  |  13 -
 .../dependencies/IncludeSparkContext.scala      |  30 -
 .../scala/com/ibm/spark/magic/package.scala     |  32 -
 .../spark/security/KernelSecurityManager.scala  | 125 ----
 .../spark/utils/ArgumentParsingSupport.scala    |  58 --
 .../spark/utils/ConditionalOutputStream.scala   |  28 -
 .../com/ibm/spark/utils/DownloadSupport.scala   |  57 --
 .../spark/utils/DynamicReflectionSupport.scala  | 135 ----
 .../com/ibm/spark/utils/KeyValuePairUtils.scala |  64 --
 .../com/ibm/spark/utils/MultiClassLoader.scala  | 143 -----
 .../com/ibm/spark/utils/MultiOutputStream.scala |  40 --
 .../ibm/spark/utils/ScheduledTaskManager.scala  | 101 ---
 .../scala/com/ibm/spark/utils/TaskManager.scala | 237 -------
 .../dependencies/DependencyDownloader.scala     |  49 ++
 .../dependencies/IvyDependencyDownloader.scala  | 185 ++++++
 .../org/apache/toree/global/StreamState.scala   |  86 +++
 .../toree/interpreter/ExecuteFailure.scala      |  44 ++
 .../apache/toree/interpreter/Interpreter.scala  | 144 +++++
 .../toree/interpreter/InterpreterTypes.scala    |  27 +
 .../org/apache/toree/interpreter/Results.scala  |  38 ++
 .../toree/interpreter/broker/BrokerBridge.scala |  46 ++
 .../toree/interpreter/broker/BrokerCode.scala   |  28 +
 .../interpreter/broker/BrokerException.scala    |  25 +
 .../toree/interpreter/broker/BrokerName.scala   |  26 +
 .../interpreter/broker/BrokerProcess.scala      | 220 +++++++
 .../broker/BrokerProcessHandler.scala           |  70 +++
 .../interpreter/broker/BrokerPromise.scala      |  29 +
 .../interpreter/broker/BrokerService.scala      |  48 ++
 .../toree/interpreter/broker/BrokerState.scala  | 176 ++++++
 .../interpreter/broker/BrokerTransformer.scala  |  54 ++
 .../toree/interpreter/broker/BrokerTypes.scala  |  22 +
 .../broker/BrokerTypesProvider.scala            |  31 +
 .../producer/JavaSparkContextProducerLike.scala |  42 ++
 .../producer/SQLContextProducerLike.scala       |  42 ++
 .../imports/printers/WrapperConsole.scala       |  47 ++
 .../imports/printers/WrapperSystem.scala        |  48 ++
 .../org/apache/toree/interpreter/package.scala  |  27 +
 .../toree/kernel/api/FactoryMethodsLike.scala   |  34 ++
 .../apache/toree/kernel/api/KernelLike.scala    | 106 ++++
 .../apache/toree/kernel/api/KernelOptions.scala |  22 +
 .../apache/toree/kernel/api/StreamInfo.scala    |  28 +
 .../toree/kernel/api/StreamMethodsLike.scala    |  13 +
 .../org/apache/toree/magic/CellMagic.scala      |   8 +
 .../toree/magic/InternalClassLoader.scala       |  53 ++
 .../org/apache/toree/magic/LineMagic.scala      |   9 +
 .../scala/org/apache/toree/magic/Magic.scala    |  29 +
 .../org/apache/toree/magic/MagicExecutor.scala  |  34 ++
 .../org/apache/toree/magic/MagicLoader.scala    | 137 +++++
 .../magic/dependencies/DependencyMap.scala      | 170 ++++++
 .../magic/dependencies/IncludeConfig.scala      |  30 +
 .../IncludeDependencyDownloader.scala           |  29 +
 .../magic/dependencies/IncludeInterpreter.scala |  30 +
 .../magic/dependencies/IncludeKernel.scala      |  29 +
 .../dependencies/IncludeKernelInterpreter.scala |  31 +
 .../magic/dependencies/IncludeMagicLoader.scala |  30 +
 .../dependencies/IncludeOutputStream.scala      |  31 +
 .../magic/dependencies/IncludeSQLContext.scala  |  13 +
 .../dependencies/IncludeSparkContext.scala      |  30 +
 .../scala/org/apache/toree/magic/package.scala  |  32 +
 .../toree/security/KernelSecurityManager.scala  | 125 ++++
 .../toree/utils/ArgumentParsingSupport.scala    |  58 ++
 .../toree/utils/ConditionalOutputStream.scala   |  28 +
 .../apache/toree/utils/DownloadSupport.scala    |  57 ++
 .../toree/utils/DynamicReflectionSupport.scala  | 135 ++++
 .../apache/toree/utils/KeyValuePairUtils.scala  |  64 ++
 .../apache/toree/utils/MultiClassLoader.scala   | 143 +++++
 .../apache/toree/utils/MultiOutputStream.scala  |  40 ++
 .../toree/utils/ScheduledTaskManager.scala      | 101 +++
 .../org/apache/toree/utils/TaskManager.scala    | 237 +++++++
 .../interpreter/broker/BrokerBridgeSpec.scala   |  51 --
 .../broker/BrokerProcessHandlerSpec.scala       |  75 ---
 .../interpreter/broker/BrokerProcessSpec.scala  | 252 --------
 .../interpreter/broker/BrokerStateSpec.scala    | 202 ------
 .../broker/BrokerTransformerSpec.scala          |  68 ---
 .../spark/magic/InternalClassLoaderSpec.scala   |  99 ---
 .../com/ibm/spark/magic/MagicLoaderSpec.scala   | 183 ------
 .../utils/ArgumentParsingSupportSpec.scala      |  75 ---
 .../utils/ConditionalOutputStreamSpec.scala     |  90 ---
 .../ibm/spark/utils/DownloadSupportSpec.scala   | 102 ----
 .../utils/DynamicReflectionSupportSpec.scala    | 181 ------
 .../ibm/spark/utils/KeyValuePairUtilsSpec.scala | 108 ----
 .../ibm/spark/utils/MultiOutputStreamSpec.scala |  76 ---
 .../spark/utils/ScheduledTaskManagerSpec.scala  | 129 ----
 .../com/ibm/spark/utils/TaskManagerSpec.scala   | 301 ---------
 .../interpreter/broker/BrokerBridgeSpec.scala   |  51 ++
 .../broker/BrokerProcessHandlerSpec.scala       |  75 +++
 .../interpreter/broker/BrokerProcessSpec.scala  | 252 ++++++++
 .../interpreter/broker/BrokerStateSpec.scala    | 202 ++++++
 .../broker/BrokerTransformerSpec.scala          |  68 +++
 .../toree/magic/InternalClassLoaderSpec.scala   |  99 +++
 .../apache/toree/magic/MagicLoaderSpec.scala    | 183 ++++++
 .../utils/ArgumentParsingSupportSpec.scala      |  75 +++
 .../utils/ConditionalOutputStreamSpec.scala     |  90 +++
 .../toree/utils/DownloadSupportSpec.scala       | 102 ++++
 .../utils/DynamicReflectionSupportSpec.scala    | 181 ++++++
 .../toree/utils/KeyValuePairUtilsSpec.scala     | 108 ++++
 .../toree/utils/MultiOutputStreamSpec.scala     |  76 +++
 .../toree/utils/ScheduledTaskManagerSpec.scala  | 129 ++++
 .../apache/toree/utils/TaskManagerSpec.scala    | 301 +++++++++
 .../main/scala/com/ibm/spark/SparkKernel.scala  |  43 --
 .../com/ibm/spark/boot/CommandLineOptions.scala | 199 ------
 .../com/ibm/spark/boot/KernelBootstrap.scala    | 172 ------
 .../spark/boot/layer/BareInitialization.scala   | 181 ------
 .../boot/layer/ComponentInitialization.scala    | 200 ------
 .../boot/layer/HandlerInitialization.scala      | 185 ------
 .../spark/boot/layer/HookInitialization.scala   | 107 ----
 .../spark/boot/layer/InterpreterManager.scala   |  66 --
 .../com/ibm/spark/comm/KernelCommManager.scala  |  47 --
 .../com/ibm/spark/comm/KernelCommWriter.scala   |  60 --
 .../ibm/spark/global/ExecuteRequestState.scala  |  50 --
 .../com/ibm/spark/global/ExecutionCounter.scala |  38 --
 .../ibm/spark/global/ScheduledTaskManager.scala |  23 -
 .../ibm/spark/kernel/api/FactoryMethods.scala   |  89 ---
 .../scala/com/ibm/spark/kernel/api/Kernel.scala | 448 --------------
 .../ibm/spark/kernel/api/StreamMethods.scala    |  48 --
 .../protocol/v5/dispatch/StatusDispatch.scala   |  51 --
 .../protocol/v5/handler/BaseHandler.scala       |  67 --
 .../v5/handler/CodeCompleteHandler.scala        |  65 --
 .../protocol/v5/handler/CommCloseHandler.scala  |  84 ---
 .../protocol/v5/handler/CommMsgHandler.scala    |  84 ---
 .../protocol/v5/handler/CommOpenHandler.scala   |  88 ---
 .../v5/handler/ExecuteRequestHandler.scala      | 163 -----
 .../handler/GenericSocketMessageHandler.scala   |  58 --
 .../v5/handler/InputRequestReplyHandler.scala   |  78 ---
 .../v5/handler/KernelInfoRequestHandler.scala   |  68 ---
 .../protocol/v5/handler/ShutdownHandler.scala   |  64 --
 .../v5/interpreter/InterpreterActor.scala       |  99 ---
 .../protocol/v5/interpreter/package.scala       |  26 -
 .../tasks/CodeCompleteTaskActor.scala           |  40 --
 .../tasks/ExecuteRequestTaskActor.scala         | 123 ----
 .../tasks/InterpreterTaskFactory.scala          |  36 --
 .../kernel/protocol/v5/kernel/ActorLoader.scala |  51 --
 .../kernel/protocol/v5/kernel/Utilities.scala   | 108 ----
 .../protocol/v5/kernel/socket/Control.scala     |  35 --
 .../protocol/v5/kernel/socket/Heartbeat.scala   |  39 --
 .../protocol/v5/kernel/socket/IOPub.scala       |  51 --
 .../protocol/v5/kernel/socket/Shell.scala       |  35 --
 .../v5/kernel/socket/SocketConfig.scala         |  51 --
 .../v5/kernel/socket/SocketConnection.scala     |  35 --
 .../v5/kernel/socket/SocketFactory.scala        | 105 ----
 .../protocol/v5/kernel/socket/Stdin.scala       |  36 --
 .../socket/ZeromqKernelMessageSocket.scala      |  64 --
 .../kernel/protocol/v5/magic/MagicParser.scala  | 145 -----
 .../protocol/v5/magic/PostProcessor.scala       |  35 --
 .../protocol/v5/relay/ExecuteRequestRelay.scala | 115 ----
 .../protocol/v5/relay/KernelMessageRelay.scala  | 179 ------
 .../protocol/v5/stream/KernelInputStream.scala  | 101 ---
 .../protocol/v5/stream/KernelOutputStream.scala | 130 ----
 .../com/ibm/spark/magic/builtin/AddDeps.scala   |  57 --
 .../com/ibm/spark/magic/builtin/AddJar.scala    | 144 -----
 .../ibm/spark/magic/builtin/BuiltinLoader.scala |  60 --
 .../com/ibm/spark/magic/builtin/Html.scala      |  44 --
 .../ibm/spark/magic/builtin/JavaScript.scala    |  45 --
 .../com/ibm/spark/magic/builtin/LSMagic.scala   |  65 --
 .../scala/com/ibm/spark/magic/builtin/RDD.scala |  61 --
 .../com/ibm/spark/magic/builtin/ShowTypes.scala |  41 --
 .../ibm/spark/magic/builtin/Truncation.scala    |  41 --
 .../com/ibm/spark/utils/MessageLogSupport.scala |  74 ---
 .../com/ibm/spark/utils/json/RddToJson.scala    |  41 --
 .../scala/org/apache/toree/SparkKernel.scala    |  43 ++
 .../apache/toree/boot/CommandLineOptions.scala  | 199 ++++++
 .../org/apache/toree/boot/KernelBootstrap.scala | 172 ++++++
 .../toree/boot/layer/BareInitialization.scala   | 181 ++++++
 .../boot/layer/ComponentInitialization.scala    | 200 ++++++
 .../boot/layer/HandlerInitialization.scala      | 185 ++++++
 .../toree/boot/layer/HookInitialization.scala   | 107 ++++
 .../toree/boot/layer/InterpreterManager.scala   |  66 ++
 .../apache/toree/comm/KernelCommManager.scala   |  47 ++
 .../apache/toree/comm/KernelCommWriter.scala    |  60 ++
 .../toree/global/ExecuteRequestState.scala      |  50 ++
 .../apache/toree/global/ExecutionCounter.scala  |  38 ++
 .../toree/global/ScheduledTaskManager.scala     |  23 +
 .../toree/kernel/api/FactoryMethods.scala       |  89 +++
 .../org/apache/toree/kernel/api/Kernel.scala    | 448 ++++++++++++++
 .../apache/toree/kernel/api/StreamMethods.scala |  48 ++
 .../protocol/v5/dispatch/StatusDispatch.scala   |  51 ++
 .../protocol/v5/handler/BaseHandler.scala       |  67 ++
 .../v5/handler/CodeCompleteHandler.scala        |  65 ++
 .../protocol/v5/handler/CommCloseHandler.scala  |  84 +++
 .../protocol/v5/handler/CommMsgHandler.scala    |  84 +++
 .../protocol/v5/handler/CommOpenHandler.scala   |  88 +++
 .../v5/handler/ExecuteRequestHandler.scala      | 163 +++++
 .../handler/GenericSocketMessageHandler.scala   |  58 ++
 .../v5/handler/InputRequestReplyHandler.scala   |  78 +++
 .../v5/handler/KernelInfoRequestHandler.scala   |  68 +++
 .../protocol/v5/handler/ShutdownHandler.scala   |  64 ++
 .../v5/interpreter/InterpreterActor.scala       |  99 +++
 .../protocol/v5/interpreter/package.scala       |  26 +
 .../tasks/CodeCompleteTaskActor.scala           |  40 ++
 .../tasks/ExecuteRequestTaskActor.scala         | 123 ++++
 .../tasks/InterpreterTaskFactory.scala          |  36 ++
 .../kernel/protocol/v5/kernel/ActorLoader.scala |  51 ++
 .../kernel/protocol/v5/kernel/Utilities.scala   | 108 ++++
 .../protocol/v5/kernel/socket/Control.scala     |  35 ++
 .../protocol/v5/kernel/socket/Heartbeat.scala   |  39 ++
 .../protocol/v5/kernel/socket/IOPub.scala       |  51 ++
 .../protocol/v5/kernel/socket/Shell.scala       |  35 ++
 .../v5/kernel/socket/SocketConfig.scala         |  51 ++
 .../v5/kernel/socket/SocketConnection.scala     |  35 ++
 .../v5/kernel/socket/SocketFactory.scala        | 105 ++++
 .../protocol/v5/kernel/socket/Stdin.scala       |  36 ++
 .../socket/ZeromqKernelMessageSocket.scala      |  64 ++
 .../kernel/protocol/v5/magic/MagicParser.scala  | 145 +++++
 .../protocol/v5/magic/PostProcessor.scala       |  35 ++
 .../protocol/v5/relay/ExecuteRequestRelay.scala | 115 ++++
 .../protocol/v5/relay/KernelMessageRelay.scala  | 179 ++++++
 .../protocol/v5/stream/KernelInputStream.scala  | 101 +++
 .../protocol/v5/stream/KernelOutputStream.scala | 130 ++++
 .../apache/toree/magic/builtin/AddDeps.scala    |  57 ++
 .../org/apache/toree/magic/builtin/AddJar.scala | 144 +++++
 .../toree/magic/builtin/BuiltinLoader.scala     |  60 ++
 .../org/apache/toree/magic/builtin/Html.scala   |  44 ++
 .../apache/toree/magic/builtin/JavaScript.scala |  45 ++
 .../apache/toree/magic/builtin/LSMagic.scala    |  65 ++
 .../org/apache/toree/magic/builtin/RDD.scala    |  61 ++
 .../apache/toree/magic/builtin/ShowTypes.scala  |  41 ++
 .../apache/toree/magic/builtin/Truncation.scala |  41 ++
 .../apache/toree/utils/MessageLogSupport.scala  |  74 +++
 .../org/apache/toree/utils/json/RddToJson.scala |  41 ++
 .../ibm/spark/boot/CommandLineOptionsSpec.scala | 328 ----------
 .../ibm/spark/comm/KernelCommManagerSpec.scala  |  74 ---
 .../ibm/spark/comm/KernelCommWriterSpec.scala   | 270 --------
 .../ibm/spark/global/ExecutionCounterSpec.scala |  34 --
 .../com/ibm/spark/kernel/api/KernelSpec.scala   | 178 ------
 .../spark/kernel/api/StreamMethodsSpec.scala    |  70 ---
 .../v5/dispatch/StatusDispatchSpec.scala        |  73 ---
 .../v5/handler/CodeCompleteHandlerSpec.scala    | 112 ----
 .../v5/handler/CommCloseHandlerSpec.scala       | 155 -----
 .../v5/handler/CommMsgHandlerSpec.scala         | 153 -----
 .../v5/handler/CommOpenHandlerSpec.scala        | 157 -----
 .../v5/handler/ExecuteRequestHandlerSpec.scala  | 282 ---------
 .../GenericSocketMessageHandlerSpec.scala       |  52 --
 .../handler/InputRequestReplyHandlerSpec.scala  | 138 -----
 .../handler/KernelInfoRequestHandlerSpec.scala  |  69 ---
 .../tasks/ExecuteRequestTaskActorSpec.scala     | 181 ------
 .../protocol/v5/kernel/ActorLoaderSpec.scala    |  73 ---
 .../v5/kernel/SimpleActorLoaderSpec.scala       |  59 --
 .../protocol/v5/kernel/UtilitiesSpec.scala      | 112 ----
 .../v5/kernel/socket/HeartbeatSpec.scala        |  55 --
 .../protocol/v5/kernel/socket/IOPubSpec.scala   |  59 --
 .../protocol/v5/kernel/socket/ShellSpec.scala   |  83 ---
 .../v5/kernel/socket/SocketConfigSpec.scala     |  93 ---
 .../v5/kernel/socket/SocketConnectionSpec.scala |  31 -
 .../v5/kernel/socket/SocketFactorySpec.scala    |  31 -
 .../protocol/v5/kernel/socket/StdinSpec.scala   |  84 ---
 .../protocol/v5/magic/MagicParserSpec.scala     | 237 -------
 .../protocol/v5/magic/PostProcessorSpec.scala   | 123 ----
 .../v5/relay/ExecuteRequestRelaySpec.scala      | 183 ------
 .../v5/relay/KernelMessageRelaySpec.scala       | 243 --------
 .../v5/stream/KernelInputStreamSpec.scala       | 142 -----
 .../v5/stream/KernelOuputStreamSpec.scala       | 283 ---------
 .../ibm/spark/magic/builtin/AddDepsSpec.scala   | 184 ------
 .../ibm/spark/magic/builtin/AddJarSpec.scala    | 220 -------
 .../spark/magic/builtin/BuiltinLoaderSpec.scala |  40 --
 .../com/ibm/spark/magic/builtin/HtmlSpec.scala  |  37 --
 .../spark/magic/builtin/JavaScriptSpec.scala    |  36 --
 .../ibm/spark/magic/builtin/LSMagicSpec.scala   |  65 --
 .../com/ibm/spark/magic/builtin/RDDSpec.scala   | 117 ----
 .../ibm/spark/utils/json/RddToJsonSpec.scala    |  55 --
 .../toree/boot/CommandLineOptionsSpec.scala     | 328 ++++++++++
 .../toree/comm/KernelCommManagerSpec.scala      |  74 +++
 .../toree/comm/KernelCommWriterSpec.scala       | 270 ++++++++
 .../toree/global/ExecutionCounterSpec.scala     |  34 ++
 .../apache/toree/kernel/api/KernelSpec.scala    | 178 ++++++
 .../toree/kernel/api/StreamMethodsSpec.scala    |  70 +++
 .../v5/dispatch/StatusDispatchSpec.scala        |  73 +++
 .../v5/handler/CodeCompleteHandlerSpec.scala    | 112 ++++
 .../v5/handler/CommCloseHandlerSpec.scala       | 155 +++++
 .../v5/handler/CommMsgHandlerSpec.scala         | 153 +++++
 .../v5/handler/CommOpenHandlerSpec.scala        | 157 +++++
 .../v5/handler/ExecuteRequestHandlerSpec.scala  | 282 +++++++++
 .../GenericSocketMessageHandlerSpec.scala       |  52 ++
 .../handler/InputRequestReplyHandlerSpec.scala  | 138 +++++
 .../handler/KernelInfoRequestHandlerSpec.scala  |  69 +++
 .../tasks/ExecuteRequestTaskActorSpec.scala     | 181 ++++++
 .../protocol/v5/kernel/ActorLoaderSpec.scala    |  73 +++
 .../v5/kernel/SimpleActorLoaderSpec.scala       |  59 ++
 .../protocol/v5/kernel/UtilitiesSpec.scala      | 112 ++++
 .../v5/kernel/socket/HeartbeatSpec.scala        |  55 ++
 .../protocol/v5/kernel/socket/IOPubSpec.scala   |  59 ++
 .../protocol/v5/kernel/socket/ShellSpec.scala   |  83 +++
 .../v5/kernel/socket/SocketConfigSpec.scala     |  93 +++
 .../v5/kernel/socket/SocketConnectionSpec.scala |  31 +
 .../v5/kernel/socket/SocketFactorySpec.scala    |  31 +
 .../protocol/v5/kernel/socket/StdinSpec.scala   |  84 +++
 .../protocol/v5/magic/MagicParserSpec.scala     | 237 +++++++
 .../protocol/v5/magic/PostProcessorSpec.scala   | 123 ++++
 .../v5/relay/ExecuteRequestRelaySpec.scala      | 183 ++++++
 .../v5/relay/KernelMessageRelaySpec.scala       | 243 ++++++++
 .../v5/stream/KernelInputStreamSpec.scala       | 142 +++++
 .../v5/stream/KernelOuputStreamSpec.scala       | 283 +++++++++
 .../toree/magic/builtin/AddDepsSpec.scala       | 184 ++++++
 .../apache/toree/magic/builtin/AddJarSpec.scala | 220 +++++++
 .../toree/magic/builtin/BuiltinLoaderSpec.scala |  40 ++
 .../apache/toree/magic/builtin/HtmlSpec.scala   |  37 ++
 .../toree/magic/builtin/JavaScriptSpec.scala    |  36 ++
 .../toree/magic/builtin/LSMagicSpec.scala       |  65 ++
 .../apache/toree/magic/builtin/RDDSpec.scala    | 117 ++++
 .../apache/toree/utils/json/RddToJsonSpec.scala |  55 ++
 .../ibm/spark/annotations/Experimental.scala    |  25 -
 .../apache/toree/annotations/Experimental.scala |  25 +
 .../com/ibm/spark/comm/CommCallbacks.scala      | 168 -----
 .../scala/com/ibm/spark/comm/CommManager.scala  | 165 -----
 .../com/ibm/spark/comm/CommRegistrar.scala      | 487 ---------------
 .../scala/com/ibm/spark/comm/CommStorage.scala  | 160 -----
 .../scala/com/ibm/spark/comm/CommWriter.scala   | 110 ----
 .../ibm/spark/kernel/protocol/v5/Header.scala   |  67 --
 .../kernel/protocol/v5/HeaderBuilder.scala      |  42 --
 .../spark/kernel/protocol/v5/KMBuilder.scala    | 106 ----
 .../kernel/protocol/v5/KernelMessage.scala      |  26 -
 .../protocol/v5/KernelMessageContent.scala      |  27 -
 .../kernel/protocol/v5/SparkKernelInfo.scala    |  61 --
 .../protocol/v5/content/ClearOutput.scala       |  46 --
 .../kernel/protocol/v5/content/CommClose.scala  |  40 --
 .../protocol/v5/content/CommContent.scala       |  26 -
 .../kernel/protocol/v5/content/CommMsg.scala    |  39 --
 .../kernel/protocol/v5/content/CommOpen.scala   |  39 --
 .../protocol/v5/content/CompleteReply.scala     |  46 --
 .../protocol/v5/content/CompleteRequest.scala   |  40 --
 .../protocol/v5/content/ConnectReply.scala      |  42 --
 .../protocol/v5/content/ConnectRequest.scala    |  47 --
 .../protocol/v5/content/DisplayData.scala       |  41 --
 .../protocol/v5/content/ErrorContent.scala      |  47 --
 .../protocol/v5/content/ExecuteInput.scala      |  40 --
 .../protocol/v5/content/ExecuteReply.scala      |  59 --
 .../protocol/v5/content/ExecuteRequest.scala    |  64 --
 .../protocol/v5/content/ExecuteResult.scala     |  42 --
 .../protocol/v5/content/HistoryReply.scala      |  44 --
 .../protocol/v5/content/HistoryRequest.scala    |  47 --
 .../kernel/protocol/v5/content/InputReply.scala |  40 --
 .../protocol/v5/content/InputRequest.scala      |  40 --
 .../protocol/v5/content/InspectReply.scala      |  48 --
 .../protocol/v5/content/InspectRequest.scala    |  43 --
 .../protocol/v5/content/KernelInfoReply.scala   |  44 --
 .../protocol/v5/content/KernelInfoRequest.scala |  47 --
 .../protocol/v5/content/KernelStatus.scala      |  50 --
 .../protocol/v5/content/ShutdownReply.scala     |  40 --
 .../protocol/v5/content/ShutdownRequest.scala   |  39 --
 .../protocol/v5/content/StreamContent.scala     |  42 --
 .../kernel/protocol/v5/content/TypeString.scala |  30 -
 .../kernel/protocol/v5/content/package.scala    |  76 ---
 .../ibm/spark/kernel/protocol/v5/package.scala  | 163 -----
 .../scala/com/ibm/spark/utils/LogLike.scala     |  29 -
 .../org/apache/toree/comm/CommCallbacks.scala   | 168 +++++
 .../org/apache/toree/comm/CommManager.scala     | 165 +++++
 .../org/apache/toree/comm/CommRegistrar.scala   | 487 +++++++++++++++
 .../org/apache/toree/comm/CommStorage.scala     | 160 +++++
 .../org/apache/toree/comm/CommWriter.scala      | 110 ++++
 .../toree/kernel/protocol/v5/Header.scala       |  67 ++
 .../kernel/protocol/v5/HeaderBuilder.scala      |  42 ++
 .../toree/kernel/protocol/v5/KMBuilder.scala    | 106 ++++
 .../kernel/protocol/v5/KernelMessage.scala      |  26 +
 .../protocol/v5/KernelMessageContent.scala      |  27 +
 .../kernel/protocol/v5/SparkKernelInfo.scala    |  61 ++
 .../protocol/v5/content/ClearOutput.scala       |  46 ++
 .../kernel/protocol/v5/content/CommClose.scala  |  40 ++
 .../protocol/v5/content/CommContent.scala       |  26 +
 .../kernel/protocol/v5/content/CommMsg.scala    |  39 ++
 .../kernel/protocol/v5/content/CommOpen.scala   |  39 ++
 .../protocol/v5/content/CompleteReply.scala     |  46 ++
 .../protocol/v5/content/CompleteRequest.scala   |  40 ++
 .../protocol/v5/content/ConnectReply.scala      |  42 ++
 .../protocol/v5/content/ConnectRequest.scala    |  47 ++
 .../protocol/v5/content/DisplayData.scala       |  41 ++
 .../protocol/v5/content/ErrorContent.scala      |  47 ++
 .../protocol/v5/content/ExecuteInput.scala      |  40 ++
 .../protocol/v5/content/ExecuteReply.scala      |  59 ++
 .../protocol/v5/content/ExecuteRequest.scala    |  64 ++
 .../protocol/v5/content/ExecuteResult.scala     |  42 ++
 .../protocol/v5/content/HistoryReply.scala      |  44 ++
 .../protocol/v5/content/HistoryRequest.scala    |  47 ++
 .../kernel/protocol/v5/content/InputReply.scala |  40 ++
 .../protocol/v5/content/InputRequest.scala      |  40 ++
 .../protocol/v5/content/InspectReply.scala      |  48 ++
 .../protocol/v5/content/InspectRequest.scala    |  43 ++
 .../protocol/v5/content/KernelInfoReply.scala   |  44 ++
 .../protocol/v5/content/KernelInfoRequest.scala |  47 ++
 .../protocol/v5/content/KernelStatus.scala      |  50 ++
 .../protocol/v5/content/ShutdownReply.scala     |  40 ++
 .../protocol/v5/content/ShutdownRequest.scala   |  39 ++
 .../protocol/v5/content/StreamContent.scala     |  42 ++
 .../kernel/protocol/v5/content/TypeString.scala |  30 +
 .../kernel/protocol/v5/content/package.scala    |  76 +++
 .../toree/kernel/protocol/v5/package.scala      | 163 +++++
 .../scala/org/apache/toree/utils/LogLike.scala  |  29 +
 .../com/ibm/spark/comm/CommCallbacksSpec.scala  | 171 ------
 .../com/ibm/spark/comm/CommManagerSpec.scala    | 198 ------
 .../com/ibm/spark/comm/CommRegistrarSpec.scala  | 460 --------------
 .../com/ibm/spark/comm/CommStorageSpec.scala    | 248 --------
 .../com/ibm/spark/comm/CommWriterSpec.scala     | 209 -------
 .../kernel/protocol/v5/HeaderBuilderSpec.scala  |  54 --
 .../spark/kernel/protocol/v5/HeaderSpec.scala   |  75 ---
 .../kernel/protocol/v5/KMBuilderSpec.scala      | 156 -----
 .../protocol/v5/content/ClearOutputSpec.scala   |  72 ---
 .../protocol/v5/content/CommCloseSpec.scala     |  73 ---
 .../protocol/v5/content/CommMsgSpec.scala       | 105 ----
 .../protocol/v5/content/CommOpenSpec.scala      |  74 ---
 .../v5/content/CompleteReplyErrorSpec.scala     |  73 ---
 .../v5/content/CompleteReplyOkSpec.scala        |  70 ---
 .../protocol/v5/content/CompleteReplySpec.scala |  80 ---
 .../v5/content/CompleteRequestSpec.scala        |  72 ---
 .../protocol/v5/content/ConnectReplySpec.scala  |  77 ---
 .../v5/content/ConnectRequestSpec.scala         |  67 --
 .../protocol/v5/content/DisplayDataSpec.scala   |  76 ---
 .../protocol/v5/content/ErrorContentSpec.scala  |  71 ---
 .../protocol/v5/content/ExecuteInputSpec.scala  |  71 ---
 .../v5/content/ExecuteReplyAbortSpec.scala      |  67 --
 .../v5/content/ExecuteReplyErrorSpec.scala      |  71 ---
 .../v5/content/ExecuteReplyOkSpec.scala         |  70 ---
 .../protocol/v5/content/ExecuteReplySpec.scala  |  73 ---
 .../v5/content/ExecuteRequestSpec.scala         |  76 ---
 .../protocol/v5/content/ExecuteResultSpec.scala | 109 ----
 .../protocol/v5/content/HistoryReplySpec.scala  |  73 ---
 .../v5/content/HistoryRequestSpec.scala         |  79 ---
 .../protocol/v5/content/InputReplySpec.scala    |  71 ---
 .../protocol/v5/content/InputRequestSpec.scala  |  72 ---
 .../v5/content/InspectReplyErrorSpec.scala      |  71 ---
 .../v5/content/InspectReplyOkSpec.scala         |  69 ---
 .../protocol/v5/content/InspectReplySpec.scala  |  73 ---
 .../v5/content/InspectRequestSpec.scala         |  73 ---
 .../v5/content/KernelInfoReplySpec.scala        |  76 ---
 .../v5/content/KernelInfoRequestSpec.scala      |  68 ---
 .../protocol/v5/content/KernelStatusSpec.scala  |  68 ---
 .../protocol/v5/content/ShutdownReplySpec.scala |  71 ---
 .../v5/content/ShutdownRequestSpec.scala        |  71 ---
 .../protocol/v5/content/StreamContentSpec.scala |  70 ---
 .../ibm/spark/kernel/protocol/v5/package.scala  |  51 --
 .../apache/toree/comm/CommCallbacksSpec.scala   | 171 ++++++
 .../org/apache/toree/comm/CommManagerSpec.scala | 198 ++++++
 .../apache/toree/comm/CommRegistrarSpec.scala   | 460 ++++++++++++++
 .../org/apache/toree/comm/CommStorageSpec.scala | 248 ++++++++
 .../org/apache/toree/comm/CommWriterSpec.scala  | 209 +++++++
 .../kernel/protocol/v5/HeaderBuilderSpec.scala  |  54 ++
 .../toree/kernel/protocol/v5/HeaderSpec.scala   |  75 +++
 .../kernel/protocol/v5/KMBuilderSpec.scala      | 156 +++++
 .../protocol/v5/content/ClearOutputSpec.scala   |  72 +++
 .../protocol/v5/content/CommCloseSpec.scala     |  73 +++
 .../protocol/v5/content/CommMsgSpec.scala       | 105 ++++
 .../protocol/v5/content/CommOpenSpec.scala      |  74 +++
 .../v5/content/CompleteReplyErrorSpec.scala     |  73 +++
 .../v5/content/CompleteReplyOkSpec.scala        |  70 +++
 .../protocol/v5/content/CompleteReplySpec.scala |  80 +++
 .../v5/content/CompleteRequestSpec.scala        |  72 +++
 .../protocol/v5/content/ConnectReplySpec.scala  |  77 +++
 .../v5/content/ConnectRequestSpec.scala         |  67 ++
 .../protocol/v5/content/DisplayDataSpec.scala   |  76 +++
 .../protocol/v5/content/ErrorContentSpec.scala  |  71 +++
 .../protocol/v5/content/ExecuteInputSpec.scala  |  71 +++
 .../v5/content/ExecuteReplyAbortSpec.scala      |  67 ++
 .../v5/content/ExecuteReplyErrorSpec.scala      |  71 +++
 .../v5/content/ExecuteReplyOkSpec.scala         |  70 +++
 .../protocol/v5/content/ExecuteReplySpec.scala  |  73 +++
 .../v5/content/ExecuteRequestSpec.scala         |  76 +++
 .../protocol/v5/content/ExecuteResultSpec.scala | 109 ++++
 .../protocol/v5/content/HistoryReplySpec.scala  |  73 +++
 .../v5/content/HistoryRequestSpec.scala         |  79 +++
 .../protocol/v5/content/InputReplySpec.scala    |  71 +++
 .../protocol/v5/content/InputRequestSpec.scala  |  72 +++
 .../v5/content/InspectReplyErrorSpec.scala      |  71 +++
 .../v5/content/InspectReplyOkSpec.scala         |  69 +++
 .../protocol/v5/content/InspectReplySpec.scala  |  73 +++
 .../v5/content/InspectRequestSpec.scala         |  73 +++
 .../v5/content/KernelInfoReplySpec.scala        |  76 +++
 .../v5/content/KernelInfoRequestSpec.scala      |  68 +++
 .../protocol/v5/content/KernelStatusSpec.scala  |  68 +++
 .../protocol/v5/content/ShutdownReplySpec.scala |  71 +++
 .../v5/content/ShutdownRequestSpec.scala        |  71 +++
 .../protocol/v5/content/StreamContentSpec.scala |  70 +++
 .../toree/kernel/protocol/v5/package.scala      |  51 ++
 .../interpreter/pyspark/PySparkBridge.scala     |  61 --
 .../interpreter/pyspark/PySparkException.scala  |  26 -
 .../pyspark/PySparkInterpreter.scala            | 162 -----
 .../interpreter/pyspark/PySparkProcess.scala    |  89 ---
 .../pyspark/PySparkProcessHandler.scala         |  38 --
 .../interpreter/pyspark/PySparkService.scala    | 104 ----
 .../interpreter/pyspark/PySparkState.scala      |  27 -
 .../pyspark/PySparkTransformer.scala            |  24 -
 .../interpreter/pyspark/PySparkTypes.scala      |  23 -
 .../kernel/interpreter/pyspark/package.scala    |  34 --
 .../com/ibm/spark/magic/builtin/PySpark.scala   |  53 --
 .../interpreter/pyspark/PySparkBridge.scala     |  61 ++
 .../interpreter/pyspark/PySparkException.scala  |  26 +
 .../pyspark/PySparkInterpreter.scala            | 162 +++++
 .../interpreter/pyspark/PySparkProcess.scala    |  89 +++
 .../pyspark/PySparkProcessHandler.scala         |  38 ++
 .../interpreter/pyspark/PySparkService.scala    | 104 ++++
 .../interpreter/pyspark/PySparkState.scala      |  27 +
 .../pyspark/PySparkTransformer.scala            |  24 +
 .../interpreter/pyspark/PySparkTypes.scala      |  23 +
 .../kernel/interpreter/pyspark/package.scala    |  34 ++
 .../apache/toree/magic/builtin/PySpark.scala    |  53 ++
 .../interpreter/scala/ScalaException.scala      |  23 -
 .../interpreter/scala/ScalaInterpreter.scala    | 611 -------------------
 .../scala/SettingsProducerLike.scala            |  37 --
 .../scala/SparkIMainProducerLike.scala          |  45 --
 .../scala/TaskManagerProducerLike.scala         |  32 -
 .../com/ibm/spark/magic/builtin/Scala.scala     |  53 --
 .../interpreter/scala/ScalaException.scala      |  23 +
 .../interpreter/scala/ScalaInterpreter.scala    | 611 +++++++++++++++++++
 .../scala/SettingsProducerLike.scala            |  37 ++
 .../scala/SparkIMainProducerLike.scala          |  45 ++
 .../scala/TaskManagerProducerLike.scala         |  32 +
 .../org/apache/toree/magic/builtin/Scala.scala  |  53 ++
 .../scala/ScalaInterpreterSpec.scala            | 403 ------------
 .../scala/ScalaInterpreterSpec.scala            | 403 ++++++++++++
 .../interpreter/sparkr/ReflectiveRBackend.scala |  50 --
 .../interpreter/sparkr/SparkRBridge.scala       |  78 ---
 .../interpreter/sparkr/SparkRException.scala    |  25 -
 .../interpreter/sparkr/SparkRInterpreter.scala  | 154 -----
 .../interpreter/sparkr/SparkRProcess.scala      |  66 --
 .../sparkr/SparkRProcessHandler.scala           |  37 --
 .../interpreter/sparkr/SparkRService.scala      | 121 ----
 .../kernel/interpreter/sparkr/SparkRState.scala |  27 -
 .../interpreter/sparkr/SparkRTransformer.scala  |  23 -
 .../kernel/interpreter/sparkr/SparkRTypes.scala |  23 -
 .../kernel/interpreter/sparkr/package.scala     |  34 --
 .../com/ibm/spark/magic/builtin/SparkR.scala    |  52 --
 .../interpreter/sparkr/ReflectiveRBackend.scala |  50 ++
 .../interpreter/sparkr/SparkRBridge.scala       |  78 +++
 .../interpreter/sparkr/SparkRException.scala    |  25 +
 .../interpreter/sparkr/SparkRInterpreter.scala  | 154 +++++
 .../interpreter/sparkr/SparkRProcess.scala      |  66 ++
 .../sparkr/SparkRProcessHandler.scala           |  37 ++
 .../interpreter/sparkr/SparkRService.scala      | 121 ++++
 .../kernel/interpreter/sparkr/SparkRState.scala |  27 +
 .../interpreter/sparkr/SparkRTransformer.scala  |  23 +
 .../kernel/interpreter/sparkr/SparkRTypes.scala |  23 +
 .../kernel/interpreter/sparkr/package.scala     |  34 ++
 .../org/apache/toree/magic/builtin/SparkR.scala |  52 ++
 .../kernel/interpreter/sql/SqlException.scala   |  26 -
 .../kernel/interpreter/sql/SqlInterpreter.scala | 122 ----
 .../kernel/interpreter/sql/SqlService.scala     |  70 ---
 .../kernel/interpreter/sql/SqlTransformer.scala |  23 -
 .../spark/kernel/interpreter/sql/SqlTypes.scala |  23 -
 .../scala/com/ibm/spark/magic/builtin/Sql.scala |  53 --
 .../kernel/interpreter/sql/SqlException.scala   |  26 +
 .../kernel/interpreter/sql/SqlInterpreter.scala | 122 ++++
 .../kernel/interpreter/sql/SqlService.scala     |  70 +++
 .../kernel/interpreter/sql/SqlTransformer.scala |  23 +
 .../toree/kernel/interpreter/sql/SqlTypes.scala |  23 +
 .../org/apache/toree/magic/builtin/Sql.scala    |  53 ++
 694 files changed, 30343 insertions(+), 30343 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/comm/ClientCommManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/comm/ClientCommManager.scala b/client/src/main/scala/com/ibm/spark/comm/ClientCommManager.scala
deleted file mode 100644
index a3a0d88..0000000
--- a/client/src/main/scala/com/ibm/spark/comm/ClientCommManager.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, UUID}
-
-/**
- * Represents a CommManager that uses a ClientCommWriter for its underlying
- * open implementation.
- *
- * @param actorLoader The actor loader to use with the ClientCommWriter
- * @param kmBuilder The KMBuilder to use with the ClientCommWriter
- * @param commRegistrar The registrar to use for callback registration
- */
-@Experimental
-class ClientCommManager(
-  private val actorLoader: ActorLoader,
-  private val kmBuilder: KMBuilder,
-  private val commRegistrar: CommRegistrar
-) extends CommManager(commRegistrar)
-{
-  /**
-   * Creates a new CommWriter instance given the Comm id.
-   *
-   * @param commId The Comm id to use with the Comm writer
-   *
-   * @return The new CommWriter instance
-   */
-  override protected def newCommWriter(commId: UUID): CommWriter =
-    new ClientCommWriter(actorLoader, kmBuilder, commId)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/comm/ClientCommWriter.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/comm/ClientCommWriter.scala b/client/src/main/scala/com/ibm/spark/comm/ClientCommWriter.scala
deleted file mode 100644
index 2c7f67c..0000000
--- a/client/src/main/scala/com/ibm/spark/comm/ClientCommWriter.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, CommContent}
-import com.ibm.spark.kernel.protocol.v5._
-
-/**
- * Represents a CommWriter to send messages from the Client to the Kernel.
- *
- * @param actorLoader The actor loader to use for loading actors responsible for
- *                    communication
- * @param kmBuilder The kernel message builder used to construct kernel messages
- * @param commId The comm id associated with this writer (defaults to a
- *               random UUID)
- */
-@Experimental
-class ClientCommWriter(
-  private val actorLoader: ActorLoader,
-  private val kmBuilder: KMBuilder,
-  override private[comm] val commId: v5.UUID
-) extends CommWriter(commId) {
-
-  /**
-   * Sends the comm message (open/msg/close) to the actor responsible for
-   * relaying messages.
-   *
-   * @param commContent The message to relay (will be packaged)
-   *
-   * @tparam T Either CommOpen, CommMsg, or CommClose
-   */
-  override protected[comm] def sendCommKernelMessage[
-    T <: KernelMessageContent with CommContent
-  ](commContent: T): Unit = {
-    val messageType = commContent match {
-      case _: CommOpen  => CommOpen.toTypeString
-      case _: CommMsg   => CommMsg.toTypeString
-      case _: CommClose => CommClose.toTypeString
-      case _            =>
-        throw new Throwable("Invalid kernel message type!")
-    }
-    actorLoader.load(SocketType.ShellClient) !
-      kmBuilder.withHeader(messageType).withContentString(commContent).build
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/ActorLoader.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/ActorLoader.scala
deleted file mode 100644
index 6c9dccd..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/ActorLoader.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client
-
-import akka.actor.{ActorRefFactory, ActorSelection}
-
-/**
- * This trait defines the interface for loading actors based on some value
- * (enum, attribute, etc...). The thought is to allow external consumers
- * acquire actors through a common interface, minimizing the spread of the
- * logic about the Actors, ActorSystem, and other similar concepts.
- */
-trait ActorLoader {
-  /**
-   * This method is meant to find an actor associated with an enum value.
-   * This enum value can map to an actor associated with handling a specific
-   * kernel message, a socket type, or other functionality.
-   * @param actorEnum The enum value used to load the actor
-   * @return An ActorSelection to pass messages to
-   */
-  def load(actorEnum: Enumeration#Value): ActorSelection
-}
-
-case class SimpleActorLoader(actorRefFactory: ActorRefFactory)
-  extends ActorLoader
-{
-  private val userActorDirectory: String = "/user/%s"
-
-  override def load(actorEnum: Enumeration#Value): ActorSelection = {
-    actorRefFactory.actorSelection(
-      userActorDirectory.format(actorEnum.toString)
-    )
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClient.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClient.scala
deleted file mode 100644
index 7544ee9..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClient.scala
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client
-
-import akka.actor.ActorSystem
-import akka.pattern.ask
-import akka.util.Timeout
-import com.ibm.spark.comm._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, ExecuteRequestTuple}
-import com.ibm.spark.kernel.protocol.v5.client.socket.HeartbeatMessage
-import com.ibm.spark.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-import com.ibm.spark.utils.LogLike
-import scala.concurrent.duration._
-
-import scala.concurrent.ExecutionContext.Implicits.global
-import scala.util.{Failure, Success}
-
-/**
- * Client API for Spark Kernel.
- *
- * Note: This takes a moment to initialize an actor system, so take appropriate action
- * if an API is to be used immediately after initialization.
- *
- * The actorSystem parameter allows shutdown of this client's ActorSystem.
- */
-class SparkKernelClient(
-  private val actorLoader: ActorLoader,
-  private val actorSystem: ActorSystem,
-  private val commRegistrar: CommRegistrar
-) extends LogLike {
-  implicit val timeout = Timeout(21474835.seconds)
-
-  /**
-   * Executes code on the Spark Kernel.
-   * Gives a <code>DeferredExecution</code> used to handle results from
-   * code execution. Specifically it can be used to register
-   * callbacks that handle stream results, the code execution result, or code
-   * execution errors.
-   *
-   * Code that prints to stdout is considered streaming and will be sent to all
-   * callbacks registered with the onStream() method. For example:
-   * <code>
-   * client.execute("println(1)").onStream(someFunction)
-   * </code>
-   * someFunction will receive a
-   * {@link com.ibm.spark.kernel.protocol.v5.content.StreamContent} message:
-   * <code>
-   * {
-   *  "name" : "stdout",
-   *  "text" : "1"
-   * }
-   * </code>
-   *
-   * Code that produces a result will cause invocation of the callbacks
-   * registered with the onResult() method. The callbacks will be invoked with
-   * the result of the executed code. For example:
-   * <code>
-   * client.execute("1+1").onResult(someFunction)
-   * </code>
-   * someFunction will receive a
-   * {@link com.ibm.spark.kernel.protocol.v5.content.ExecuteResult} message:
-   * <code>
-   * {
-   *  "execution_count" : 1,
-   *  "data" : {
-   *    "text/plain" : "2"
-   *  },
-   *  "metadata" : {}
-   * }
-   * </code>
-   *
-   * Code that produces an error will be sent to all callbacks registered
-   * with the onResult() method. For example:
-   * <code>
-   * client.execute("1+1").onResult(someFunction)
-   * </code>
-   * someFunction will be invoked with an
-   * {@link com.ibm.spark.kernel.protocol.v5.content.ExecuteReply} message
-   * containing the error.
-   *
-   * @param code Scala code
-   * @return The DeferredExecution associated with the code execution.
-   */
-  def execute(code: String): DeferredExecution = {
-    val request = ExecuteRequest(code, false, true, UserExpressions(), true)
-    val de = new DeferredExecution
-    actorLoader.load(MessageType.Incoming.ExecuteRequest) ! ExecuteRequestTuple(request, de)
-    de
-  }
-
-  /**
-   * Sets the response function used when input is requested by the kernel.
-   * @param responseFunc The response function to use
-   */
-  def setResponseFunction(responseFunc: ResponseFunction): Unit =
-    actorLoader.load(SocketType.StdInClient) ! responseFunc
-
-  /**
-   * Represents the exposed interface for Comm communication with the kernel.
-   */
-  val comm = new ClientCommManager(
-    actorLoader = actorLoader,
-    kmBuilder = KMBuilder(),
-    commRegistrar = commRegistrar
-  )
-
-  // TODO: hide this? just heartbeat to see if kernel is reachable?
-  def heartbeat(failure: () => Unit): Unit = {
-    val future = actorLoader.load(SocketType.Heartbeat) ? HeartbeatMessage
-
-    future.onComplete {
-      case Success(_) =>
-        logger.info("Client received heartbeat.")
-      case Failure(_) =>
-        failure()
-        logger.info("There was an error receiving heartbeat from kernel.")
-    }
-  }
-
-  def shutdown() = {
-    logger.info("Shutting down client")
-    actorSystem.shutdown()
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/Utilities.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/Utilities.scala
deleted file mode 100644
index 56e88c6..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/Utilities.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client
-
-import java.nio.charset.Charset
-
-import akka.util.{ByteString, Timeout}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-import com.ibm.spark.utils.LogLike
-import play.api.data.validation.ValidationError
-import play.api.libs.json.{JsPath, Json, Reads}
-
-import scala.concurrent.duration._
-
-object Utilities extends LogLike {
-  //
-  // NOTE: This is brought in to remove feature warnings regarding the use of
-  //       implicit conversions regarding the following:
-  //
-  //       1. ByteStringToString
-  //       2. ZMQMessageToKernelMessage
-  //
-  import scala.language.implicitConversions
-
-  private val sessionId: UUID = java.util.UUID.randomUUID().toString
-
-  /**
-   * This timeout needs to be defined for the Akka asks to timeout
-   */
-  implicit val timeout = Timeout(21474835.seconds) // Maximum delay
-
-  implicit def ByteStringToString(byteString : ByteString) : String = {
-    new String(byteString.toArray, Charset.forName("UTF-8"))
-  }
-
-  implicit def StringToByteString(string : String) : ByteString = {
-    ByteString(string.getBytes)
-  }
-
-  implicit def ZMQMessageToKernelMessage(message: ZMQMessage): KernelMessage = {
-    val delimiterIndex: Int =
-      message.frames.indexOf(ByteString("<IDS|MSG>".getBytes))
-    //  TODO Handle the case where there is no delimeter
-    val ids: Seq[String] =
-      message.frames.take(delimiterIndex).map(
-        (byteString : ByteString) =>  { new String(byteString.toArray) }
-      )
-    val header = Json.parse(message.frames(delimiterIndex + 2)).as[Header]
-    val parentHeader = Json.parse(message.frames(delimiterIndex + 3)).validate[ParentHeader].fold[ParentHeader](
-      // TODO: Investigate better solution than setting parentHeader to null for {}
-      (invalid: Seq[(JsPath, Seq[ValidationError])]) => null, //HeaderBuilder.empty,
-      (valid: ParentHeader) => valid
-    )
-    val metadata = Json.parse(message.frames(delimiterIndex + 4)).as[Metadata]
-
-    KMBuilder().withIds(ids.toList)
-               .withSignature(message.frame(delimiterIndex + 1))
-               .withHeader(header)
-               .withParentHeader(parentHeader)
-               .withMetadata(metadata)
-               .withContentString(message.frame(delimiterIndex + 5)).build(false)
-  }
-
-  implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = {
-    val frames: scala.collection.mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer()
-    kernelMessage.ids.map((id : String) => frames += id )
-    frames += "<IDS|MSG>"
-    frames += kernelMessage.signature
-    frames += Json.toJson(kernelMessage.header).toString()
-    frames += Json.toJson(kernelMessage.parentHeader).toString()
-    frames += Json.toJson(kernelMessage.metadata).toString
-    frames += kernelMessage.contentString
-    ZMQMessage(frames  : _*)
-  }
-
-  def parseAndHandle[T](json: String, reads: Reads[T], handler: T => Unit) : Unit = {
-    Json.parse(json).validate[T](reads).fold(
-      (invalid: Seq[(JsPath, Seq[ValidationError])]) =>
-        logger.error(s"Could not parse JSON, ${json}"),
-      (content: T) => handler(content)
-    )
-  }
-
-  def getSessionId = sessionId
-
-  def toKernelMessage(message: ExecuteRequest): KernelMessage = {
-    // construct a kernel message whose content is an ExecuteRequest
-    val id = java.util.UUID.randomUUID().toString
-    val header = Header(
-      id, "spark", sessionId, MessageType.Incoming.ExecuteRequest.toString, "5.0")
-
-    KMBuilder().withIds(Seq[String]()).withSignature("").withHeader(header)
-      .withParentHeader(HeaderBuilder.empty).withContentString(message).build
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/ClientBootstrap.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/ClientBootstrap.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/ClientBootstrap.scala
deleted file mode 100644
index e75f7dd..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/ClientBootstrap.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.boot
-
-import akka.actor.ActorSystem
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.client.boot.layers._
-import com.ibm.spark.kernel.protocol.v5.client.socket.{SocketConfig, SocketFactory}
-import com.ibm.spark.kernel.protocol.v5.client.{SimpleActorLoader, SparkKernelClient}
-import com.ibm.spark.utils.LogLike
-import com.typesafe.config.Config
-import org.zeromq.ZMQ
-
-object ClientBootstrap {
-  /**
-   * Generates a new unique name for a client actor system.
-   *
-   * @return The unique name as a string
-   */
-  def newActorSystemName(): String =
-    "spark-client-actor-system-" + java.util.UUID.randomUUID().toString
-}
-
-class ClientBootstrap(config: Config) extends LogLike {
-  this: SystemInitialization with HandlerInitialization =>
-
-  /**
-   * Creates a new Spark Kernel client instance.
-   *
-   * @return The new client instance
-   */
-  def createClient(
-    actorSystemName: String = ClientBootstrap.newActorSystemName()
-  ): SparkKernelClient = {
-    logger.trace(s"Creating new kernel client actor system, '$actorSystemName'")
-    val actorSystem = ActorSystem(actorSystemName)
-
-    logger.trace(s"Creating actor loader for actor system, '$actorSystemName'")
-    val actorLoader = SimpleActorLoader(actorSystem)
-
-    logger.trace(s"Creating socket factory for actor system, '$actorSystemName")
-    val socketFactory = new SocketFactory(SocketConfig.fromConfig(config))
-
-    logger.trace(s"Initializing underlying system for, '$actorSystemName'")
-    val (_, _, _, _, commRegistrar, _) =
-      initializeSystem(config, actorSystem, actorLoader, socketFactory)
-
-    logger.trace(s"Initializing handlers for, '$actorSystemName'")
-    initializeHandlers(actorSystem, actorLoader)
-
-    logger.trace(s"ZeroMQ (JeroMQ) version: ${ZMQ.getVersionString}")
-
-    new SparkKernelClient(actorLoader, actorSystem, commRegistrar)
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
deleted file mode 100644
index 57a294a..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.client.boot.layers
-
-import akka.actor.{ActorSystem, Props}
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.MessageType
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-import com.ibm.spark.kernel.protocol.v5.client.handler.ExecuteHandler
-import com.ibm.spark.utils.LogLike
-
-/**
- * Represents the event handler initialization such as message handlers.
- */
-trait HandlerInitialization {
-  /**
-   * Initializes event handlers.
-   *
-   * @param actorSystem The actor system used by the client
-   * @param actorLoader The actor loader used by the client
-   */
-  def initializeHandlers(
-    actorSystem: ActorSystem, actorLoader: ActorLoader
-  ): Unit
-}
-
-/**
- * Represents the standard implementation of HandlerInitialization.
- */
-trait StandardHandlerInitialization extends HandlerInitialization {
-  this: LogLike =>
-
-  /**
-   * Initializes event handlers.
-   *
-   * @param actorSystem The actor system used by the client
-   * @param actorLoader The actor loader used by the client
-   */
-  override def initializeHandlers(
-    actorSystem: ActorSystem, actorLoader: ActorLoader
-  ): Unit = initializeMessageHandlers(actorSystem, actorLoader)
-
-  private def initializeRequestHandler[T](
-    actorSystem: ActorSystem, actorLoader: ActorLoader,
-    clazz: Class[T], messageType: MessageType
-  ) = {
-    logger.info("Creating %s handler".format(messageType.toString))
-    actorSystem.actorOf(Props(clazz, actorLoader), name = messageType.toString)
-  }
-
-  private def initializeMessageHandlers(
-    actorSystem: ActorSystem, actorLoader: ActorLoader
-  ): Unit = {
-    initializeRequestHandler(
-      actorSystem,
-      actorLoader,
-      classOf[ExecuteHandler],
-      MessageType.Incoming.ExecuteRequest
-    )
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
deleted file mode 100644
index 945017c..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.client.boot.layers
-
-import akka.actor.{Props, ActorRef, ActorSystem}
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.communication.security.{SecurityActorType, SignatureManagerActor}
-import com.ibm.spark.kernel.protocol.v5.SocketType
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.client.socket._
-import com.ibm.spark.utils.LogLike
-import com.typesafe.config.Config
-
-/**
- * Represents the system-related initialization such as socket actors.
- */
-trait SystemInitialization {
-  /**
-   * Initializes the system-related client objects.
-   *
-   * @param config The configuration for the system
-   * @param actorSystem The actor system used by the client
-   * @param actorLoader The actor loader used by the client
-   * @param socketFactory The socket factory used by the client
-   *
-   * @return The heartbeat, stdin, shell, and IOPub client actors and the Comm
-   *         registrar and storage used for Comm callbacks
-   */
-  def initializeSystem(
-    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader,
-    socketFactory: SocketFactory
-  ): (ActorRef, ActorRef, ActorRef, ActorRef, CommRegistrar, CommStorage)
-}
-
-/**
- * Represents the standard implementation of SystemInitialization.
- */
-trait StandardSystemInitialization extends SystemInitialization with LogLike {
-  /**
-   * Initializes the system-related client objects.
-   *
-   * @param config The configuration for the system
-   * @param actorSystem The actor system used by the client
-   * @param actorLoader The actor loader used by the client
-   * @param socketFactory The socket factory used by the client
-   *
-   * @return The heartbeat, shell, and IOPub client actors
-   */
-  override def initializeSystem(
-    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader,
-    socketFactory: SocketFactory
-  ): (ActorRef, ActorRef, ActorRef, ActorRef, CommRegistrar, CommStorage) = {
-    val commStorage = new CommStorage()
-    val commRegistrar = new CommRegistrar(commStorage)
-
-    val (heartbeat, stdin, shell, ioPub) = initializeSystemActors(
-      config = config,
-      actorSystem = actorSystem,
-      actorLoader = actorLoader,
-      socketFactory = socketFactory,
-      commRegistrar = commRegistrar,
-      commStorage = commStorage
-    )
-
-    val signatureManager = initializeSecurityActors(config, actorSystem)
-
-    (heartbeat, stdin, shell, ioPub, commRegistrar, commStorage)
-  }
-
-  private def initializeSystemActors(
-    config: Config, actorSystem: ActorSystem, actorLoader: ActorLoader,
-    socketFactory: SocketFactory, commRegistrar: CommRegistrar,
-    commStorage: CommStorage
-  ) = {
-    val signatureEnabled = config.getString("key").nonEmpty
-
-    val heartbeatClient = actorSystem.actorOf(
-      Props(classOf[HeartbeatClient],
-        socketFactory, actorLoader, signatureEnabled),
-      name = SocketType.HeartbeatClient.toString
-    )
-
-    val stdinClient = actorSystem.actorOf(
-      Props(classOf[StdinClient], socketFactory, actorLoader, signatureEnabled),
-      name = SocketType.StdInClient.toString
-    )
-
-    val shellClient = actorSystem.actorOf(
-      Props(classOf[ShellClient], socketFactory, actorLoader, signatureEnabled),
-      name = SocketType.ShellClient.toString
-    )
-
-    val ioPubClient = actorSystem.actorOf(
-      Props(classOf[IOPubClient], socketFactory, actorLoader, signatureEnabled,
-        commRegistrar, commStorage),
-      name = SocketType.IOPubClient.toString
-    )
-
-    (heartbeatClient, stdinClient, shellClient, ioPubClient)
-  }
-
-  private def initializeSecurityActors(
-    config: Config,
-    actorSystem: ActorSystem
-  ): Option[ActorRef] = {
-    val key = config.getString("key")
-    val signatureScheme = config.getString("signature_scheme").replace("-", "")
-
-    var signatureManager: Option[ActorRef] = None
-
-    if (key.nonEmpty) {
-      logger.debug(s"Initializing client signatures with key '$key'!")
-      signatureManager = Some(actorSystem.actorOf(
-        Props(classOf[SignatureManagerActor], key, signatureScheme),
-        name = SecurityActorType.SignatureManager.toString
-      ))
-    } else {
-      logger.debug(s"Signatures disabled for client!")
-    }
-
-    signatureManager
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/exception/ShellException.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/exception/ShellException.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/exception/ShellException.scala
deleted file mode 100644
index 6bb89ba..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/exception/ShellException.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.exception
-
-class ShellException(e: Throwable) extends Throwable {
-  val exception: Throwable = e
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecution.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecution.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecution.scala
deleted file mode 100644
index c6e7f86..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecution.scala
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.execution
-
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.utils.LogLike
-
-case class DeferredExecution() extends LogLike {
-  private var executeResultCallbacks: List[(ExecuteResult) => Unit] = Nil
-  private var streamCallbacks: List[(StreamContent) => Unit] = Nil
-  private var errorCallbacks: List[(ExecuteReplyError) => Unit] = Nil
-  private var successCallbacks: List[(ExecuteReplyError) => Unit] = Nil
-  private var executeResultOption: Option[ExecuteResult] = None
-  private var executeReplyOption: Option[ExecuteReply] = None
-
-  /**
-   * Registers a callback for handling ExecuteResult messages.
-   * This {@param callback} will run once on successful code execution and
-   * then be unregistered. If {@param callback} is registered after the result
-   * has been returned it will be invoked immediately.
-   * In the event of a failure {@param callback} will never be called.
-   * @param callback A callback function, which will be invoked at most once,
-   *                 with an ExecuteResult IPython message
-   * @return  The DeferredExecution with the given callback registered.
-   */
-  def onResult(callback: (ExecuteResult) => Unit): DeferredExecution = {
-    this.executeResultCallbacks = callback :: this.executeResultCallbacks
-    processCallbacks()
-    this
-  }
-
-  /**
-   * Registers a callback for handling StreamContent messages.
-   * Ths {@param callback} can be called 0 or more times. If the
-   * {@param callback} is registered after StreamContent messages have been
-   * emitted, the {@param callback} will only receive messages emitted after the
-   * point of registration.
-   * @param callback A callback function, which can be invoked 0 or more times,
-   *                 with Stream Ipython messages
-   * @return  The DeferredExecution with the given callback registered.
-   */
-  def onStream(callback: (StreamContent) => Unit): DeferredExecution = {
-    this.streamCallbacks = callback :: this.streamCallbacks
-    this
-  }
-
-  /**
-   * Registers a callback for handling ExecuteReply messages when there is an
-   * error during code execution. This {@param callback} will run once on failed
-   * code execution and then be unregistered. If {@param callback} is registered
-   * after the error reply has been returned it will be invoked immediately.
-   * In the event of successful code execution {@param callback} will never be
-   * called.
-   * @param callback A callback function, which will be invoked at most once,
-   *                 with an ExecuteReply IPython message
-   * @return  The DeferredExecution with the given callback registered.
-   */
-  def onError(callback: (ExecuteReplyError) => Unit): DeferredExecution = {
-    this.errorCallbacks = callback :: this.errorCallbacks
-    processCallbacks()
-    this
-  }
-
-  /**
-   * Registers a callback to be notified when code completion has completed
-   * successfully. {@param callback} will not be called if an error has been
-   * encountered, use {@method onError}.
-   * @param callback The callback to register.
-   * @return This deferred execution
-   */
-  def onSuccess(callback: (ExecuteReplyError) => Unit): DeferredExecution = {
-    this.successCallbacks = callback :: this.successCallbacks
-    processCallbacks()
-    this
-  }
-  //  In the next three methods we need to clear each list.
-  //  This prevents methods from getting called again when
-  //  a callback is registered after processing has happened
-  private def callErrorCallbacks(executeReplyError: ExecuteReplyError) = {
-    this.errorCallbacks.foreach(_(executeReplyError))
-    this.errorCallbacks = Nil
-  }
-
-  private def callSuccessCallbacks(executeReplyOk: ExecuteReplyOk) = {
-    this.successCallbacks.foreach(_(executeReplyOk))
-    this.successCallbacks = Nil
-  }
-
-  private def callResultCallbacks(executeResult: ExecuteResult) = {
-    this.executeResultCallbacks.foreach(_(executeResult))
-    this.executeResultCallbacks = Nil
-  }
-
-  private def processCallbacks(): Unit = {
-    (executeReplyOption, executeResultOption) match {
-      case (Some(executeReply), Some(executeResult)) if executeReply.status.equals("error") =>
-        callErrorCallbacks(executeReply)
-      case (Some(executeReply), Some(executeResult)) if executeReply.status.equals("ok") =>
-        callResultCallbacks(executeResult)
-        callSuccessCallbacks(executeReply)
-      case (Some(executeReply), None) if executeReply.status.equals("ok") =>
-        callSuccessCallbacks(executeReply)
-      case value =>
-        logger.debug(
-          s"""|Did not invoke client callbacks.
-              |ExecuteReply was: ${executeReplyOption}
-              |ExecuteResult was: ${executeResultOption}
-           """.stripMargin.trim)
-    }
-  }
-
-  def resolveResult(executeResultMessage: ExecuteResult): Unit = {
-    this.executeResultOption = Some(executeResultMessage)
-    processCallbacks()
-  }
-
-  def resolveReply(executeReplyMessage: ExecuteReply): Unit = {
-    this.executeReplyOption = Some(executeReplyMessage)
-    processCallbacks()
-  }
-
-  def emitStreamContent(streamContent: StreamContent): Unit = {
-    this.streamCallbacks.foreach(streamCallback => {
-      streamCallback(streamContent)
-    })
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
deleted file mode 100644
index 3c7489b..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.execution
-
-import com.ibm.spark.kernel.protocol.v5.UUID
-import com.ibm.spark.utils.LogLike
-
-import scala.collection.concurrent.{Map, TrieMap}
-
-object DeferredExecutionManager extends LogLike{
-  private val executionMap: Map[UUID, DeferredExecution] = TrieMap[UUID, DeferredExecution]()
-  
-  def add(id: UUID, de: DeferredExecution): Unit = executionMap += (id -> de)
-
-  def get(id: UUID): Option[DeferredExecution] = executionMap.get(id)
-
-  def remove(de: DeferredExecution): Unit = {
-    val optionalDE: Option[(UUID, DeferredExecution)] = executionMap.find {
-      case (id: UUID, searchedDe: DeferredExecution) => {
-        de.eq(searchedDe)
-    }}
-    optionalDE match {
-      case None =>
-        logger.warn("Searched and did not find deferred execution!")
-      case Some((id, foundDe)) =>
-        executionMap.remove(id)
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
deleted file mode 100644
index b9b1e5e..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.execution
-
-import com.ibm.spark.kernel.protocol.v5.UUID
-
-case class DeferredExecutionTuple ( id: UUID, de: DeferredExecution)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
deleted file mode 100644
index 6c8c751..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.execution
-
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-
-case class ExecuteRequestTuple(request: ExecuteRequest, de: DeferredExecution)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/handler/ExecuteHandler.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/handler/ExecuteHandler.scala b/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/handler/ExecuteHandler.scala
deleted file mode 100644
index 57d8e85..0000000
--- a/client/src/main/scala/com/ibm/spark/kernel/protocol/v5/client/handler/ExecuteHandler.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.handler
-
-import akka.actor.Actor
-import akka.util.Timeout
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.client.execution.{ExecuteRequestTuple, DeferredExecutionManager}
-import com.ibm.spark.utils.LogLike
-import scala.concurrent.duration._
-
-/**
- * Actor for handling client execute request and reply messages
- */
-class ExecuteHandler(actorLoader: ActorLoader) extends Actor with LogLike {
-  implicit val timeout = Timeout(21474835.seconds)
-
-  override def receive: Receive = {
-    case reqTuple: ExecuteRequestTuple =>
-      // create message to send to shell
-      val km: KernelMessage = Utilities.toKernelMessage(reqTuple.request)
-      //  Register the execution for this message id with the manager
-      DeferredExecutionManager.add(km.header.msg_id,reqTuple.de)
-
-      // send the message to the ShellClient
-      val shellClient = actorLoader.load(SocketType.ShellClient)
-      shellClient ! km
-  }
-}
\ No newline at end of file


[28/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
new file mode 100644
index 0000000..6f3789d
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import com.typesafe.config.Config
+import play.api.libs.json.Json
+
+case class SocketConfig (
+  stdin_port: Int,
+  control_port: Int,
+  hb_port: Int,
+  shell_port: Int,
+  iopub_port: Int,
+  ip : String,
+  transport: String,
+  signature_scheme: String,
+  key: String
+)
+
+object SocketConfig {
+  implicit val socketConfigReads = Json.reads[SocketConfig]
+  implicit val socketConfigWrites = Json.writes[SocketConfig]
+
+  def fromConfig(config: Config) = {
+    new SocketConfig(
+      config.getInt("stdin_port"),
+      config.getInt("control_port"),
+      config.getInt("hb_port"),
+      config.getInt("shell_port"),
+      config.getInt("iopub_port"),
+      config.getString("ip"),
+      config.getString("transport"),
+      config.getString("signature_scheme"),
+      config.getString("key")
+    )
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
new file mode 100644
index 0000000..fae1d0e
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+object SocketConnection {
+  def apply(protocol: String, ip: String, port: Int) =
+    new SocketConnection(protocol, ip, port)
+}
+
+/**
+ * Represent a connection string for a socket
+ * @param protocol The protocol portion of the connection (e.g. tcp, akka, udp)
+ * @param ip The hostname or ip address to bind on (e.g. *, myhost, 127.0.0.1)
+ * @param port The port for the socket to listen on
+ */
+class SocketConnection(protocol: String, ip: String, port: Int) {
+  private val SocketConnectionString : String = "%s://%s:%d"
+
+  override def toString: String = {
+    SocketConnectionString.format(protocol, ip, port)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
new file mode 100644
index 0000000..07b05d7
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import java.util.UUID
+
+import akka.actor.{Props, ActorRef, ActorSystem}
+import com.ibm.spark.communication.actors.{DealerSocketActor, ReqSocketActor, SubSocketActor}
+
+object SocketFactory {
+  def apply(socketConfig: SocketConfig) = {
+    new SocketFactory(socketConfig)
+  }
+}
+
+/**
+ * A Factor class to provide various socket connections for IPython Kernel Spec.
+ *
+ * @param socketConfig The configuration for the sockets to be properly
+ *                     instantiated
+ */
+class  SocketFactory(socketConfig: SocketConfig) {
+  /**
+   * Represents the identity shared between Shell and Stdin connections.
+   */
+  private val ZmqIdentity = UUID.randomUUID().toString
+
+  val HeartbeatConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.hb_port)
+  val ShellConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.shell_port)
+  val IOPubConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.iopub_port)
+  val StdinConnection = SocketConnection(
+    socketConfig.transport, socketConfig.ip, socketConfig.stdin_port)
+
+  /**
+   * Creates a ZeroMQ request socket representing the client endpoint for
+   * heartbeat messages.
+   *
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   *
+   * @return The ActorRef created for the socket connection
+   */
+  def HeartbeatClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
+    system.actorOf(Props(classOf[ReqSocketActor], HeartbeatConnection.toString, listener))
+//    ZeroMQExtension(system).newReqSocket(Array(
+//      Listener(listener), Connect(HeartbeatConnection.toString)
+//    ))
+  }
+
+  /**
+   * Creates a ZeroMQ request socket representing the client endpoint for shell
+   * messages. Generates an id for
+   * <a href="http://api.zeromq.org/2-1:zmq-setsockopt#toc6">
+   * Router/Dealer message routing</a>.
+   *
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   *
+   * @return The ActorRef created for the socket connection
+   */
+  def ShellClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
+    system.actorOf(Props(classOf[DealerSocketActor], ShellConnection.toString, listener))
+    //socket.setIdentity(ZmqIdentity)
+//    ZeroMQExtension(system).newDealerSocket(Array(
+//      Listener(listener), Connect(ShellConnection.toString),
+//      Identity(ZmqIdentity)
+//    ))
+  }
+
+  /**
+   * Creates a ZeroMQ reply socket representing the client endpoint for stdin
+   * messages. Generates an id for
+   * <a href="http://api.zeromq.org/2-1:zmq-setsockopt#toc6">
+   * Router/Dealer message routing</a>.
+   *
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   *
+   * @return The ActorRef created for the socket connection
+   */
+  def StdinClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
+    system.actorOf(Props(classOf[DealerSocketActor], StdinConnection.toString, listener))
+    //socket.setIdentity(ZmqIdentity)
+//    ZeroMQExtension(system).newDealerSocket(Array(
+//      Listener(listener), Connect(StdinConnection.toString),
+//      Identity(ZmqIdentity)
+//    ))
+  }
+
+  /**
+   * Creates a ZeroMQ request socket representing the client endpoint for IOPub
+   * messages.
+   *
+   * @param system The actor system the socket actor will belong
+   * @param listener The actor who will receive
+   *
+   * @return The ActorRef created for the socket connection
+   */
+  def IOPubClient(system: ActorSystem, listener: ActorRef) : ActorRef = {
+    system.actorOf(Props(classOf[SubSocketActor], IOPubConnection.toString, listener))
+    //socket.subscribe(ZMQ.SUBSCRIPTION_ALL)
+//    ZeroMQExtension(system).newSubSocket(Array(
+//      Listener(listener), Connect(IOPubConnection.toString), SubscribeAll
+//    ))
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
new file mode 100644
index 0000000..22c6071
--- /dev/null
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.client.socket
+
+import akka.actor.Actor
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.communication.security.SecurityActorType
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.{HeaderBuilder, KMBuilder, KernelMessage}
+import com.ibm.spark.kernel.protocol.v5.content.{InputReply, InputRequest}
+import com.ibm.spark.utils.LogLike
+import com.ibm.spark.kernel.protocol.v5.client.Utilities._
+import play.api.libs.json.Json
+
+import StdinClient._
+import akka.pattern.ask
+
+import scala.concurrent.duration._
+import scala.concurrent.Await
+
+object StdinClient {
+  type ResponseFunction = (String, Boolean) => String
+  val EmptyResponseFunction: ResponseFunction = (_, _) => ""
+}
+
+/**
+ * The client endpoint for Stdin messages specified in the IPython Kernel Spec
+ * @param socketFactory A factory to create the ZeroMQ socket connection
+ * @param actorLoader The loader used to retrieve actors
+ * @param signatureEnabled Whether or not to check and provide signatures
+ */
+class StdinClient(
+  socketFactory: SocketFactory,
+  actorLoader: ActorLoader,
+  signatureEnabled: Boolean
+) extends Actor with LogLike {
+  logger.debug("Created stdin client actor")
+
+  private val socket = socketFactory.StdinClient(context.system, self)
+
+  /**
+   * The function to use for generating a response from an input_request
+   * message.
+   */
+  private var responseFunc: ResponseFunction = EmptyResponseFunction
+
+  override def receive: Receive = {
+    case responseFunc: ResponseFunction =>
+      logger.debug("Updating response function")
+      this.responseFunc = responseFunc
+
+    case message: ZMQMessage =>
+      logger.debug("Received stdin kernel message")
+      val kernelMessage: KernelMessage = message
+      val messageType = kernelMessage.header.msg_type
+
+      if (messageType == InputRequest.toTypeString) {
+        logger.debug("Message is an input request")
+
+        val inputRequest =
+          Json.parse(kernelMessage.contentString).as[InputRequest]
+        val value = responseFunc(inputRequest.prompt, inputRequest.password)
+        val inputReply = InputReply(value)
+
+        val newKernelMessage = KMBuilder()
+          .withParent(kernelMessage)
+          .withHeader(HeaderBuilder.empty.copy(
+            msg_type = InputReply.toTypeString,
+            session = getSessionId
+          ))
+          .withContentString(inputReply)
+          .build
+
+        import scala.concurrent.ExecutionContext.Implicits.global
+        val messageWithSignature = if (signatureEnabled) {
+          val signatureManager =
+            actorLoader.load(SecurityActorType.SignatureManager)
+          val signatureMessage = signatureManager ? newKernelMessage
+          Await.result(signatureMessage, 100.milliseconds)
+            .asInstanceOf[KernelMessage]
+        } else newKernelMessage
+
+        val zmqMessage: ZMQMessage = messageWithSignature
+
+        socket ! zmqMessage
+      } else {
+        logger.debug(s"Unknown message of type $messageType")
+      }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/comm/ClientCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/comm/ClientCommManagerSpec.scala b/client/src/test/scala/com/ibm/spark/comm/ClientCommManagerSpec.scala
deleted file mode 100644
index 85ef4aa..0000000
--- a/client/src/test/scala/com/ibm/spark/comm/ClientCommManagerSpec.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content.CommContent
-import org.scalatest.mock.MockitoSugar
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-
-class ClientCommManagerSpec extends FunSpec with Matchers with BeforeAndAfter
-  with MockitoSugar
-{
-  private val TestTargetName = "some target"
-
-  private var mockActorLoader: ActorLoader = _
-  private var mockKMBuilder: KMBuilder = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var clientCommManager: ClientCommManager = _
-
-  private var generatedCommWriter: CommWriter = _
-
-  before {
-    mockActorLoader = mock[ActorLoader]
-    mockKMBuilder = mock[KMBuilder]
-    mockCommRegistrar = mock[CommRegistrar]
-
-    clientCommManager = new ClientCommManager(
-      mockActorLoader,
-      mockKMBuilder,
-      mockCommRegistrar
-    ) {
-      override protected def newCommWriter(commId: UUID): CommWriter = {
-        val commWriter = super.newCommWriter(commId)
-
-        generatedCommWriter = commWriter
-
-        val spyCommWriter = spy(commWriter)
-        doNothing().when(spyCommWriter)
-          .sendCommKernelMessage(any[KernelMessageContent with CommContent])
-
-        spyCommWriter
-      }
-    }
-  }
-
-  describe("ClientCommManager") {
-    describe("#open") {
-      it("should return a wrapped instance of ClientCommWriter") {
-        clientCommManager.open(TestTargetName, v5.MsgData.Empty)
-
-        // Exposed hackishly for testing
-        generatedCommWriter shouldBe a [ClientCommWriter]
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/comm/ClientCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/comm/ClientCommWriterSpec.scala b/client/src/test/scala/com/ibm/spark/comm/ClientCommWriterSpec.scala
deleted file mode 100644
index f5a4b43..0000000
--- a/client/src/test/scala/com/ibm/spark/comm/ClientCommWriterSpec.scala
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import java.util.UUID
-
-import akka.actor.{ActorSelection, ActorSystem}
-import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.typesafe.config.ConfigFactory
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import play.api.libs.json.Json
-
-import scala.concurrent.duration._
-
-object ClientCommWriterSpec {
-  val config ="""
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class ClientCommWriterSpec extends TestKit(
-  ActorSystem("ClientCommWriterSpec",
-    ConfigFactory.parseString(ClientCommWriterSpec.config))
-) with FunSpecLike with Matchers with BeforeAndAfter with MockitoSugar
-{
-
-  private val commId = UUID.randomUUID().toString
-  private var clientCommWriter: ClientCommWriter = _
-  private var kernelMessageBuilder: KMBuilder = _
-
-  private var actorLoader: ActorLoader = _
-  private var shellSocketProbe: TestProbe = _
-
-  /**
-   * Retrieves the next message available.
-   *
-   * @return The KernelMessage instance (or an error if timed out)
-   */
-  private def getNextMessage =
-    shellSocketProbe.receiveOne(200.milliseconds)
-      .asInstanceOf[KernelMessage]
-
-  /**
-   * Retrieves the next message available and returns its type.
-   *
-   * @return The type of the message (pulled from message header)
-   */
-  private def getNextMessageType = getNextMessage.header.msg_type
-
-  /**
-   * Retrieves the next message available and parses the content string.
-   *
-   * @tparam T The type to coerce the content string into
-   *
-   * @return The resulting KernelMessageContent instance
-   */
-  private def getNextMessageContents[T <: KernelMessageContent]
-    (implicit fjs: play.api.libs.json.Reads[T], mf: Manifest[T]) =
-  {
-    val receivedMessage = getNextMessage
-
-    Json.parse(receivedMessage.contentString).as[T]
-  }
-
-  before {
-    kernelMessageBuilder = spy(KMBuilder())
-
-    // Construct path for kernel message relay
-    actorLoader = mock[ActorLoader]
-    shellSocketProbe = TestProbe()
-    val shellSocketSelection: ActorSelection =
-      system.actorSelection(shellSocketProbe.ref.path.toString)
-    doReturn(shellSocketSelection)
-      .when(actorLoader).load(SocketType.ShellClient)
-
-    // Create a new writer to use for testing
-    clientCommWriter =
-      new ClientCommWriter(actorLoader, kernelMessageBuilder, commId)
-  }
-
-  describe("ClientCommWriter") {
-    describe("#writeOpen") {
-      it("should send a comm_open message to the relay") {
-        clientCommWriter.writeOpen(anyString())
-
-        getNextMessageType should be (CommOpen.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        clientCommWriter.writeOpen(anyString())
-
-        val actual = getNextMessageContents[CommOpen].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should include the target name in the message") {
-        val expected = "<TARGET_NAME>"
-        clientCommWriter.writeOpen(expected)
-
-        val actual = getNextMessageContents[CommOpen].target_name
-
-        actual should be (expected)
-      }
-
-      it("should provide empty data in the message if no data is provided") {
-        val expected = MsgData.Empty
-        clientCommWriter.writeOpen(anyString())
-
-        val actual = getNextMessageContents[CommOpen].data
-
-        actual should be (expected)
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("some key" -> "some value")
-        clientCommWriter.writeOpen(anyString(), expected)
-
-        val actual = getNextMessageContents[CommOpen].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#writeMsg") {
-      it("should send a comm_msg message to the relay") {
-        clientCommWriter.writeMsg(MsgData.Empty)
-
-        getNextMessageType should be (CommMsg.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        clientCommWriter.writeMsg(MsgData.Empty)
-
-        val actual = getNextMessageContents[CommMsg].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should fail a require if the data is null") {
-        intercept[IllegalArgumentException] {
-          clientCommWriter.writeMsg(null)
-        }
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("some key" -> "some value")
-        clientCommWriter.writeMsg(expected)
-
-        val actual = getNextMessageContents[CommMsg].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#writeClose") {
-      it("should send a comm_close message to the relay") {
-        clientCommWriter.writeClose()
-
-        getNextMessageType should be (CommClose.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        clientCommWriter.writeClose()
-
-        val actual = getNextMessageContents[CommClose].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should provide empty data in the message if no data is provided") {
-        val expected = MsgData.Empty
-        clientCommWriter.writeClose()
-
-        val actual = getNextMessageContents[CommClose].data
-
-        actual should be (expected)
-      }
-
-      it("should include the data in the message") {
-        val expected = MsgData("some key" -> "some value")
-        clientCommWriter.writeClose(expected)
-
-        val actual = getNextMessageContents[CommClose].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#write") {
-      it("should send a comm_msg message to the relay") {
-        clientCommWriter.write(Array('a'), 0, 1)
-
-        getNextMessageType should be (CommMsg.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        clientCommWriter.write(Array('a'), 0, 1)
-
-        val actual = getNextMessageContents[CommMsg].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should package the string as part of the data with a 'message' key") {
-        val expected = MsgData("message" -> "a")
-        clientCommWriter.write(Array('a'), 0, 1)
-
-        val actual = getNextMessageContents[CommMsg].data
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#flush") {
-      it("should do nothing") {
-        // TODO: Is this test necessary? It does nothing.
-        clientCommWriter.flush()
-      }
-    }
-
-    describe("#close") {
-      it("should send a comm_close message to the relay") {
-        clientCommWriter.close()
-
-        getNextMessageType should be (CommClose.toTypeString)
-      }
-
-      it("should include the comm_id in the message") {
-        val expected = commId
-        clientCommWriter.close()
-
-        val actual = getNextMessageContents[CommClose].comm_id
-
-        actual should be (expected)
-      }
-
-      it("should provide empty data in the message") {
-        val expected = MsgData.Empty
-        clientCommWriter.close()
-
-        val actual = getNextMessageContents[CommClose].data
-
-        actual should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClientSpec.scala b/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClientSpec.scala
deleted file mode 100644
index 8db29f8..0000000
--- a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/SparkKernelClientSpec.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client
-
-import akka.actor.ActorSystem
-import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.comm.{CommCallbacks, CommStorage, CommRegistrar}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.execution.ExecuteRequestTuple
-import scala.concurrent.duration._
-import org.mockito.Mockito._
-import org.mockito.Matchers.{eq => mockEq, _}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-
-class SparkKernelClientSpec
-  extends TestKit(ActorSystem("SparkKernelClientActorSystem"))
-  with Matchers with MockitoSugar with FunSpecLike with BeforeAndAfter
-{
-  private val TestTargetName = "some target"
-
-  private var mockActorLoader: ActorLoader = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var sparkKernelClient: SparkKernelClient = _
-  private var executeRequestProbe: TestProbe = _
-  private var shellClientProbe: TestProbe = _
-
-  before {
-    mockActorLoader = mock[ActorLoader]
-    mockCommRegistrar = mock[CommRegistrar]
-
-    executeRequestProbe = TestProbe()
-    when(mockActorLoader.load(MessageType.Incoming.ExecuteRequest))
-      .thenReturn(system.actorSelection(executeRequestProbe.ref.path.toString))
-
-    shellClientProbe = TestProbe()
-    when(mockActorLoader.load(SocketType.ShellClient))
-      .thenReturn(system.actorSelection(shellClientProbe.ref.path.toString))
-
-    sparkKernelClient = new SparkKernelClient(
-      mockActorLoader, system, mockCommRegistrar)
-  }
-
-  describe("SparkKernelClient") {
-    describe("#execute") {
-      it("should send an ExecuteRequest message") {
-        val func = (x: Any) => println(x)
-        sparkKernelClient.execute("val foo = 2")
-        executeRequestProbe.expectMsgClass(classOf[ExecuteRequestTuple])
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala b/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
deleted file mode 100644
index db3205c..0000000
--- a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.execution
-
-import com.ibm.spark.kernel.protocol.v5.content.{StreamContent, ExecuteResult}
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{Matchers, FunSpec}
-import org.scalatest.concurrent.ScalaFutures
-
-import scala.concurrent.Promise
-import scala.util.{Try, Failure, Success}
-
-object DeferredExecutionTest {
-  val executeReplyError  = Option(ExecuteReplyError(1, None, None, None))
-  val executeReplyOk     = Option(ExecuteReplyOk(1, None, None))
-  val executeResult      = Option(ExecuteResult(1, Data(), Metadata()))
-
-  def mockSendingKernelMessages(deferredExecution: DeferredExecution,
-                                executeReplyOption: Option[ExecuteReply],
-                                executeResultOption: Option[ExecuteResult]): Unit = {
-    //  Mock behaviour of the kernel sending messages to us
-    executeResultOption.map {
-      executeResult =>
-      deferredExecution.resolveResult(executeResult)
-    }
-    executeReplyOption.map {
-      executeReply=>
-        deferredExecution.resolveReply(executeReply)
-    }
-  }
-  
-  def processExecuteResult(executeResult: ExecuteResult)
-          (implicit promise: Promise[Try[ExecuteResultPromise]]): Unit = {
-    promise.success(Success(new ExecuteResultPromise))
-  }
-
-  def processExecuteReply(executeReplyError: ExecuteReplyError)
-          (implicit promise: Promise[Try[ExecuteReplyPromise]]): Unit = {
-    promise.success(Success(new ExecuteReplyPromise))
-  }
-
-  def processOnSuccessfulCompletion(executeReplyOk: ExecuteReplyOk)
-    (implicit promise: Promise[Try[String]]): Unit = {
-    promise.success(Success("Success"))
-  }
-}
-
-class ExecuteResultPromise {}
-class ExecuteReplyPromise {}
-
-class DeferredExecutionTest extends FunSpec with ScalaFutures with Matchers {
-  import DeferredExecutionTest._
-  describe("DeferredExecution") {
-    describe("onResult( callback )"){
-      it("should run all onResult callbacks when ExecuteResult and " +
-         "successful ExecuteReply are returned") {
-        implicit val executeResultPromise: Promise[Try[ExecuteResultPromise]] = Promise()
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onResult(processExecuteResult)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
-
-        whenReady(executeResultPromise.future) {
-          case Success(v) => assert(true)
-          case Failure(exception: Throwable) =>
-            fail("Promise resolved with failure when processing " +
-                 "execute result.", exception)
-          case unknownValue=>
-            fail(s"Promised resolved with unknown value: ${unknownValue}")
-        }
-      }
-      it("should run all onResultCallbacks registered after deferred has " +
-         "been resolved") {
-        val executeResultPromise: Promise[Int] = Promise()
-        var counter = 0
-        def processExecuteResult (executeResult: ExecuteResult) : Unit = {
-          counter = counter + 1
-          // Hack to allow callbacks to occur after meeting our assertion value
-          if(counter == 2) {
-            Thread.sleep(500)
-            executeResultPromise.success(counter)
-          }
-        }
-
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onResult(processExecuteResult)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
-        //  register callback after code execution has completed
-        deferredExecution.onResult(processExecuteResult)
-
-        whenReady(executeResultPromise.future){ _ => counter should be(2) }
-
-      }
-      it("should not run onResult callbacks when ExecuteReply is a failure") {
-        //  This promise should be resolved by the deferred
-        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
-        //  This promise should not be resolved by the deferred
-        implicit val executeResultPromise: Promise[Try[ExecuteResultPromise]] = Promise()
-
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onError(processExecuteReply)
-          .onResult(processExecuteResult)
-        mockSendingKernelMessages(deferredExecution, executeReplyError, executeResult)
-
-        whenReady(executeReplyPromise.future) { _ =>
-          executeResultPromise.isCompleted should be(false)
-        }
-      }
-    }
-    describe("onStream( callback )"){
-      it("should execute all streaming callbacks") {
-        var counter = 0
-        val streamingResultPromise: Promise[Int] = Promise()
-        def processStreamContent (streamContent: StreamContent) : Unit = {
-          counter = counter + 1
-          if (counter == 4)
-            streamingResultPromise.success(counter)
-        }
-
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onStream(processStreamContent)
-          .onStream(processStreamContent)
-
-        deferredExecution.emitStreamContent(StreamContent("stdout","msg"))
-        deferredExecution.emitStreamContent(StreamContent("stdout","msg2"))
-
-        whenReady(streamingResultPromise.future){ counterValue =>
-          counterValue should be(4)
-        }
-      }
-    }
-    
-    describe("onError( callback )") {
-      it("should run all onError callbacks") {
-        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onError(processExecuteReply)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyError, executeResult)
-
-        whenReady(executeReplyPromise.future) {
-          case Success(v) => assert(true)
-          case Failure(exception: Throwable) =>
-            fail("Promised resolved with failure while trying to " +
-                 "process execute result.", exception)
-          case unknownValue=>
-            fail(s"Promised resolved with unknown value: ${unknownValue}")
-        }
-      }
-      it("should not run onError callbacks when ExecuteReply is a success") {
-        //  This promise and callback should not be executed by the deferred
-        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
-        //  This promise and callback should be executed by the deferred
-        implicit val executeResultPromise: Promise[Try[ExecuteResultPromise]] = Promise()
-
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onError(processExecuteReply)
-          .onResult(processExecuteResult)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
-
-        whenReady(executeResultPromise.future) {
-          case _ =>
-            executeReplyPromise.isCompleted should be(false)
-        }
-      }
-    }
-    describe("onSuccessfulCompletion( callback )") {
-      it("should run all onSuccessfulCompletion callbacks on ExecuteReplyOk and ExecuteResult") {
-        implicit val executeCompletePromise: Promise[Try[String]] = Promise()
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onSuccess(processOnSuccessfulCompletion)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
-
-        whenReady(executeCompletePromise.future) {
-          case Success(s) =>  //  Nothing to do for the successful case
-          case Failure(exception: Throwable) =>
-            fail("Promised resolved with failure while trying to " +
-              "process execute result.", exception)
-          case unknownValue=>
-            fail(s"Promised resolved with unknown value: ${unknownValue}")
-        }
-      }
-      it("should run all onSuccessfulCompletion callbacks on ExecuteReplyOk and None") {
-        implicit val executeCompletePromise: Promise[Try[String]] = Promise()
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onSuccess(processOnSuccessfulCompletion)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyOk, None)
-
-        whenReady(executeCompletePromise.future) {
-          case Success(s) =>  //  Nothing to do for the successful case
-          case Failure(exception: Throwable) =>
-            fail("Promised resolved with failure while trying to " +
-              "process execute result.", exception)
-          case unknownValue=>
-            fail(s"Promised resolved with unknown value: ${unknownValue}")
-        }
-      }
-      it("should not run onSuccessfulCompletion callbacks on ExecuteReplyError") {
-        implicit val executeCompletePromise: Promise[Try[String]] = Promise()
-        //  This promise and callback should not be executed by the deferred
-        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
-
-        val deferredExecution: DeferredExecution = DeferredExecution()
-          .onError(processExecuteReply)
-          .onSuccess(processOnSuccessfulCompletion)
-
-        mockSendingKernelMessages(deferredExecution, executeReplyError, executeResult)
-
-        whenReady(executeReplyPromise.future) {
-          case _ =>
-            executeCompletePromise.isCompleted should be(false)
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala b/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
deleted file mode 100644
index 9fdd702..0000000
--- a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpecLike}
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-
-class HeartbeatClientSpec extends TestKit(ActorSystem("HeartbeatActorSpec"))
-  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-
-  describe("HeartbeatClientActor") {
-    val socketFactory = mock[SocketFactory]
-    val mockActorLoader = mock[ActorLoader]
-    val probe : TestProbe = TestProbe()
-    when(socketFactory.HeartbeatClient(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(probe.ref)
-
-    val heartbeatClient = system.actorOf(Props(
-      classOf[HeartbeatClient], socketFactory, mockActorLoader, true
-    ))
-
-    describe("send heartbeat") {
-      it("should send ping ZMQMessage") {
-        heartbeatClient ! HeartbeatMessage
-        probe.expectMsgClass(classOf[ZMQMessage])
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClientSpec.scala b/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
deleted file mode 100644
index b592dcd..0000000
--- a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import java.util.UUID
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import akka.pattern.ask
-import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import akka.util.Timeout
-import com.ibm.spark.comm.{CommCallbacks, CommRegistrar, CommStorage, CommWriter}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
-import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
-import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, StreamContent}
-import com.typesafe.config.ConfigFactory
-import org.mockito.Matchers.{eq => mockEq, _}
-import org.mockito.Mockito._
-import org.scalatest.concurrent.{Eventually, ScalaFutures}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.time.{Milliseconds, Span}
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import play.api.libs.json.Json
-
-import scala.concurrent.duration._
-import scala.concurrent.{Future, Promise}
-import scala.util.Failure
-
-object IOPubClientSpec {
-  val config ="""
-    akka {
-      loglevel = "WARNING"
-    }"""
-}
-
-class IOPubClientSpec extends TestKit(ActorSystem(
-  "IOPubClientSpecSystem", ConfigFactory.parseString(IOPubClientSpec.config)
-)) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with ScalaFutures with BeforeAndAfter with Eventually
-{
-  private val TestTimeout = Timeout(10.seconds)
-  implicit override val patienceConfig = PatienceConfig(
-    timeout = scaled(Span(200, Milliseconds)),
-    interval = scaled(Span(5, Milliseconds))
-  )
-  private val SignatureEnabled = true
-
-  private var clientSocketProbe: TestProbe = _
-  private var mockClientSocketFactory: SocketFactory = _
-  private var mockActorLoader: ActorLoader = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var spyCommStorage: CommStorage = _
-  private var mockCommCallbacks: CommCallbacks = _
-  private var ioPubClient: ActorRef = _
-
-  private var kmBuilder: KMBuilder = _
-
-  private val id = UUID.randomUUID().toString
-  private val TestTargetName = "some target"
-  private val TestCommId = UUID.randomUUID().toString
-
-  before {
-    kmBuilder = KMBuilder()
-    mockCommCallbacks = mock[CommCallbacks]
-    mockCommRegistrar = mock[CommRegistrar]
-
-    spyCommStorage = spy(new CommStorage())
-
-    clientSocketProbe = TestProbe()
-    mockActorLoader = mock[ActorLoader]
-    mockClientSocketFactory = mock[SocketFactory]
-
-    //  Stub the return value for the socket factory
-    when(mockClientSocketFactory.IOPubClient(anyObject(), any[ActorRef]))
-      .thenReturn(clientSocketProbe.ref)
-
-    //  Construct the object we will test against
-    ioPubClient = system.actorOf(Props(
-      classOf[IOPubClient], mockClientSocketFactory, mockActorLoader,
-      SignatureEnabled, mockCommRegistrar, spyCommStorage
-    ))
-  }
-
-  describe("IOPubClient") {
-    describe("#receive") {
-      it("should execute all Comm open callbacks on comm_open message") {
-        val message: ZMQMessage = kmBuilder
-          .withHeader(CommOpen.toTypeString)
-          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
-          .build
-
-        // Mark as target being provided
-        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
-          .getTargetCallbacks(anyString())
-
-        // Simulate receiving a message from the kernel
-        ioPubClient ! message
-
-        // Check to see if "eventually" the callback is triggered
-        eventually {
-          verify(mockCommCallbacks).executeOpenCallbacks(
-            any[CommWriter], mockEq(TestCommId),
-            mockEq(TestTargetName), any[v5.MsgData])
-        }
-      }
-
-      it("should not execute Comm open callbacks if the target is not found") {
-        val message: ZMQMessage = kmBuilder
-          .withHeader(CommOpen.toTypeString)
-          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
-          .build
-
-        // Mark as target NOT being provided
-        doReturn(None).when(spyCommStorage).getTargetCallbacks(anyString())
-
-        // Simulate receiving a message from the kernel
-        ioPubClient ! message
-
-        // Check to see if "eventually" the callback is NOT triggered
-        eventually {
-          // Check that we have checked if the target exists
-          verify(spyCommStorage).getTargetCallbacks(TestTargetName)
-
-          verify(mockCommCallbacks, never()).executeOpenCallbacks(
-            any[CommWriter], mockEq(TestCommId),
-            mockEq(TestTargetName), any[v5.MsgData])
-          verify(mockCommRegistrar, never()).link(TestTargetName, TestCommId)
-        }
-      }
-
-      it("should execute all Comm msg callbacks on comm_msg message") {
-        val message: ZMQMessage = kmBuilder
-          .withHeader(CommMsg.toTypeString)
-          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Mark as target being provided
-        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(any[v5.UUID])
-
-        // Simulate receiving a message from the kernel
-        ioPubClient ! message
-
-        // Check to see if "eventually" the callback is triggered
-        eventually {
-          verify(mockCommCallbacks).executeMsgCallbacks(
-            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
-        }
-      }
-
-      it("should not execute Comm msg callbacks if the Comm id is not found") {
-        val message: ZMQMessage = kmBuilder
-          .withHeader(CommMsg.toTypeString)
-          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Mark as target NOT being provided
-        doReturn(None).when(spyCommStorage).getCommIdCallbacks(any[v5.UUID])
-
-        // Simulate receiving a message from the kernel
-        ioPubClient ! message
-
-        // Check to see if "eventually" the callback is NOT triggered
-        eventually {
-          // Check that we have checked if the target exists
-          verify(spyCommStorage).getCommIdCallbacks(TestCommId)
-
-          verify(mockCommCallbacks, never()).executeMsgCallbacks(
-            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
-        }
-      }
-
-      it("should execute all Comm close callbacks on comm_close message") {
-        val message: ZMQMessage = kmBuilder
-          .withHeader(CommClose.toTypeString)
-          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Mark as target being provided
-        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
-          .getCommIdCallbacks(any[v5.UUID])
-
-        // Simulate receiving a message from the kernel
-        ioPubClient ! message
-
-        // Check to see if "eventually" the callback is triggered
-        eventually {
-          verify(mockCommCallbacks).executeCloseCallbacks(
-            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
-        }
-      }
-
-      it("should not execute Comm close callbacks if Comm id is not found") {
-        val message: ZMQMessage = kmBuilder
-          .withHeader(CommClose.toTypeString)
-          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
-          .build
-
-        // Mark as target NOT being provided
-        doReturn(None).when(spyCommStorage).getCommIdCallbacks(any[v5.UUID])
-
-        // Simulate receiving a message from the kernel
-        ioPubClient ! message
-
-        // Check to see if "eventually" the callback is NOT triggered
-        eventually {
-          // Check that we have checked if the target exists
-          verify(spyCommStorage).getCommIdCallbacks(TestCommId)
-
-          verify(mockCommCallbacks, never()).executeCloseCallbacks(
-            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
-        }
-      }
-
-      it("should call a registered callback on stream message") {
-        val result = StreamContent("foo", "bar")
-        val header = Header(id, "spark", id,
-          MessageType.Outgoing.Stream.toString, "5.0")
-        val parentHeader = Header(id, "spark", id,
-          MessageType.Incoming.ExecuteRequest.toString, "5.0")
-
-        val kernelMessage = new KernelMessage(
-          Seq[String](),
-          "",
-          header,
-          parentHeader,
-          Metadata(),
-          Json.toJson(result).toString()
-        )
-        val promise: Promise[String] = Promise()
-        val de: DeferredExecution = DeferredExecution().onStream(
-          (content: StreamContent) => {
-            promise.success(content.text)
-          }
-        )
-        DeferredExecutionManager.add(id, de)
-        // Send the message to the IOPubClient
-        val zmqMessage: ZMQMessage = kernelMessage
-
-        ioPubClient ! zmqMessage
-
-        whenReady(promise.future) {
-          case res: String =>
-            res should be eq("bar")
-          case _ =>
-            fail(s"Received failure when asking IOPubClient")
-        }
-      }
-
-      it("should not invoke callback when stream message's parent header is null") {
-        // Construct the kernel message
-        val result = StreamContent("foo", "bar")
-        val header = Header(id, "spark", id,
-          MessageType.Outgoing.Stream.toString, "5.0")
-
-        val kernelMessage = new KernelMessage(
-          Seq[String](),
-          "",
-          header,
-          null,
-          Metadata(),
-          Json.toJson(result).toString()
-        )
-
-        // Send the message to the IOPubClient
-        val zmqMessage: ZMQMessage = kernelMessage
-        val futureResult: Future[Any] = ioPubClient.ask(zmqMessage)(TestTimeout)
-        whenReady(futureResult) {
-          case result: Failure[Any] =>
-            //  Getting the value of the failure will cause the underlying exception will be thrown
-            try {
-              result.get
-            } catch {
-              case t:RuntimeException =>
-                t.getMessage should be("Parent Header was null in Kernel Message.")
-            }
-          case result =>
-            fail(s"Did not receive failure!! ${result}")
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClientSpec.scala b/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClientSpec.scala
deleted file mode 100644
index 0110dfd..0000000
--- a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/ShellClientSpec.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.client.socket
-
-import java.util.UUID
-
-import akka.actor.{ActorRef, ActorSystem, Props}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{Matchers, FunSpecLike}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import play.api.libs.json.Json
-
-class ShellClientSpec extends TestKit(ActorSystem("ShellActorSpec"))
-  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
-  private val SignatureEnabled = true
-
-  describe("ShellClientActor") {
-    val socketFactory = mock[SocketFactory]
-    val mockActorLoader = mock[ActorLoader]
-    val probe : TestProbe = TestProbe()
-    when(socketFactory.ShellClient(
-      any(classOf[ActorSystem]), any(classOf[ActorRef])
-    )).thenReturn(probe.ref)
-
-    val signatureManagerProbe = TestProbe()
-    doReturn(system.actorSelection(signatureManagerProbe.ref.path.toString))
-      .when(mockActorLoader).load(SecurityActorType.SignatureManager)
-
-    val shellClient = system.actorOf(Props(
-      classOf[ShellClient], socketFactory, mockActorLoader, SignatureEnabled
-    ))
-
-    describe("send execute request") {
-      it("should send execute request") {
-        val request = ExecuteRequest(
-          "foo", false, true, UserExpressions(), true
-        )
-        val header = Header(
-          UUID.randomUUID().toString, "spark",
-          UUID.randomUUID().toString, MessageType.Incoming.ExecuteRequest.toString,
-          "5.0"
-        )
-        val kernelMessage = KernelMessage(
-          Seq[String](), "",
-          header, HeaderBuilder.empty,
-          Metadata(), Json.toJson(request).toString
-        )
-        shellClient ! kernelMessage
-
-        // Echo back the kernel message sent to have a signature injected
-        signatureManagerProbe.expectMsgClass(classOf[KernelMessage])
-        signatureManagerProbe.reply(kernelMessage)
-
-        probe.expectMsgClass(classOf[ZMQMessage])
-      }
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClientSpec.scala b/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClientSpec.scala
deleted file mode 100644
index 877c4f5..0000000
--- a/client/src/test/scala/com/ibm/spark/kernel/protocol/v5/client/socket/StdinClientSpec.scala
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.client.socket
-
-import akka.actor.{ActorRef, Props, ActorSystem}
-import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
-import com.ibm.spark.kernel.protocol.v5.content.{InputReply, InputRequest, ClearOutput, ExecuteRequest}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
-import com.ibm.spark.kernel.protocol.v5.client.Utilities._
-import play.api.libs.json.Json
-import scala.concurrent.duration._
-
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-class StdinClientSpec extends TestKit(ActorSystem("StdinActorSpec"))
-  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val SignatureEnabled = true
-  private val TestReplyString = "some value"
-  private val TestResponseFunc: ResponseFunction = (_, _) => TestReplyString
-
-  private var mockSocketFactory: SocketFactory = _
-  private var mockActorLoader: ActorLoader = _
-  private var signatureManagerProbe: TestProbe = _
-  private var socketProbe: TestProbe = _
-  private var stdinClient: ActorRef = _
-
-  before {
-    socketProbe = TestProbe()
-    signatureManagerProbe = TestProbe()
-    mockSocketFactory = mock[SocketFactory]
-    mockActorLoader = mock[ActorLoader]
-    doReturn(system.actorSelection(signatureManagerProbe.ref.path.toString))
-      .when(mockActorLoader).load(SecurityActorType.SignatureManager)
-    doReturn(socketProbe.ref).when(mockSocketFactory)
-      .StdinClient(any[ActorSystem], any[ActorRef])
-
-    stdinClient = system.actorOf(Props(
-      classOf[StdinClient], mockSocketFactory, mockActorLoader, SignatureEnabled
-    ))
-
-    // Set the response function for our client socket
-    stdinClient ! TestResponseFunc
-  }
-
-  describe("StdinClient") {
-    describe("#receive") {
-      it("should update the response function if receiving a new one") {
-        val expected = "some other value"
-        val replacementFunc: ResponseFunction = (_, _) => expected
-
-        // Update the function
-        stdinClient ! replacementFunc
-
-        val inputRequestMessage: ZMQMessage = KMBuilder()
-          .withHeader(InputRequest.toTypeString)
-          .withContentString(InputRequest("", false))
-          .build
-
-        stdinClient ! inputRequestMessage
-
-        // Echo back the kernel message sent to have a signature injected
-        signatureManagerProbe.expectMsgPF() {
-          case kernelMessage: KernelMessage =>
-            signatureManagerProbe.reply(kernelMessage)
-            true
-        }
-
-        socketProbe.expectMsgPF() {
-          case zmqMessage: ZMQMessage =>
-            val kernelMessage: KernelMessage = zmqMessage
-            val inputReply =
-              Json.parse(kernelMessage.contentString).as[InputReply]
-            inputReply.value should be (expected)
-        }
-      }
-
-      it("should do nothing if the incoming message is not an input_request") {
-        val notInputRequestMessage: ZMQMessage = KMBuilder()
-          .withHeader(ClearOutput.toTypeString)
-          .build
-
-        stdinClient ! notInputRequestMessage
-
-        socketProbe.expectNoMsg(300.milliseconds)
-      }
-
-      it("should respond with an input_reply if the incoming message is " +
-        "an input_request") {
-        val inputRequestMessage: ZMQMessage = KMBuilder()
-          .withHeader(InputRequest.toTypeString)
-          .withContentString(InputRequest("", false))
-          .build
-
-        stdinClient ! inputRequestMessage
-
-        // Echo back the kernel message sent to have a signature injected
-        signatureManagerProbe.expectMsgPF() {
-          case kernelMessage: KernelMessage =>
-            signatureManagerProbe.reply(kernelMessage)
-            true
-        }
-
-        socketProbe.expectMsgPF() {
-          case zmqMessage: ZMQMessage =>
-            val kernelMessage: KernelMessage = zmqMessage
-            val messageType = kernelMessage.header.msg_type
-            messageType should be (InputReply.toTypeString)
-        }
-      }
-
-      it("should use the result from the response function if the incoming " +
-        "message is an input_request") {
-        val inputRequestMessage: ZMQMessage = KMBuilder()
-          .withHeader(InputRequest.toTypeString)
-          .withContentString(InputRequest("", false))
-          .build
-
-        stdinClient ! inputRequestMessage
-
-        // Echo back the kernel message sent to have a signature injected
-        signatureManagerProbe.expectMsgPF() {
-          case kernelMessage: KernelMessage =>
-            signatureManagerProbe.reply(kernelMessage)
-            true
-        }
-
-        socketProbe.expectMsgPF() {
-          case zmqMessage: ZMQMessage =>
-            val kernelMessage: KernelMessage = zmqMessage
-            val inputReply =
-              Json.parse(kernelMessage.contentString).as[InputReply]
-            inputReply.value should be (TestReplyString)
-        }
-      }
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala b/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
new file mode 100644
index 0000000..85ef4aa
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.content.CommContent
+import org.scalatest.mock.MockitoSugar
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
+
+class ClientCommManagerSpec extends FunSpec with Matchers with BeforeAndAfter
+  with MockitoSugar
+{
+  private val TestTargetName = "some target"
+
+  private var mockActorLoader: ActorLoader = _
+  private var mockKMBuilder: KMBuilder = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var clientCommManager: ClientCommManager = _
+
+  private var generatedCommWriter: CommWriter = _
+
+  before {
+    mockActorLoader = mock[ActorLoader]
+    mockKMBuilder = mock[KMBuilder]
+    mockCommRegistrar = mock[CommRegistrar]
+
+    clientCommManager = new ClientCommManager(
+      mockActorLoader,
+      mockKMBuilder,
+      mockCommRegistrar
+    ) {
+      override protected def newCommWriter(commId: UUID): CommWriter = {
+        val commWriter = super.newCommWriter(commId)
+
+        generatedCommWriter = commWriter
+
+        val spyCommWriter = spy(commWriter)
+        doNothing().when(spyCommWriter)
+          .sendCommKernelMessage(any[KernelMessageContent with CommContent])
+
+        spyCommWriter
+      }
+    }
+  }
+
+  describe("ClientCommManager") {
+    describe("#open") {
+      it("should return a wrapped instance of ClientCommWriter") {
+        clientCommManager.open(TestTargetName, v5.MsgData.Empty)
+
+        // Exposed hackishly for testing
+        generatedCommWriter shouldBe a [ClientCommWriter]
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala b/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
new file mode 100644
index 0000000..f5a4b43
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import java.util.UUID
+
+import akka.actor.{ActorSelection, ActorSystem}
+import akka.testkit.{TestKit, TestProbe}
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.typesafe.config.ConfigFactory
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+
+object ClientCommWriterSpec {
+  val config ="""
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class ClientCommWriterSpec extends TestKit(
+  ActorSystem("ClientCommWriterSpec",
+    ConfigFactory.parseString(ClientCommWriterSpec.config))
+) with FunSpecLike with Matchers with BeforeAndAfter with MockitoSugar
+{
+
+  private val commId = UUID.randomUUID().toString
+  private var clientCommWriter: ClientCommWriter = _
+  private var kernelMessageBuilder: KMBuilder = _
+
+  private var actorLoader: ActorLoader = _
+  private var shellSocketProbe: TestProbe = _
+
+  /**
+   * Retrieves the next message available.
+   *
+   * @return The KernelMessage instance (or an error if timed out)
+   */
+  private def getNextMessage =
+    shellSocketProbe.receiveOne(200.milliseconds)
+      .asInstanceOf[KernelMessage]
+
+  /**
+   * Retrieves the next message available and returns its type.
+   *
+   * @return The type of the message (pulled from message header)
+   */
+  private def getNextMessageType = getNextMessage.header.msg_type
+
+  /**
+   * Retrieves the next message available and parses the content string.
+   *
+   * @tparam T The type to coerce the content string into
+   *
+   * @return The resulting KernelMessageContent instance
+   */
+  private def getNextMessageContents[T <: KernelMessageContent]
+    (implicit fjs: play.api.libs.json.Reads[T], mf: Manifest[T]) =
+  {
+    val receivedMessage = getNextMessage
+
+    Json.parse(receivedMessage.contentString).as[T]
+  }
+
+  before {
+    kernelMessageBuilder = spy(KMBuilder())
+
+    // Construct path for kernel message relay
+    actorLoader = mock[ActorLoader]
+    shellSocketProbe = TestProbe()
+    val shellSocketSelection: ActorSelection =
+      system.actorSelection(shellSocketProbe.ref.path.toString)
+    doReturn(shellSocketSelection)
+      .when(actorLoader).load(SocketType.ShellClient)
+
+    // Create a new writer to use for testing
+    clientCommWriter =
+      new ClientCommWriter(actorLoader, kernelMessageBuilder, commId)
+  }
+
+  describe("ClientCommWriter") {
+    describe("#writeOpen") {
+      it("should send a comm_open message to the relay") {
+        clientCommWriter.writeOpen(anyString())
+
+        getNextMessageType should be (CommOpen.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        clientCommWriter.writeOpen(anyString())
+
+        val actual = getNextMessageContents[CommOpen].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should include the target name in the message") {
+        val expected = "<TARGET_NAME>"
+        clientCommWriter.writeOpen(expected)
+
+        val actual = getNextMessageContents[CommOpen].target_name
+
+        actual should be (expected)
+      }
+
+      it("should provide empty data in the message if no data is provided") {
+        val expected = MsgData.Empty
+        clientCommWriter.writeOpen(anyString())
+
+        val actual = getNextMessageContents[CommOpen].data
+
+        actual should be (expected)
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("some key" -> "some value")
+        clientCommWriter.writeOpen(anyString(), expected)
+
+        val actual = getNextMessageContents[CommOpen].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#writeMsg") {
+      it("should send a comm_msg message to the relay") {
+        clientCommWriter.writeMsg(MsgData.Empty)
+
+        getNextMessageType should be (CommMsg.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        clientCommWriter.writeMsg(MsgData.Empty)
+
+        val actual = getNextMessageContents[CommMsg].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should fail a require if the data is null") {
+        intercept[IllegalArgumentException] {
+          clientCommWriter.writeMsg(null)
+        }
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("some key" -> "some value")
+        clientCommWriter.writeMsg(expected)
+
+        val actual = getNextMessageContents[CommMsg].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#writeClose") {
+      it("should send a comm_close message to the relay") {
+        clientCommWriter.writeClose()
+
+        getNextMessageType should be (CommClose.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        clientCommWriter.writeClose()
+
+        val actual = getNextMessageContents[CommClose].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should provide empty data in the message if no data is provided") {
+        val expected = MsgData.Empty
+        clientCommWriter.writeClose()
+
+        val actual = getNextMessageContents[CommClose].data
+
+        actual should be (expected)
+      }
+
+      it("should include the data in the message") {
+        val expected = MsgData("some key" -> "some value")
+        clientCommWriter.writeClose(expected)
+
+        val actual = getNextMessageContents[CommClose].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#write") {
+      it("should send a comm_msg message to the relay") {
+        clientCommWriter.write(Array('a'), 0, 1)
+
+        getNextMessageType should be (CommMsg.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        clientCommWriter.write(Array('a'), 0, 1)
+
+        val actual = getNextMessageContents[CommMsg].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should package the string as part of the data with a 'message' key") {
+        val expected = MsgData("message" -> "a")
+        clientCommWriter.write(Array('a'), 0, 1)
+
+        val actual = getNextMessageContents[CommMsg].data
+
+        actual should be (expected)
+      }
+    }
+
+    describe("#flush") {
+      it("should do nothing") {
+        // TODO: Is this test necessary? It does nothing.
+        clientCommWriter.flush()
+      }
+    }
+
+    describe("#close") {
+      it("should send a comm_close message to the relay") {
+        clientCommWriter.close()
+
+        getNextMessageType should be (CommClose.toTypeString)
+      }
+
+      it("should include the comm_id in the message") {
+        val expected = commId
+        clientCommWriter.close()
+
+        val actual = getNextMessageContents[CommClose].comm_id
+
+        actual should be (expected)
+      }
+
+      it("should provide empty data in the message") {
+        val expected = MsgData.Empty
+        clientCommWriter.close()
+
+        val actual = getNextMessageContents[CommClose].data
+
+        actual should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
new file mode 100644
index 0000000..8db29f8
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client
+
+import akka.actor.ActorSystem
+import akka.testkit.{TestKit, TestProbe}
+import com.ibm.spark.comm.{CommCallbacks, CommStorage, CommRegistrar}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.execution.ExecuteRequestTuple
+import scala.concurrent.duration._
+import org.mockito.Mockito._
+import org.mockito.Matchers.{eq => mockEq, _}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+
+class SparkKernelClientSpec
+  extends TestKit(ActorSystem("SparkKernelClientActorSystem"))
+  with Matchers with MockitoSugar with FunSpecLike with BeforeAndAfter
+{
+  private val TestTargetName = "some target"
+
+  private var mockActorLoader: ActorLoader = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var sparkKernelClient: SparkKernelClient = _
+  private var executeRequestProbe: TestProbe = _
+  private var shellClientProbe: TestProbe = _
+
+  before {
+    mockActorLoader = mock[ActorLoader]
+    mockCommRegistrar = mock[CommRegistrar]
+
+    executeRequestProbe = TestProbe()
+    when(mockActorLoader.load(MessageType.Incoming.ExecuteRequest))
+      .thenReturn(system.actorSelection(executeRequestProbe.ref.path.toString))
+
+    shellClientProbe = TestProbe()
+    when(mockActorLoader.load(SocketType.ShellClient))
+      .thenReturn(system.actorSelection(shellClientProbe.ref.path.toString))
+
+    sparkKernelClient = new SparkKernelClient(
+      mockActorLoader, system, mockCommRegistrar)
+  }
+
+  describe("SparkKernelClient") {
+    describe("#execute") {
+      it("should send an ExecuteRequest message") {
+        val func = (x: Any) => println(x)
+        sparkKernelClient.execute("val foo = 2")
+        executeRequestProbe.expectMsgClass(classOf[ExecuteRequestTuple])
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
new file mode 100644
index 0000000..db3205c
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.execution
+
+import com.ibm.spark.kernel.protocol.v5.content.{StreamContent, ExecuteResult}
+import com.ibm.spark.kernel.protocol.v5.content._
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{Matchers, FunSpec}
+import org.scalatest.concurrent.ScalaFutures
+
+import scala.concurrent.Promise
+import scala.util.{Try, Failure, Success}
+
+object DeferredExecutionTest {
+  val executeReplyError  = Option(ExecuteReplyError(1, None, None, None))
+  val executeReplyOk     = Option(ExecuteReplyOk(1, None, None))
+  val executeResult      = Option(ExecuteResult(1, Data(), Metadata()))
+
+  def mockSendingKernelMessages(deferredExecution: DeferredExecution,
+                                executeReplyOption: Option[ExecuteReply],
+                                executeResultOption: Option[ExecuteResult]): Unit = {
+    //  Mock behaviour of the kernel sending messages to us
+    executeResultOption.map {
+      executeResult =>
+      deferredExecution.resolveResult(executeResult)
+    }
+    executeReplyOption.map {
+      executeReply=>
+        deferredExecution.resolveReply(executeReply)
+    }
+  }
+  
+  def processExecuteResult(executeResult: ExecuteResult)
+          (implicit promise: Promise[Try[ExecuteResultPromise]]): Unit = {
+    promise.success(Success(new ExecuteResultPromise))
+  }
+
+  def processExecuteReply(executeReplyError: ExecuteReplyError)
+          (implicit promise: Promise[Try[ExecuteReplyPromise]]): Unit = {
+    promise.success(Success(new ExecuteReplyPromise))
+  }
+
+  def processOnSuccessfulCompletion(executeReplyOk: ExecuteReplyOk)
+    (implicit promise: Promise[Try[String]]): Unit = {
+    promise.success(Success("Success"))
+  }
+}
+
+class ExecuteResultPromise {}
+class ExecuteReplyPromise {}
+
+class DeferredExecutionTest extends FunSpec with ScalaFutures with Matchers {
+  import DeferredExecutionTest._
+  describe("DeferredExecution") {
+    describe("onResult( callback )"){
+      it("should run all onResult callbacks when ExecuteResult and " +
+         "successful ExecuteReply are returned") {
+        implicit val executeResultPromise: Promise[Try[ExecuteResultPromise]] = Promise()
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onResult(processExecuteResult)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
+
+        whenReady(executeResultPromise.future) {
+          case Success(v) => assert(true)
+          case Failure(exception: Throwable) =>
+            fail("Promise resolved with failure when processing " +
+                 "execute result.", exception)
+          case unknownValue=>
+            fail(s"Promised resolved with unknown value: ${unknownValue}")
+        }
+      }
+      it("should run all onResultCallbacks registered after deferred has " +
+         "been resolved") {
+        val executeResultPromise: Promise[Int] = Promise()
+        var counter = 0
+        def processExecuteResult (executeResult: ExecuteResult) : Unit = {
+          counter = counter + 1
+          // Hack to allow callbacks to occur after meeting our assertion value
+          if(counter == 2) {
+            Thread.sleep(500)
+            executeResultPromise.success(counter)
+          }
+        }
+
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onResult(processExecuteResult)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
+        //  register callback after code execution has completed
+        deferredExecution.onResult(processExecuteResult)
+
+        whenReady(executeResultPromise.future){ _ => counter should be(2) }
+
+      }
+      it("should not run onResult callbacks when ExecuteReply is a failure") {
+        //  This promise should be resolved by the deferred
+        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
+        //  This promise should not be resolved by the deferred
+        implicit val executeResultPromise: Promise[Try[ExecuteResultPromise]] = Promise()
+
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onError(processExecuteReply)
+          .onResult(processExecuteResult)
+        mockSendingKernelMessages(deferredExecution, executeReplyError, executeResult)
+
+        whenReady(executeReplyPromise.future) { _ =>
+          executeResultPromise.isCompleted should be(false)
+        }
+      }
+    }
+    describe("onStream( callback )"){
+      it("should execute all streaming callbacks") {
+        var counter = 0
+        val streamingResultPromise: Promise[Int] = Promise()
+        def processStreamContent (streamContent: StreamContent) : Unit = {
+          counter = counter + 1
+          if (counter == 4)
+            streamingResultPromise.success(counter)
+        }
+
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onStream(processStreamContent)
+          .onStream(processStreamContent)
+
+        deferredExecution.emitStreamContent(StreamContent("stdout","msg"))
+        deferredExecution.emitStreamContent(StreamContent("stdout","msg2"))
+
+        whenReady(streamingResultPromise.future){ counterValue =>
+          counterValue should be(4)
+        }
+      }
+    }
+    
+    describe("onError( callback )") {
+      it("should run all onError callbacks") {
+        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onError(processExecuteReply)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyError, executeResult)
+
+        whenReady(executeReplyPromise.future) {
+          case Success(v) => assert(true)
+          case Failure(exception: Throwable) =>
+            fail("Promised resolved with failure while trying to " +
+                 "process execute result.", exception)
+          case unknownValue=>
+            fail(s"Promised resolved with unknown value: ${unknownValue}")
+        }
+      }
+      it("should not run onError callbacks when ExecuteReply is a success") {
+        //  This promise and callback should not be executed by the deferred
+        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
+        //  This promise and callback should be executed by the deferred
+        implicit val executeResultPromise: Promise[Try[ExecuteResultPromise]] = Promise()
+
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onError(processExecuteReply)
+          .onResult(processExecuteResult)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
+
+        whenReady(executeResultPromise.future) {
+          case _ =>
+            executeReplyPromise.isCompleted should be(false)
+        }
+      }
+    }
+    describe("onSuccessfulCompletion( callback )") {
+      it("should run all onSuccessfulCompletion callbacks on ExecuteReplyOk and ExecuteResult") {
+        implicit val executeCompletePromise: Promise[Try[String]] = Promise()
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onSuccess(processOnSuccessfulCompletion)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyOk, executeResult)
+
+        whenReady(executeCompletePromise.future) {
+          case Success(s) =>  //  Nothing to do for the successful case
+          case Failure(exception: Throwable) =>
+            fail("Promised resolved with failure while trying to " +
+              "process execute result.", exception)
+          case unknownValue=>
+            fail(s"Promised resolved with unknown value: ${unknownValue}")
+        }
+      }
+      it("should run all onSuccessfulCompletion callbacks on ExecuteReplyOk and None") {
+        implicit val executeCompletePromise: Promise[Try[String]] = Promise()
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onSuccess(processOnSuccessfulCompletion)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyOk, None)
+
+        whenReady(executeCompletePromise.future) {
+          case Success(s) =>  //  Nothing to do for the successful case
+          case Failure(exception: Throwable) =>
+            fail("Promised resolved with failure while trying to " +
+              "process execute result.", exception)
+          case unknownValue=>
+            fail(s"Promised resolved with unknown value: ${unknownValue}")
+        }
+      }
+      it("should not run onSuccessfulCompletion callbacks on ExecuteReplyError") {
+        implicit val executeCompletePromise: Promise[Try[String]] = Promise()
+        //  This promise and callback should not be executed by the deferred
+        implicit val executeReplyPromise: Promise[Try[ExecuteReplyPromise]] = Promise()
+
+        val deferredExecution: DeferredExecution = DeferredExecution()
+          .onError(processExecuteReply)
+          .onSuccess(processOnSuccessfulCompletion)
+
+        mockSendingKernelMessages(deferredExecution, executeReplyError, executeResult)
+
+        whenReady(executeReplyPromise.future) {
+          case _ =>
+            executeCompletePromise.isCompleted should be(false)
+        }
+      }
+    }
+  }
+}



[43/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala b/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
index a8be55f..e7ae22a 100644
--- a/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala b/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
index 44989eb..d129574 100644
--- a/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
@@ -1,18 +1,21 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
+ *      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.
+ *  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 org.apache.toree.comm
 
 import java.util.UUID

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala b/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
index c281d15..e22c784 100644
--- a/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.global

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
index 06b6724..20010a3 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.api
 
 import java.io.{InputStream, PrintStream}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
index e9a46ad..4c29396 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.api
 
 import akka.actor.ActorSystem

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
index b8d2767..93c5b41 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.dispatch

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
index c6f33fe..cd92580 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
index 77f0120..b834aed 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandlerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
index 29e8dcf..488bf9b 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandlerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
index ddf1893..2625725 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandlerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
index f8532bd..8f49b11 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandlerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
index 2df1c39..f62f55a 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandlerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
index 45bc197..8f6b36a 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandlerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
index 23558b4..2cebdc9 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandlerSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
index 98824ab..4566507 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActorSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.interpreter.tasks

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
index bc7d79d..2252760 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoaderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
index d4a1f40..7d3a9e4 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/SimpleActorLoaderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
index 907d822..f2f21b7 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/UtilitiesSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
index 0d5f3ac..5973625 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/HeartbeatSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
index d8c035a..a52d4b2 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPubSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
index e87fb80..3574ba6 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ShellSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
index af9a4dd..895f5df 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
index a922684..9b2d250 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnectionSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
index bd034ce..b60b298 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactorySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
index a9830d8..d55c7bd 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/StdinSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
index 2a1d46c..705161e 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParserSpec.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.protocol.v5.magic
 
 import org.apache.toree.magic.MagicLoader

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
index f3be08d..d5181b0 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessorSpec.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.protocol.v5.magic
 
 import org.apache.toree.interpreter.Interpreter

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
index 296cbe0..eccc5fc 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelaySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.relay

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
index 66dc0d4..d36491a 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelaySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.relay

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
index 0686dc5..9550353 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStreamSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.stream

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
index be71728..d3e04c6 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.stream

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
index c13d4bb..3967952 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddDepsSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
index 5489de3..255853d 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/AddJarSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
index 7b08db3..079d525 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/BuiltinLoaderSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
index 20856af..9ccfceb 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/HtmlSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
index e7ad7b4..b97fd51 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/JavaScriptSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
index 3447cbb..f68db5e 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/LSMagicSpec.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.magic.builtin
 
 import java.io.OutputStream

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala b/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
index 7c0e435..3062036 100644
--- a/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/magic/builtin/RDDSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala b/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
index 0f6c277..e2b403e 100644
--- a/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/utils/json/RddToJsonSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils.json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/system/KernelCommSpecForSystem.scala b/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
index 4866896..6cc50f5 100644
--- a/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
+++ b/kernel/src/test/scala/system/KernelCommSpecForSystem.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package system

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/system/SuiteForSystem.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/system/SuiteForSystem.scala b/kernel/src/test/scala/system/SuiteForSystem.scala
index 1fe94fa..19f256a 100644
--- a/kernel/src/test/scala/system/SuiteForSystem.scala
+++ b/kernel/src/test/scala/system/SuiteForSystem.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 system
 
 import org.apache.toree.boot.layer.SparkKernelDeployer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/system/TruncationTests.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/system/TruncationTests.scala b/kernel/src/test/scala/system/TruncationTests.scala
index 39ca1ce..f413cda 100644
--- a/kernel/src/test/scala/system/TruncationTests.scala
+++ b/kernel/src/test/scala/system/TruncationTests.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package system

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/DummyInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/DummyInterpreter.scala b/kernel/src/test/scala/test/utils/DummyInterpreter.scala
index 016eee2..9963ca1 100644
--- a/kernel/src/test/scala/test/utils/DummyInterpreter.scala
+++ b/kernel/src/test/scala/test/utils/DummyInterpreter.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 test.utils
 
 import java.net.URL

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/ErrorActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/ErrorActor.scala b/kernel/src/test/scala/test/utils/ErrorActor.scala
index 40c0dc1..8de08d0 100644
--- a/kernel/src/test/scala/test/utils/ErrorActor.scala
+++ b/kernel/src/test/scala/test/utils/ErrorActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 test.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala b/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
index e19036b..3052cfe 100644
--- a/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
+++ b/kernel/src/test/scala/test/utils/NoArgSparkKernelTestKit.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package test.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/SparkContextProvider.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/SparkContextProvider.scala b/kernel/src/test/scala/test/utils/SparkContextProvider.scala
index c9c2164..0021a52 100644
--- a/kernel/src/test/scala/test/utils/SparkContextProvider.scala
+++ b/kernel/src/test/scala/test/utils/SparkContextProvider.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 test.utils
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala b/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
index a4b6189..b157eaa 100644
--- a/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
+++ b/kernel/src/test/scala/test/utils/SparkKernelDeployer.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.boot.layer



[31/51] [abbrv] incubator-toree git commit: Renamed com.ibm.spark to org.apache.toree

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
index 7eba136..915be74 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/magic/builtin/SparkR.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
-import com.ibm.spark.kernel.interpreter.sparkr.{SparkRInterpreter, SparkRException}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
-import com.ibm.spark.magic.dependencies.IncludeKernel
+import org.apache.toree.interpreter.{ExecuteError, ExecuteAborted}
+import org.apache.toree.kernel.interpreter.sparkr.{SparkRInterpreter, SparkRException}
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.{CellMagicOutput, CellMagic}
+import org.apache.toree.magic.dependencies.IncludeKernel
 
 /**
  * Represents the magic interface to use the SparkR interpreter.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
index 2c0b4d5..2b0f0ad 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlException.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sql
+package org.apache.toree.kernel.interpreter.sql
 
-import com.ibm.spark.interpreter.broker.BrokerException
+import org.apache.toree.interpreter.broker.BrokerException
 
 /**
  * Represents a generic SQL exception.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
index 889d4a6..f8ffffe 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sql
+package org.apache.toree.kernel.interpreter.sql
 
 import java.net.URL
 
-import com.ibm.spark.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter}
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter}
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
index 2f2fed6..0641a6d 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sql
+package org.apache.toree.kernel.interpreter.sql
 
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.kernel.api.KernelLike
 import java.io.ByteArrayOutputStream
 
-import com.ibm.spark.interpreter.broker.BrokerService
-import com.ibm.spark.kernel.interpreter.sql.SqlTypes._
+import org.apache.toree.interpreter.broker.BrokerService
+import org.apache.toree.kernel.interpreter.sql.SqlTypes._
 import org.apache.spark.sql.SQLContext
 
 import scala.concurrent.{Future, future}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
index 114c97f..df542ab 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTransformer.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sql
+package org.apache.toree.kernel.interpreter.sql
 
-import com.ibm.spark.interpreter.broker.BrokerTransformer
+import org.apache.toree.interpreter.broker.BrokerTransformer
 
 /**
  * Represents the transformer used by Apache SQL.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
index a2fbd10..8c7b98b 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlTypes.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.interpreter.sql
+package org.apache.toree.kernel.interpreter.sql
 
-import com.ibm.spark.interpreter.broker.BrokerTypesProvider
+import org.apache.toree.interpreter.broker.BrokerTypesProvider
 
 /**
  * Represents all types associated with the SQL interface.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
----------------------------------------------------------------------
diff --git a/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala b/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
index a8f439c..727c809 100644
--- a/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
+++ b/sql-interpreter/src/main/scala/org/apache/toree/magic/builtin/Sql.scala
@@ -13,13 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteAborted}
-import com.ibm.spark.kernel.interpreter.sql.{SqlInterpreter, SqlException}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic.{CellMagicOutput, CellMagic}
-import com.ibm.spark.magic.dependencies.IncludeKernel
+import org.apache.toree.interpreter.{ExecuteError, ExecuteAborted}
+import org.apache.toree.kernel.interpreter.sql.{SqlInterpreter, SqlException}
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.{CellMagicOutput, CellMagic}
+import org.apache.toree.magic.dependencies.IncludeKernel
 
 /**
  * Represents the magic interface to use the SQL interpreter.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/src/test/scala/system/StdinForSystemSpec.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/system/StdinForSystemSpec.scala b/src/test/scala/system/StdinForSystemSpec.scala
index 98dbf77..0461591 100644
--- a/src/test/scala/system/StdinForSystemSpec.scala
+++ b/src/test/scala/system/StdinForSystemSpec.scala
@@ -16,7 +16,7 @@
 
 package system
 
-import com.ibm.spark.kernel.protocol.v5.client.SparkKernelClient
+import org.apache.toree.kernel.protocol.v5.client.SparkKernelClient
 import org.scalatest.concurrent.Eventually
 import org.scalatest.time.{Seconds, Milliseconds, Span}
 import org.scalatest.{BeforeAndAfterAll, FunSpec, Matchers}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala b/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
index 757a7e7..3c8d5f9 100644
--- a/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
+++ b/src/test/scala/test.utils/root/SparkKernelClientDeployer.scala
@@ -16,8 +16,8 @@
 
 package test.utils.root
 
-import com.ibm.spark.kernel.protocol.v5.client.boot.ClientBootstrap
-import com.ibm.spark.kernel.protocol.v5.client.boot.layers._
+import org.apache.toree.kernel.protocol.v5.client.boot.ClientBootstrap
+import org.apache.toree.kernel.protocol.v5.client.boot.layers._
 import com.typesafe.config.{ConfigFactory, Config}
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/src/test/scala/test.utils/root/SparkKernelDeployer.scala
----------------------------------------------------------------------
diff --git a/src/test/scala/test.utils/root/SparkKernelDeployer.scala b/src/test/scala/test.utils/root/SparkKernelDeployer.scala
index d8c5b40..9521917 100644
--- a/src/test/scala/test.utils/root/SparkKernelDeployer.scala
+++ b/src/test/scala/test.utils/root/SparkKernelDeployer.scala
@@ -16,8 +16,8 @@
 
 package test.utils.root
 
-import com.ibm.spark.boot.layer._
-import com.ibm.spark.boot.{KernelBootstrap, CommandLineOptions}
+import org.apache.toree.boot.layer._
+import org.apache.toree.boot.{KernelBootstrap, CommandLineOptions}
 
 /**
   * Provides tests with a generic Spark Kernel.


[22/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
new file mode 100644
index 0000000..2529866
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.security
+
+import java.security.Permission
+import java.util.UUID
+
+import scala.collection.immutable.HashMap
+
+object KernelSecurityManager {
+  val RestrictedGroupName = "restricted-" + UUID.randomUUID().toString
+
+  /**
+   * Special case for this permission since the name changes with each status
+   * code.
+   */
+  private val SystemExitPermissionName = "exitVM." // + status
+
+  /**
+   * Used to indicate which permissions to check. Only checks if the permission
+   * is found in the keys and the value for that permission is true.
+   */
+  private val permissionsToCheck: Map[String, Boolean] = HashMap(
+    "modifyThreadGroup" -> true
+  )
+
+  /**
+   * Checks whether the permission with the provided name is listed to be
+   * checked.
+   *
+   * @param name The name of the permission
+   *
+   * @return True if the permission is listed to be checked, false otherwise
+   */
+  private def shouldCheckPermission(name: String): Boolean =
+    permissionsToCheck.getOrElse(name, shouldCheckPermissionSpecialCases(name))
+
+  /**
+   * Checks whether the permission with the provided name is one of the special
+   * cases that don't exist in the normal name conventions.
+   *
+   * @param name The name of the permission
+   *
+   * @return True if the permission is to be checked, false otherwise
+   */
+  private def shouldCheckPermissionSpecialCases(name: String): Boolean =
+    name.startsWith(SystemExitPermissionName)
+}
+
+class KernelSecurityManager extends SecurityManager {
+  import KernelSecurityManager._
+
+  override def checkPermission(perm: Permission, context: scala.Any): Unit = {
+    // TODO: Investigate why the StackOverflowError occurs in IntelliJ without
+    //       this check for FilePermission related to this class
+    // NOTE: The above problem does not happen when built with sbt pack
+    if (perm.getActions == "read" &&
+      perm.getName.contains(this.getClass.getSimpleName))
+      return
+
+    if (shouldCheckPermission(perm.getName))
+      super.checkPermission(perm, context)
+  }
+
+  override def checkPermission(perm: Permission): Unit = {
+    // TODO: Investigate why the StackOverflowError occurs in IntelliJ without
+    //       this check for FilePermission related to this class
+    // NOTE: The above problem does not happen when built with sbt pack
+    if (perm.getActions == "read" &&
+      perm.getName.contains(this.getClass.getSimpleName))
+      return
+
+    if (shouldCheckPermission(perm.getName))
+      super.checkPermission(perm)
+  }
+
+  override def getThreadGroup: ThreadGroup = {
+    val currentGroup = Thread.currentThread().getThreadGroup
+
+    // For restricted groups, we can only catch them in the checkAccess if we
+    // set the current group as the parent (to make sure all groups have a
+    // consistent name)
+    if (currentGroup.getName == RestrictedGroupName) {
+      new ThreadGroup(currentGroup, currentGroup.getName)
+    } else {
+      super.getThreadGroup
+    }
+  }
+
+  override def checkAccess(g: ThreadGroup): Unit = {
+    //super.checkAccess(g)
+    if (g == null) return
+
+    val parentGroup = g.getParent
+
+    if (parentGroup != null &&
+      parentGroup.getName == RestrictedGroupName &&
+      g.getName != RestrictedGroupName)
+      throw new SecurityException("Not allowed to modify ThreadGroups!")
+  }
+
+  override def checkExit(status: Int): Unit = {
+    val currentGroup = Thread.currentThread().getThreadGroup
+
+    if (currentGroup.getName == RestrictedGroupName) {
+      // TODO: Determine why System.exit(...) is being blocked in the ShutdownHandler
+      System.out.println("Unauthorized system.exit detected!")
+      //throw new SecurityException("Not allowed to invoke System.exit!")
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
new file mode 100644
index 0000000..a748fe4
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import joptsimple.{OptionSpec, OptionParser}
+import scala.collection.JavaConverters._
+import scala.language.implicitConversions
+import java.io.{PrintStream, OutputStream}
+
+trait ArgumentParsingSupport {
+  protected lazy val parser = new OptionParser()
+  private var options: joptsimple.OptionSet = _
+  parser.allowsUnrecognizedOptions()
+
+  /**
+   * Parses the arguments provided as a string, updating all internal
+   * references to specific arguments.
+   *
+   * @param args The arguments as a string
+   * @param delimiter An optional delimiter for separating arguments
+   */
+  def parseArgs(args: String, delimiter: String = " ") = {
+    options = parser.parse(args.split(delimiter): _*)
+
+    options.nonOptionArguments().asScala.map(_.toString)
+  }
+
+  def printHelp(outputStream: OutputStream, usage: String) = {
+    val printStream = new PrintStream(outputStream)
+
+    printStream.println(s"Usage: $usage\n")
+    parser.printHelpOn(outputStream)
+  }
+
+  implicit def has[T](spec: OptionSpec[T]): Boolean = {
+    require(options != null, "Arguments not parsed yet!")
+    options.has(spec)
+  }
+
+  implicit def get[T](spec: OptionSpec[T]): Option[T] = {
+    require(options != null, "Arguments not parsed yet!")
+    Some(options.valueOf(spec)).filter(_ != null)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
new file mode 100644
index 0000000..65f7650
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.io.OutputStream
+
+class ConditionalOutputStream(
+  private val outputStream: OutputStream,
+  condition: => Boolean
+) extends OutputStream {
+  require(outputStream != null)
+
+  override def write(b: Int): Unit = if (condition) outputStream.write(b)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
new file mode 100644
index 0000000..9d36326
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.net.URL
+import java.nio.channels._
+import java.io.FileOutputStream
+
+/**
+ * A utility for downloading the contents of a file to a specified location.
+ */
+trait DownloadSupport {
+  /**
+   * Download a file located at the given URL to the specified destination file.
+   * The file type of the downloadDestination should match the file type
+   * of the file located at fileUrl. Throws a FileNotFoundException if the
+   * fileUrl or downloadDestination are invalid.
+   *
+   * @param fileUrl A URL for the file to be downloaded
+   * @param destinationUrl Location to download the file to (e.g. /tmp/file.txt)
+   *
+   * @return The URL representing the location of the downloaded file
+   */
+  def downloadFile(fileUrl: URL, destinationUrl: URL): URL = {
+    val rbc = Channels.newChannel(fileUrl.openStream())
+    val fos = new FileOutputStream(destinationUrl.getPath)
+    fos.getChannel.transferFrom(rbc, 0, Long.MaxValue)
+
+    destinationUrl
+  }
+
+  /**
+   * Download a file given a URL string to the specified downloadDestination.
+   *
+   * @param fileToDownload A URL in string format (e.g. file:///tmp/foo, http://ibm.com)
+   * @param destination Location to download the file to (e.g. /tmp/file.txt)
+   *
+   * @return The URL representing the location of the downloaded file
+   */
+  def downloadFile(fileToDownload: String, destination: String): URL = {
+    downloadFile(new URL(fileToDownload), new URL(destination))
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
new file mode 100644
index 0000000..73e02b6
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import language.dynamics
+import language.existentials
+
+import java.lang.reflect.Method
+
+/**
+ * Represents dynamic support capabilities for a class. Provides field and
+ * method catchers to reflectively execute potentially-missing cases.
+ * @param klass The class whose fields and methods to access
+ * @param instance The specific instance whose fields and methods to access
+ */
+case class DynamicReflectionSupport(
+  private val klass: Class[_], private val instance: Any
+) extends Dynamic {
+
+  /**
+   * Handles cases of field access not found from type-checks. Attempts to
+   * reflectively access field from provided class (or instance). Will first
+   * check for a method signature matching field name due to Scala
+   * transformation process.
+   * @param name The name of the field
+   * @return The content held by the field
+   */
+  def selectDynamic(name: String): Any = {
+    val method = getMethod(name, Nil)
+    method match {
+      case Some(m) => invokeMethod(m, Nil)
+      case _ =>
+        try {
+          val field = klass.getDeclaredField(name)
+          field.setAccessible(true)
+          field.get(instance)
+        } catch {
+          case ex: NoSuchFieldException =>
+            throw new NoSuchFieldException(
+              klass.getName + "." + name + " does not exist!"
+            )
+          case ex: Throwable => throw ex
+        }
+    }
+  }
+
+  /**
+   * Handles cases of method not found from type-checks. Attempts to
+   * reflectively execute the method from the provided class (or instance).
+   * Will search for a method signature that has matching parameters with
+   * arguments allowed to be subclasses of parameter types.
+   *
+   * @note Chaining in not supported. You must first cast the result of the
+   *       execution before attempting to apply a method upon it.
+   *
+   * @param name The name of the method
+   * @param args The list of arguments for the method
+   * @return The result of the method's execution
+   */
+  def applyDynamic(name: String)(args: Any*) = {
+    val method = getMethod(name, args.toList)
+
+    method match {
+      case Some(m) => invokeMethod(m, args.toList)
+      case _ =>
+        throw new NoSuchMethodException(
+          klass.getName + "." + name +
+            "(" + args.map(_.getClass.getName).mkString(",") + ")"
+        )
+    }
+  }
+
+  private def getMethod(name: String, args: Any*): Option[Method] = {
+    val flatArgs = flatten(args)
+    val potentialMethods = klass.getDeclaredMethods.filter(_.getName == name)
+    val method: Option[Method] =
+      potentialMethods.foldLeft[Option[Method]](None) {
+        (current, m) =>
+          if (current != None) current
+          else if (m.getParameterTypes.size != flatArgs.size) current
+          else if (!m.getParameterTypes.zipWithIndex.forall {
+            case (c, i) => isCompatible(c, flatArgs(i).getClass)
+          }) current
+          else Some(m)
+      }
+
+    method
+  }
+
+  private def invokeMethod(method: Method, args: Any*) = {
+    val flatArgs = flatten(args).map(_.asInstanceOf[AnyRef])
+    method.invoke(instance, flatArgs: _*)
+  }
+
+  private def flatten(l: Seq[Any]): Seq[Any] = {
+    l.flatMap {
+      case newList: List[_] => flatten(newList)
+      case newSeq: Seq[_] => flatten(newSeq)
+      case x => List(x)
+    }
+  }
+
+  private def isCompatible(klazz1: Class[_], klazz2: Class[_]): Boolean = {
+    var result =
+      klazz1.isAssignableFrom(klazz2) ||
+      klazz1.isInstance(klazz2) ||
+      klazz1.isInstanceOf[klazz2.type]
+
+    if (!result) {
+      try {
+        klazz1.asInstanceOf[klazz2.type]
+        result = true
+      } catch {
+        case _: Throwable => result = false
+      }
+    }
+
+    result
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala b/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
new file mode 100644
index 0000000..7869aa6
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.utils
+
+import joptsimple.util.KeyValuePair
+
+/**
+ * Provides utility methods for jsimple-opt key pair values.
+ */
+object KeyValuePairUtils {
+  val DefaultDelimiter = ","
+
+  /**
+   * Transforms the provided string into a list of KeyValuePair objects.
+   * @param keyValuePairString The string representing the series of keys and
+   *                           values
+   * @param delimiter The delimiter used for splitting up the string
+   * @return The list of KeyValuePair objects
+   */
+  def stringToKeyValuePairSeq(
+    keyValuePairString: String,
+    delimiter: String = DefaultDelimiter
+  ): Seq[KeyValuePair] = {
+    require(keyValuePairString != null, "KeyValuePair string cannot be null!")
+
+    keyValuePairString
+      .split(delimiter)
+      .map(_.trim)
+      .filterNot(_.isEmpty)
+      .map(KeyValuePair.valueOf)
+      .toSeq
+  }
+
+  /**
+   * Transforms the provided list of KeyValuePair elements into a string.
+   * @param keyValuePairSeq The sequence of KeyValuePair objects
+   * @param delimiter The separator between string KeyValuePair
+   * @return The resulting string from the list of KeyValuePair objects
+   */
+  def keyValuePairSeqToString(
+    keyValuePairSeq: Seq[KeyValuePair],
+    delimiter: String = DefaultDelimiter
+  ): String = {
+    require(keyValuePairSeq != null, "KeyValuePair sequence cannot be null!")
+
+    keyValuePairSeq
+      .map(pair => pair.key.trim + "=" + pair.value.trim)
+      .mkString(delimiter)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
new file mode 100644
index 0000000..9ee4da1
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.lang.reflect.Method
+import java.net.{URL, URLClassLoader}
+import java.util
+import org.slf4j.LoggerFactory
+
+import scala.collection.JavaConverters._
+import scala.util.{Failure, Success, Try}
+
+import scala.language.existentials
+
+/**
+ * Represents a class loader that supports delegating to multiple class loaders.
+ *
+ * @note Implements URLClassLoader purely to support the Guava requirement for
+ *       detecting all classes.
+ *
+ * @param urls The URLs to use for the underlying URLClassLoader
+ * @param classLoaders The class loaders to use as the underlying
+ *                     implementations of this class loader
+ */
+class MultiClassLoader(
+  private val urls: Seq[URL],
+  private val classLoaders: Seq[ClassLoader]
+) extends URLClassLoader(
+  classLoaders.flatMap({
+    case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.toSeq
+    case _                              => Nil
+  }).distinct.toArray,
+  /* Create a parent chain based on a each classloader's parent */ {
+    val parents = classLoaders.flatMap(cl => Option(cl.getParent))
+
+    // If multiple parents, set the parent to another multi class loader
+    if (parents.size > 1) new MultiClassLoader(Nil, parents)
+
+    // If a single parent, set the parent to that single parent
+    else if (parents.size == 1) parents.head
+
+    // If no parent, set to null (default if parent not provided)
+    else null
+  }: ClassLoader
+) { self =>
+  private val logger = LoggerFactory.getLogger(this.getClass)
+
+  /**
+   * Creates a new multi class loader with no URLs of its own, although it may
+   * still expose URLs from provided class loaders.
+   *
+   * @param classLoaders The class loaders to use as the underlying
+   *                     implementations of this class loader
+   */
+  def this(classLoaders: ClassLoader*) = {
+    this(Nil, classLoaders)
+  }
+
+  override protected def findClass(name: String): Class[_] = {
+    @inline def tryFindClass(classLoader: ClassLoader, name: String) = {
+      Try(Class.forName(name, false, classLoader))
+    }
+
+    // NOTE: Using iterator to evaluate elements one at a time
+    classLoaders.toIterator
+      .map(classLoader => tryFindClass(classLoader, name))
+      .find(_.isSuccess)
+      .map(_.get)
+      .getOrElse(throw new ClassNotFoundException(name))
+  }
+
+  override protected def findResource(name: String): URL = {
+    // NOTE: Using iterator to evaluate elements one at a time
+    classLoaders.toIterator.map(cl => _findResource(cl, name)).find(_ != null)
+      .getOrElse(super.findResource(name))
+  }
+
+  override protected def findResources(name: String): util.Enumeration[URL] = {
+    val internalResources = classLoaders
+      .flatMap(cl => Try(_findResources(cl, name)).toOption)
+      .map(_.asScala)
+      .reduce(_ ++ _)
+
+    (
+      internalResources
+      ++
+      Try(super.findResources(name)).map(_.asScala).getOrElse(Nil)
+    ).asJavaEnumeration
+  }
+
+  private def _findResource[T <: ClassLoader](classLoader: T, name: String) = {
+    _getDeclaredMethod(classLoader.getClass, "findResource", classOf[String])
+      .invoke(classLoader, name).asInstanceOf[URL]
+  }
+
+  private def _findResources[T <: ClassLoader](classLoader: T, name: String) = {
+    _getDeclaredMethod(classLoader.getClass, "findResources", classOf[String])
+      .invoke(classLoader, name).asInstanceOf[util.Enumeration[URL]]
+  }
+
+  private def _loadClass[T <: ClassLoader](
+    classLoader: T,
+    name: String,
+    resolve: Boolean
+  ) = {
+    _getDeclaredMethod(classLoader.getClass, "loadClass",
+      classOf[String], classOf[Boolean]
+    ).invoke(classLoader, name, resolve: java.lang.Boolean).asInstanceOf[Class[_]]
+  }
+
+  private def _getDeclaredMethod(
+    klass: Class[_],
+    name: String,
+    classes: Class[_]*
+  ): Method = {
+    // Attempt to retrieve the method (public/protected/private) for the class,
+    // trying the super class if the method is not available
+    val potentialMethod = Try(klass.getDeclaredMethod(name, classes: _*))
+      .orElse(Try(_getDeclaredMethod(klass.getSuperclass, name, classes: _*)))
+
+    // Allow access to protected/private methods
+    potentialMethod.foreach(_.setAccessible(true))
+
+    potentialMethod match {
+      case Success(method)  => method
+      case Failure(error)   => throw error
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
new file mode 100644
index 0000000..6ebaf3e
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.io.OutputStream
+
+case class MultiOutputStream(val outputStreams: List[OutputStream])
+  extends OutputStream
+{
+  require(outputStreams != null)
+
+  override def write(cbuf: Array[Byte]): Unit =
+    outputStreams.foreach(outputStream => outputStream.write(cbuf))
+
+  override def write(cbuf: Array[Byte], off: Int, len: Int): Unit =
+    outputStreams.foreach(outputStream => outputStream.write(cbuf, off, len))
+
+  override def write(b: Int): Unit =
+    outputStreams.foreach(outputStream => outputStream.write(b))
+
+  override def flush() =
+    outputStreams.foreach(outputStream => outputStream.flush())
+
+  override def close() =
+    outputStreams.foreach(outputStream => outputStream.close())
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
new file mode 100644
index 0000000..a91e2ba
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.utils
+
+import scala.language.existentials
+import java.util.concurrent._
+import java.util.UUID
+import ScheduledTaskManager._
+
+import scala.util.Try
+
+/**
+ * Constructs timing-based events that are periodically executed. Does not
+ * support hard-killing tasks that are not interruptable.
+ * @param totalThreads The total threads to create for the underlying thread
+ *                     pool
+ * @param defaultExecutionDelay The default delay to use before all added tasks
+ * @param defaultTimeInterval The default time interval between tasks in
+ *                            milliseconds
+ */
+class ScheduledTaskManager(
+  private val totalThreads: Int = DefaultMaxThreads,
+  private val defaultExecutionDelay: Long = DefaultExecutionDelay,
+  private val defaultTimeInterval: Long = DefaultTimeInterval
+) {
+  private[utils] val _scheduler = new ScheduledThreadPoolExecutor(totalThreads)
+  _scheduler.setRemoveOnCancelPolicy(true)
+
+  private val _taskMap = new ConcurrentHashMap[String, ScheduledFuture[_]]()
+
+  /**
+   * Adds the specified task to the queued list to execute at the specified
+   * time interval.
+   * @param executionDelay The time delay (in milliseconds) before starting
+   * @param timeInterval The time interval (in milliseconds)
+   * @param task The task to execute
+   * @tparam T The type of return result (currently ignored)
+   * @return The id of the task
+   */
+  def addTask[T](
+    executionDelay: Long = defaultExecutionDelay,
+    timeInterval: Long = defaultTimeInterval,
+    task: => T
+  ) = {
+    val taskId = UUID.randomUUID().toString
+    val runnable: Runnable = new Runnable {
+      override def run(): Unit = Try(task)
+    }
+
+    // Schedule our task at the desired interval
+    _taskMap.put(taskId, _scheduler.scheduleAtFixedRate(
+      runnable, executionDelay, timeInterval, TimeUnit.MILLISECONDS))
+
+    taskId
+  }
+
+  /**
+   * Removes the specified task from the manager.
+   * @param taskId The id of the task to remove
+   * @return True if the task was removed, otherwise false
+   */
+  def removeTask(taskId: String): Boolean = {
+    // Exit if the task with the given id does not exist
+    if (taskId == null || !_taskMap.containsKey(taskId)) return false
+
+    val future = _taskMap.remove(taskId)
+
+    // Stop the future, but allow the current task to finish
+    future.cancel(false)
+
+    true
+  }
+
+  /**
+   * Shuts down the thread pool used for task execution.
+   */
+  def stop() = {
+    _taskMap.clear()
+    _scheduler.shutdown()
+  }
+}
+
+object ScheduledTaskManager {
+  val DefaultMaxThreads = 4
+  val DefaultExecutionDelay = 10 // 10 milliseconds
+  val DefaultTimeInterval = 100 // 100 milliseconds
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala b/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
new file mode 100644
index 0000000..c3a43fc
--- /dev/null
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
@@ -0,0 +1,237 @@
+package com.ibm.spark.utils
+
+import java.util.concurrent.atomic.AtomicInteger
+
+import org.slf4j.LoggerFactory
+
+import scala.concurrent.{promise, Future}
+import java.util.concurrent._
+
+import com.ibm.spark.security.KernelSecurityManager._
+import TaskManager._
+
+import scala.util.Try
+
+/**
+ * Represents a processor of tasks that has X worker threads dedicated to
+ * executing the tasks.
+ *
+ * @param threadGroup The thread group to use with all worker threads
+ * @param minimumWorkers The number of workers to spawn initially and keep
+ *                       alive even when idle
+ * @param maximumWorkers The max number of worker threads to spawn, defaulting
+ *                   to the number of processors on the machine
+ * @param keepAliveTime The maximum time in milliseconds for workers to remain
+ *                      idle before shutting down
+ */
+class TaskManager(
+  private val threadGroup: ThreadGroup = DefaultThreadGroup,
+  private val maxTasks: Int = DefaultMaxTasks,
+  private val minimumWorkers: Int = DefaultMinimumWorkers,
+  private val maximumWorkers: Int = DefaultMaximumWorkers,
+  private val keepAliveTime: Long = DefaultKeepAliveTime
+) {
+  protected val logger = LoggerFactory.getLogger(this.getClass.getName)
+
+  private class TaskManagerThreadFactory extends ThreadFactory {
+    override def newThread(r: Runnable): Thread = {
+      val thread = new Thread(threadGroup, r)
+
+      logger.trace(s"Creating new thread named ${thread.getName}!")
+
+      thread
+    }
+  }
+
+  private[utils] class ScalingThreadPoolExecutor extends ThreadPoolExecutor(
+    minimumWorkers,
+    maximumWorkers,
+    keepAliveTime,
+    TimeUnit.MILLISECONDS,
+    taskQueue,
+    taskManagerThreadFactory
+  ) {
+    protected val logger = LoggerFactory.getLogger(this.getClass.getName)
+
+    /** Used to keep track of tasks separately from the task queue. */
+    private val taskCount = new AtomicInteger(0)
+
+    /**
+     * Syncs the core pool size of the executor with the current number of
+     * tasks, using the minimum worker size and maximum worker size as the
+     * bounds.
+     */
+    private def syncPoolLimits(): Unit = {
+      val totalTasks = taskCount.get()
+      val newCorePoolSize =
+        math.max(minimumWorkers, math.min(totalTasks, maximumWorkers))
+
+      logger.trace(Seq(
+        s"Task execution count is $totalTasks!",
+        s"Updating core pool size to $newCorePoolSize!"
+      ).mkString(" "))
+      executor.foreach(_.setCorePoolSize(newCorePoolSize))
+    }
+
+    override def execute(r: Runnable): Unit = {
+      synchronized {
+        if (taskCount.incrementAndGet() > maximumWorkers)
+          logger.warn(s"Exceeded $maximumWorkers workers during processing!")
+
+        syncPoolLimits()
+      }
+
+      super.execute(r)
+    }
+
+    override def afterExecute(r: Runnable, t: Throwable): Unit = {
+      super.afterExecute(r, t)
+
+      synchronized {
+        taskCount.decrementAndGet()
+        syncPoolLimits()
+      }
+    }
+  }
+
+  private val taskManagerThreadFactory = new TaskManagerThreadFactory
+  private val taskQueue = new ArrayBlockingQueue[Runnable](maxTasks)
+
+  @volatile
+  private[utils] var executor: Option[ScalingThreadPoolExecutor] = None
+
+  /**
+   * Adds a new task to the list to execute.
+   *
+   * @param taskFunction The new task as a block of code
+   *
+   * @return Future representing the return value (or error) from the task
+   */
+  def add[T <: Any](taskFunction: => T): Future[T] = {
+    assert(executor.nonEmpty, "Task manager not started!")
+
+    val taskPromise = promise[T]()
+
+    // Construct runnable that completes the promise
+    logger.trace(s"Queueing new task to be processed!")
+    executor.foreach(_.execute(new Runnable {
+      override def run(): Unit = {
+        var threadName: String = "???"
+        try {
+          threadName = Try(Thread.currentThread().getName).getOrElse(threadName)
+          logger.trace(s"(Thread $threadName) Executing task!")
+          val result = taskFunction
+
+          logger.trace(s"(Thread $threadName) Task finished successfully!")
+          taskPromise.success(result)
+        } catch {
+          case ex: Throwable =>
+            val exName = ex.getClass.getName
+            val exMessage = Option(ex.getLocalizedMessage).getOrElse("???")
+            logger.trace(
+              s"(Thread $threadName) Task failed: ($exName) = $exMessage")
+            taskPromise.tryFailure(ex)
+        }
+      }
+    }))
+
+    taskPromise.future
+  }
+
+  /**
+   * Returns the count of tasks including the currently-running ones.
+   *
+   * @return The count of tasks
+   */
+  def size: Int = taskQueue.size() + executor.map(_.getActiveCount).getOrElse(0)
+
+  /**
+   * Returns whether or not there is a task in the queue to be processed.
+   *
+   * @return True if the internal queue is not empty, otherwise false
+   */
+  def hasTaskInQueue: Boolean = !taskQueue.isEmpty
+
+  /**
+   * Whether or not there is a task being executed currently.
+   *
+   * @return True if there is a task being executed, otherwise false
+   */
+  def isExecutingTask: Boolean = executor.exists(_.getActiveCount > 0)
+
+  /**
+   * Block execution (by sleeping) until all tasks currently queued up for
+   * execution are processed.
+   */
+  def await(): Unit =
+    while (!taskQueue.isEmpty || isExecutingTask) Thread.sleep(1)
+
+  /**
+   * Starts the task manager (begins processing tasks). Creates X new threads
+   * in the process.
+   */
+  def start(): Unit = {
+    logger.trace(
+      s"""
+         |Initializing with the following settings:
+         |- $minimumWorkers core worker pool
+         |- $maximumWorkers maximum workers
+         |- $keepAliveTime milliseconds keep alive time
+       """.stripMargin.trim)
+    executor = Some(new ScalingThreadPoolExecutor)
+  }
+
+  /**
+   * Restarts internal processing of tasks (removing current task).
+   */
+  def restart(): Unit = {
+    stop()
+    start()
+  }
+
+  /**
+   * Stops internal processing of tasks.
+   */
+  def stop(): Unit = {
+    executor.foreach(_.shutdownNow())
+    executor = None
+  }
+}
+
+/**
+ * Represents constants associated with the task manager.
+ */
+object TaskManager {
+  /** The default thread group to use with all worker threads. */
+  val DefaultThreadGroup = new ThreadGroup(RestrictedGroupName)
+
+  /** The default number of maximum tasks accepted by the task manager. */
+  val DefaultMaxTasks = 200
+
+  /**
+   * The default number of workers to spawn initially and keep alive
+   * even when idle.
+   */
+  val DefaultMinimumWorkers = 1
+
+  /** The default maximum number of workers to spawn. */
+  val DefaultMaximumWorkers = Runtime.getRuntime.availableProcessors()
+
+  /** The default timeout in milliseconds for workers waiting for tasks. */
+  val DefaultKeepAliveTime = 1000
+
+  /**
+   * The default timeout in milliseconds to wait before stopping a thread
+   * if it cannot be interrupted.
+   */
+  val InterruptTimeout = 5000
+
+  /** The maximum time to wait to add a task to the queue in milliseconds. */
+  val MaximumTaskQueueTimeout = 10000
+
+  /**
+   * The maximum time in milliseconds to wait to queue up a thread in the
+   * thread factory.
+   */
+  val MaximumThreadQueueTimeout = 10000
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerBridgeSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerBridgeSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerBridgeSpec.scala
deleted file mode 100644
index d74867c..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerBridgeSpec.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import com.ibm.spark.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
-import com.ibm.spark.kernel.api.KernelLike
-import org.apache.spark.api.java.JavaSparkContext
-import org.apache.spark.sql.SQLContext
-import org.apache.spark.{SparkConf, SparkContext}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers, OneInstancePerTest}
-import org.mockito.Mockito._
-
-class BrokerBridgeSpec extends FunSpec with Matchers with OneInstancePerTest
-  with MockitoSugar
-{
-  private val mockBrokerState = mock[BrokerState]
-  private val mockKernel = mock[KernelLike]
-
-  private val brokerBridge = new BrokerBridge(
-    mockBrokerState,
-    mockKernel
-  )
-
-  describe("BrokerBridge") {
-    describe("#state") {
-      it("should return the broker state from the constructor") {
-        brokerBridge.state should be (mockBrokerState)
-      }
-    }
-
-    describe("#kernel") {
-      it("should return the kernel from the constructor") {
-        brokerBridge.kernel should be (mockKernel)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandlerSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandlerSpec.scala
deleted file mode 100644
index 35d3235..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessHandlerSpec.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import org.apache.commons.exec.ExecuteException
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers, OneInstancePerTest}
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-class BrokerProcessHandlerSpec extends FunSpec with Matchers
-  with OneInstancePerTest with MockitoSugar
-{
-  private val mockBrokerBridge = mock[BrokerBridge]
-  private val brokerProcessHandler = new BrokerProcessHandler(
-    mockBrokerBridge,
-    restartOnFailure = true,
-    restartOnCompletion = true
-  )
-
-  describe("BrokerProcessHandler") {
-    describe("#onProcessFailed") {
-      it("should invoke the reset method") {
-        val mockResetMethod = mock[String => Unit]
-        brokerProcessHandler.setResetMethod(mockResetMethod)
-
-        brokerProcessHandler.onProcessFailed(mock[ExecuteException])
-
-        verify(mockResetMethod).apply(anyString())
-      }
-
-      it("should invoke the restart method if the proper flag is set to true") {
-        val mockRestartMethod = mock[() => Unit]
-        brokerProcessHandler.setRestartMethod(mockRestartMethod)
-
-        brokerProcessHandler.onProcessFailed(mock[ExecuteException])
-
-        verify(mockRestartMethod).apply()
-      }
-    }
-
-    describe("#onProcessComplete") {
-      it("should invoke the reset method") {
-        val mockResetMethod = mock[String => Unit]
-        brokerProcessHandler.setResetMethod(mockResetMethod)
-
-        brokerProcessHandler.onProcessComplete(0)
-
-        verify(mockResetMethod).apply(anyString())
-      }
-
-      it("should invoke the restart method if the proper flag is set to true") {
-        val mockRestartMethod = mock[() => Unit]
-        brokerProcessHandler.setRestartMethod(mockRestartMethod)
-
-        brokerProcessHandler.onProcessComplete(0)
-
-        verify(mockRestartMethod).apply()
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessSpec.scala
deleted file mode 100644
index 83face3..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerProcessSpec.scala
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import java.io.{OutputStream, InputStream, File}
-
-import org.apache.commons.exec._
-import org.apache.commons.io.FilenameUtils
-import org.mockito.ArgumentCaptor
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers, OneInstancePerTest}
-
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-class BrokerProcessSpec extends FunSpec with Matchers
-  with OneInstancePerTest with MockitoSugar
-{
-  private val TestProcessName = "test_process"
-  private val TestEntryResource = "test/entry/resource"
-  private val TestOtherResources = Seq("test/resource/1", "test/resource/2")
-  private val TestArguments = Seq("a", "b", "c")
-  private val TestEnvironment = Map(
-    "e1" -> "1",
-    "e2" -> "2"
-  )
-
-  private val mockBrokerBridge = mock[BrokerBridge]
-  private val mockBrokerProcessHandler = mock[BrokerProcessHandler]
-
-  private val mockExecutor = mock[Executor]
-
-  private val brokerProcess = new BrokerProcess(
-    processName = TestProcessName,
-    entryResource = TestEntryResource,
-    otherResources = TestOtherResources,
-    brokerBridge = mockBrokerBridge,
-    brokerProcessHandler = mockBrokerProcessHandler,
-    arguments = TestArguments
-  ) {
-    @volatile private var _tmpDir: String =
-      System.getProperty("java.io.tmpdir")
-
-    def setTmpDirectory(newDir: String) = _tmpDir = newDir
-    override protected def getTmpDirectory: String = _tmpDir
-    override protected def newExecutor(): Executor = mockExecutor
-    override protected def copy(
-      inputStream: InputStream,
-      outputStream: OutputStream
-    ): Int = 0
-
-    override protected def newProcessEnvironment(): Map[String, String] =
-      TestEnvironment
-    override protected lazy val getSubDirectory: String = ""
-    def doCopyResourceToTmp(resource: String) = copyResourceToTmp(resource)
-  }
-
-  describe("BrokerProcess") {
-    describe("constructor") {
-      it("should fail if the process name is null") {
-        intercept[IllegalArgumentException] {
-          new BrokerProcess(
-            processName = null,
-            entryResource = TestEntryResource,
-            otherResources = TestOtherResources,
-            brokerBridge = mockBrokerBridge,
-            brokerProcessHandler = mockBrokerProcessHandler,
-            arguments = TestArguments
-          )
-        }
-      }
-
-      it("should fail if the process name is empty") {
-        intercept[IllegalArgumentException] {
-          new BrokerProcess(
-            processName = " \t\n\r",
-            entryResource = TestEntryResource,
-            otherResources = TestOtherResources,
-            brokerBridge = mockBrokerBridge,
-            brokerProcessHandler = mockBrokerProcessHandler,
-            arguments = TestArguments
-          )
-        }
-      }
-
-      it("should fail if the entry resource is null") {
-        intercept[IllegalArgumentException] {
-          new BrokerProcess(
-            processName = TestProcessName,
-            entryResource = null,
-            otherResources = TestOtherResources,
-            brokerBridge = mockBrokerBridge,
-            brokerProcessHandler = mockBrokerProcessHandler,
-            arguments = TestArguments
-          )
-        }
-      }
-
-      it("should fail if the entry resource is empty") {
-        intercept[IllegalArgumentException] {
-          new BrokerProcess(
-            processName = TestProcessName,
-            entryResource = " \t\n\r",
-            otherResources = TestOtherResources,
-            brokerBridge = mockBrokerBridge,
-            brokerProcessHandler = mockBrokerProcessHandler,
-            arguments = TestArguments
-          )
-        }
-      }
-    }
-
-    describe("#copyResourceToTmp") {
-      it("should fail if a directory with the resource name already exists") {
-        val baseDir = System.getProperty("java.io.tmpdir")
-        val newResourceName = "some_resource/"
-
-        val resourceFile = new File(baseDir + s"/$newResourceName")
-        resourceFile.delete() // Ensure that there is not a file or something
-        resourceFile.mkdir()
-
-        intercept[BrokerException] {
-          brokerProcess.doCopyResourceToTmp(resourceFile.getPath)
-        }
-
-        resourceFile.delete()
-      }
-
-      it("should throw an exception if the tmp directory is not set") {
-        brokerProcess.setTmpDirectory(null)
-
-        intercept[BrokerException] {
-          brokerProcess.doCopyResourceToTmp("some file")
-        }
-      }
-
-      it("should return the resulting destination of the resource") {
-        val rootDir = System.getProperty("java.io.tmpdir")
-        val fileName = FilenameUtils.getBaseName(TestEntryResource)
-        val fullPath = Seq(rootDir, fileName).mkString("/")
-        val expected = new File(fullPath)
-
-        expected.delete()
-
-        brokerProcess.setTmpDirectory(rootDir)
-        val destination = brokerProcess.doCopyResourceToTmp(TestEntryResource)
-
-        val actual = new File(destination)
-        actual should be (expected)
-      }
-    }
-
-    describe("#start") {
-      it("should throw an exception if the process is already started") {
-        brokerProcess.start()
-
-        intercept[AssertionError] {
-          brokerProcess.start()
-        }
-      }
-
-      it("should execute the process using the entry and provided arguments") {
-        val finalResourceDestination = FilenameUtils.concat(
-          System.getProperty("java.io.tmpdir"),
-          FilenameUtils.getBaseName(TestEntryResource)
-        )
-        val expected = finalResourceDestination +: TestArguments
-
-        val commandLineCaptor = ArgumentCaptor.forClass(classOf[CommandLine])
-
-        brokerProcess.start()
-        verify(mockExecutor).execute(commandLineCaptor.capture(), any(), any())
-
-        val commandLine = commandLineCaptor.getValue
-        val actual = commandLine.getArguments
-
-        actual should contain theSameElementsAs expected
-      }
-
-      it("should execute using the environment provided") {
-        val finalResourceDestination = FilenameUtils.concat(
-          System.getProperty("java.io.tmpdir"),
-          FilenameUtils.getBaseName(TestEntryResource)
-        )
-
-        val environmentCaptor =
-          ArgumentCaptor.forClass(classOf[java.util.Map[String, String]])
-
-        brokerProcess.start()
-        verify(mockExecutor).execute(any(),environmentCaptor.capture() , any())
-
-        import scala.collection.JavaConverters._
-        val environment = environmentCaptor.getValue.asScala
-
-        environment should contain theSameElementsAs TestEnvironment
-      }
-
-      it("should use the process handler provided to listen for events") {
-        val expected = mockBrokerProcessHandler
-        val finalResourceDestination = FilenameUtils.concat(
-          System.getProperty("java.io.tmpdir"),
-          FilenameUtils.getBaseName(TestEntryResource)
-        )
-
-        val executeRequestHandlerCaptor =
-          ArgumentCaptor.forClass(classOf[ExecuteResultHandler])
-
-        brokerProcess.start()
-        verify(mockExecutor).execute(
-          any(), any(), executeRequestHandlerCaptor.capture())
-
-        val actual = executeRequestHandlerCaptor.getValue
-        actual should be (expected)
-      }
-    }
-
-    describe("#stop") {
-      it("should destroy the process if it is running") {
-        brokerProcess.start()
-
-        val mockExecuteWatchdog = mock[ExecuteWatchdog]
-        doReturn(mockExecuteWatchdog).when(mockExecutor).getWatchdog
-
-        brokerProcess.stop()
-
-        verify(mockExecuteWatchdog).destroyProcess()
-      }
-
-      it("should not try to destroy the process if it is not running") {
-        val mockExecuteWatchdog = mock[ExecuteWatchdog]
-        doReturn(mockExecuteWatchdog).when(mockExecutor).getWatchdog
-
-        brokerProcess.stop()
-
-        verify(mockExecuteWatchdog, never()).destroyProcess()
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerStateSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerStateSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerStateSpec.scala
deleted file mode 100644
index 84a1ae7..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerStateSpec.scala
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import org.scalatest.{OneInstancePerTest, Matchers, FunSpec}
-
-import scala.util.{Failure, Success}
-
-class BrokerStateSpec extends FunSpec with Matchers with OneInstancePerTest {
-
-  private val TestMaxQueuedCode = 5
-  private val brokerState = new BrokerState(TestMaxQueuedCode)
-
-  describe("BrokerState") {
-    describe("#pushCode") {
-      it("should throw an exception if the queue is maxed out") {
-        val code = "some code"
-
-        // Fill up to the max of our queue
-        for (i <- 1 to TestMaxQueuedCode)
-          brokerState.pushCode(code)
-
-        // Adding an additional code should throw an exception
-        intercept[IllegalStateException] {
-          brokerState.pushCode(code)
-        }
-      }
-
-      it("should queue up the code to eventually be executed") {
-        val code = "some code"
-
-        brokerState.totalQueuedCode() should be (0)
-        brokerState.pushCode(code)
-        brokerState.totalQueuedCode() should be (1)
-      }
-    }
-
-    describe("#totalQueuedCode") {
-      it("should return the total queued code elements") {
-        val code = "some code"
-
-        // Queue up to the maximum test elements, verifying that the total
-        // queued element count increases per push
-        for (i <- 1 to TestMaxQueuedCode) {
-          brokerState.pushCode(code)
-          brokerState.totalQueuedCode() should be (i)
-        }
-      }
-    }
-
-    describe("#nextCode") {
-      it("should return the next code element if available") {
-        val code = "some code"
-
-        brokerState.pushCode(code)
-
-        brokerState.nextCode().code should be (code)
-      }
-
-      it("should return null if no code element is available") {
-        brokerState.nextCode() should be (null)
-      }
-    }
-
-    describe("#isReady") {
-      it("should return true if the broker state is marked as ready") {
-        brokerState.markReady()
-        brokerState.isReady should be (true)
-      }
-
-      it("should return false if the broker state is not marked as ready") {
-        brokerState.isReady should be (false)
-      }
-    }
-
-    describe("#markReady") {
-      it("should mark the state of the broker as ready") {
-        // Mark once to make sure that the state gets set
-        brokerState.markReady()
-        brokerState.isReady should be (true)
-
-        // Mark a second time to ensure that the state does not change
-        brokerState.markReady()
-        brokerState.isReady should be (true)
-      }
-    }
-
-    describe("#markSuccess") {
-      it("should mark the future for the code as successful") {
-        val future = brokerState.pushCode("some code")
-        val BrokerCode(codeId, _) = brokerState.nextCode()
-
-        brokerState.markSuccess(codeId)
-        future.value.get.isSuccess should be (true)
-      }
-
-      it("should use the provided message as the contents of the future") {
-        val future = brokerState.pushCode("some code")
-        val BrokerCode(codeId, _) = brokerState.nextCode()
-
-        val message = "some message"
-        brokerState.markSuccess(codeId, message)
-        future.value.get should be (Success(message))
-      }
-
-      it("should do nothing if the code id is invalid") {
-        val future = brokerState.pushCode("some code")
-        val BrokerCode(codeId, _) = brokerState.nextCode()
-
-        brokerState.markSuccess(codeId + "1")
-        future.isCompleted should be (false)
-      }
-    }
-
-    describe("#markFailure") {
-      it("should mark the future for the code as failure") {
-        val future = brokerState.pushCode("some code")
-        val BrokerCode(codeId, _) = brokerState.nextCode()
-
-        brokerState.markFailure(codeId)
-        future.value.get.isSuccess should be (false)
-      }
-
-      it("should use the provided message as the contents of the exception") {
-        val future = brokerState.pushCode("some code")
-        val BrokerCode(codeId, _) = brokerState.nextCode()
-
-        val message = "some message"
-        brokerState.markFailure(codeId, message)
-
-        val failure = future.value.get.failed.get
-        failure.getLocalizedMessage should be (message)
-      }
-
-      it("should do nothing if the code id is invalid") {
-        val future = brokerState.pushCode("some code")
-        val BrokerCode(codeId, _) = brokerState.nextCode()
-
-        brokerState.markFailure(codeId + "1")
-        future.isCompleted should be (false)
-      }
-    }
-
-    describe("#reset") {
-      it("should clear any code still in the queue") {
-        brokerState.pushCode("some code")
-
-        brokerState.reset("")
-
-        brokerState.totalQueuedCode() should be (0)
-      }
-
-      it("should mark any evaluating code as a failure if marked true") {
-        val future = brokerState.pushCode("some code")
-
-        brokerState.reset("")
-
-        future.value.get.isFailure should be (true)
-      }
-
-      it("should use the message as the contents of the failed code futures") {
-        val future = brokerState.pushCode("some code")
-
-        val message = "some message"
-        brokerState.reset(message)
-
-        val failure = future.value.get.failed.get
-        failure.getLocalizedMessage should be (message)
-      }
-
-      it("should mark any evaluating code as a success if marked false") {
-        val future = brokerState.pushCode("some code")
-
-        brokerState.reset("", markAllAsFailure = false)
-
-        future.value.get.isSuccess should be (true)
-      }
-
-      it("should use the message as the contents of the successful code futures") {
-        val future = brokerState.pushCode("some code")
-
-        val message = "some message"
-        brokerState.reset(message, markAllAsFailure = false)
-
-        future.value.get should be (Success(message))
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerTransformerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerTransformerSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerTransformerSpec.scala
deleted file mode 100644
index 266c753..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/interpreter/broker/BrokerTransformerSpec.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- * 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.ibm.spark.interpreter.broker
-
-import com.ibm.spark.interpreter.{ExecuteError, Results}
-import org.scalatest.concurrent.Eventually
-import org.scalatest.{OneInstancePerTest, Matchers, FunSpec}
-
-import scala.concurrent.promise
-
-class BrokerTransformerSpec extends FunSpec with Matchers
-  with OneInstancePerTest with Eventually
-{
-  private val brokerTransformer = new BrokerTransformer
-
-  describe("BrokerTransformer") {
-    describe("#transformToInterpreterResult") {
-      it("should convert to success with result output if no failure") {
-        val codeResultPromise = promise[BrokerTypes.CodeResults]()
-
-        val transformedFuture = brokerTransformer.transformToInterpreterResult(
-          codeResultPromise.future
-        )
-
-        val successOutput = "some success"
-        codeResultPromise.success(successOutput)
-
-        eventually {
-          val result = transformedFuture.value.get.get
-          result should be((Results.Success, Left(successOutput)))
-        }
-      }
-
-      it("should convert to error with broker exception if failure") {
-        val codeResultPromise = promise[BrokerTypes.CodeResults]()
-
-        val transformedFuture = brokerTransformer.transformToInterpreterResult(
-          codeResultPromise.future
-        )
-
-        val failureException = new BrokerException("some failure")
-        codeResultPromise.failure(failureException)
-
-        eventually {
-          val result = transformedFuture.value.get.get
-          result should be((Results.Error, Right(ExecuteError(
-            name = failureException.getClass.getName,
-            value = failureException.getLocalizedMessage,
-            stackTrace = failureException.getStackTrace.map(_.toString).toList
-          ))))
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/magic/InternalClassLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/magic/InternalClassLoaderSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/magic/InternalClassLoaderSpec.scala
deleted file mode 100644
index c568c6d..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/magic/InternalClassLoaderSpec.scala
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.magic
-
-import org.scalatest.{Matchers, FunSpec}
-import org.scalatest.mock.MockitoSugar
-
-class InternalClassLoaderSpec extends FunSpec with Matchers with MockitoSugar {
-
-  abstract class MockClassLoader extends ClassLoader(null) {
-    override def loadClass(name: String): Class[_] = null
-  }
-
-  describe("InternalClassLoader") {
-    describe("#loadClass") {
-      it("should invoke super loadClass with loader's package prepended") {
-        val expected = classOf[Class[_]]
-        val packageName = "com.ibm.spark.magic"
-        val className = "SomeClass"
-
-        var parentLoadClassCorrectlyInvoked = false
-
-        val internalClassLoader = new InternalClassLoader(null) {
-          override private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = {
-            parentLoadClassCorrectlyInvoked =
-              name == s"$packageName.$className" && resolve
-            expected
-          }
-        }
-
-        internalClassLoader.loadClass(className, true) should be (expected)
-
-        parentLoadClassCorrectlyInvoked should be (true)
-      }
-
-      it("should use loader's package instead of provided package first") {
-        val expected = classOf[Class[_]]
-        val forcedPackageName = "com.ibm.spark.magic"
-        val packageName = "some.other.package"
-        val className = "SomeClass"
-
-        var parentLoadClassCorrectlyInvoked = false
-
-        val internalClassLoader = new InternalClassLoader(null) {
-          override private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = {
-            parentLoadClassCorrectlyInvoked =
-              name == s"$forcedPackageName.$className" && resolve
-            expected
-          }
-        }
-
-        internalClassLoader.loadClass(s"$packageName.$className", true) should be (expected)
-
-        parentLoadClassCorrectlyInvoked should be (true)
-      }
-
-      it("should invoke super loadClass with given package if internal missing") {
-        val expected = classOf[Class[_]]
-        val packageName = "some.other.package"
-        val className = "SomeClass"
-
-        var parentLoadClassCorrectlyInvoked = false
-
-        var methodCalled = false
-        val internalClassLoader = new InternalClassLoader(null) {
-          override private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = {
-            if (!methodCalled) {
-              methodCalled = true
-              throw new ClassNotFoundException()
-            }
-
-            parentLoadClassCorrectlyInvoked =
-              name == s"$packageName.$className" && resolve
-            expected
-          }
-        }
-
-        internalClassLoader.loadClass(s"$packageName.$className", true) should
-          be (expected)
-
-        parentLoadClassCorrectlyInvoked should be (true)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/magic/MagicLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/magic/MagicLoaderSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/magic/MagicLoaderSpec.scala
deleted file mode 100644
index 0c2b894..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/magic/MagicLoaderSpec.scala
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
-* Copyright 2014 IBM Corp.
-*
-* 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.ibm.spark.magic
-
-import java.io.OutputStream
-
-import com.ibm.spark.dependencies.DependencyDownloader
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.dependencies._
-import org.apache.spark.SparkContext
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{FunSpec, Matchers}
-
-
-/**
-* Used for verification of dependency injection. Calls toString on each
-* dependency to assert that they are provided.
-*/
-class LineMagicWithDependencies extends LineMagic
-  with IncludeDependencyDownloader
-  with IncludeSparkContext
-  with IncludeInterpreter
-  with IncludeOutputStream
-{
-  override def execute(code: String): Unit = {
-    sparkContext.cancelAllJobs()
-    interpreter.classServerURI
-    outputStream.close()
-    dependencyDownloader.setPrintStream(null)
-  }
-}
-
-class MockLineMagic extends LineMagic {
-  override def execute(code: String): Unit = {}
-}
-
-class MockCellMagic extends CellMagic {
-  override def execute(code: String): CellMagicOutput = 
-    CellMagicOutput()
-}
-
-class MagicLoaderSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("MagicLoader") {
-    describe("#hasLineMagic") {
-      it("should return false if a class with the magic name is not found") {
-        val magicLoader = new MagicLoader() {
-          override def findClass(name: String): Class[_] =
-            throw new ClassNotFoundException()
-        }
-
-        magicLoader.hasLineMagic("potato") should be (false)
-      }
-
-      it("should return true if a class with the magic name is found") {
-        val magicLoader = new MagicLoader() {
-          override def findClass(name: String): Class[_] = 
-            classOf[MockLineMagic]
-        }
-
-        magicLoader.hasLineMagic("potato") should be (true)
-      }
-
-      it("should return true if a class with the magic name is found regardless of case"){
-        // Only loads a class named "Potato"
-        val classLoader = new ClassLoader() {
-          override def findClass(name: String) =
-            if (name == "Potato") classOf[MockLineMagic]
-            else throw new ClassNotFoundException
-        }
-
-        // Case insensitive matching should be performed on "Potato"
-        val magicLoader = new MagicLoader(parentLoader = classLoader) {
-          override def magicClassNames = List("Potato")
-        }
-
-        magicLoader.hasLineMagic("Potato") should be (true)
-        magicLoader.hasLineMagic("potato") should be (true)
-        magicLoader.hasLineMagic("pOTatO") should be (true)
-      }
-    }
-
-    describe("#hasCellMagic") {
-      it("should return false if a class with the magic name is not found") {
-        val magicLoader = new MagicLoader() {
-          override def findClass(name: String): Class[_] =
-            throw new ClassNotFoundException()
-        }
-
-        magicLoader.hasCellMagic("potato") should be (false)
-      }
-
-      it("should return true if a class with the magic name is found") {
-        val magicLoader = new MagicLoader() {
-          override def findClass(name: String): Class[_] =
-            classOf[MockCellMagic]
-        }
-
-        magicLoader.hasCellMagic("potato") should be (true)
-      }
-
-      it("should return true if a class with the magic name is found regardless of case"){
-        // Only loads a class named "Potato"
-        val classLoader = new ClassLoader() {
-          override def findClass(name: String) =
-            if (name == "Potato") classOf[MockCellMagic]
-            else throw new ClassNotFoundException
-        }
-
-        // Case insensitive matching should be performed on "Potato"
-        val magicLoader = new MagicLoader(parentLoader = classLoader) {
-          override def magicClassNames = List("Potato")
-        }
-
-        magicLoader.hasCellMagic("Potato") should be (true)
-        magicLoader.hasCellMagic("potato") should be (true)
-        magicLoader.hasCellMagic("pOTatO") should be (true)
-      }
-    }
-    
-    describe("#magicClassName"){
-      it("should return the correctly-cased version of the requested magic name") {
-        val magicLoader = new MagicLoader() {
-          override def magicClassNames = List("Potato")
-        }
-
-        magicLoader.magicClassName("Potato") should be ("Potato")
-        magicLoader.magicClassName("potato") should be ("Potato")
-        magicLoader.magicClassName("pOTatO") should be ("Potato")
-      }
-
-      it("should return the query if a corresponding magic class does not exist") {
-        val magicLoader = new MagicLoader() {
-          override def magicClassNames = List()
-        }
-
-        magicLoader.magicClassName("dne") should be ("dne")
-        magicLoader.magicClassName("dNE") should be ("dNE")
-      }
-    }
-
-    describe("#createMagicInstance") {
-      it("should correctly insert dependencies into a class") {
-        val mockInterpreter = mock[Interpreter]
-        val mockSparkContext = mock[SparkContext]
-        val mockOutputStream = mock[OutputStream]
-        val mockDependencyDownloader = mock[DependencyDownloader]
-
-        val dependencyMap = new DependencyMap()
-          .setInterpreter(mockInterpreter)
-          .setSparkContext(mockSparkContext)
-          .setOutputStream(mockOutputStream)
-          .setDependencyDownloader(mockDependencyDownloader)
-
-        val magicLoader = new MagicLoader(
-          dependencyMap = dependencyMap,
-          parentLoader = new InternalClassLoader(getClass.getClassLoader)
-        )
-
-        val magicName = "LineMagicWithDependencies"
-        val instance = magicLoader.createMagicInstance(magicName)
-          .asInstanceOf[LineMagicWithDependencies]
-        instance.interpreter should be(mockInterpreter)
-        instance.outputStream should be(mockOutputStream)
-        instance.sparkContext should be(mockSparkContext)
-        instance.dependencyDownloader should be(mockDependencyDownloader)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/ArgumentParsingSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/ArgumentParsingSupportSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/ArgumentParsingSupportSpec.scala
deleted file mode 100644
index 144e90f..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/ArgumentParsingSupportSpec.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
-import joptsimple.{OptionSet, OptionSpec, OptionParser}
-import org.scalatest.mock.MockitoSugar
-
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-
-import collection.JavaConverters._
-
-class ArgumentParsingSupportSpec extends FunSpec with Matchers
-  with BeforeAndAfter with MockitoSugar
-{
-  private var mockOptions: OptionSet = _
-  private var mockParser: OptionParser = _
-  private var argumentParsingInstance: ArgumentParsingSupport = _
-
-  before {
-    mockOptions = mock[OptionSet]
-    mockParser = mock[OptionParser]
-    doReturn(mockOptions).when(mockParser).parse(anyVararg[String]())
-
-    argumentParsingInstance = new Object() with ArgumentParsingSupport {
-      override protected lazy val parser: OptionParser = mockParser
-    }
-  }
-
-  describe("ArgumentParsingSupport") {
-    describe("#parseArgs") {
-      it("should invoke the underlying parser's parse method") {
-        doReturn(Nil.asJava).when(mockOptions).nonOptionArguments()
-        argumentParsingInstance.parseArgs("")
-
-        verify(mockParser).parse(anyString())
-      }
-
-      it("should return an empty list if there are no non-option arguments") {
-        val expected = Nil
-        doReturn(expected.asJava).when(mockOptions).nonOptionArguments()
-        val actual = argumentParsingInstance.parseArgs((
-          "--transitive" :: expected
-        ).mkString(" "))
-
-        actual should be (expected)
-      }
-
-      it("should return a list containing non-option arguments") {
-        val expected = "non-option" :: Nil
-        doReturn(expected.asJava).when(mockOptions).nonOptionArguments()
-        val actual = argumentParsingInstance.parseArgs((
-          "--transitive" :: expected
-          ).mkString(" "))
-
-        actual should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/ConditionalOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/ConditionalOutputStreamSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/ConditionalOutputStreamSpec.scala
deleted file mode 100644
index d5c4e4c..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/ConditionalOutputStreamSpec.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.io.OutputStream
-
-import org.scalatest.mock.MockitoSugar
-import org.mockito.Mockito._
-import org.mockito.Matchers._
-import org.scalatest.{Matchers, FunSpec}
-
-class ConditionalOutputStreamSpec extends FunSpec with Matchers with MockitoSugar {
-  describe("ConditionalOutputStream") {
-    describe("#()") {
-      it("should throw an exception if the output stream is null") {
-        intercept[IllegalArgumentException] {
-          new ConditionalOutputStream(null, true)
-        }
-      }
-    }
-
-    describe("#write") {
-      it("should call the underlying write if the condition is true") {
-        val mockOutputStream = mock[OutputStream]
-        val conditionalOutputStream =
-          new ConditionalOutputStream(mockOutputStream, true)
-
-        val expected = 101
-        conditionalOutputStream.write(expected)
-
-        verify(mockOutputStream).write(expected)
-      }
-
-      it("should call the underlying write if the condition becomes true") {
-        val mockOutputStream = mock[OutputStream]
-        var condition = false
-
-        val conditionalOutputStream =
-          new ConditionalOutputStream(mockOutputStream, condition)
-
-        condition = true
-
-        val expected = 101
-        conditionalOutputStream.write(expected)
-
-        verify(mockOutputStream).write(expected)
-      }
-
-      it("should not call the underlying write if the condition is false") {
-        val mockOutputStream = mock[OutputStream]
-        val conditionalOutputStream =
-          new ConditionalOutputStream(mockOutputStream, false)
-
-        val expected = 101
-        conditionalOutputStream.write(expected)
-
-        verify(mockOutputStream, never()).write(any[Byte])
-      }
-
-      it("should not call the underlying write if the condition becomes false") {
-        val mockOutputStream = mock[OutputStream]
-        var condition = true
-
-        val conditionalOutputStream =
-          new ConditionalOutputStream(mockOutputStream, condition)
-
-        condition = false
-
-        val expected = 101
-        conditionalOutputStream.write(expected)
-
-        verify(mockOutputStream, never()).write(any[Byte])
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/DownloadSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/DownloadSupportSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/DownloadSupportSpec.scala
deleted file mode 100644
index 4b0cc3d..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/DownloadSupportSpec.scala
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.io.FileNotFoundException
-import java.net.URL
-
-import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
-import scala.io.Source
-import scala.tools.nsc.io.File
-
-class DownloadSupportSpec extends FunSpec with Matchers with BeforeAndAfter {
-  val downloadDestinationUrl = new URL("file:///tmp/testfile2.ext")
-
-  val testFileContent = "This is a test"
-  val testFileName = "/tmp/testfile.txt"
-
-  //  Create a test file for downloading
-  before {
-    File(testFileName).writeAll(testFileContent)
-  }
-
-  //  Cleanup what we made
-  after {
-    File(testFileName).deleteIfExists()
-    File(downloadDestinationUrl.getPath).deleteIfExists()
-  }
-
-  describe("DownloadSupport"){
-    describe("#downloadFile( String, String )"){
-      it("should download a file to the download directory"){
-        val testFileUrl = "file:///tmp/testfile.txt"
-
-        //  Create our utility and download the file
-        val downloader = new Object with DownloadSupport
-        downloader.downloadFile(
-          testFileUrl,
-          downloadDestinationUrl.getProtocol + "://" +
-            downloadDestinationUrl.getPath)
-
-        //  Verify the file contents are what was in the original file
-        val downloadedFileContent: String =
-          Source.fromFile(downloadDestinationUrl.getPath).mkString
-
-        downloadedFileContent should be (testFileContent)
-      }
-
-    }
-
-    describe("#downloadFile( URL, URL )"){
-      it("should download a file to the download directory"){
-        val testFileUrl = new URL("file:///tmp/testfile.txt")
-
-        val downloader = new Object with DownloadSupport
-        downloader.downloadFile(testFileUrl, downloadDestinationUrl)
-
-        //  Verify the file contents are what was in the original file
-        val downloadedFileContent: String =
-          Source.fromFile(downloadDestinationUrl.getPath).mkString
-
-        downloadedFileContent should be (testFileContent)
-      }
-
-      it("should throw FileNotFoundException if the download URL is bad"){
-        val badFilename = "file:///tmp/testbadfile.txt"
-        File(badFilename).deleteIfExists()
-        val badFileUrl = new URL(badFilename)
-
-        val downloader = new Object with DownloadSupport
-        intercept[FileNotFoundException] {
-          downloader.downloadFile(badFileUrl, downloadDestinationUrl)
-        }
-      }
-
-      it("should throw FileNotFoundException if the download ") {
-        val testFileUrl = new URL("file:///tmp/testfile.txt")
-        val badDestinationUrl =
-          new URL("file:///tmp/badloc/that/doesnt/exist.txt")
-
-        val downloader = new Object with DownloadSupport
-        intercept[FileNotFoundException] {
-          downloader.downloadFile(testFileUrl, badDestinationUrl)
-        }
-      }
-    }
-  }
-
-}


[21/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/DynamicReflectionSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/DynamicReflectionSupportSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/DynamicReflectionSupportSpec.scala
deleted file mode 100644
index fdfe637..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/DynamicReflectionSupportSpec.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.io.OutputStream
-
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{GivenWhenThen, BeforeAndAfter, FunSpec, Matchers}
-
-class DynamicReflectionSupportSpec
-  extends FunSpec with Matchers with MockitoSugar {
-
-  describe("DynamicReflectionSupport") {
-    describe("with a class instance") {
-      describe("#selectDynamic") {
-        it("should support accessing a normal field") {
-          class MyTestClass {
-            val test = 3
-          }
-
-          val x: MyTestClass = new MyTestClass
-
-          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
-
-          dynamicSupport.test should be (3)
-        }
-
-        it("should support accessing a method with no arguments") {
-          class MyTestClass {
-            def test = 3
-          }
-
-          val x: MyTestClass = new MyTestClass
-
-          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
-
-          dynamicSupport.test should be (3)
-        }
-
-        it("should throw an error if the field does not exist") {
-          class MyTestClass
-
-          val x: MyTestClass = new MyTestClass
-
-          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
-
-          intercept[NoSuchFieldException] {
-            dynamicSupport.test
-          }
-        }
-      }
-
-      describe("#applyDynamic") {
-        it("should support executing a method with one argument") {
-          class MyTestClass {
-            def test(x: Int) = x
-          }
-
-          val x: MyTestClass = new MyTestClass
-
-          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
-
-          dynamicSupport.test(5) should be (5)
-        }
-
-        it("should support executing a method with multiple arguments") {
-          class MyTestClass {
-            def test(x: Int, y: String) = (x, y)
-          }
-
-          val x: MyTestClass = new MyTestClass
-
-          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
-
-          dynamicSupport.test(5, "test me") should be ((5, "test me"))
-        }
-
-        it("should throw an error if the method does not exist") {
-          class MyTestClass
-
-          val x: MyTestClass = new MyTestClass
-
-          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
-
-          intercept[NoSuchMethodException] {
-            dynamicSupport.test(5, "test me")
-          }
-        }
-      }
-    }
-
-    describe("with an object") {
-      describe("#selectDynamic") {
-        it("should support accessing a normal field") {
-          object MyTestObject {
-            val test = 3
-          }
-
-          val dynamicSupport =
-            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
-
-          dynamicSupport.test should be (3)
-        }
-
-        it("should support accessing a method with no arguments") {
-          object MyTestObject {
-            def test = 3
-          }
-
-          val dynamicSupport =
-            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
-
-          dynamicSupport.test should be (3)
-        }
-
-        it("should throw an error if the field does not exist") {
-          object MyTestObject
-
-          val dynamicSupport =
-            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
-
-          intercept[NoSuchFieldException] {
-            dynamicSupport.test
-          }
-        }
-      }
-
-      describe("#applyDynamic") {
-        it("should support executing a method with one argument") {
-          object MyTestObject {
-            def test(x: Int) = x
-          }
-
-          val dynamicSupport =
-            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
-
-          dynamicSupport.test(5) should be (5)
-        }
-
-        it("should support executing a method with multiple arguments") {
-          object MyTestObject {
-            def test(x: Int, y: String) = (x, y)
-          }
-
-          val dynamicSupport =
-            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
-
-          dynamicSupport.test(5, "test me") should be ((5, "test me"))
-
-        }
-
-        it("should throw an error if the method does not exist") {
-          object MyTestObject
-
-          val dynamicSupport =
-            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
-
-          intercept[NoSuchMethodException] {
-            dynamicSupport.test(5, "test me")
-          }
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/KeyValuePairUtilsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/KeyValuePairUtilsSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/KeyValuePairUtilsSpec.scala
deleted file mode 100644
index cba632d..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/KeyValuePairUtilsSpec.scala
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.utils
-
-import joptsimple.util.KeyValuePair
-import org.scalatest.{Matchers, FunSpec}
-
-class KeyValuePairUtilsSpec extends FunSpec with Matchers {
-  private object TestKeyValuePair {
-    def apply(key: String, value: String) = KeyValuePair.valueOf(s"$key=$value")
-  }
-
-  describe("KeyValuePairUtils") {
-    describe("#stringToKeyValuePairSeq") {
-      it("should throw an exception when given a null string") {
-        intercept[IllegalArgumentException] {
-          KeyValuePairUtils.stringToKeyValuePairSeq(null)
-        }
-      }
-
-      it("should convert an empty string to an empty sequence") {
-        val expected = Nil
-        val actual = KeyValuePairUtils.stringToKeyValuePairSeq("")
-
-        actual should be (expected)
-      }
-
-      it("should convert a single key-value pair to a sequence with one pair") {
-        val expected = Seq(TestKeyValuePair("key", "value"))
-        val actual = KeyValuePairUtils.stringToKeyValuePairSeq("key=value")
-
-        actual should be (expected)
-      }
-
-      it("should convert multiple key-value pairs using the provided delimiter") {
-        val expected = Seq(
-          TestKeyValuePair("key1", "value1"),
-          TestKeyValuePair("key2", "value2")
-        )
-        val actual = KeyValuePairUtils.stringToKeyValuePairSeq(
-          "key1=value1, key2=value2", ",")
-
-        actual should be (expected)
-      }
-
-      it("should fail if the string does not contain valid key-value pairs") {
-        KeyValuePairUtils.stringToKeyValuePairSeq("not valid")
-      }
-    }
-
-    describe("#keyValuePairSeqToString") {
-      it("should throw an exception when given a null sequence") {
-        intercept[IllegalArgumentException] {
-          KeyValuePairUtils.keyValuePairSeqToString(null)
-        }
-      }
-
-      it("should return an empty string if the sequence is empty") {
-        val expected = ""
-        val actual = KeyValuePairUtils.keyValuePairSeqToString(Nil)
-
-        actual should be (expected)
-      }
-
-      it("should generate key=value for a key-value pair") {
-        val expected = "key=value"
-        val actual = KeyValuePairUtils.keyValuePairSeqToString(
-          Seq(TestKeyValuePair("key", "value")))
-
-        actual should be (expected)
-      }
-
-      it("should use the provided delimiter to separate key-value pairs") {
-        val expected = "key1=value1,key2=value2"
-        val actual = KeyValuePairUtils.keyValuePairSeqToString(Seq(
-          TestKeyValuePair("key1", "value1"),
-          TestKeyValuePair("key2", "value2")
-        ), ",")
-
-        actual should be (expected)
-      }
-
-      it("should trim whitespace from keys and values") {
-        val expected = "key1=value1,key2=value2"
-        val actual = KeyValuePairUtils.keyValuePairSeqToString(Seq(
-          TestKeyValuePair(" key1", "  value1 "),
-          TestKeyValuePair("\tkey2 ", "value2\t")
-        ), ",")
-
-        actual should be (expected)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/MultiOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/MultiOutputStreamSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/MultiOutputStreamSpec.scala
deleted file mode 100644
index 185a85d..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/MultiOutputStreamSpec.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.io.OutputStream
-
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
-import org.mockito.Matchers._
-import org.mockito.Mockito._
-
-class MultiOutputStreamSpec
-  extends FunSpec with Matchers with MockitoSugar with BeforeAndAfter {
-
-  describe("MultiOutputStream") {
-    val listOfMockOutputStreams = List(mock[OutputStream], mock[OutputStream])
-    val multiOutputStream = MultiOutputStream(listOfMockOutputStreams)
-
-    describe("#close") {
-      it("should call #close on all internal output streams") {
-        multiOutputStream.close()
-
-        listOfMockOutputStreams.foreach(mockOutputStream => verify(mockOutputStream).close())
-      }
-    }
-
-    describe("#flush") {
-      it("should call #flush on all internal output streams") {
-        multiOutputStream.flush()
-
-        listOfMockOutputStreams.foreach(mockOutputStream => verify(mockOutputStream).flush())
-      }
-    }
-
-    describe("#write(int)") {
-      it("should call #write(int) on all internal output streams") {
-        multiOutputStream.write(anyInt())
-
-        listOfMockOutputStreams.foreach(
-          mockOutputStream => verify(mockOutputStream).write(anyInt()))
-      }
-    }
-    describe("#write(byte[])") {
-      it("should call #write(byte[]) on all internal output streams") {
-        multiOutputStream.write(any[Array[Byte]])
-
-        listOfMockOutputStreams.foreach(
-          mockOutputStream => verify(mockOutputStream).write(any[Array[Byte]]))
-      }
-    }
-
-    describe("#write(byte[], int, int)") {
-      it("should call #write(byte[], int, int) on all internal output streams") {
-        multiOutputStream.write(any[Array[Byte]], anyInt(), anyInt())
-
-        listOfMockOutputStreams.foreach(
-          mockOutputStream =>
-            verify(mockOutputStream).write(any[Array[Byte]], anyInt(), anyInt()))
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/ScheduledTaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/ScheduledTaskManagerSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/ScheduledTaskManagerSpec.scala
deleted file mode 100644
index 8db4535..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/ScheduledTaskManagerSpec.scala
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.utils
-
-import java.util.Calendar
-import java.util.concurrent.atomic.AtomicBoolean
-import java.util.concurrent.{TimeUnit, CountDownLatch}
-
-import org.scalatest.concurrent.Eventually
-import org.scalatest.time.{Milliseconds, Span}
-import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
-
-class ScheduledTaskManagerSpec extends FunSpec with Matchers with BeforeAndAfter
-  with Eventually
-{
-  private val TestTimeInterval = 30
-  private val MaximumChecks = 3
-  private val TimeoutScale = 3
-  private var scheduledTaskManager: ScheduledTaskManager = _
-  private var scheduleVerifier: ScheduleVerifier = _
-
-  implicit override val patienceConfig = PatienceConfig(
-    timeout = scaled(Span(
-      TestTimeInterval * MaximumChecks * TimeoutScale, Milliseconds)),
-    interval = scaled(Span(TestTimeInterval / 2, Milliseconds))
-  )
-
-  private class ScheduleVerifier {
-    @volatile private var checkinTimes: List[Long] = Nil
-    private val taskRun = new AtomicBoolean(false)
-
-    def task() = {
-      if (checkinTimes.length < MaximumChecks)
-        checkinTimes = checkinTimes :+ Calendar.getInstance().getTimeInMillis
-      taskRun.set(true)
-    }
-
-    def shouldNotRunAnymore(milliseconds: Long) = eventually {
-      val offset: Int = (milliseconds * 0.5).toInt
-
-      // Clean the state and wait to see if the task is executed again
-      taskRun.set(false)
-      Thread.sleep(milliseconds + offset)
-
-      taskRun.get() should be (false)
-    }
-
-    def shouldRunEvery(milliseconds: Long) = {
-      // 50% +/-
-      val offset: Int = (milliseconds * 0.5).toInt
-
-      eventually {
-        // Assert we have the desired number of checks
-        checkinTimes.length should be (MaximumChecks)
-
-        checkinTimes.take(checkinTimes.length - 1).zip(
-          checkinTimes.takeRight(checkinTimes.length - 1)
-        ).foreach({ times =>
-          val firstTime = times._1
-          val secondTime = times._2
-          (secondTime - firstTime) should (
-            be >= milliseconds - offset and
-              be <= milliseconds + offset)
-        })
-      }
-    }
-  }
-
-  before {
-    scheduledTaskManager = new ScheduledTaskManager
-    scheduleVerifier = new ScheduleVerifier
-  }
-
-  after {
-    scheduledTaskManager.stop()
-  }
-
-  describe("ScheduledTaskManager") {
-    describe("#addTask") {
-      // TODO: This is failing frequently due to some sort of timing problem
-      ignore("should add a new task to be executed periodically") {
-        scheduledTaskManager.addTask(timeInterval = TestTimeInterval,
-          task = scheduleVerifier.task())
-
-        scheduleVerifier.shouldRunEvery(TestTimeInterval)
-      }
-    }
-
-    describe("#removeTask") {
-      it("should stop and remove the task if it exists") {
-        val taskId = scheduledTaskManager.addTask(
-          timeInterval = TestTimeInterval,
-          task = scheduleVerifier.task()
-        )
-
-        scheduledTaskManager.removeTask(taskId)
-
-        scheduleVerifier.shouldNotRunAnymore(TestTimeInterval)
-      }
-
-      it("should return true if the task was removed") {
-        val taskId = scheduledTaskManager.addTask(
-          timeInterval = TestTimeInterval,
-          task = scheduleVerifier.task()
-        )
-
-        scheduledTaskManager.removeTask(taskId) should be (true)
-      }
-
-      it("should return false if the task does not exist") {
-        scheduledTaskManager.removeTask("") should be (false)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/com/ibm/spark/utils/TaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/com/ibm/spark/utils/TaskManagerSpec.scala b/kernel-api/src/test/scala/com/ibm/spark/utils/TaskManagerSpec.scala
deleted file mode 100644
index 3456d98..0000000
--- a/kernel-api/src/test/scala/com/ibm/spark/utils/TaskManagerSpec.scala
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.utils
-
-import java.util.concurrent.{RejectedExecutionException, ExecutionException}
-
-import org.scalatest.concurrent.PatienceConfiguration.Timeout
-import org.scalatest.concurrent.{Timeouts, Eventually, ScalaFutures}
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.time.{Milliseconds, Seconds, Span}
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-import test.utils.UncaughtExceptionSuppression
-
-import scala.concurrent.Future
-import scala.runtime.BoxedUnit
-
-class TaskManagerSpec extends FunSpec with Matchers with MockitoSugar
-  with BeforeAndAfter with ScalaFutures with UncaughtExceptionSuppression
-  with Eventually with Timeouts
-{
-  implicit override val patienceConfig = PatienceConfig(
-    timeout = scaled(Span(200, Milliseconds)),
-    interval = scaled(Span(5, Milliseconds))
-  )
-  private val MaxTestTasks = 50000
-  private var taskManager: TaskManager = _
-
-  before {
-    taskManager = new TaskManager
-  }
-
-  after {
-    taskManager = null
-  }
-
-  describe("TaskManager") {
-    describe("#add") {
-      it("should throw an exception if not started") {
-        intercept[AssertionError] {
-          taskManager.add {}
-        }
-      }
-
-      it("should throw an exception if more tasks are added than max task size") {
-        val taskManager = new TaskManager(maximumWorkers = 1, maxTasks = 1)
-
-        taskManager.start()
-
-        // Should fail from having too many tasks added
-        intercept[RejectedExecutionException] {
-          for (i <- 1 to MaxTestTasks) taskManager.add {}
-        }
-      }
-
-      it("should return a Future[_] based on task provided") {
-        taskManager.start()
-
-        // Cannot check inner Future type due to type erasure
-        taskManager.add { } shouldBe an [Future[_]]
-
-        taskManager.stop()
-      }
-
-      it("should work for a task that returns nothing") {
-        taskManager.start()
-
-        val f = taskManager.add { }
-
-        whenReady(f) { result =>
-          result shouldBe a [BoxedUnit]
-          taskManager.stop()
-        }
-      }
-
-      it("should construct a Runnable that invokes a Promise on success") {
-        taskManager.start()
-
-        val returnValue = 3
-        val f = taskManager.add { returnValue }
-
-        whenReady(f) { result =>
-          result should be (returnValue)
-          taskManager.stop()
-        }
-      }
-
-      it("should construct a Runnable that invokes a Promise on failure") {
-        taskManager.start()
-
-        val error = new Throwable("ERROR")
-        val f = taskManager.add { throw error }
-
-        whenReady(f.failed) { result =>
-          result should be (error)
-          taskManager.stop()
-        }
-      }
-
-      it("should not block when adding more tasks than available threads") {
-        val taskManager = new TaskManager(maximumWorkers = 1)
-
-        taskManager.start()
-
-        failAfter(Span(100, Milliseconds)) {
-          taskManager.add { while (true) { Thread.sleep(1) } }
-          taskManager.add { while (true) { Thread.sleep(1) } }
-        }
-      }
-    }
-
-    describe("#size") {
-      it("should be zero when no tasks have been added") {
-        taskManager.size should be (0)
-      }
-
-      it("should reflect queued tasks and executing tasks") {
-        val taskManager = new TaskManager(maximumWorkers = 1)
-        taskManager.start()
-
-        // Fill up the task manager and then add another task to the queue
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-
-        taskManager.size should be (2)
-      }
-
-      it("should be one if there is only one executing task and no queued ones") {
-        taskManager.start()
-
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-
-        // Wait until task is being executed to check if the task is still in
-        // the queue
-        while (!taskManager.isExecutingTask) Thread.sleep(1)
-
-        taskManager.size should be (1)
-
-        taskManager.stop()
-      }
-    }
-
-    describe("#hasTaskInQueue") {
-      it("should be false when no task has been added") {
-        taskManager.hasTaskInQueue should be (false)
-      }
-
-      it("should be true where there are tasks remaining in the queue") {
-        val taskManager = new TaskManager(maximumWorkers = 1)
-        taskManager.start()
-
-        // Fill up the task manager and then add another task to the queue
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-
-        taskManager.hasTaskInQueue should be (true)
-      }
-
-      it("should be false when the only task is currently being executed") {
-        taskManager.start()
-
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-
-        // Wait until task is being executed to check if the task is still in
-        // the queue
-        while (!taskManager.isExecutingTask) Thread.sleep(1)
-
-        taskManager.hasTaskInQueue should be (false)
-
-        taskManager.stop()
-      }
-    }
-
-    describe("#isExecutingTask") {
-      it("should be true when a task is being executed") {
-        taskManager.start()
-        taskManager.add { while (true) { Thread.sleep(1000) } }
-
-        eventually {
-          taskManager.isExecutingTask should be (true)
-        }
-
-        taskManager.stop()
-      }
-
-      it("should be false when no tasks have been added") {
-        taskManager.isExecutingTask should be (false)
-      }
-
-      // TODO: Timing issue on Travis CI needs to be resolved
-      ignore("should be false when all tasks have finished") {
-        taskManager.start()
-        val f = taskManager.add { } // Really fast execution
-
-        // Wait for up to 1 second for the task to finish
-        whenReady(f, Timeout(Span(1, Seconds))) { result =>
-          taskManager.isExecutingTask should be (false)
-          taskManager.stop()
-        }
-      }
-    }
-
-    describe("#await") {
-      it("should block until all tasks are completed") {
-        val taskManager = new TaskManager(
-          maximumWorkers = 1,
-          maxTasks = MaxTestTasks
-        )
-
-        taskManager.start()
-
-        // TODO: Need better way to ensure tasks are still running while
-        // awaiting their return
-        for (x <- 1 to MaxTestTasks) taskManager.add { Thread.sleep(1) }
-
-        assume(taskManager.hasTaskInQueue)
-        taskManager.await()
-
-        taskManager.hasTaskInQueue should be (false)
-        taskManager.isExecutingTask should be (false)
-
-        taskManager.stop()
-      }
-    }
-
-    describe("#start") {
-      it("should create an internal thread pool executor") {
-        taskManager.start()
-
-        taskManager.executor should not be (None)
-
-        taskManager.stop()
-      }
-    }
-
-    describe("#restart") {
-      it("should stop & erase the old internal thread and create a new one") {
-        taskManager.start()
-
-        val oldExecutor = taskManager.executor
-
-        taskManager.restart()
-
-        taskManager.executor should not be (oldExecutor)
-
-        taskManager.stop()
-      }
-    }
-
-    describe("#stop") {
-      it("should attempt to interrupt the currently-running task") {
-        taskManager.start()
-        val f = taskManager.add { while (true) { Thread.sleep(1000) } }
-
-        // Wait for the task to start
-        while (!taskManager.isExecutingTask) Thread.sleep(1)
-
-        // Cancel the task
-        taskManager.stop()
-
-        // Future should return an InterruptedException
-        whenReady(f.failed) { result =>
-          result shouldBe an [ExecutionException]
-          result.getCause shouldBe an [InterruptedException]
-        }
-      }
-
-      // TODO: Refactoring task manager to be parallelizable broke this ability
-      //       so this will need to be reimplemented or abandoned
-      ignore("should kill the thread if interrupts failed and kill enabled") {
-        taskManager.start()
-        val f = taskManager.add { var x = 0; while (true) { x += 1 } }
-
-        // Wait for the task to start
-        while (!taskManager.isExecutingTask) Thread.sleep(1)
-
-        // Kill the task
-        taskManager.stop()
-
-        // Future should return ThreadDeath when killed
-        whenReady(f.failed) { result =>
-          result shouldBe an [ExecutionException]
-          result.getCause shouldBe a [ThreadDeath]
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
new file mode 100644
index 0000000..d74867c
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import com.ibm.spark.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
+import com.ibm.spark.kernel.api.KernelLike
+import org.apache.spark.api.java.JavaSparkContext
+import org.apache.spark.sql.SQLContext
+import org.apache.spark.{SparkConf, SparkContext}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers, OneInstancePerTest}
+import org.mockito.Mockito._
+
+class BrokerBridgeSpec extends FunSpec with Matchers with OneInstancePerTest
+  with MockitoSugar
+{
+  private val mockBrokerState = mock[BrokerState]
+  private val mockKernel = mock[KernelLike]
+
+  private val brokerBridge = new BrokerBridge(
+    mockBrokerState,
+    mockKernel
+  )
+
+  describe("BrokerBridge") {
+    describe("#state") {
+      it("should return the broker state from the constructor") {
+        brokerBridge.state should be (mockBrokerState)
+      }
+    }
+
+    describe("#kernel") {
+      it("should return the kernel from the constructor") {
+        brokerBridge.kernel should be (mockKernel)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
new file mode 100644
index 0000000..35d3235
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import org.apache.commons.exec.ExecuteException
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers, OneInstancePerTest}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+class BrokerProcessHandlerSpec extends FunSpec with Matchers
+  with OneInstancePerTest with MockitoSugar
+{
+  private val mockBrokerBridge = mock[BrokerBridge]
+  private val brokerProcessHandler = new BrokerProcessHandler(
+    mockBrokerBridge,
+    restartOnFailure = true,
+    restartOnCompletion = true
+  )
+
+  describe("BrokerProcessHandler") {
+    describe("#onProcessFailed") {
+      it("should invoke the reset method") {
+        val mockResetMethod = mock[String => Unit]
+        brokerProcessHandler.setResetMethod(mockResetMethod)
+
+        brokerProcessHandler.onProcessFailed(mock[ExecuteException])
+
+        verify(mockResetMethod).apply(anyString())
+      }
+
+      it("should invoke the restart method if the proper flag is set to true") {
+        val mockRestartMethod = mock[() => Unit]
+        brokerProcessHandler.setRestartMethod(mockRestartMethod)
+
+        brokerProcessHandler.onProcessFailed(mock[ExecuteException])
+
+        verify(mockRestartMethod).apply()
+      }
+    }
+
+    describe("#onProcessComplete") {
+      it("should invoke the reset method") {
+        val mockResetMethod = mock[String => Unit]
+        brokerProcessHandler.setResetMethod(mockResetMethod)
+
+        brokerProcessHandler.onProcessComplete(0)
+
+        verify(mockResetMethod).apply(anyString())
+      }
+
+      it("should invoke the restart method if the proper flag is set to true") {
+        val mockRestartMethod = mock[() => Unit]
+        brokerProcessHandler.setRestartMethod(mockRestartMethod)
+
+        brokerProcessHandler.onProcessComplete(0)
+
+        verify(mockRestartMethod).apply()
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
new file mode 100644
index 0000000..83face3
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import java.io.{OutputStream, InputStream, File}
+
+import org.apache.commons.exec._
+import org.apache.commons.io.FilenameUtils
+import org.mockito.ArgumentCaptor
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers, OneInstancePerTest}
+
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+class BrokerProcessSpec extends FunSpec with Matchers
+  with OneInstancePerTest with MockitoSugar
+{
+  private val TestProcessName = "test_process"
+  private val TestEntryResource = "test/entry/resource"
+  private val TestOtherResources = Seq("test/resource/1", "test/resource/2")
+  private val TestArguments = Seq("a", "b", "c")
+  private val TestEnvironment = Map(
+    "e1" -> "1",
+    "e2" -> "2"
+  )
+
+  private val mockBrokerBridge = mock[BrokerBridge]
+  private val mockBrokerProcessHandler = mock[BrokerProcessHandler]
+
+  private val mockExecutor = mock[Executor]
+
+  private val brokerProcess = new BrokerProcess(
+    processName = TestProcessName,
+    entryResource = TestEntryResource,
+    otherResources = TestOtherResources,
+    brokerBridge = mockBrokerBridge,
+    brokerProcessHandler = mockBrokerProcessHandler,
+    arguments = TestArguments
+  ) {
+    @volatile private var _tmpDir: String =
+      System.getProperty("java.io.tmpdir")
+
+    def setTmpDirectory(newDir: String) = _tmpDir = newDir
+    override protected def getTmpDirectory: String = _tmpDir
+    override protected def newExecutor(): Executor = mockExecutor
+    override protected def copy(
+      inputStream: InputStream,
+      outputStream: OutputStream
+    ): Int = 0
+
+    override protected def newProcessEnvironment(): Map[String, String] =
+      TestEnvironment
+    override protected lazy val getSubDirectory: String = ""
+    def doCopyResourceToTmp(resource: String) = copyResourceToTmp(resource)
+  }
+
+  describe("BrokerProcess") {
+    describe("constructor") {
+      it("should fail if the process name is null") {
+        intercept[IllegalArgumentException] {
+          new BrokerProcess(
+            processName = null,
+            entryResource = TestEntryResource,
+            otherResources = TestOtherResources,
+            brokerBridge = mockBrokerBridge,
+            brokerProcessHandler = mockBrokerProcessHandler,
+            arguments = TestArguments
+          )
+        }
+      }
+
+      it("should fail if the process name is empty") {
+        intercept[IllegalArgumentException] {
+          new BrokerProcess(
+            processName = " \t\n\r",
+            entryResource = TestEntryResource,
+            otherResources = TestOtherResources,
+            brokerBridge = mockBrokerBridge,
+            brokerProcessHandler = mockBrokerProcessHandler,
+            arguments = TestArguments
+          )
+        }
+      }
+
+      it("should fail if the entry resource is null") {
+        intercept[IllegalArgumentException] {
+          new BrokerProcess(
+            processName = TestProcessName,
+            entryResource = null,
+            otherResources = TestOtherResources,
+            brokerBridge = mockBrokerBridge,
+            brokerProcessHandler = mockBrokerProcessHandler,
+            arguments = TestArguments
+          )
+        }
+      }
+
+      it("should fail if the entry resource is empty") {
+        intercept[IllegalArgumentException] {
+          new BrokerProcess(
+            processName = TestProcessName,
+            entryResource = " \t\n\r",
+            otherResources = TestOtherResources,
+            brokerBridge = mockBrokerBridge,
+            brokerProcessHandler = mockBrokerProcessHandler,
+            arguments = TestArguments
+          )
+        }
+      }
+    }
+
+    describe("#copyResourceToTmp") {
+      it("should fail if a directory with the resource name already exists") {
+        val baseDir = System.getProperty("java.io.tmpdir")
+        val newResourceName = "some_resource/"
+
+        val resourceFile = new File(baseDir + s"/$newResourceName")
+        resourceFile.delete() // Ensure that there is not a file or something
+        resourceFile.mkdir()
+
+        intercept[BrokerException] {
+          brokerProcess.doCopyResourceToTmp(resourceFile.getPath)
+        }
+
+        resourceFile.delete()
+      }
+
+      it("should throw an exception if the tmp directory is not set") {
+        brokerProcess.setTmpDirectory(null)
+
+        intercept[BrokerException] {
+          brokerProcess.doCopyResourceToTmp("some file")
+        }
+      }
+
+      it("should return the resulting destination of the resource") {
+        val rootDir = System.getProperty("java.io.tmpdir")
+        val fileName = FilenameUtils.getBaseName(TestEntryResource)
+        val fullPath = Seq(rootDir, fileName).mkString("/")
+        val expected = new File(fullPath)
+
+        expected.delete()
+
+        brokerProcess.setTmpDirectory(rootDir)
+        val destination = brokerProcess.doCopyResourceToTmp(TestEntryResource)
+
+        val actual = new File(destination)
+        actual should be (expected)
+      }
+    }
+
+    describe("#start") {
+      it("should throw an exception if the process is already started") {
+        brokerProcess.start()
+
+        intercept[AssertionError] {
+          brokerProcess.start()
+        }
+      }
+
+      it("should execute the process using the entry and provided arguments") {
+        val finalResourceDestination = FilenameUtils.concat(
+          System.getProperty("java.io.tmpdir"),
+          FilenameUtils.getBaseName(TestEntryResource)
+        )
+        val expected = finalResourceDestination +: TestArguments
+
+        val commandLineCaptor = ArgumentCaptor.forClass(classOf[CommandLine])
+
+        brokerProcess.start()
+        verify(mockExecutor).execute(commandLineCaptor.capture(), any(), any())
+
+        val commandLine = commandLineCaptor.getValue
+        val actual = commandLine.getArguments
+
+        actual should contain theSameElementsAs expected
+      }
+
+      it("should execute using the environment provided") {
+        val finalResourceDestination = FilenameUtils.concat(
+          System.getProperty("java.io.tmpdir"),
+          FilenameUtils.getBaseName(TestEntryResource)
+        )
+
+        val environmentCaptor =
+          ArgumentCaptor.forClass(classOf[java.util.Map[String, String]])
+
+        brokerProcess.start()
+        verify(mockExecutor).execute(any(),environmentCaptor.capture() , any())
+
+        import scala.collection.JavaConverters._
+        val environment = environmentCaptor.getValue.asScala
+
+        environment should contain theSameElementsAs TestEnvironment
+      }
+
+      it("should use the process handler provided to listen for events") {
+        val expected = mockBrokerProcessHandler
+        val finalResourceDestination = FilenameUtils.concat(
+          System.getProperty("java.io.tmpdir"),
+          FilenameUtils.getBaseName(TestEntryResource)
+        )
+
+        val executeRequestHandlerCaptor =
+          ArgumentCaptor.forClass(classOf[ExecuteResultHandler])
+
+        brokerProcess.start()
+        verify(mockExecutor).execute(
+          any(), any(), executeRequestHandlerCaptor.capture())
+
+        val actual = executeRequestHandlerCaptor.getValue
+        actual should be (expected)
+      }
+    }
+
+    describe("#stop") {
+      it("should destroy the process if it is running") {
+        brokerProcess.start()
+
+        val mockExecuteWatchdog = mock[ExecuteWatchdog]
+        doReturn(mockExecuteWatchdog).when(mockExecutor).getWatchdog
+
+        brokerProcess.stop()
+
+        verify(mockExecuteWatchdog).destroyProcess()
+      }
+
+      it("should not try to destroy the process if it is not running") {
+        val mockExecuteWatchdog = mock[ExecuteWatchdog]
+        doReturn(mockExecuteWatchdog).when(mockExecutor).getWatchdog
+
+        brokerProcess.stop()
+
+        verify(mockExecuteWatchdog, never()).destroyProcess()
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
new file mode 100644
index 0000000..84a1ae7
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import org.scalatest.{OneInstancePerTest, Matchers, FunSpec}
+
+import scala.util.{Failure, Success}
+
+class BrokerStateSpec extends FunSpec with Matchers with OneInstancePerTest {
+
+  private val TestMaxQueuedCode = 5
+  private val brokerState = new BrokerState(TestMaxQueuedCode)
+
+  describe("BrokerState") {
+    describe("#pushCode") {
+      it("should throw an exception if the queue is maxed out") {
+        val code = "some code"
+
+        // Fill up to the max of our queue
+        for (i <- 1 to TestMaxQueuedCode)
+          brokerState.pushCode(code)
+
+        // Adding an additional code should throw an exception
+        intercept[IllegalStateException] {
+          brokerState.pushCode(code)
+        }
+      }
+
+      it("should queue up the code to eventually be executed") {
+        val code = "some code"
+
+        brokerState.totalQueuedCode() should be (0)
+        brokerState.pushCode(code)
+        brokerState.totalQueuedCode() should be (1)
+      }
+    }
+
+    describe("#totalQueuedCode") {
+      it("should return the total queued code elements") {
+        val code = "some code"
+
+        // Queue up to the maximum test elements, verifying that the total
+        // queued element count increases per push
+        for (i <- 1 to TestMaxQueuedCode) {
+          brokerState.pushCode(code)
+          brokerState.totalQueuedCode() should be (i)
+        }
+      }
+    }
+
+    describe("#nextCode") {
+      it("should return the next code element if available") {
+        val code = "some code"
+
+        brokerState.pushCode(code)
+
+        brokerState.nextCode().code should be (code)
+      }
+
+      it("should return null if no code element is available") {
+        brokerState.nextCode() should be (null)
+      }
+    }
+
+    describe("#isReady") {
+      it("should return true if the broker state is marked as ready") {
+        brokerState.markReady()
+        brokerState.isReady should be (true)
+      }
+
+      it("should return false if the broker state is not marked as ready") {
+        brokerState.isReady should be (false)
+      }
+    }
+
+    describe("#markReady") {
+      it("should mark the state of the broker as ready") {
+        // Mark once to make sure that the state gets set
+        brokerState.markReady()
+        brokerState.isReady should be (true)
+
+        // Mark a second time to ensure that the state does not change
+        brokerState.markReady()
+        brokerState.isReady should be (true)
+      }
+    }
+
+    describe("#markSuccess") {
+      it("should mark the future for the code as successful") {
+        val future = brokerState.pushCode("some code")
+        val BrokerCode(codeId, _) = brokerState.nextCode()
+
+        brokerState.markSuccess(codeId)
+        future.value.get.isSuccess should be (true)
+      }
+
+      it("should use the provided message as the contents of the future") {
+        val future = brokerState.pushCode("some code")
+        val BrokerCode(codeId, _) = brokerState.nextCode()
+
+        val message = "some message"
+        brokerState.markSuccess(codeId, message)
+        future.value.get should be (Success(message))
+      }
+
+      it("should do nothing if the code id is invalid") {
+        val future = brokerState.pushCode("some code")
+        val BrokerCode(codeId, _) = brokerState.nextCode()
+
+        brokerState.markSuccess(codeId + "1")
+        future.isCompleted should be (false)
+      }
+    }
+
+    describe("#markFailure") {
+      it("should mark the future for the code as failure") {
+        val future = brokerState.pushCode("some code")
+        val BrokerCode(codeId, _) = brokerState.nextCode()
+
+        brokerState.markFailure(codeId)
+        future.value.get.isSuccess should be (false)
+      }
+
+      it("should use the provided message as the contents of the exception") {
+        val future = brokerState.pushCode("some code")
+        val BrokerCode(codeId, _) = brokerState.nextCode()
+
+        val message = "some message"
+        brokerState.markFailure(codeId, message)
+
+        val failure = future.value.get.failed.get
+        failure.getLocalizedMessage should be (message)
+      }
+
+      it("should do nothing if the code id is invalid") {
+        val future = brokerState.pushCode("some code")
+        val BrokerCode(codeId, _) = brokerState.nextCode()
+
+        brokerState.markFailure(codeId + "1")
+        future.isCompleted should be (false)
+      }
+    }
+
+    describe("#reset") {
+      it("should clear any code still in the queue") {
+        brokerState.pushCode("some code")
+
+        brokerState.reset("")
+
+        brokerState.totalQueuedCode() should be (0)
+      }
+
+      it("should mark any evaluating code as a failure if marked true") {
+        val future = brokerState.pushCode("some code")
+
+        brokerState.reset("")
+
+        future.value.get.isFailure should be (true)
+      }
+
+      it("should use the message as the contents of the failed code futures") {
+        val future = brokerState.pushCode("some code")
+
+        val message = "some message"
+        brokerState.reset(message)
+
+        val failure = future.value.get.failed.get
+        failure.getLocalizedMessage should be (message)
+      }
+
+      it("should mark any evaluating code as a success if marked false") {
+        val future = brokerState.pushCode("some code")
+
+        brokerState.reset("", markAllAsFailure = false)
+
+        future.value.get.isSuccess should be (true)
+      }
+
+      it("should use the message as the contents of the successful code futures") {
+        val future = brokerState.pushCode("some code")
+
+        val message = "some message"
+        brokerState.reset(message, markAllAsFailure = false)
+
+        future.value.get should be (Success(message))
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
new file mode 100644
index 0000000..266c753
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ * 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.ibm.spark.interpreter.broker
+
+import com.ibm.spark.interpreter.{ExecuteError, Results}
+import org.scalatest.concurrent.Eventually
+import org.scalatest.{OneInstancePerTest, Matchers, FunSpec}
+
+import scala.concurrent.promise
+
+class BrokerTransformerSpec extends FunSpec with Matchers
+  with OneInstancePerTest with Eventually
+{
+  private val brokerTransformer = new BrokerTransformer
+
+  describe("BrokerTransformer") {
+    describe("#transformToInterpreterResult") {
+      it("should convert to success with result output if no failure") {
+        val codeResultPromise = promise[BrokerTypes.CodeResults]()
+
+        val transformedFuture = brokerTransformer.transformToInterpreterResult(
+          codeResultPromise.future
+        )
+
+        val successOutput = "some success"
+        codeResultPromise.success(successOutput)
+
+        eventually {
+          val result = transformedFuture.value.get.get
+          result should be((Results.Success, Left(successOutput)))
+        }
+      }
+
+      it("should convert to error with broker exception if failure") {
+        val codeResultPromise = promise[BrokerTypes.CodeResults]()
+
+        val transformedFuture = brokerTransformer.transformToInterpreterResult(
+          codeResultPromise.future
+        )
+
+        val failureException = new BrokerException("some failure")
+        codeResultPromise.failure(failureException)
+
+        eventually {
+          val result = transformedFuture.value.get.get
+          result should be((Results.Error, Right(ExecuteError(
+            name = failureException.getClass.getName,
+            value = failureException.getLocalizedMessage,
+            stackTrace = failureException.getStackTrace.map(_.toString).toList
+          ))))
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala b/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
new file mode 100644
index 0000000..c568c6d
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.magic
+
+import org.scalatest.{Matchers, FunSpec}
+import org.scalatest.mock.MockitoSugar
+
+class InternalClassLoaderSpec extends FunSpec with Matchers with MockitoSugar {
+
+  abstract class MockClassLoader extends ClassLoader(null) {
+    override def loadClass(name: String): Class[_] = null
+  }
+
+  describe("InternalClassLoader") {
+    describe("#loadClass") {
+      it("should invoke super loadClass with loader's package prepended") {
+        val expected = classOf[Class[_]]
+        val packageName = "com.ibm.spark.magic"
+        val className = "SomeClass"
+
+        var parentLoadClassCorrectlyInvoked = false
+
+        val internalClassLoader = new InternalClassLoader(null) {
+          override private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = {
+            parentLoadClassCorrectlyInvoked =
+              name == s"$packageName.$className" && resolve
+            expected
+          }
+        }
+
+        internalClassLoader.loadClass(className, true) should be (expected)
+
+        parentLoadClassCorrectlyInvoked should be (true)
+      }
+
+      it("should use loader's package instead of provided package first") {
+        val expected = classOf[Class[_]]
+        val forcedPackageName = "com.ibm.spark.magic"
+        val packageName = "some.other.package"
+        val className = "SomeClass"
+
+        var parentLoadClassCorrectlyInvoked = false
+
+        val internalClassLoader = new InternalClassLoader(null) {
+          override private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = {
+            parentLoadClassCorrectlyInvoked =
+              name == s"$forcedPackageName.$className" && resolve
+            expected
+          }
+        }
+
+        internalClassLoader.loadClass(s"$packageName.$className", true) should be (expected)
+
+        parentLoadClassCorrectlyInvoked should be (true)
+      }
+
+      it("should invoke super loadClass with given package if internal missing") {
+        val expected = classOf[Class[_]]
+        val packageName = "some.other.package"
+        val className = "SomeClass"
+
+        var parentLoadClassCorrectlyInvoked = false
+
+        var methodCalled = false
+        val internalClassLoader = new InternalClassLoader(null) {
+          override private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = {
+            if (!methodCalled) {
+              methodCalled = true
+              throw new ClassNotFoundException()
+            }
+
+            parentLoadClassCorrectlyInvoked =
+              name == s"$packageName.$className" && resolve
+            expected
+          }
+        }
+
+        internalClassLoader.loadClass(s"$packageName.$className", true) should
+          be (expected)
+
+        parentLoadClassCorrectlyInvoked should be (true)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala b/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
new file mode 100644
index 0000000..0c2b894
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
@@ -0,0 +1,183 @@
+/*
+* Copyright 2014 IBM Corp.
+*
+* 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.ibm.spark.magic
+
+import java.io.OutputStream
+
+import com.ibm.spark.dependencies.DependencyDownloader
+import com.ibm.spark.interpreter.Interpreter
+import com.ibm.spark.magic.dependencies._
+import org.apache.spark.SparkContext
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{FunSpec, Matchers}
+
+
+/**
+* Used for verification of dependency injection. Calls toString on each
+* dependency to assert that they are provided.
+*/
+class LineMagicWithDependencies extends LineMagic
+  with IncludeDependencyDownloader
+  with IncludeSparkContext
+  with IncludeInterpreter
+  with IncludeOutputStream
+{
+  override def execute(code: String): Unit = {
+    sparkContext.cancelAllJobs()
+    interpreter.classServerURI
+    outputStream.close()
+    dependencyDownloader.setPrintStream(null)
+  }
+}
+
+class MockLineMagic extends LineMagic {
+  override def execute(code: String): Unit = {}
+}
+
+class MockCellMagic extends CellMagic {
+  override def execute(code: String): CellMagicOutput = 
+    CellMagicOutput()
+}
+
+class MagicLoaderSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("MagicLoader") {
+    describe("#hasLineMagic") {
+      it("should return false if a class with the magic name is not found") {
+        val magicLoader = new MagicLoader() {
+          override def findClass(name: String): Class[_] =
+            throw new ClassNotFoundException()
+        }
+
+        magicLoader.hasLineMagic("potato") should be (false)
+      }
+
+      it("should return true if a class with the magic name is found") {
+        val magicLoader = new MagicLoader() {
+          override def findClass(name: String): Class[_] = 
+            classOf[MockLineMagic]
+        }
+
+        magicLoader.hasLineMagic("potato") should be (true)
+      }
+
+      it("should return true if a class with the magic name is found regardless of case"){
+        // Only loads a class named "Potato"
+        val classLoader = new ClassLoader() {
+          override def findClass(name: String) =
+            if (name == "Potato") classOf[MockLineMagic]
+            else throw new ClassNotFoundException
+        }
+
+        // Case insensitive matching should be performed on "Potato"
+        val magicLoader = new MagicLoader(parentLoader = classLoader) {
+          override def magicClassNames = List("Potato")
+        }
+
+        magicLoader.hasLineMagic("Potato") should be (true)
+        magicLoader.hasLineMagic("potato") should be (true)
+        magicLoader.hasLineMagic("pOTatO") should be (true)
+      }
+    }
+
+    describe("#hasCellMagic") {
+      it("should return false if a class with the magic name is not found") {
+        val magicLoader = new MagicLoader() {
+          override def findClass(name: String): Class[_] =
+            throw new ClassNotFoundException()
+        }
+
+        magicLoader.hasCellMagic("potato") should be (false)
+      }
+
+      it("should return true if a class with the magic name is found") {
+        val magicLoader = new MagicLoader() {
+          override def findClass(name: String): Class[_] =
+            classOf[MockCellMagic]
+        }
+
+        magicLoader.hasCellMagic("potato") should be (true)
+      }
+
+      it("should return true if a class with the magic name is found regardless of case"){
+        // Only loads a class named "Potato"
+        val classLoader = new ClassLoader() {
+          override def findClass(name: String) =
+            if (name == "Potato") classOf[MockCellMagic]
+            else throw new ClassNotFoundException
+        }
+
+        // Case insensitive matching should be performed on "Potato"
+        val magicLoader = new MagicLoader(parentLoader = classLoader) {
+          override def magicClassNames = List("Potato")
+        }
+
+        magicLoader.hasCellMagic("Potato") should be (true)
+        magicLoader.hasCellMagic("potato") should be (true)
+        magicLoader.hasCellMagic("pOTatO") should be (true)
+      }
+    }
+    
+    describe("#magicClassName"){
+      it("should return the correctly-cased version of the requested magic name") {
+        val magicLoader = new MagicLoader() {
+          override def magicClassNames = List("Potato")
+        }
+
+        magicLoader.magicClassName("Potato") should be ("Potato")
+        magicLoader.magicClassName("potato") should be ("Potato")
+        magicLoader.magicClassName("pOTatO") should be ("Potato")
+      }
+
+      it("should return the query if a corresponding magic class does not exist") {
+        val magicLoader = new MagicLoader() {
+          override def magicClassNames = List()
+        }
+
+        magicLoader.magicClassName("dne") should be ("dne")
+        magicLoader.magicClassName("dNE") should be ("dNE")
+      }
+    }
+
+    describe("#createMagicInstance") {
+      it("should correctly insert dependencies into a class") {
+        val mockInterpreter = mock[Interpreter]
+        val mockSparkContext = mock[SparkContext]
+        val mockOutputStream = mock[OutputStream]
+        val mockDependencyDownloader = mock[DependencyDownloader]
+
+        val dependencyMap = new DependencyMap()
+          .setInterpreter(mockInterpreter)
+          .setSparkContext(mockSparkContext)
+          .setOutputStream(mockOutputStream)
+          .setDependencyDownloader(mockDependencyDownloader)
+
+        val magicLoader = new MagicLoader(
+          dependencyMap = dependencyMap,
+          parentLoader = new InternalClassLoader(getClass.getClassLoader)
+        )
+
+        val magicName = "LineMagicWithDependencies"
+        val instance = magicLoader.createMagicInstance(magicName)
+          .asInstanceOf[LineMagicWithDependencies]
+        instance.interpreter should be(mockInterpreter)
+        instance.outputStream should be(mockOutputStream)
+        instance.sparkContext should be(mockSparkContext)
+        instance.dependencyDownloader should be(mockDependencyDownloader)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
new file mode 100644
index 0000000..144e90f
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
+import joptsimple.{OptionSet, OptionSpec, OptionParser}
+import org.scalatest.mock.MockitoSugar
+
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+import collection.JavaConverters._
+
+class ArgumentParsingSupportSpec extends FunSpec with Matchers
+  with BeforeAndAfter with MockitoSugar
+{
+  private var mockOptions: OptionSet = _
+  private var mockParser: OptionParser = _
+  private var argumentParsingInstance: ArgumentParsingSupport = _
+
+  before {
+    mockOptions = mock[OptionSet]
+    mockParser = mock[OptionParser]
+    doReturn(mockOptions).when(mockParser).parse(anyVararg[String]())
+
+    argumentParsingInstance = new Object() with ArgumentParsingSupport {
+      override protected lazy val parser: OptionParser = mockParser
+    }
+  }
+
+  describe("ArgumentParsingSupport") {
+    describe("#parseArgs") {
+      it("should invoke the underlying parser's parse method") {
+        doReturn(Nil.asJava).when(mockOptions).nonOptionArguments()
+        argumentParsingInstance.parseArgs("")
+
+        verify(mockParser).parse(anyString())
+      }
+
+      it("should return an empty list if there are no non-option arguments") {
+        val expected = Nil
+        doReturn(expected.asJava).when(mockOptions).nonOptionArguments()
+        val actual = argumentParsingInstance.parseArgs((
+          "--transitive" :: expected
+        ).mkString(" "))
+
+        actual should be (expected)
+      }
+
+      it("should return a list containing non-option arguments") {
+        val expected = "non-option" :: Nil
+        doReturn(expected.asJava).when(mockOptions).nonOptionArguments()
+        val actual = argumentParsingInstance.parseArgs((
+          "--transitive" :: expected
+          ).mkString(" "))
+
+        actual should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
new file mode 100644
index 0000000..d5c4e4c
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.io.OutputStream
+
+import org.scalatest.mock.MockitoSugar
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import org.scalatest.{Matchers, FunSpec}
+
+class ConditionalOutputStreamSpec extends FunSpec with Matchers with MockitoSugar {
+  describe("ConditionalOutputStream") {
+    describe("#()") {
+      it("should throw an exception if the output stream is null") {
+        intercept[IllegalArgumentException] {
+          new ConditionalOutputStream(null, true)
+        }
+      }
+    }
+
+    describe("#write") {
+      it("should call the underlying write if the condition is true") {
+        val mockOutputStream = mock[OutputStream]
+        val conditionalOutputStream =
+          new ConditionalOutputStream(mockOutputStream, true)
+
+        val expected = 101
+        conditionalOutputStream.write(expected)
+
+        verify(mockOutputStream).write(expected)
+      }
+
+      it("should call the underlying write if the condition becomes true") {
+        val mockOutputStream = mock[OutputStream]
+        var condition = false
+
+        val conditionalOutputStream =
+          new ConditionalOutputStream(mockOutputStream, condition)
+
+        condition = true
+
+        val expected = 101
+        conditionalOutputStream.write(expected)
+
+        verify(mockOutputStream).write(expected)
+      }
+
+      it("should not call the underlying write if the condition is false") {
+        val mockOutputStream = mock[OutputStream]
+        val conditionalOutputStream =
+          new ConditionalOutputStream(mockOutputStream, false)
+
+        val expected = 101
+        conditionalOutputStream.write(expected)
+
+        verify(mockOutputStream, never()).write(any[Byte])
+      }
+
+      it("should not call the underlying write if the condition becomes false") {
+        val mockOutputStream = mock[OutputStream]
+        var condition = true
+
+        val conditionalOutputStream =
+          new ConditionalOutputStream(mockOutputStream, condition)
+
+        condition = false
+
+        val expected = 101
+        conditionalOutputStream.write(expected)
+
+        verify(mockOutputStream, never()).write(any[Byte])
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
new file mode 100644
index 0000000..4b0cc3d
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.io.FileNotFoundException
+import java.net.URL
+
+import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
+import scala.io.Source
+import scala.tools.nsc.io.File
+
+class DownloadSupportSpec extends FunSpec with Matchers with BeforeAndAfter {
+  val downloadDestinationUrl = new URL("file:///tmp/testfile2.ext")
+
+  val testFileContent = "This is a test"
+  val testFileName = "/tmp/testfile.txt"
+
+  //  Create a test file for downloading
+  before {
+    File(testFileName).writeAll(testFileContent)
+  }
+
+  //  Cleanup what we made
+  after {
+    File(testFileName).deleteIfExists()
+    File(downloadDestinationUrl.getPath).deleteIfExists()
+  }
+
+  describe("DownloadSupport"){
+    describe("#downloadFile( String, String )"){
+      it("should download a file to the download directory"){
+        val testFileUrl = "file:///tmp/testfile.txt"
+
+        //  Create our utility and download the file
+        val downloader = new Object with DownloadSupport
+        downloader.downloadFile(
+          testFileUrl,
+          downloadDestinationUrl.getProtocol + "://" +
+            downloadDestinationUrl.getPath)
+
+        //  Verify the file contents are what was in the original file
+        val downloadedFileContent: String =
+          Source.fromFile(downloadDestinationUrl.getPath).mkString
+
+        downloadedFileContent should be (testFileContent)
+      }
+
+    }
+
+    describe("#downloadFile( URL, URL )"){
+      it("should download a file to the download directory"){
+        val testFileUrl = new URL("file:///tmp/testfile.txt")
+
+        val downloader = new Object with DownloadSupport
+        downloader.downloadFile(testFileUrl, downloadDestinationUrl)
+
+        //  Verify the file contents are what was in the original file
+        val downloadedFileContent: String =
+          Source.fromFile(downloadDestinationUrl.getPath).mkString
+
+        downloadedFileContent should be (testFileContent)
+      }
+
+      it("should throw FileNotFoundException if the download URL is bad"){
+        val badFilename = "file:///tmp/testbadfile.txt"
+        File(badFilename).deleteIfExists()
+        val badFileUrl = new URL(badFilename)
+
+        val downloader = new Object with DownloadSupport
+        intercept[FileNotFoundException] {
+          downloader.downloadFile(badFileUrl, downloadDestinationUrl)
+        }
+      }
+
+      it("should throw FileNotFoundException if the download ") {
+        val testFileUrl = new URL("file:///tmp/testfile.txt")
+        val badDestinationUrl =
+          new URL("file:///tmp/badloc/that/doesnt/exist.txt")
+
+        val downloader = new Object with DownloadSupport
+        intercept[FileNotFoundException] {
+          downloader.downloadFile(testFileUrl, badDestinationUrl)
+        }
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
new file mode 100644
index 0000000..fdfe637
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.io.OutputStream
+
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{GivenWhenThen, BeforeAndAfter, FunSpec, Matchers}
+
+class DynamicReflectionSupportSpec
+  extends FunSpec with Matchers with MockitoSugar {
+
+  describe("DynamicReflectionSupport") {
+    describe("with a class instance") {
+      describe("#selectDynamic") {
+        it("should support accessing a normal field") {
+          class MyTestClass {
+            val test = 3
+          }
+
+          val x: MyTestClass = new MyTestClass
+
+          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
+
+          dynamicSupport.test should be (3)
+        }
+
+        it("should support accessing a method with no arguments") {
+          class MyTestClass {
+            def test = 3
+          }
+
+          val x: MyTestClass = new MyTestClass
+
+          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
+
+          dynamicSupport.test should be (3)
+        }
+
+        it("should throw an error if the field does not exist") {
+          class MyTestClass
+
+          val x: MyTestClass = new MyTestClass
+
+          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
+
+          intercept[NoSuchFieldException] {
+            dynamicSupport.test
+          }
+        }
+      }
+
+      describe("#applyDynamic") {
+        it("should support executing a method with one argument") {
+          class MyTestClass {
+            def test(x: Int) = x
+          }
+
+          val x: MyTestClass = new MyTestClass
+
+          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
+
+          dynamicSupport.test(5) should be (5)
+        }
+
+        it("should support executing a method with multiple arguments") {
+          class MyTestClass {
+            def test(x: Int, y: String) = (x, y)
+          }
+
+          val x: MyTestClass = new MyTestClass
+
+          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
+
+          dynamicSupport.test(5, "test me") should be ((5, "test me"))
+        }
+
+        it("should throw an error if the method does not exist") {
+          class MyTestClass
+
+          val x: MyTestClass = new MyTestClass
+
+          val dynamicSupport = DynamicReflectionSupport(x.getClass, x)
+
+          intercept[NoSuchMethodException] {
+            dynamicSupport.test(5, "test me")
+          }
+        }
+      }
+    }
+
+    describe("with an object") {
+      describe("#selectDynamic") {
+        it("should support accessing a normal field") {
+          object MyTestObject {
+            val test = 3
+          }
+
+          val dynamicSupport =
+            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
+
+          dynamicSupport.test should be (3)
+        }
+
+        it("should support accessing a method with no arguments") {
+          object MyTestObject {
+            def test = 3
+          }
+
+          val dynamicSupport =
+            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
+
+          dynamicSupport.test should be (3)
+        }
+
+        it("should throw an error if the field does not exist") {
+          object MyTestObject
+
+          val dynamicSupport =
+            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
+
+          intercept[NoSuchFieldException] {
+            dynamicSupport.test
+          }
+        }
+      }
+
+      describe("#applyDynamic") {
+        it("should support executing a method with one argument") {
+          object MyTestObject {
+            def test(x: Int) = x
+          }
+
+          val dynamicSupport =
+            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
+
+          dynamicSupport.test(5) should be (5)
+        }
+
+        it("should support executing a method with multiple arguments") {
+          object MyTestObject {
+            def test(x: Int, y: String) = (x, y)
+          }
+
+          val dynamicSupport =
+            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
+
+          dynamicSupport.test(5, "test me") should be ((5, "test me"))
+
+        }
+
+        it("should throw an error if the method does not exist") {
+          object MyTestObject
+
+          val dynamicSupport =
+            DynamicReflectionSupport(MyTestObject.getClass, MyTestObject)
+
+          intercept[NoSuchMethodException] {
+            dynamicSupport.test(5, "test me")
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
new file mode 100644
index 0000000..cba632d
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.utils
+
+import joptsimple.util.KeyValuePair
+import org.scalatest.{Matchers, FunSpec}
+
+class KeyValuePairUtilsSpec extends FunSpec with Matchers {
+  private object TestKeyValuePair {
+    def apply(key: String, value: String) = KeyValuePair.valueOf(s"$key=$value")
+  }
+
+  describe("KeyValuePairUtils") {
+    describe("#stringToKeyValuePairSeq") {
+      it("should throw an exception when given a null string") {
+        intercept[IllegalArgumentException] {
+          KeyValuePairUtils.stringToKeyValuePairSeq(null)
+        }
+      }
+
+      it("should convert an empty string to an empty sequence") {
+        val expected = Nil
+        val actual = KeyValuePairUtils.stringToKeyValuePairSeq("")
+
+        actual should be (expected)
+      }
+
+      it("should convert a single key-value pair to a sequence with one pair") {
+        val expected = Seq(TestKeyValuePair("key", "value"))
+        val actual = KeyValuePairUtils.stringToKeyValuePairSeq("key=value")
+
+        actual should be (expected)
+      }
+
+      it("should convert multiple key-value pairs using the provided delimiter") {
+        val expected = Seq(
+          TestKeyValuePair("key1", "value1"),
+          TestKeyValuePair("key2", "value2")
+        )
+        val actual = KeyValuePairUtils.stringToKeyValuePairSeq(
+          "key1=value1, key2=value2", ",")
+
+        actual should be (expected)
+      }
+
+      it("should fail if the string does not contain valid key-value pairs") {
+        KeyValuePairUtils.stringToKeyValuePairSeq("not valid")
+      }
+    }
+
+    describe("#keyValuePairSeqToString") {
+      it("should throw an exception when given a null sequence") {
+        intercept[IllegalArgumentException] {
+          KeyValuePairUtils.keyValuePairSeqToString(null)
+        }
+      }
+
+      it("should return an empty string if the sequence is empty") {
+        val expected = ""
+        val actual = KeyValuePairUtils.keyValuePairSeqToString(Nil)
+
+        actual should be (expected)
+      }
+
+      it("should generate key=value for a key-value pair") {
+        val expected = "key=value"
+        val actual = KeyValuePairUtils.keyValuePairSeqToString(
+          Seq(TestKeyValuePair("key", "value")))
+
+        actual should be (expected)
+      }
+
+      it("should use the provided delimiter to separate key-value pairs") {
+        val expected = "key1=value1,key2=value2"
+        val actual = KeyValuePairUtils.keyValuePairSeqToString(Seq(
+          TestKeyValuePair("key1", "value1"),
+          TestKeyValuePair("key2", "value2")
+        ), ",")
+
+        actual should be (expected)
+      }
+
+      it("should trim whitespace from keys and values") {
+        val expected = "key1=value1,key2=value2"
+        val actual = KeyValuePairUtils.keyValuePairSeqToString(Seq(
+          TestKeyValuePair(" key1", "  value1 "),
+          TestKeyValuePair("\tkey2 ", "value2\t")
+        ), ",")
+
+        actual should be (expected)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
new file mode 100644
index 0000000..185a85d
--- /dev/null
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.utils
+
+import java.io.OutputStream
+
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+
+class MultiOutputStreamSpec
+  extends FunSpec with Matchers with MockitoSugar with BeforeAndAfter {
+
+  describe("MultiOutputStream") {
+    val listOfMockOutputStreams = List(mock[OutputStream], mock[OutputStream])
+    val multiOutputStream = MultiOutputStream(listOfMockOutputStreams)
+
+    describe("#close") {
+      it("should call #close on all internal output streams") {
+        multiOutputStream.close()
+
+        listOfMockOutputStreams.foreach(mockOutputStream => verify(mockOutputStream).close())
+      }
+    }
+
+    describe("#flush") {
+      it("should call #flush on all internal output streams") {
+        multiOutputStream.flush()
+
+        listOfMockOutputStreams.foreach(mockOutputStream => verify(mockOutputStream).flush())
+      }
+    }
+
+    describe("#write(int)") {
+      it("should call #write(int) on all internal output streams") {
+        multiOutputStream.write(anyInt())
+
+        listOfMockOutputStreams.foreach(
+          mockOutputStream => verify(mockOutputStream).write(anyInt()))
+      }
+    }
+    describe("#write(byte[])") {
+      it("should call #write(byte[]) on all internal output streams") {
+        multiOutputStream.write(any[Array[Byte]])
+
+        listOfMockOutputStreams.foreach(
+          mockOutputStream => verify(mockOutputStream).write(any[Array[Byte]]))
+      }
+    }
+
+    describe("#write(byte[], int, int)") {
+      it("should call #write(byte[], int, int) on all internal output streams") {
+        multiOutputStream.write(any[Array[Byte]], anyInt(), anyInt())
+
+        listOfMockOutputStreams.foreach(
+          mockOutputStream =>
+            verify(mockOutputStream).write(any[Array[Byte]], anyInt(), anyInt()))
+      }
+    }
+  }
+}


[47/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala b/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
index cc4372b..52d08fa 100644
--- a/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
+++ b/client/src/test/scala/integration/unused.integration.socket/ClientToShellSpecForIntegration.scala
@@ -1,19 +1,22 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 integration.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala b/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
index ca0cde7..85b8f67 100644
--- a/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
+++ b/client/src/test/scala/org/apache/toree/comm/ClientCommManagerSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala b/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
index 3c795e5..ece75bf 100644
--- a/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
+++ b/client/src/test/scala/org/apache/toree/comm/ClientCommWriterSpec.scala
@@ -1,9 +1,11 @@
+
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,8 +13,9 @@
  *  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.
+ *  limitations under the License
  */
+
 package org.apache.toree.comm
 
 import java.util.UUID

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
index 2683c87..f9e910b 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClientSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
index 655bed3..40e2168 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTest.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.execution

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
index 0755785..6e09c7f 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
index 99c2914..142a3a8 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
index 6c88605..382304e 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
index a3a48b7..79aaa44 100644
--- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/system/ClientCommSpecForSystem.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/system/ClientCommSpecForSystem.scala b/client/src/test/scala/system/ClientCommSpecForSystem.scala
index c8e98be..cf7c27e 100644
--- a/client/src/test/scala/system/ClientCommSpecForSystem.scala
+++ b/client/src/test/scala/system/ClientCommSpecForSystem.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package system

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/test/utils/SparkClientDeployer.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/test/utils/SparkClientDeployer.scala b/client/src/test/scala/test/utils/SparkClientDeployer.scala
index beebd0c..2b52c4d 100644
--- a/client/src/test/scala/test/utils/SparkClientDeployer.scala
+++ b/client/src/test/scala/test/utils/SparkClientDeployer.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package test.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/build.sbt
----------------------------------------------------------------------
diff --git a/communication/build.sbt b/communication/build.sbt
index d17e407..0e3794f 100644
--- a/communication/build.sbt
+++ b/communication/build.sbt
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
 
 libraryDependencies ++= Seq(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
index bb75df7..c660848 100644
--- a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala b/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
index fee8dd3..25f2532 100644
--- a/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/ZMQMessage.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
index 16d8b76..c5b4575 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/DealerSocketActor.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.actors
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
index e186926..bed93b8 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/PubSocketActor.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.actors
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
index 9c54b30..6a3d1ef 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/RepSocketActor.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.actors
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
index f1b65f4..71a99a5 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/ReqSocketActor.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.actors
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
index 969aece..67cbd80 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/RouterSocketActor.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.actors
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala b/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
index e37ba4c..7c39fb5 100644
--- a/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/actors/SubSocketActor.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.actors
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala b/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
index 1692f1e..06582b3 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/Hmac.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
index 56ca1bd..986d03c 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
index bef8797..61379b6 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureManagerActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
index e0dc6d9..66450f9 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/security/package.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/security/package.scala b/communication/src/main/scala/org/apache/toree/communication/security/package.scala
index 208b04b..5e9faff 100644
--- a/communication/src/main/scala/org/apache/toree/communication/security/package.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/security/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala b/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
index 6eaf1c2..e8942de 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
index 80599dc..40d680d 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
index 8205068..81355fa 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
index 2c1233d..504ad32 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
index edfc1fd..3e3f26c 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
index ea2db3d..ee43bc7 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
index fdb0b6d..a93a6bc 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
index cb7a7ac..8db2f97 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
index 1e38573..5405b08 100644
--- a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala b/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
index 9a5cfb8..6c2e311 100644
--- a/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
+++ b/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package integration
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala b/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
index fde73b1..689b315 100644
--- a/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
+++ b/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 integration.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala b/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
index 4ee35a3..5e937ba 100644
--- a/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
+++ b/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 integration.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala b/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
index 2496164..6ff5343 100644
--- a/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
+++ b/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 integration.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala b/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
index dfd7b6e..97b2f5f 100644
--- a/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.security

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
index 8318e06..d742a75 100644
--- a/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
index 785ae96..d16f7a7 100644
--- a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 package org.apache.toree.communication.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala b/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
index c70e349..e7539dc 100644
--- a/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.communication.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/etc/bin/toree-kernel
----------------------------------------------------------------------
diff --git a/etc/bin/toree-kernel b/etc/bin/toree-kernel
index 71831bf..bdeb402 100755
--- a/etc/bin/toree-kernel
+++ b/etc/bin/toree-kernel
@@ -1,11 +1,12 @@
 #!/usr/bin/env bash
 
 #
-# Copyright 2015 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -13,7 +14,7 @@
 # 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.
+# limitations under the License
 #
                                            ``
 PROG_HOME="$(cd "`dirname "$0"`"/..; pwd)"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/build.sbt
----------------------------------------------------------------------
diff --git a/kernel-api/build.sbt b/kernel-api/build.sbt
index 831bd44..406483c 100644
--- a/kernel-api/build.sbt
+++ b/kernel-api/build.sbt
@@ -1,19 +1,20 @@
-import Common._
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
+
 //
 // SCALA INTERPRETER DEPENDENCIES
 //

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/project/plugins.sbt
----------------------------------------------------------------------
diff --git a/kernel-api/project/plugins.sbt b/kernel-api/project/plugins.sbt
index 7d420a0..b1ec6cc 100644
--- a/kernel-api/project/plugins.sbt
+++ b/kernel-api/project/plugins.sbt
@@ -1,15 +1,16 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- * 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.
- */
+*  Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  See the NOTICE file distributed with
+*  this work for additional information regarding copyright ownership.
+*  The ASF licenses this file to You 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
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
index 292f514..b1e2f41 100644
--- a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.dependencies

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
index 797604f..f569a60 100644
--- a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.dependencies



[44/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
index d822559..71c65b2 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
index 4060659..8defc9d 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
index 91709e3..7f43ae9 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
index cdbe309..a475cbb 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
index 0be7345..bfd8ce3 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
index dab699e..220e452 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
index cf1c171..d5b302b 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
index 7fc6467..df96e8b 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
index 6dbf521..b2794bf 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.interpreter

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
index daafe25..055563d 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
index 6c2ba55..9227839 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.interpreter.tasks

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
index 99f086e..3949630 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.interpreter.tasks

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
index 7a4afbe..fb7b918 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.interpreter.tasks

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
index 7a727d0..79ba496 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
index 3db49fd..6ef4c06 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
index 857be8e..9fe551e 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
index 7849a98..94478a8 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
index a46e146..65b28a9 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
index ba72ff1..43c0ccc 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
index 5549a26..04221b0 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
index 9115516..f679f13 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
index 0cbaad1..b883bd9 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
index c233a9c..cd902ad 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
index 810f735..cd37e8f 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.kernel.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
index 0dbde14..f86d76a 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.protocol.v5.magic
 
 import org.apache.toree.magic.MagicLoader

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
index 143a42b..d4a554a 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.toree.kernel.protocol.v5.magic
 
 import org.apache.toree.interpreter.{ExecuteOutput, Interpreter}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
index 9676dcf..022a426 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.relay

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
index 47c8f7c..316e74f 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.relay

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
index c9e87c5..05f2554 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.stream

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
index 5b4ff77..65c5874 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.stream

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
index 9b19afd..90f64d7 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
index 2347465..65abccc 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
index 6333b2e..cffe702 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
index c451f32..8060a46 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
index eb57450..a3bd585 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
index 0db1f88..260db25 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
index d6a99a1..32244d0 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
index a5faa92..62cfb3a 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
index a295945..0443199 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.magic.builtin
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala b/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
index cd2603f..6346276 100644
--- a/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
+++ b/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala b/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
index 7411809..d3c25fb 100644
--- a/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
+++ b/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.utils.json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala b/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
index 56c8cdb..62da297 100644
--- a/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
+++ b/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 integration

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala b/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
index 4308160..6a401b9 100644
--- a/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
+++ b/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 integration

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
index 41fd37d..cda360a 100644
--- a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.boot


[40/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
index 71fc9af..c354b73 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
index 6ca748b..13f72c1 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
index 5e9fec9..fa4caa6 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
index f60fdb9..376b073 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.content

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
index 9235d2b..e30941a 100644
--- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/build.sbt
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/build.sbt b/pyspark-interpreter/build.sbt
index ac8156e..9444250 100644
--- a/pyspark-interpreter/build.sbt
+++ b/pyspark-interpreter/build.sbt
@@ -1,15 +1,16 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
index ef7a95b..4926aef 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkBridge.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
index 23512a5..377ff3f 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkException.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
index b0e5d2b..4a40fb7 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkInterpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
index 13ef1c5..81dde5d 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcess.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
index ae66d5b..95a7828 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkProcessHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
index a9b1e1f..5cfd59a 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkService.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
index 946687f..495380a 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkState.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
index b26b3bd..70905e4 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTransformer.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
index 64e10df..7ba9496 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/PySparkTypes.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.pyspark
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
index f0d8760..2ffb725 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/pyspark/package.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
----------------------------------------------------------------------
diff --git a/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala b/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
index 343caa0..7510656 100644
--- a/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
+++ b/pyspark-interpreter/src/main/scala/org/apache/toree/magic/builtin/PySpark.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.magic.builtin
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/resources/compile/application.conf
----------------------------------------------------------------------
diff --git a/resources/compile/application.conf b/resources/compile/application.conf
index 29909c0..4c85f99 100644
--- a/resources/compile/application.conf
+++ b/resources/compile/application.conf
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 akka {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/resources/compile/log4j.properties
----------------------------------------------------------------------
diff --git a/resources/compile/log4j.properties b/resources/compile/log4j.properties
index 81d0722..c760493 100644
--- a/resources/compile/log4j.properties
+++ b/resources/compile/log4j.properties
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 # Set everything to be logged to the console

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/resources/compile/reference.conf
----------------------------------------------------------------------
diff --git a/resources/compile/reference.conf b/resources/compile/reference.conf
index f28e97d..5857133 100644
--- a/resources/compile/reference.conf
+++ b/resources/compile/reference.conf
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 stdin_port = 48691

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/resources/test/application.conf
----------------------------------------------------------------------
diff --git a/resources/test/application.conf b/resources/test/application.conf
index 29909c0..4c85f99 100644
--- a/resources/test/application.conf
+++ b/resources/test/application.conf
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 akka {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/resources/test/log4j.properties
----------------------------------------------------------------------
diff --git a/resources/test/log4j.properties b/resources/test/log4j.properties
index b91cacb..3fc6c5b 100644
--- a/resources/test/log4j.properties
+++ b/resources/test/log4j.properties
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 # Set everything to be logged to the console

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/resources/test/reference.conf
----------------------------------------------------------------------
diff --git a/resources/test/reference.conf b/resources/test/reference.conf
index 50d1d59..806a977 100644
--- a/resources/test/reference.conf
+++ b/resources/test/reference.conf
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 stdin_port = 48691

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/build.sbt
----------------------------------------------------------------------
diff --git a/scala-interpreter/build.sbt b/scala-interpreter/build.sbt
index ac8156e..9444250 100644
--- a/scala-interpreter/build.sbt
+++ b/scala-interpreter/build.sbt
@@ -1,15 +1,16 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
index c28e27f..92b4f47 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaException.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.scala
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
index 20fd410..249441e 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.scala

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
index 064a9ca..76806df 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SettingsProducerLike.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.scala

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
index 6a49d10..882f632 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/SparkIMainProducerLike.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.scala

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
index 1acc672..8a890f9 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/TaskManagerProducerLike.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.scala

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala b/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
index 63e237b..7d18405 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/magic/builtin/Scala.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.magic.builtin
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala b/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
index 8e9a587..2d5faa4 100644
--- a/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
+++ b/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 integration.interpreter.scala

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala b/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
index 35ea035..a5eac32 100644
--- a/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
+++ b/scala-interpreter/src/test/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpec.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.scala

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/build.sbt
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/build.sbt b/sparkr-interpreter/build.sbt
index ac8156e..9444250 100644
--- a/sparkr-interpreter/build.sbt
+++ b/sparkr-interpreter/build.sbt
@@ -1,15 +1,16 @@
 /*
- * Copyright 2015 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/resources/R/log4j.properties
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/resources/R/log4j.properties b/sparkr-interpreter/src/main/resources/R/log4j.properties
index c05e856..fa3e996 100644
--- a/sparkr-interpreter/src/main/resources/R/log4j.properties
+++ b/sparkr-interpreter/src/main/resources/R/log4j.properties
@@ -1,17 +1,18 @@
 #
-# Copyright 2015 IBM Corp.
-#
-# 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
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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.
+#  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
 #
 
 # Set everything to be logged to the file target/unit-tests.log

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R b/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
index 8074bbe..3b1b475 100644
--- a/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
+++ b/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner.R
@@ -1,17 +1,18 @@
 #
-# Copyright 2015 IBM Corp.
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
-#  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
 #
-#      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.
+# 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
 #
 
 # Initialize our global environment

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner_utils.R
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner_utils.R b/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner_utils.R
index bdd4fc8..65e7f3c 100644
--- a/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner_utils.R
+++ b/sparkr-interpreter/src/main/resources/kernelR/sparkr_runner_utils.R
@@ -1,17 +1,18 @@
 #
-# Copyright 2015 IBM Corp.
-#
-#  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.
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
 
 #

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
index a1c6319..fd406ad 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/ReflectiveRBackend.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
index 360d6c6..5d82e51 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRBridge.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
index 1f91e0f..2c56eb1 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRException.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
index ba49574..851a2d2 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRInterpreter.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
index a56cf42..708b2e5 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcess.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
index 9082598..6dd93e8 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRProcessHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
index 928b0df..be10e63 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRService.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
index 4c7a210..2f7ddc7 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRState.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
----------------------------------------------------------------------
diff --git a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
index af28ac7..c35e342 100644
--- a/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
+++ b/sparkr-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sparkr/SparkRTransformer.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- * 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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *  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 org.apache.toree.kernel.interpreter.sparkr
 



[34/51] [abbrv] incubator-toree git commit: Renamed com.ibm.spark to org.apache.toree

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
index 939b896..248cf56 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala
@@ -14,24 +14,24 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.boot.layer
+package org.apache.toree.boot.layer
 
 import java.util
 import java.util.concurrent.ConcurrentHashMap
 
 import akka.actor.ActorRef
-import com.ibm.spark.comm.{CommManager, KernelCommManager, CommRegistrar, CommStorage}
-import com.ibm.spark.dependencies.{DependencyDownloader, IvyDependencyDownloader}
-import com.ibm.spark.global
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.{KernelLike, Kernel}
-import com.ibm.spark.kernel.protocol.v5.KMBuilder
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.magic.builtin.BuiltinLoader
-import com.ibm.spark.magic.dependencies.DependencyMap
-import com.ibm.spark.utils.{MultiClassLoader, TaskManager, KeyValuePairUtils, LogLike}
+import org.apache.toree.comm.{CommManager, KernelCommManager, CommRegistrar, CommStorage}
+import org.apache.toree.dependencies.{DependencyDownloader, IvyDependencyDownloader}
+import org.apache.toree.global
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.api.{KernelLike, Kernel}
+import org.apache.toree.kernel.protocol.v5.KMBuilder
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.stream.KernelOutputStream
+import org.apache.toree.magic.MagicLoader
+import org.apache.toree.magic.builtin.BuiltinLoader
+import org.apache.toree.magic.dependencies.DependencyMap
+import org.apache.toree.utils.{MultiClassLoader, TaskManager, KeyValuePairUtils, LogLike}
 import com.typesafe.config.Config
 import org.apache.spark.sql.SQLContext
 import org.apache.spark.{SparkContext, SparkConf}
@@ -148,7 +148,7 @@ trait StandardComponentInitialization extends ComponentInitialization {
     /*
     interpreter.doQuietly {
       interpreter.bind(
-        "kernel", "com.ibm.spark.kernel.api.Kernel",
+        "kernel", "org.apache.toree.kernel.api.Kernel",
         kernel, List( """@transient implicit""")
       )
     }

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
index 1d16ac4..d86f826 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HandlerInitialization.scala
@@ -14,23 +14,23 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.boot.layer
+package org.apache.toree.boot.layer
 
 import akka.actor.{ActorRef, ActorSystem, Props}
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.Kernel
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-import com.ibm.spark.kernel.protocol.v5.SocketType.SocketType
-import com.ibm.spark.kernel.protocol.v5.handler._
-import com.ibm.spark.kernel.protocol.v5.interpreter.InterpreterActor
-import com.ibm.spark.kernel.protocol.v5.interpreter.tasks.InterpreterTaskFactory
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
-import com.ibm.spark.kernel.protocol.v5.relay.ExecuteRequestRelay
-import com.ibm.spark.kernel.protocol.v5.{MessageType, SocketType, SystemActorType}
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.comm.{CommRegistrar, CommStorage}
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.api.Kernel
+import org.apache.toree.kernel.protocol.v5.MessageType.MessageType
+import org.apache.toree.kernel.protocol.v5.SocketType.SocketType
+import org.apache.toree.kernel.protocol.v5.handler._
+import org.apache.toree.kernel.protocol.v5.interpreter.InterpreterActor
+import org.apache.toree.kernel.protocol.v5.interpreter.tasks.InterpreterTaskFactory
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.magic.{MagicParser, PostProcessor}
+import org.apache.toree.kernel.protocol.v5.relay.ExecuteRequestRelay
+import org.apache.toree.kernel.protocol.v5.{MessageType, SocketType, SystemActorType}
+import org.apache.toree.magic.MagicLoader
+import org.apache.toree.utils.LogLike
 
 /**
  * Represents the Akka handler initialization. All actors (not needed in bare

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
index c590394..beb0707 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/HookInitialization.scala
@@ -14,11 +14,11 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.boot.layer
+package org.apache.toree.boot.layer
 
-import com.ibm.spark.boot.KernelBootstrap
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.boot.KernelBootstrap
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.utils.LogLike
 
 /**
  * Represents the hook (interrupt/shutdown) initialization. All JVM-related

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
index 520d68c..dbdadda 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala
@@ -1,8 +1,8 @@
-package com.ibm.spark.boot.layer
+package org.apache.toree.boot.layer
 
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.kernel.api.KernelLike
 import com.typesafe.config.Config
-import com.ibm.spark.interpreter._
+import org.apache.toree.interpreter._
 import scala.collection.JavaConverters._
 
 import org.slf4j.LoggerFactory

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala b/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
index 9706ce7..333f4c1 100644
--- a/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
+++ b/kernel/src/main/scala/org/apache/toree/comm/KernelCommManager.scala
@@ -14,11 +14,11 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, UUID}
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, UUID}
 
 /**
  * Represents a CommManager that uses a KernelCommWriter for its underlying

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala b/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
index e494663..75e3a2a 100644
--- a/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
+++ b/kernel/src/main/scala/org/apache/toree/comm/KernelCommWriter.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.content.{CommMsg, CommOpen, CommClose, CommContent}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.content.{CommMsg, CommOpen, CommClose, CommContent}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 
 /**
  * Represents a CommWriter to send messages from the Kernel to the Client.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala b/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
index 389cf82..d770054 100644
--- a/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
+++ b/kernel/src/main/scala/org/apache/toree/global/ExecuteRequestState.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.global
+package org.apache.toree.global
 
-import com.ibm.spark.kernel.api.Kernel
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.api.Kernel
+import org.apache.toree.kernel.protocol.v5.KernelMessage
 
 /**
  * Represents the state of the kernel messages being received containing

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala b/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
index c00f937..b34a6da 100644
--- a/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
+++ b/kernel/src/main/scala/org/apache/toree/global/ExecutionCounter.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.global
+package org.apache.toree.global
 
-import com.ibm.spark.kernel.protocol.v5.UUID
+import org.apache.toree.kernel.protocol.v5.UUID
 
 import scala.collection.concurrent._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala b/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
index 83d2cea..bc530c9 100644
--- a/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
+++ b/kernel/src/main/scala/org/apache/toree/global/ScheduledTaskManager.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.global
+package org.apache.toree.global
 
-import com.ibm.spark.utils
+import org.apache.toree.utils
 
 object ScheduledTaskManager {
   lazy val instance = new utils.ScheduledTaskManager

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
index 36c5c5c..8be5af0 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/FactoryMethods.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 import java.io.{InputStream, OutputStream}
 
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
 import com.typesafe.config.Config
 
 /**
@@ -81,7 +81,7 @@ class FactoryMethods(
     new v5.stream.KernelOutputStream(
       actorLoader,
       kmBuilder,
-      com.ibm.spark.global.ScheduledTaskManager.instance,
+      org.apache.toree.global.ScheduledTaskManager.instance,
       streamType = streamType,
       sendEmptyOutput = sendEmptyOutput
     )

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
index 219804a..1ee3147 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala
@@ -14,24 +14,24 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 import java.io.{OutputStream, InputStream, PrintStream}
 import java.util.concurrent.ConcurrentHashMap
 
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.boot.layer.InterpreterManager
-import com.ibm.spark.comm.CommManager
-import com.ibm.spark.global
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.MagicParser
-import com.ibm.spark.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
-import com.ibm.spark.magic.{MagicLoader, MagicExecutor}
-import com.ibm.spark.utils.{KeyValuePairUtils, LogLike}
+import org.apache.toree.annotations.Experimental
+import org.apache.toree.boot.layer.InterpreterManager
+import org.apache.toree.comm.CommManager
+import org.apache.toree.global
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.magic.MagicParser
+import org.apache.toree.kernel.protocol.v5.stream.{KernelOutputStream, KernelInputStream}
+import org.apache.toree.magic.{MagicLoader, MagicExecutor}
+import org.apache.toree.utils.{KeyValuePairUtils, LogLike}
 import com.typesafe.config.Config
 import org.apache.spark.api.java.JavaSparkContext
 import org.apache.spark.sql.SQLContext
@@ -41,7 +41,7 @@ import scala.util.{Try, DynamicVariable}
 import scala.reflect.runtime.universe._
 
 import scala.language.dynamics
-import com.ibm.spark.global.ExecuteRequestState
+import org.apache.toree.global.ExecuteRequestState
 
 /**
  * Represents the main kernel API to be used for interaction.
@@ -177,7 +177,7 @@ class Kernel (
    *
    * @return The collection of streaming methods
    */
-  private[spark] def stream(
+  private[toree] def stream(
     parentMessage: v5.KernelMessage = lastKernelMessage()
   ): StreamMethods = {
     new StreamMethods(actorLoader, parentMessage)
@@ -203,7 +203,7 @@ class Kernel (
    *
    * @return The collection of factory methods
    */
-  private[spark] def factory(
+  private[toree] def factory(
     parentMessage: v5.KernelMessage = lastKernelMessage(),
     kmBuilder: v5.KMBuilder = v5.KMBuilder()
   ): FactoryMethods = {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
index 35c4960..1b60f77 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/api/StreamMethods.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 
 /**
  * Represents the methods available to stream data from the kernel to the

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
index 144b067..0d1e6cd 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.dispatch
+package org.apache.toree.kernel.protocol.v5.dispatch
 
 import akka.actor.Actor
-import com.ibm.spark.kernel.protocol.v5.KernelStatusType.KernelStatusType
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.KernelStatus
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.KernelStatusType.KernelStatusType
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.KernelStatus
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.LogLike
 import play.api.libs.json.Json
 
 class StatusDispatch(actorLoader: ActorLoader) extends Actor with LogLike {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
index abbf6d3..b0be249 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/BaseHandler.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.MessageLogSupport
 
 import scala.concurrent.Future
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
index c3b38ee..39c446d 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandler.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.pattern.ask
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
 import Utilities._
-import com.ibm.spark.utils.{MessageLogSupport, LogLike}
+import org.apache.toree.utils.{MessageLogSupport, LogLike}
 import play.api.data.validation.ValidationError
 import play.api.libs.json.{JsPath, Json}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
index 2c87dd7..d822559 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
-import com.ibm.spark.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.content.CommClose
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
+import org.apache.toree.kernel.protocol.v5.content.CommClose
+import org.apache.toree.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import org.apache.toree.utils.MessageLogSupport
 import play.api.data.validation.ValidationError
 import play.api.libs.json.JsPath
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
index 03baef9..4060659 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
-import com.ibm.spark.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
-import com.ibm.spark.kernel.protocol.v5.content.CommMsg
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.comm.{KernelCommWriter, CommRegistrar, CommWriter, CommStorage}
+import org.apache.toree.kernel.protocol.v5.content.CommMsg
+import org.apache.toree.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import org.apache.toree.utils.MessageLogSupport
 import play.api.data.validation.ValidationError
 import play.api.libs.json.JsPath
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
index 80e2b35..91709e3 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
-import com.ibm.spark.comm.{KernelCommWriter, CommStorage, CommRegistrar, CommWriter}
-import com.ibm.spark.kernel.protocol.v5.content.CommOpen
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, KernelMessage}
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.comm.{KernelCommWriter, CommStorage, CommRegistrar, CommWriter}
+import org.apache.toree.kernel.protocol.v5.content.CommOpen
+import org.apache.toree.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, KernelMessage}
+import org.apache.toree.utils.MessageLogSupport
 import play.api.data.validation.ValidationError
 import play.api.libs.json.JsPath
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
index c066d98..cdbe309 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.actor.ActorSelection
 import akka.pattern.ask
-import com.ibm.spark.global.{ExecuteRequestState, ExecutionCounter}
-import com.ibm.spark.kernel.api.{Kernel, KernelLike}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5.stream.KernelOutputStream
-import com.ibm.spark.{global => kernelGlobal}
+import org.apache.toree.global.{ExecuteRequestState, ExecutionCounter}
+import org.apache.toree.kernel.api.{Kernel, KernelLike}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5.stream.KernelOutputStream
+import org.apache.toree.{global => kernelGlobal}
 import Utilities._
-import com.ibm.spark.utils._
+import org.apache.toree.utils._
 import play.api.data.validation.ValidationError
 import play.api.libs.json.JsPath
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
index 834f632..0be7345 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/GenericSocketMessageHandler.scala
@@ -14,18 +14,18 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.{MessageLogSupport, LogLike}
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.{MessageLogSupport, LogLike}
 
 /**
  * All KernelMessage leaving the kernel for the client will exit the relay in a similar pattern. This class is meant
  * to encapsulate this behaviour into one generic method. This class should be used by mapping a
- * {@link com.ibm.spark.kernel.protocol.MessageType} to the {@link com.ibm.spark.kernel.protocol.SocketType} constructor
+ * {@link org.apache.toree.kernel.protocol.MessageType} to the {@link org.apache.toree.kernel.protocol.SocketType} constructor
  * parameter. This will map MessageTypes to their corresponding SocketTypes. An example us of this class would be
  *
  * actorSystem.actorOf(

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
index dba0eef..dab699e 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala
@@ -14,16 +14,16 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.actor.ActorRef
-import com.ibm.spark.comm.{CommRegistrar, CommStorage}
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.{SystemActorType, KernelMessage}
-import com.ibm.spark.kernel.protocol.v5.content.{InputReply, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.comm.{CommRegistrar, CommStorage}
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5.{SystemActorType, KernelMessage}
+import org.apache.toree.kernel.protocol.v5.content.{InputReply, CommOpen}
+import org.apache.toree.kernel.protocol.v5.kernel.{Utilities, ActorLoader}
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.utils.MessageLogSupport
 import play.api.libs.json.Json
 
 import scala.concurrent.{Promise, Future}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
index 854a759..cf1c171 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/KernelInfoRequestHandler.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.KernelInfoReply
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.KernelInfoReply
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.LogLike
 import play.api.libs.json.Json
 
 import scala.concurrent._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
index a0a2001..7fc6467 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ShutdownHandler.scala
@@ -14,13 +14,13 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
-import com.ibm.spark.comm.{CommRegistrar, CommStorage, KernelCommWriter}
-import com.ibm.spark.kernel.protocol.v5.content.{ShutdownReply, ShutdownRequest, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.comm.{CommRegistrar, CommStorage, KernelCommWriter}
+import org.apache.toree.kernel.protocol.v5.content.{ShutdownReply, ShutdownRequest, CommOpen}
+import org.apache.toree.kernel.protocol.v5.kernel.{ActorLoader, Utilities}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.utils.MessageLogSupport
 import play.api.data.validation.ValidationError
 import play.api.libs.json.JsPath
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
index b5ae174..6dbf521 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.interpreter
+package org.apache.toree.kernel.protocol.v5.interpreter
 
 import java.io.OutputStream
 
 import akka.actor.{Actor, ActorRef, Props}
 import akka.pattern.{ask, pipe}
 import akka.util.Timeout
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.interpreter.tasks._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.interpreter._
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.protocol.v5.interpreter.tasks._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.interpreter._
+import org.apache.toree.utils.LogLike
 
 import scala.concurrent.duration._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
index 6738520..daafe25 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/package.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5
+package org.apache.toree.kernel.protocol.v5
 
 package object interpreter {
   object InterpreterChildActorType extends Enumeration {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
index 87f37b0..6c2ba55 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.interpreter.tasks
+package org.apache.toree.kernel.protocol.v5.interpreter.tasks
 
 import akka.actor.{Actor, Props}
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.protocol.v5.content.CompleteRequest
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.protocol.v5.content.CompleteRequest
+import org.apache.toree.utils.LogLike
 
 object CodeCompleteTaskActor {
   def props(interpreter: Interpreter): Props =

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
index dc22b21..99f086e 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala
@@ -14,18 +14,18 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.interpreter.tasks
+package org.apache.toree.kernel.protocol.v5.interpreter.tasks
 
 import java.io.OutputStream
 
 import akka.actor.{Props, Actor}
-import com.ibm.spark.global.StreamState
-import com.ibm.spark.interpreter.{ExecuteAborted, Results, ExecuteError, Interpreter}
-import com.ibm.spark.kernel.api.StreamInfo
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.security.KernelSecurityManager
-import com.ibm.spark.utils.{ConditionalOutputStream, MultiOutputStream, LogLike}
+import org.apache.toree.global.StreamState
+import org.apache.toree.interpreter.{ExecuteAborted, Results, ExecuteError, Interpreter}
+import org.apache.toree.kernel.api.StreamInfo
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.security.KernelSecurityManager
+import org.apache.toree.utils.{ConditionalOutputStream, MultiOutputStream, LogLike}
 
 object ExecuteRequestTaskActor {
   def props(interpreter: Interpreter): Props =
@@ -56,7 +56,7 @@ class ExecuteRequestTaskActor(interpreter: Interpreter) extends Actor with LogLi
 //            interpreter.doQuietly {
 //              interpreter.bind(
 //                "$streamInfo",
-//                "com.ibm.spark.kernel.api.StreamInfo",
+//                "org.apache.toree.kernel.api.StreamInfo",
 //                new KernelMessage(
 //                  ids = parentMessage.ids,
 //                  signature = parentMessage.signature,

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
index 5f5a7ad..7a4afbe 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/InterpreterTaskFactory.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.interpreter.tasks
+package org.apache.toree.kernel.protocol.v5.interpreter.tasks
 
 import akka.actor.{ActorRefFactory, ActorRef}
-import com.ibm.spark.interpreter.Interpreter
+import org.apache.toree.interpreter.Interpreter
 
 class InterpreterTaskFactory(interpreter: Interpreter) {
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
index 171934d..7a727d0 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/ActorLoader.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel
+package org.apache.toree.kernel.protocol.v5.kernel
 
 import akka.actor.{ActorRefFactory, ActorSelection}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
index 73cf1b1..3db49fd 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel
+package org.apache.toree.kernel.protocol.v5.kernel
 
 import java.nio.charset.Charset
 
 import akka.util.{ByteString, Timeout}
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.utils.LogLike
 import play.api.data.validation.ValidationError
 import play.api.libs.json.{JsPath, Json, Reads}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
index df42b03..857be8e 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Control.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
-import com.ibm.spark.kernel.protocol.v5.SystemActorType
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.SystemActorType
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 
 /**
  * The server endpoint for control messages specified in the IPython Kernel Spec

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
index d17c360..7849a98 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Heartbeat.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import akka.actor.Actor
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.utils.LogLike
 
 /**
  * The server endpoint for heartbeat messages specified in the IPython Kernel Spec

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
index d2ff8e9..a46e146 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/IOPub.scala
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import akka.actor.Actor
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities
+import org.apache.toree.communication.ZMQMessage
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.Utilities
 import Utilities._
-import com.ibm.spark.utils.{MessageLogSupport, LogLike}
+import org.apache.toree.utils.{MessageLogSupport, LogLike}
 
 /**
  * The server endpoint for IOPub messages specified in the IPython Kernel Spec

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
index b5c4bfb..ba72ff1 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Shell.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.SystemActorType
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.SystemActorType
 
 /**
  * The server endpoint for shell messages specified in the IPython Kernel Spec

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
index 5fe3e39..5549a26 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfig.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import com.typesafe.config.Config
 import play.api.libs.json.Json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
index 865c383..9115516 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConnection.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 object SocketConnection {
   def apply(protocol: String, ip: String, port: Int) = new SocketConnection(protocol, ip, port)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
index ef2001f..0cbaad1 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketFactory.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import akka.actor.{Props, ActorRef, ActorSystem}
-import com.ibm.spark.communication.actors.{RouterSocketActor, RepSocketActor, PubSocketActor}
+import org.apache.toree.communication.actors.{RouterSocketActor, RepSocketActor, PubSocketActor}
 
 object SocketFactory {
   def apply(socketConfig: SocketConfig) = {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
index 261151e..c233a9c 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/Stdin.scala
@@ -14,10 +14,10 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.SystemActorType
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.SystemActorType
 
 /**
  * The server endpoint for stdin messages specified in the IPython Kernel Spec

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
index 3d02f0b..810f735 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/ZeromqKernelMessageSocket.scala
@@ -14,18 +14,18 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.kernel.socket
+package org.apache.toree.kernel.protocol.v5.kernel.socket
 
 import java.nio.charset.Charset
 
 import akka.actor.{ActorSelection, ActorSystem, ActorRef, Actor}
 import akka.util.ByteString
-import com.ibm.spark.communication.ZMQMessage
+import org.apache.toree.communication.ZMQMessage
 
-//import com.ibm.spark.kernel.protocol.v5.kernel.ZMQMessage
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities._
-import com.ibm.spark.utils.MessageLogSupport
+//import org.apache.toree.kernel.protocol.v5.kernel.ZMQMessage
+import org.apache.toree.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.protocol.v5.kernel.Utilities._
+import org.apache.toree.utils.MessageLogSupport
 
 /**
  * Represents a generic socket geared toward two-way communication using

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
index a24c062..0dbde14 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/MagicParser.scala
@@ -1,6 +1,6 @@
-package com.ibm.spark.kernel.protocol.v5.magic
+package org.apache.toree.kernel.protocol.v5.magic
 
-import com.ibm.spark.magic.MagicLoader
+import org.apache.toree.magic.MagicLoader
 
 class MagicParser(magicLoader: MagicLoader) {
   private val magicRegex = """^[%]{1,2}(\w+)""".r

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
index 73c3c9f..143a42b 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/magic/PostProcessor.scala
@@ -1,9 +1,9 @@
-package com.ibm.spark.kernel.protocol.v5.magic
+package org.apache.toree.kernel.protocol.v5.magic
 
-import com.ibm.spark.interpreter.{ExecuteOutput, Interpreter}
-import com.ibm.spark.kernel.protocol.v5.{Data, MIMEType}
-import com.ibm.spark.magic.{CellMagicOutput, LineMagicOutput}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.interpreter.{ExecuteOutput, Interpreter}
+import org.apache.toree.kernel.protocol.v5.{Data, MIMEType}
+import org.apache.toree.magic.{CellMagicOutput, LineMagicOutput}
+import org.apache.toree.utils.LogLike
 
 class PostProcessor(interpreter: Interpreter) extends LogLike {
   val defaultErr = "Something went wrong in postprocessor!"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
index a1b846a..9676dcf 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala
@@ -14,20 +14,20 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.relay
+package org.apache.toree.kernel.protocol.v5.relay
 
 import java.io.OutputStream
 
 import akka.actor.Actor
 import akka.pattern._
 import akka.util.Timeout
-import com.ibm.spark.interpreter.{ExecuteAborted, ExecuteError, ExecuteFailure, ExecuteOutput}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.magic.{PostProcessor, MagicParser}
-import com.ibm.spark.magic.MagicLoader
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.interpreter.{ExecuteAborted, ExecuteError, ExecuteFailure, ExecuteOutput}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.magic.{PostProcessor, MagicParser}
+import org.apache.toree.magic.MagicLoader
+import org.apache.toree.utils.LogLike
 
 import scala.concurrent.Future
 import scala.concurrent.duration._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
index cc45479..47c8f7c 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/KernelMessageRelay.scala
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.relay
+package org.apache.toree.kernel.protocol.v5.relay
 
 import akka.pattern.ask
 import akka.util.Timeout
-import com.ibm.spark.communication.security.SecurityActorType
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-import com.ibm.spark.kernel.protocol.v5.content.ShutdownRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, MessageType, _}
-import com.ibm.spark.utils.MessageLogSupport
+import org.apache.toree.communication.security.SecurityActorType
+import org.apache.toree.communication.utils.OrderedSupport
+import org.apache.toree.kernel.protocol.v5.MessageType.MessageType
+import org.apache.toree.kernel.protocol.v5.content.ShutdownRequest
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, MessageType, _}
+import org.apache.toree.utils.MessageLogSupport
 import scala.collection.immutable.HashMap
 import scala.concurrent.duration._
 import scala.util.{Random, Failure, Success}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
index e57fd84..c9e87c5 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelInputStream.scala
@@ -14,16 +14,16 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.stream
+package org.apache.toree.kernel.protocol.v5.stream
 
 import java.io.InputStream
 import java.nio.charset.Charset
 
 import akka.pattern.ask
-import com.ibm.spark.kernel.protocol.v5.content.InputRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5.kernel.Utilities.timeout
-import com.ibm.spark.kernel.protocol.v5.{KMBuilder, MessageType}
+import org.apache.toree.kernel.protocol.v5.content.InputRequest
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5.kernel.Utilities.timeout
+import org.apache.toree.kernel.protocol.v5.{KMBuilder, MessageType}
 
 import scala.collection.mutable.ListBuffer
 import scala.concurrent.{Await, Future}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
index 56b0cbb..5b4ff77 100644
--- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
+++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOutputStream.scala
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.stream
+package org.apache.toree.kernel.protocol.v5.stream
 
 import java.io.OutputStream
 import java.nio.charset.Charset
 
-import com.ibm.spark.kernel.protocol.v5.content.StreamContent
-import com.ibm.spark.kernel.protocol.v5.{SystemActorType, MessageType, KMBuilder}
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.utils.{LogLike, ScheduledTaskManager}
+import org.apache.toree.kernel.protocol.v5.content.StreamContent
+import org.apache.toree.kernel.protocol.v5.{SystemActorType, MessageType, KMBuilder}
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.utils.{LogLike, ScheduledTaskManager}
 import scala.collection.mutable.ListBuffer
 import KernelOutputStream._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
index 5555c08..9b19afd 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.PrintStream
 
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies._
-import com.ibm.spark.utils.ArgumentParsingSupport
+import org.apache.toree.magic._
+import org.apache.toree.magic.dependencies._
+import org.apache.toree.utils.ArgumentParsingSupport
 
 class AddDeps extends LineMagic with IncludeInterpreter
   with IncludeOutputStream with IncludeSparkContext with ArgumentParsingSupport

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
index bdfdbe2..2347465 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddJar.scala
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.{File, PrintStream}
 import java.net.URL
 import java.nio.file.{Files, Paths}
 
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.builtin.AddJar._
-import com.ibm.spark.magic.dependencies._
-import com.ibm.spark.utils.{ArgumentParsingSupport, DownloadSupport, LogLike}
+import org.apache.toree.magic._
+import org.apache.toree.magic.builtin.AddJar._
+import org.apache.toree.magic.dependencies._
+import org.apache.toree.utils.{ArgumentParsingSupport, DownloadSupport, LogLike}
 import com.typesafe.config.Config
 
 object AddJar {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
index aecc90f..6333b2e 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/BuiltinLoader.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import com.google.common.reflect.ClassPath
 import com.google.common.reflect.ClassPath.ClassInfo
-import com.ibm.spark.magic.InternalClassLoader
+import org.apache.toree.magic.InternalClassLoader
 import com.google.common.base.Strings._
 import scala.collection.JavaConversions._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
index 95fa31a..c451f32 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Html.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.PrintStream
 
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-import com.ibm.spark.utils.ArgumentParsingSupport
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic._
+import org.apache.toree.magic.dependencies.IncludeOutputStream
+import org.apache.toree.utils.ArgumentParsingSupport
 import com.google.common.base.Strings
 
 class Html extends CellMagic with ArgumentParsingSupport

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
index 42772c1..eb57450 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/JavaScript.scala
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.PrintStream
 
 import com.google.common.base.Strings
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
-import com.ibm.spark.utils.ArgumentParsingSupport
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic._
+import org.apache.toree.magic.dependencies.IncludeOutputStream
+import org.apache.toree.utils.ArgumentParsingSupport
 import org.slf4j.LoggerFactory
 
 class JavaScript extends CellMagic with ArgumentParsingSupport

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
index db99cc1..0db1f88 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/LSMagic.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
 import java.io.PrintStream
 
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import org.apache.toree.magic._
+import org.apache.toree.magic.dependencies.IncludeOutputStream
 
 class LSMagic extends LineMagic with IncludeOutputStream {
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
index dbee517..d6a99a1 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/RDD.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.interpreter.{ExecuteFailure, Results, ExecuteAborted, ExecuteError}
-import com.ibm.spark.kernel.protocol.v5.MIMEType
-import com.ibm.spark.magic._
-import com.ibm.spark.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
-import com.ibm.spark.utils.LogLike
-import com.ibm.spark.utils.json.RddToJson
+import org.apache.toree.interpreter.{ExecuteFailure, Results, ExecuteAborted, ExecuteError}
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic._
+import org.apache.toree.magic.dependencies.{IncludeKernelInterpreter, IncludeInterpreter}
+import org.apache.toree.utils.LogLike
+import org.apache.toree.utils.json.RddToJson
 import org.apache.spark.sql.SchemaRDD
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
index 47d4f65..a5faa92 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowTypes.scala
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.magic.LineMagic
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import org.apache.toree.magic.LineMagic
+import org.apache.toree.magic.dependencies.IncludeOutputStream
 import java.io.PrintStream
-import com.ibm.spark.kernel.api.KernelOptions
+import org.apache.toree.kernel.api.KernelOptions
 
 
 class ShowTypes extends LineMagic with IncludeOutputStream {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
index d30736e..a295945 100644
--- a/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Truncation.scala
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.magic.builtin
+package org.apache.toree.magic.builtin
 
-import com.ibm.spark.magic.LineMagic
-import com.ibm.spark.magic.dependencies.IncludeOutputStream
+import org.apache.toree.magic.LineMagic
+import org.apache.toree.magic.dependencies.IncludeOutputStream
 import java.io.PrintStream
-import com.ibm.spark.kernel.api.KernelOptions
+import org.apache.toree.kernel.api.KernelOptions
 
 
 class Truncation extends LineMagic with IncludeOutputStream {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala b/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
index 05c2216..cd2603f 100644
--- a/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
+++ b/kernel/src/main/scala/org/apache/toree/utils/MessageLogSupport.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
-import com.ibm.spark.kernel.protocol.v5.{MessageType, KernelMessage}
+import org.apache.toree.kernel.protocol.v5.{MessageType, KernelMessage}
 
 trait MessageLogSupport extends LogLike {
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala b/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
index 3439d0d..7411809 100644
--- a/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
+++ b/kernel/src/main/scala/org/apache/toree/utils/json/RddToJson.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils.json
+package org.apache.toree.utils.json
 
 import org.apache.spark.sql.{DataFrame, SchemaRDD}
 import play.api.libs.json.{JsObject, JsString, Json}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala b/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
index 81f6656..56c8cdb 100644
--- a/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
+++ b/kernel/src/test/scala/integration/InterpreterActorSpecForIntegration.scala
@@ -20,14 +20,14 @@ import java.io.{ByteArrayOutputStream, OutputStream}
 
 import akka.actor.{ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit}
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.kernel.interpreter.scala.{StandardTaskManagerProducer, StandardSparkIMainProducer, StandardSettingsProducer, ScalaInterpreter}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.interpreter.InterpreterActor
-import com.ibm.spark.kernel.protocol.v5.interpreter.tasks.InterpreterTaskFactory
-import com.ibm.spark.utils.{TaskManager, MultiOutputStream}
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.kernel.interpreter.scala.{StandardTaskManagerProducer, StandardSparkIMainProducer, StandardSettingsProducer, ScalaInterpreter}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.interpreter.InterpreterActor
+import org.apache.toree.kernel.protocol.v5.interpreter.tasks.InterpreterTaskFactory
+import org.apache.toree.utils.{TaskManager, MultiOutputStream}
 import com.typesafe.config.ConfigFactory
 import org.apache.spark.{SparkConf, SparkContext}
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala b/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
index 5cdddb3..4308160 100644
--- a/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
+++ b/kernel/src/test/scala/integration/PostProcessorSpecForIntegration.scala
@@ -18,11 +18,11 @@ package integration
 
 import java.io.OutputStream
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.kernel.interpreter.scala.{StandardSettingsProducer, StandardTaskManagerProducer, StandardSparkIMainProducer, ScalaInterpreter}
-import com.ibm.spark.kernel.protocol.v5.magic.PostProcessor
-import com.ibm.spark.utils.{TaskManager, MultiOutputStream}
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.kernel.interpreter.scala.{StandardSettingsProducer, StandardTaskManagerProducer, StandardSparkIMainProducer, ScalaInterpreter}
+import org.apache.toree.kernel.protocol.v5.magic.PostProcessor
+import org.apache.toree.utils.{TaskManager, MultiOutputStream}
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
index 703d677..41fd37d 100644
--- a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.boot
+package org.apache.toree.boot
 
 import java.io.File
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala b/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
index 7b4442c..a8be55f 100644
--- a/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/comm/KernelCommManagerSpec.scala
@@ -14,12 +14,12 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.CommContent
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.CommContent
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import org.scalatest.mock.MockitoSugar
 import org.mockito.Mockito._
 import org.mockito.Matchers._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala b/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
index eb792bb..44989eb 100644
--- a/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/comm/KernelCommWriterSpec.scala
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.comm
+package org.apache.toree.comm
 
 import java.util.UUID
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import play.api.libs.json.Json
 import scala.concurrent.duration._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala b/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
index 4d1641f..c281d15 100644
--- a/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/global/ExecutionCounterSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.global
+package org.apache.toree.global
 
 import org.scalatest.{FunSpec, Matchers}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
index 58ea0c5..06b6724 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/api/KernelSpec.scala
@@ -1,20 +1,20 @@
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 import java.io.{InputStream, PrintStream}
 
-import com.ibm.spark.boot.layer.InterpreterManager
-import com.ibm.spark.comm.CommManager
-import com.ibm.spark.interpreter._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.magic.MagicLoader
+import org.apache.toree.boot.layer.InterpreterManager
+import org.apache.toree.comm.CommManager
+import org.apache.toree.interpreter._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.magic.MagicLoader
 import com.typesafe.config.Config
 import org.apache.spark.{SparkConf, SparkContext}
 import org.mockito.Mockito._
 import org.mockito.Matchers._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-import com.ibm.spark.global.ExecuteRequestState
+import org.apache.toree.global.ExecuteRequestState
 
 class KernelSpec extends FunSpec with Matchers with MockitoSugar
   with BeforeAndAfter
@@ -46,7 +46,7 @@ class KernelSpec extends FunSpec with Matchers with MockitoSugar
     when(mockInterpreterManager.defaultInterpreter)
       .thenReturn(Some(mockInterpreter))
     when(mockInterpreterManager.interpreters)
-      .thenReturn(Map[String, com.ibm.spark.interpreter.Interpreter]())
+      .thenReturn(Map[String, org.apache.toree.interpreter.Interpreter]())
     when(mockInterpreter.interpret(BadCode.get))
       .thenReturn((Results.Incomplete, null))
     when(mockInterpreter.interpret(GoodCode.get))

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
index fc87588..e9a46ad 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/api/StreamMethodsSpec.scala
@@ -1,9 +1,9 @@
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 import akka.actor.ActorSystem
 import akka.testkit.{ImplicitSender, TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
+import org.apache.toree.kernel.protocol.v5
+import org.apache.toree.kernel.protocol.v5.KernelMessage
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpecLike, BeforeAndAfter, Matchers, FunSpec}
 import play.api.libs.json.Json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
index 60d3b42..b8d2767 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatchSpec.scala
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.dispatch
+package org.apache.toree.kernel.protocol.v5.dispatch
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{TestKit, TestProbe}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.KernelStatus
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.KernelStatus
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
 import org.mockito.Mockito._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
index b44ad1c..c6f33fe 100644
--- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
+++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/handler/CodeCompleteHandlerSpec.scala
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.kernel.protocol.v5.handler
+package org.apache.toree.kernel.protocol.v5.handler
 
 import akka.actor._
 import akka.testkit.{TestProbe, ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.CompleteRequest
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.kernel.protocol.v5Test._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.CompleteRequest
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.kernel.protocol.v5Test._
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpecLike, BeforeAndAfter, Matchers}
 import org.mockito.Mockito._



[48/51] [abbrv] incubator-toree git commit: Changes to license header on all files

Posted by lb...@apache.org.
Changes to license header on all files


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/c3b736a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/c3b736a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/c3b736a4

Branch: refs/heads/TestBranch
Commit: c3b736a413a38fc3746dbfc8ba7db12f65e74ee0
Parents: 39cdd69
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Fri Jan 15 16:05:53 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Fri Jan 15 16:40:37 2016 -0600

----------------------------------------------------------------------
 Dockerfile                                      | 13 +++++----
 Makefile                                        | 13 +++++----
 NOTICE                                          |  6 ++--
 Vagrantfile                                     | 13 +++++----
 client/build.sbt                                | 23 ++++++++--------
 .../apache/toree/comm/ClientCommManager.scala   | 13 +++++----
 .../apache/toree/comm/ClientCommWriter.scala    | 13 +++++----
 .../kernel/protocol/v5/client/ActorLoader.scala | 23 ++++++++--------
 .../protocol/v5/client/SparkKernelClient.scala  | 23 ++++++++--------
 .../kernel/protocol/v5/client/Utilities.scala   | 23 ++++++++--------
 .../v5/client/boot/ClientBootstrap.scala        | 23 ++++++++--------
 .../boot/layers/HandlerInitialization.scala     | 13 +++++----
 .../boot/layers/SystemInitialization.scala      | 13 +++++----
 .../v5/client/exception/ShellException.scala    | 23 ++++++++--------
 .../v5/client/execution/DeferredExecution.scala | 23 ++++++++--------
 .../execution/DeferredExecutionManager.scala    | 23 ++++++++--------
 .../execution/DeferredExecutionTuple.scala      | 23 ++++++++--------
 .../client/execution/ExecuteRequestTuple.scala  | 23 ++++++++--------
 .../v5/client/handler/ExecuteHandler.scala      | 23 ++++++++--------
 .../v5/client/socket/HeartbeatClient.scala      | 23 ++++++++--------
 .../protocol/v5/client/socket/IOPubClient.scala | 23 ++++++++--------
 .../protocol/v5/client/socket/ShellClient.scala | 23 ++++++++--------
 .../v5/client/socket/SocketConfig.scala         | 23 ++++++++--------
 .../v5/client/socket/SocketConnection.scala     | 23 ++++++++--------
 .../v5/client/socket/SocketFactory.scala        | 23 ++++++++--------
 .../protocol/v5/client/socket/StdinClient.scala | 13 +++++----
 client/src/test/resources/testng.yaml           | 13 +++++----
 .../scala/examples/DocumentationExamples.scala  | 23 ++++++++--------
 .../scala/examples/ScalaSparkClientUsage.scala  | 23 ++++++++--------
 .../ClientToHeartbeatSpecForIntegration.scala   | 25 +++++++++--------
 .../ClientToIOPubSpecForIntegration.scala       | 25 +++++++++--------
 .../ClientToShellSpecForIntegration.scala       | 25 +++++++++--------
 .../toree/comm/ClientCommManagerSpec.scala      | 13 +++++----
 .../toree/comm/ClientCommWriterSpec.scala       | 15 ++++++----
 .../v5/client/SparkKernelClientSpec.scala       | 23 ++++++++--------
 .../execution/DeferredExecutionTest.scala       | 23 ++++++++--------
 .../v5/client/socket/HeartbeatClientSpec.scala  | 23 ++++++++--------
 .../v5/client/socket/IOPubClientSpec.scala      | 23 ++++++++--------
 .../v5/client/socket/ShellClientSpec.scala      | 23 ++++++++--------
 .../v5/client/socket/StdinClientSpec.scala      | 13 +++++----
 .../scala/system/ClientCommSpecForSystem.scala  | 13 +++++----
 .../scala/test/utils/SparkClientDeployer.scala  | 13 +++++----
 communication/build.sbt                         | 23 ++++++++--------
 .../toree/communication/SocketManager.scala     | 13 +++++----
 .../apache/toree/communication/ZMQMessage.scala | 13 +++++----
 .../actors/DealerSocketActor.scala              | 13 +++++----
 .../communication/actors/PubSocketActor.scala   | 13 +++++----
 .../communication/actors/RepSocketActor.scala   | 13 +++++----
 .../communication/actors/ReqSocketActor.scala   | 13 +++++----
 .../actors/RouterSocketActor.scala              | 13 +++++----
 .../communication/actors/SubSocketActor.scala   | 13 +++++----
 .../toree/communication/security/Hmac.scala     | 23 ++++++++--------
 .../security/SignatureCheckerActor.scala        | 23 ++++++++--------
 .../security/SignatureManagerActor.scala        | 23 ++++++++--------
 .../security/SignatureProducerActor.scala       | 23 ++++++++--------
 .../toree/communication/security/package.scala  | 23 ++++++++--------
 .../communication/socket/JeroMQSocket.scala     | 13 +++++----
 .../socket/PubSocketRunnable.scala              | 13 +++++----
 .../socket/ReqSocketRunnable.scala              | 13 +++++----
 .../toree/communication/socket/SocketLike.scala | 13 +++++----
 .../communication/socket/SocketOption.scala     | 13 +++++----
 .../communication/socket/SocketRunnable.scala   | 13 +++++----
 .../toree/communication/socket/SocketType.scala | 13 +++++----
 .../socket/ZeroMQSocketRunnable.scala           | 13 +++++----
 .../communication/utils/OrderedSupport.scala    | 23 ++++++++--------
 .../JeroMQSocketIntegrationSpec.scala           | 13 +++++----
 ...ignatureCheckerActorSpecForIntegration.scala | 23 ++++++++--------
 ...ignatureManagerActorSpecForIntegration.scala | 23 ++++++++--------
 ...gnatureProducerActorSpecForIntegration.scala | 23 ++++++++--------
 .../toree/communication/security/HmacSpec.scala | 23 ++++++++--------
 .../communication/socket/JeroMQSocketSpec.scala | 13 +++++----
 .../socket/ZeroMQSocketRunnableSpec.scala       | 13 +++++----
 .../utils/OrderedSupportSpec.scala              | 23 ++++++++--------
 etc/bin/toree-kernel                            | 13 +++++----
 kernel-api/build.sbt                            | 25 +++++++++--------
 kernel-api/project/plugins.sbt                  | 29 ++++++++++----------
 .../dependencies/DependencyDownloader.scala     | 23 ++++++++--------
 .../dependencies/IvyDependencyDownloader.scala  | 23 ++++++++--------
 .../org/apache/toree/global/StreamState.scala   | 23 ++++++++--------
 .../toree/interpreter/ExecuteFailure.scala      | 21 +++++++-------
 .../apache/toree/interpreter/Interpreter.scala  | 21 +++++++-------
 .../toree/interpreter/InterpreterTypes.scala    | 21 +++++++-------
 .../org/apache/toree/interpreter/Results.scala  | 21 +++++++-------
 .../toree/interpreter/broker/BrokerBridge.scala | 21 +++++++-------
 .../toree/interpreter/broker/BrokerCode.scala   | 21 +++++++-------
 .../interpreter/broker/BrokerException.scala    | 21 +++++++-------
 .../toree/interpreter/broker/BrokerName.scala   | 21 +++++++-------
 .../interpreter/broker/BrokerProcess.scala      | 21 +++++++-------
 .../broker/BrokerProcessHandler.scala           | 21 +++++++-------
 .../interpreter/broker/BrokerPromise.scala      | 21 +++++++-------
 .../interpreter/broker/BrokerService.scala      | 21 +++++++-------
 .../toree/interpreter/broker/BrokerState.scala  | 21 +++++++-------
 .../interpreter/broker/BrokerTransformer.scala  | 21 +++++++-------
 .../toree/interpreter/broker/BrokerTypes.scala  | 21 +++++++-------
 .../broker/BrokerTypesProvider.scala            | 21 +++++++-------
 .../producer/JavaSparkContextProducerLike.scala | 21 +++++++-------
 .../producer/SQLContextProducerLike.scala       | 21 +++++++-------
 .../imports/printers/WrapperConsole.scala       | 21 +++++++-------
 .../imports/printers/WrapperSystem.scala        | 21 +++++++-------
 .../org/apache/toree/interpreter/package.scala  | 21 +++++++-------
 .../toree/kernel/api/FactoryMethodsLike.scala   | 17 ++++++++++++
 .../apache/toree/kernel/api/KernelLike.scala    | 13 +++++----
 .../apache/toree/kernel/api/KernelOptions.scala | 23 ++++++++--------
 .../apache/toree/kernel/api/StreamInfo.scala    | 13 +++++----
 .../toree/kernel/api/StreamMethodsLike.scala    | 17 ++++++++++++
 .../org/apache/toree/magic/CellMagic.scala      | 17 ++++++++++++
 .../toree/magic/InternalClassLoader.scala       | 23 ++++++++--------
 .../org/apache/toree/magic/LineMagic.scala      | 17 ++++++++++++
 .../scala/org/apache/toree/magic/Magic.scala    | 23 ++++++++--------
 .../org/apache/toree/magic/MagicExecutor.scala  | 17 ++++++++++++
 .../org/apache/toree/magic/MagicLoader.scala    | 23 ++++++++--------
 .../magic/dependencies/DependencyMap.scala      | 23 ++++++++--------
 .../magic/dependencies/IncludeConfig.scala      | 23 ++++++++--------
 .../IncludeDependencyDownloader.scala           | 23 ++++++++--------
 .../magic/dependencies/IncludeInterpreter.scala | 23 ++++++++--------
 .../magic/dependencies/IncludeKernel.scala      | 23 ++++++++--------
 .../dependencies/IncludeKernelInterpreter.scala | 23 ++++++++--------
 .../magic/dependencies/IncludeMagicLoader.scala | 23 ++++++++--------
 .../dependencies/IncludeOutputStream.scala      | 23 ++++++++--------
 .../magic/dependencies/IncludeSQLContext.scala  | 17 ++++++++++++
 .../dependencies/IncludeSparkContext.scala      | 23 ++++++++--------
 .../scala/org/apache/toree/magic/package.scala  | 23 ++++++++--------
 .../toree/security/KernelSecurityManager.scala  | 23 ++++++++--------
 .../toree/utils/ArgumentParsingSupport.scala    | 23 ++++++++--------
 .../toree/utils/ConditionalOutputStream.scala   | 23 ++++++++--------
 .../apache/toree/utils/DownloadSupport.scala    | 23 ++++++++--------
 .../toree/utils/DynamicReflectionSupport.scala  | 23 ++++++++--------
 .../apache/toree/utils/KeyValuePairUtils.scala  | 13 +++++----
 .../apache/toree/utils/MultiClassLoader.scala   | 23 ++++++++--------
 .../apache/toree/utils/MultiOutputStream.scala  | 23 ++++++++--------
 .../toree/utils/ScheduledTaskManager.scala      | 13 +++++----
 .../org/apache/toree/utils/TaskManager.scala    | 17 ++++++++++++
 .../interpreter/broker/BrokerBridgeSpec.scala   | 21 +++++++-------
 .../broker/BrokerProcessHandlerSpec.scala       | 21 +++++++-------
 .../interpreter/broker/BrokerProcessSpec.scala  | 21 +++++++-------
 .../interpreter/broker/BrokerStateSpec.scala    | 21 +++++++-------
 .../broker/BrokerTransformerSpec.scala          | 21 +++++++-------
 .../toree/magic/InternalClassLoaderSpec.scala   | 23 ++++++++--------
 .../apache/toree/magic/MagicLoaderSpec.scala    | 29 ++++++++++----------
 .../utils/ArgumentParsingSupportSpec.scala      | 23 ++++++++--------
 .../utils/ConditionalOutputStreamSpec.scala     | 23 ++++++++--------
 .../toree/utils/DownloadSupportSpec.scala       | 23 ++++++++--------
 .../utils/DynamicReflectionSupportSpec.scala    | 23 ++++++++--------
 .../toree/utils/KeyValuePairUtilsSpec.scala     | 13 +++++----
 .../toree/utils/MultiOutputStreamSpec.scala     | 23 ++++++++--------
 .../toree/utils/ScheduledTaskManagerSpec.scala  | 13 +++++----
 .../apache/toree/utils/TaskManagerSpec.scala    | 23 ++++++++--------
 .../utils/UncaughtExceptionSuppression.scala    | 23 ++++++++--------
 kernel/build.sbt                                | 25 +++++++++--------
 kernel/project/plugins.sbt                      | 23 ++++++++--------
 .../src/main/scala/org/apache/toree/Main.scala  | 23 ++++++++--------
 .../apache/toree/boot/CommandLineOptions.scala  | 21 +++++++-------
 .../org/apache/toree/boot/KernelBootstrap.scala | 23 ++++++++--------
 .../toree/boot/layer/BareInitialization.scala   | 13 +++++----
 .../boot/layer/ComponentInitialization.scala    | 21 +++++++-------
 .../boot/layer/HandlerInitialization.scala      | 13 +++++----
 .../toree/boot/layer/HookInitialization.scala   | 13 +++++----
 .../toree/boot/layer/InterpreterManager.scala   | 17 ++++++++++++
 .../apache/toree/comm/KernelCommManager.scala   | 13 +++++----
 .../apache/toree/comm/KernelCommWriter.scala    | 13 +++++----
 .../toree/global/ExecuteRequestState.scala      | 21 +++++++-------
 .../apache/toree/global/ExecutionCounter.scala  | 23 ++++++++--------
 .../toree/global/ScheduledTaskManager.scala     | 21 +++++++-------
 .../toree/kernel/api/FactoryMethods.scala       | 21 +++++++-------
 .../org/apache/toree/kernel/api/Kernel.scala    | 21 +++++++-------
 .../apache/toree/kernel/api/StreamMethods.scala | 21 +++++++-------
 .../protocol/v5/dispatch/StatusDispatch.scala   | 23 ++++++++--------
 .../protocol/v5/handler/BaseHandler.scala       | 23 ++++++++--------
 .../v5/handler/CodeCompleteHandler.scala        | 23 ++++++++--------
 .../protocol/v5/handler/CommCloseHandler.scala  | 13 +++++----
 .../protocol/v5/handler/CommMsgHandler.scala    | 13 +++++----
 .../protocol/v5/handler/CommOpenHandler.scala   | 13 +++++----
 .../v5/handler/ExecuteRequestHandler.scala      | 23 ++++++++--------
 .../handler/GenericSocketMessageHandler.scala   | 23 ++++++++--------
 .../v5/handler/InputRequestReplyHandler.scala   | 13 +++++----
 .../v5/handler/KernelInfoRequestHandler.scala   | 23 ++++++++--------
 .../protocol/v5/handler/ShutdownHandler.scala   | 13 +++++----
 .../v5/interpreter/InterpreterActor.scala       | 23 ++++++++--------
 .../protocol/v5/interpreter/package.scala       | 23 ++++++++--------
 .../tasks/CodeCompleteTaskActor.scala           | 23 ++++++++--------
 .../tasks/ExecuteRequestTaskActor.scala         | 23 ++++++++--------
 .../tasks/InterpreterTaskFactory.scala          | 23 ++++++++--------
 .../kernel/protocol/v5/kernel/ActorLoader.scala | 23 ++++++++--------
 .../kernel/protocol/v5/kernel/Utilities.scala   | 23 ++++++++--------
 .../protocol/v5/kernel/socket/Control.scala     | 23 ++++++++--------
 .../protocol/v5/kernel/socket/Heartbeat.scala   | 23 ++++++++--------
 .../protocol/v5/kernel/socket/IOPub.scala       | 23 ++++++++--------
 .../protocol/v5/kernel/socket/Shell.scala       | 23 ++++++++--------
 .../v5/kernel/socket/SocketConfig.scala         | 23 ++++++++--------
 .../v5/kernel/socket/SocketConnection.scala     | 23 ++++++++--------
 .../v5/kernel/socket/SocketFactory.scala        | 23 ++++++++--------
 .../protocol/v5/kernel/socket/Stdin.scala       | 13 +++++----
 .../socket/ZeromqKernelMessageSocket.scala      | 13 +++++----
 .../kernel/protocol/v5/magic/MagicParser.scala  | 17 ++++++++++++
 .../protocol/v5/magic/PostProcessor.scala       | 17 ++++++++++++
 .../protocol/v5/relay/ExecuteRequestRelay.scala | 23 ++++++++--------
 .../protocol/v5/relay/KernelMessageRelay.scala  | 23 ++++++++--------
 .../protocol/v5/stream/KernelInputStream.scala  | 13 +++++----
 .../protocol/v5/stream/KernelOutputStream.scala | 23 ++++++++--------
 .../apache/toree/magic/builtin/AddDeps.scala    | 23 ++++++++--------
 .../org/apache/toree/magic/builtin/AddJar.scala | 23 ++++++++--------
 .../toree/magic/builtin/BuiltinLoader.scala     | 23 ++++++++--------
 .../org/apache/toree/magic/builtin/Html.scala   | 23 ++++++++--------
 .../apache/toree/magic/builtin/JavaScript.scala | 23 ++++++++--------
 .../apache/toree/magic/builtin/LSMagic.scala    | 23 ++++++++--------
 .../org/apache/toree/magic/builtin/RDD.scala    | 23 ++++++++--------
 .../apache/toree/magic/builtin/ShowTypes.scala  | 23 ++++++++--------
 .../apache/toree/magic/builtin/Truncation.scala | 23 ++++++++--------
 .../apache/toree/utils/MessageLogSupport.scala  | 23 ++++++++--------
 .../org/apache/toree/utils/json/RddToJson.scala | 23 ++++++++--------
 .../InterpreterActorSpecForIntegration.scala    | 21 +++++++-------
 .../PostProcessorSpecForIntegration.scala       | 21 +++++++-------
 .../toree/boot/CommandLineOptionsSpec.scala     | 23 ++++++++--------
 .../toree/comm/KernelCommManagerSpec.scala      | 13 +++++----
 .../toree/comm/KernelCommWriterSpec.scala       | 25 +++++++++--------
 .../toree/global/ExecutionCounterSpec.scala     | 23 ++++++++--------
 .../apache/toree/kernel/api/KernelSpec.scala    | 17 ++++++++++++
 .../toree/kernel/api/StreamMethodsSpec.scala    | 17 ++++++++++++
 .../v5/dispatch/StatusDispatchSpec.scala        | 23 ++++++++--------
 .../v5/handler/CodeCompleteHandlerSpec.scala    | 23 ++++++++--------
 .../v5/handler/CommCloseHandlerSpec.scala       | 13 +++++----
 .../v5/handler/CommMsgHandlerSpec.scala         | 13 +++++----
 .../v5/handler/CommOpenHandlerSpec.scala        | 13 +++++----
 .../v5/handler/ExecuteRequestHandlerSpec.scala  | 23 ++++++++--------
 .../GenericSocketMessageHandlerSpec.scala       | 23 ++++++++--------
 .../handler/InputRequestReplyHandlerSpec.scala  | 13 +++++----
 .../handler/KernelInfoRequestHandlerSpec.scala  | 23 ++++++++--------
 .../tasks/ExecuteRequestTaskActorSpec.scala     | 23 ++++++++--------
 .../protocol/v5/kernel/ActorLoaderSpec.scala    | 23 ++++++++--------
 .../v5/kernel/SimpleActorLoaderSpec.scala       | 23 ++++++++--------
 .../protocol/v5/kernel/UtilitiesSpec.scala      | 23 ++++++++--------
 .../v5/kernel/socket/HeartbeatSpec.scala        | 23 ++++++++--------
 .../protocol/v5/kernel/socket/IOPubSpec.scala   | 23 ++++++++--------
 .../protocol/v5/kernel/socket/ShellSpec.scala   | 23 ++++++++--------
 .../v5/kernel/socket/SocketConfigSpec.scala     | 23 ++++++++--------
 .../v5/kernel/socket/SocketConnectionSpec.scala | 23 ++++++++--------
 .../v5/kernel/socket/SocketFactorySpec.scala    | 23 ++++++++--------
 .../protocol/v5/kernel/socket/StdinSpec.scala   | 13 +++++----
 .../protocol/v5/magic/MagicParserSpec.scala     | 17 ++++++++++++
 .../protocol/v5/magic/PostProcessorSpec.scala   | 17 ++++++++++++
 .../v5/relay/ExecuteRequestRelaySpec.scala      | 23 ++++++++--------
 .../v5/relay/KernelMessageRelaySpec.scala       | 23 ++++++++--------
 .../v5/stream/KernelInputStreamSpec.scala       | 13 +++++----
 .../v5/stream/KernelOuputStreamSpec.scala       | 23 ++++++++--------
 .../toree/magic/builtin/AddDepsSpec.scala       | 23 ++++++++--------
 .../apache/toree/magic/builtin/AddJarSpec.scala | 23 ++++++++--------
 .../toree/magic/builtin/BuiltinLoaderSpec.scala | 23 ++++++++--------
 .../apache/toree/magic/builtin/HtmlSpec.scala   | 23 ++++++++--------
 .../toree/magic/builtin/JavaScriptSpec.scala    | 23 ++++++++--------
 .../toree/magic/builtin/LSMagicSpec.scala       | 17 ++++++++++++
 .../apache/toree/magic/builtin/RDDSpec.scala    | 23 ++++++++--------
 .../apache/toree/utils/json/RddToJsonSpec.scala | 23 ++++++++--------
 .../scala/system/KernelCommSpecForSystem.scala  | 13 +++++----
 .../src/test/scala/system/SuiteForSystem.scala  | 17 ++++++++++++
 .../src/test/scala/system/TruncationTests.scala | 13 +++++----
 .../scala/test/utils/DummyInterpreter.scala     | 17 ++++++++++++
 .../src/test/scala/test/utils/ErrorActor.scala  | 23 ++++++++--------
 .../test/utils/NoArgSparkKernelTestKit.scala    | 13 +++++----
 .../scala/test/utils/SparkContextProvider.scala | 23 ++++++++--------
 .../scala/test/utils/SparkKernelDeployer.scala  | 13 +++++----
 .../src/test/scala/test/utils/StackActor.scala  | 23 ++++++++--------
 .../scala/test/utils/TestProbeProxyActor.scala  | 23 ++++++++--------
 macros/build.sbt                                | 13 +++++----
 macros/project/plugins.sbt                      | 13 +++++----
 .../apache/toree/annotations/Experimental.scala | 15 ++++++----
 project/Build.scala                             | 21 +++++++-------
 project/Common.scala                            | 21 +++++++-------
 project/build.properties                        | 17 ++++++++++++
 project/plugins.sbt                             | 24 ++++++++--------
 protocol/build.sbt                              | 23 ++++++++--------
 protocol/project/plugins.sbt                    | 23 ++++++++--------
 .../org/apache/toree/comm/CommCallbacks.scala   | 15 ++++++----
 .../org/apache/toree/comm/CommManager.scala     | 13 +++++----
 .../org/apache/toree/comm/CommRegistrar.scala   | 15 ++++++----
 .../org/apache/toree/comm/CommStorage.scala     | 13 +++++----
 .../org/apache/toree/comm/CommWriter.scala      | 15 ++++++----
 .../toree/kernel/protocol/v5/Header.scala       | 23 ++++++++--------
 .../kernel/protocol/v5/HeaderBuilder.scala      | 23 ++++++++--------
 .../toree/kernel/protocol/v5/KMBuilder.scala    | 23 ++++++++--------
 .../kernel/protocol/v5/KernelMessage.scala      | 23 ++++++++--------
 .../protocol/v5/KernelMessageContent.scala      | 23 ++++++++--------
 .../kernel/protocol/v5/SparkKernelInfo.scala    | 23 ++++++++--------
 .../protocol/v5/content/ClearOutput.scala       | 23 ++++++++--------
 .../kernel/protocol/v5/content/CommClose.scala  | 23 ++++++++--------
 .../protocol/v5/content/CommContent.scala       | 25 +++++++++--------
 .../kernel/protocol/v5/content/CommMsg.scala    | 23 ++++++++--------
 .../kernel/protocol/v5/content/CommOpen.scala   | 23 ++++++++--------
 .../protocol/v5/content/CompleteReply.scala     | 23 ++++++++--------
 .../protocol/v5/content/CompleteRequest.scala   | 23 ++++++++--------
 .../protocol/v5/content/ConnectReply.scala      | 23 ++++++++--------
 .../protocol/v5/content/ConnectRequest.scala    | 23 ++++++++--------
 .../protocol/v5/content/DisplayData.scala       | 23 ++++++++--------
 .../protocol/v5/content/ErrorContent.scala      | 23 ++++++++--------
 .../protocol/v5/content/ExecuteInput.scala      | 23 ++++++++--------
 .../protocol/v5/content/ExecuteReply.scala      | 23 ++++++++--------
 .../protocol/v5/content/ExecuteRequest.scala    | 23 ++++++++--------
 .../protocol/v5/content/ExecuteResult.scala     | 23 ++++++++--------
 .../protocol/v5/content/HistoryReply.scala      | 23 ++++++++--------
 .../protocol/v5/content/HistoryRequest.scala    | 23 ++++++++--------
 .../kernel/protocol/v5/content/InputReply.scala | 13 +++++----
 .../protocol/v5/content/InputRequest.scala      | 13 +++++----
 .../protocol/v5/content/InspectReply.scala      | 23 ++++++++--------
 .../protocol/v5/content/InspectRequest.scala    | 23 ++++++++--------
 .../protocol/v5/content/KernelInfoReply.scala   | 23 ++++++++--------
 .../protocol/v5/content/KernelInfoRequest.scala | 23 ++++++++--------
 .../protocol/v5/content/KernelStatus.scala      | 23 ++++++++--------
 .../protocol/v5/content/ShutdownReply.scala     | 13 +++++----
 .../protocol/v5/content/ShutdownRequest.scala   | 23 ++++++++--------
 .../protocol/v5/content/StreamContent.scala     | 23 ++++++++--------
 .../kernel/protocol/v5/content/TypeString.scala | 13 +++++----
 .../kernel/protocol/v5/content/package.scala    | 23 ++++++++--------
 .../toree/kernel/protocol/v5/package.scala      | 23 ++++++++--------
 .../scala/org/apache/toree/utils/LogLike.scala  | 13 +++++----
 .../apache/toree/comm/CommCallbacksSpec.scala   | 13 +++++----
 .../org/apache/toree/comm/CommManagerSpec.scala | 13 +++++----
 .../apache/toree/comm/CommRegistrarSpec.scala   | 13 +++++----
 .../org/apache/toree/comm/CommStorageSpec.scala | 13 +++++----
 .../org/apache/toree/comm/CommWriterSpec.scala  | 15 ++++++----
 .../kernel/protocol/v5/HeaderBuilderSpec.scala  | 23 ++++++++--------
 .../toree/kernel/protocol/v5/HeaderSpec.scala   | 23 ++++++++--------
 .../kernel/protocol/v5/KMBuilderSpec.scala      | 23 ++++++++--------
 .../protocol/v5/content/ClearOutputSpec.scala   | 23 ++++++++--------
 .../protocol/v5/content/CommCloseSpec.scala     | 23 ++++++++--------
 .../protocol/v5/content/CommMsgSpec.scala       | 23 ++++++++--------
 .../protocol/v5/content/CommOpenSpec.scala      | 23 ++++++++--------
 .../v5/content/CompleteReplyErrorSpec.scala     | 23 ++++++++--------
 .../v5/content/CompleteReplyOkSpec.scala        | 23 ++++++++--------
 .../protocol/v5/content/CompleteReplySpec.scala | 23 ++++++++--------
 .../v5/content/CompleteRequestSpec.scala        | 23 ++++++++--------
 .../protocol/v5/content/ConnectReplySpec.scala  | 23 ++++++++--------
 .../v5/content/ConnectRequestSpec.scala         | 23 ++++++++--------
 .../protocol/v5/content/DisplayDataSpec.scala   | 23 ++++++++--------
 .../protocol/v5/content/ErrorContentSpec.scala  | 23 ++++++++--------
 .../protocol/v5/content/ExecuteInputSpec.scala  | 23 ++++++++--------
 .../v5/content/ExecuteReplyAbortSpec.scala      | 23 ++++++++--------
 .../v5/content/ExecuteReplyErrorSpec.scala      | 23 ++++++++--------
 .../v5/content/ExecuteReplyOkSpec.scala         | 23 ++++++++--------
 .../protocol/v5/content/ExecuteReplySpec.scala  | 23 ++++++++--------
 .../v5/content/ExecuteRequestSpec.scala         | 23 ++++++++--------
 .../protocol/v5/content/ExecuteResultSpec.scala | 23 ++++++++--------
 .../protocol/v5/content/HistoryReplySpec.scala  | 23 ++++++++--------
 .../v5/content/HistoryRequestSpec.scala         | 23 ++++++++--------
 .../protocol/v5/content/InputReplySpec.scala    | 13 +++++----
 .../protocol/v5/content/InputRequestSpec.scala  | 13 +++++----
 .../v5/content/InspectReplyErrorSpec.scala      | 23 ++++++++--------
 .../v5/content/InspectReplyOkSpec.scala         | 23 ++++++++--------
 .../protocol/v5/content/InspectReplySpec.scala  | 23 ++++++++--------
 .../v5/content/InspectRequestSpec.scala         | 23 ++++++++--------
 .../v5/content/KernelInfoReplySpec.scala        | 23 ++++++++--------
 .../v5/content/KernelInfoRequestSpec.scala      | 23 ++++++++--------
 .../protocol/v5/content/KernelStatusSpec.scala  | 23 ++++++++--------
 .../protocol/v5/content/ShutdownReplySpec.scala | 23 ++++++++--------
 .../v5/content/ShutdownRequestSpec.scala        | 23 ++++++++--------
 .../protocol/v5/content/StreamContentSpec.scala | 23 ++++++++--------
 .../toree/kernel/protocol/v5/package.scala      | 23 ++++++++--------
 pyspark-interpreter/build.sbt                   | 23 ++++++++--------
 .../interpreter/pyspark/PySparkBridge.scala     | 21 +++++++-------
 .../interpreter/pyspark/PySparkException.scala  | 21 +++++++-------
 .../pyspark/PySparkInterpreter.scala            | 21 +++++++-------
 .../interpreter/pyspark/PySparkProcess.scala    | 21 +++++++-------
 .../pyspark/PySparkProcessHandler.scala         | 21 +++++++-------
 .../interpreter/pyspark/PySparkService.scala    | 21 +++++++-------
 .../interpreter/pyspark/PySparkState.scala      | 21 +++++++-------
 .../pyspark/PySparkTransformer.scala            | 21 +++++++-------
 .../interpreter/pyspark/PySparkTypes.scala      | 21 +++++++-------
 .../kernel/interpreter/pyspark/package.scala    | 21 +++++++-------
 .../apache/toree/magic/builtin/PySpark.scala    | 21 +++++++-------
 resources/compile/application.conf              | 13 +++++----
 resources/compile/log4j.properties              | 13 +++++----
 resources/compile/reference.conf                | 13 +++++----
 resources/test/application.conf                 | 13 +++++----
 resources/test/log4j.properties                 | 13 +++++----
 resources/test/reference.conf                   | 13 +++++----
 scala-interpreter/build.sbt                     | 23 ++++++++--------
 .../interpreter/scala/ScalaException.scala      | 21 +++++++-------
 .../interpreter/scala/ScalaInterpreter.scala    | 21 +++++++-------
 .../scala/SettingsProducerLike.scala            | 21 +++++++-------
 .../scala/SparkIMainProducerLike.scala          | 21 +++++++-------
 .../scala/TaskManagerProducerLike.scala         | 21 +++++++-------
 .../org/apache/toree/magic/builtin/Scala.scala  | 21 +++++++-------
 .../AddExternalJarMagicSpecForIntegration.scala | 21 +++++++-------
 .../scala/ScalaInterpreterSpec.scala            | 21 +++++++-------
 sparkr-interpreter/build.sbt                    | 23 ++++++++--------
 .../src/main/resources/R/log4j.properties       | 21 +++++++-------
 .../src/main/resources/kernelR/sparkr_runner.R  | 23 ++++++++--------
 .../resources/kernelR/sparkr_runner_utils.R     | 27 +++++++++---------
 .../interpreter/sparkr/ReflectiveRBackend.scala | 21 +++++++-------
 .../interpreter/sparkr/SparkRBridge.scala       | 21 +++++++-------
 .../interpreter/sparkr/SparkRException.scala    | 21 +++++++-------
 .../interpreter/sparkr/SparkRInterpreter.scala  | 21 +++++++-------
 .../interpreter/sparkr/SparkRProcess.scala      | 21 +++++++-------
 .../sparkr/SparkRProcessHandler.scala           | 21 +++++++-------
 .../interpreter/sparkr/SparkRService.scala      | 21 +++++++-------
 .../kernel/interpreter/sparkr/SparkRState.scala | 21 +++++++-------
 .../interpreter/sparkr/SparkRTransformer.scala  | 21 +++++++-------
 .../kernel/interpreter/sparkr/SparkRTypes.scala | 21 +++++++-------
 .../kernel/interpreter/sparkr/package.scala     | 21 +++++++-------
 .../org/apache/toree/magic/builtin/SparkR.scala | 21 +++++++-------
 sql-interpreter/build.sbt                       | 23 ++++++++--------
 .../kernel/interpreter/sql/SqlException.scala   | 21 +++++++-------
 .../kernel/interpreter/sql/SqlInterpreter.scala | 21 +++++++-------
 .../kernel/interpreter/sql/SqlService.scala     | 21 +++++++-------
 .../kernel/interpreter/sql/SqlTransformer.scala | 21 +++++++-------
 .../toree/kernel/interpreter/sql/SqlTypes.scala | 21 +++++++-------
 .../org/apache/toree/magic/builtin/Sql.scala    | 21 +++++++-------
 src/test/scala/system/StdinForSystemSpec.scala  | 13 +++++----
 .../root/SparkKernelClientDeployer.scala        | 13 +++++----
 .../test.utils/root/SparkKernelDeployer.scala   | 13 +++++----
 408 files changed, 4471 insertions(+), 3751 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
index be9a229..dcb6340 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 FROM ubuntu:14.04

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 6e23722..3d706df 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
 #
-# Copyright 2015 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 .PHONY: help clean clean-dist build dev test test-travis

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index de30874..a9db504 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,3 +1,5 @@
-Spark Kernel
-Copyright 2014 IBM Corp.
+Apache Toree
+Copyright [2016] The Apache Software Foundation
 
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
index 6cb3ee5..dddce07 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 # -*- mode: ruby -*-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/build.sbt
----------------------------------------------------------------------
diff --git a/client/build.sbt b/client/build.sbt
index 4e1aa4c..45003ef 100644
--- a/client/build.sbt
+++ b/client/build.sbt
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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
  */
 // Update compiler options to allow reflective calls
 scalacOptions += "-language:reflectiveCalls"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala b/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
index 196bc09..51a4f1b 100644
--- a/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
+++ b/client/src/main/scala/org/apache/toree/comm/ClientCommManager.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala b/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
index 5259c0f..bc8bf8e 100644
--- a/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
+++ b/client/src/main/scala/org/apache/toree/comm/ClientCommWriter.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.comm

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
index 4fa93bc..04a5b20 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/ActorLoader.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
index 2e1c690..97830d4 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/SparkKernelClient.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
index d31a573..b8e5fa8 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
index 33cc20f..2bff776 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/ClientBootstrap.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.boot

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
index a379a29..fa6af59 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/HandlerInitialization.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.client.boot.layers

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
index 329841e..64ffa5a 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/boot/layers/SystemInitialization.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2014 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.client.boot.layers

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
index 38936b5..3958105 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/exception/ShellException.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.exception

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
index 32815f5..cf40291 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecution.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.execution

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
index 3154222..cf6c235 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionManager.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.execution

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
index 0049407..8727d63 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/DeferredExecutionTuple.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.execution

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
index 044197f..33466fc 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/execution/ExecuteRequestTuple.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.execution

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
index d7b7c9f..9a4c33e 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/handler/ExecuteHandler.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.handler

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
index efd7eb8..fd4c074 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
index ca4b10d..02f1794 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
index ab3f478..1c1c864 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClient.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
index 14f21fd..4931568 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConfig.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
index da9b02a..8a479c0 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketConnection.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
index 087cdbc..1d39047 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/SocketFactory.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
----------------------------------------------------------------------
diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
index e70ec32..69b74c4 100644
--- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
+++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClient.scala
@@ -1,9 +1,10 @@
 /*
- * Copyright 2015 IBM Corp.
- *
- *  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
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
@@ -11,7 +12,7 @@
  *  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.
+ *  limitations under the License
  */
 
 package org.apache.toree.kernel.protocol.v5.client.socket

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/resources/testng.yaml
----------------------------------------------------------------------
diff --git a/client/src/test/resources/testng.yaml b/client/src/test/resources/testng.yaml
index b1ec4c8..dee30fe 100644
--- a/client/src/test/resources/testng.yaml
+++ b/client/src/test/resources/testng.yaml
@@ -1,9 +1,10 @@
 #
-# Copyright 2014 IBM Corp.
-#
-# 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 #
@@ -11,7 +12,7 @@
 # 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.
+# limitations under the License
 #
 
 name: SparkKernelJavaTests

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/examples/DocumentationExamples.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/examples/DocumentationExamples.scala b/client/src/test/scala/examples/DocumentationExamples.scala
index dd2a8f7..3d67f20 100644
--- a/client/src/test/scala/examples/DocumentationExamples.scala
+++ b/client/src/test/scala/examples/DocumentationExamples.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 examples

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/examples/ScalaSparkClientUsage.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/examples/ScalaSparkClientUsage.scala b/client/src/test/scala/examples/ScalaSparkClientUsage.scala
index 6d38c43..5f5e15f 100644
--- a/client/src/test/scala/examples/ScalaSparkClientUsage.scala
+++ b/client/src/test/scala/examples/ScalaSparkClientUsage.scala
@@ -1,17 +1,18 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 examples

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala b/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
index dc6c047..ea7f1ac 100644
--- a/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
+++ b/client/src/test/scala/integration/unused.integration.socket/ClientToHeartbeatSpecForIntegration.scala
@@ -1,19 +1,22 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 integration.socket
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c3b736a4/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala b/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
index b4fe468..3ca125e 100644
--- a/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
+++ b/client/src/test/scala/integration/unused.integration.socket/ClientToIOPubSpecForIntegration.scala
@@ -1,19 +1,22 @@
 /*
- * Copyright 2014 IBM Corp.
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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
  *
- * 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
  *
- *     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.
+ *  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 integration.socket
 


[10/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/comm/CommRegistrar.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/comm/CommRegistrar.scala b/protocol/src/main/scala/com/ibm/spark/comm/CommRegistrar.scala
deleted file mode 100644
index 84df054..0000000
--- a/protocol/src/main/scala/com/ibm/spark/comm/CommRegistrar.scala
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.comm.CommCallbacks._
-import com.ibm.spark.kernel.protocol.v5
-
-import scala.annotation.tailrec
-import scala.collection.immutable
-
-/**
- * Represents a point of communication to register new Comm entities (targets)
- * and attach handlers for various events. Uses external storage for the
- * Comm information.
- *
- * @param commStorage The storage used to save/load callbacks
- * @param defaultTargetName The default target name to use for functions
- */
-@Experimental
-class CommRegistrar(
-  private val commStorage: CommStorage,
-  private[comm] val defaultTargetName: Option[String] = None
-) {
-
-  /**
-   * Returns an updated copy of the registrar that is using the specified
-   * target name as the default for chaining.
-   *
-   * @param targetName The name of the target to treat as the default
-   *
-   * @return The updated registrar (for chaining methods)
-   */
-  def withTarget(targetName: String): CommRegistrar = {
-    new CommRegistrar(commStorage, Some(targetName))
-  }
-
-  /**
-   * Registers a specific target for Comm communications.
-   *
-   * @param targetName The name of the target to register
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def register(targetName: String): CommRegistrar = {
-    // Mark as registered if not already
-    if (!commStorage.hasTargetCallbacks(targetName))
-      commStorage.setTargetCallbacks(targetName, new CommCallbacks())
-
-    // Return new instance with default target name specified for easier
-    // method chaining
-    new CommRegistrar(commStorage, Some(targetName))
-  }
-
-  /**
-   * Unregisters a specific target for Comm communications.
-   *
-   * @param targetName The name of the target to unregister
-   *
-   * @return Some collection of callbacks associated with the target if it was
-   *         registered, otherwise None
-   */
-  def unregister(targetName: String): Option[CommCallbacks] = {
-    commStorage.removeTargetCallbacks(targetName)
-  }
-
-  /**
-   * Indicates whether or not the specified target is currently registered
-   * with this registrar.
-   *
-   * @param targetName The name of the target
-   *
-   * @return True if the target is registered, otherwise false
-   */
-  def isRegistered(targetName: String): Boolean = {
-    commStorage.hasTargetCallbacks(targetName)
-  }
-
-  /**
-   * Links a target and a specific Comm id together.
-   *
-   * @param targetName The name of the target to link
-   * @param commId The Comm Id to link
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def link(targetName: String, commId: v5.UUID): CommRegistrar =
-    linkImpl(targetName)(commId)
-
-  /**
-   * Links a target and a specific Comm id together.
-   *
-   * @param commId The Comm Id to link
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def link(commId: v5.UUID): CommRegistrar = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    linkImpl(defaultTargetName.get)(commId)
-  }
-
-  private def linkImpl(targetName: String)(commId: v5.UUID) = {
-    val commIds = commStorage.getCommIdsFromTarget(targetName)
-      .getOrElse(immutable.Vector.empty[v5.UUID])
-
-    commStorage.setTargetCommIds(targetName, commIds :+ commId)
-
-    this
-  }
-
-  /**
-   * Retrieves the current links for the specified target.
-   *
-   * @param targetName The name of the target whose links to retrieve
-   *
-   * @return The collection of link ids
-   */
-  def getLinks(targetName: String): Seq[v5.UUID] =
-    getLinksImpl(targetName)
-
-  /**
-   * Retrieves the target associated with the specified link.
-   *
-   * @param commId The Comm id whose target to look up
-   *
-   * @return Some target name if found, otherwise None
-   */
-  def getTargetFromLink(commId: v5.UUID): Option[String] = {
-    commStorage.getTargetFromCommId(commId)
-  }
-
-  /**
-   * Retrieves the current links for the current target.
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The collection of link ids
-   */
-  def getLinks: Seq[v5.UUID] = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    getLinksImpl(defaultTargetName.get)
-  }
-
-  private def getLinksImpl(targetName: String): Seq[v5.UUID] = {
-    commStorage
-      .getCommIdsFromTarget(targetName)
-      .getOrElse(Nil)
-  }
-
-  /**
-   * Unlinks a target and a specific Comm id based on the provided id.
-   *
-   * @param commId The id of the Comm instance to unlink from its target
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def unlink(commId: v5.UUID): CommRegistrar = {
-    commStorage.removeCommIdFromTarget(commId)
-
-    this
-  }
-
-  /**
-   * Adds an entry to the list of open Comm handlers.
-   *
-   * @param targetName The name of the target whose open event to monitor
-   * @param func The handler function to trigger when an open is received
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def addOpenHandler(targetName: String, func: OpenCallback) =
-    addOpenHandlerImpl(targetName)(func)
-
-  /**
-   * Adds an entry to the list of open Comm handlers.
-   *
-   * @param func The handler function to trigger when an open is received
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def addOpenHandler(func: OpenCallback) = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    addOpenHandlerImpl(defaultTargetName.get)(func)
-  }
-
-  private def addOpenHandlerImpl(targetName: String)(func: OpenCallback) = {
-    val commCallbacks =
-      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
-
-    commStorage.setTargetCallbacks(
-      targetName, commCallbacks.addOpenCallback(func))
-
-    this
-  }
-
-  /**
-   * Removes the specified callback from the list of open Comm handlers.
-   *
-   * @param targetName The name of the target to remove the open callback
-   * @param func The callback to remove
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def removeOpenHandler(targetName: String, func: OpenCallback) =
-    removeOpenHandlerImpl(targetName)(func)
-
-  /**
-   * Removes the specified callback from the list of open Comm handlers.
-   *
-   * @param func The callback to remove
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def removeOpenHandler(func: OpenCallback) = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    removeOpenHandlerImpl(defaultTargetName.get)(func)
-  }
-
-  private def removeOpenHandlerImpl(targetName: String)(func: OpenCallback) = {
-    val commCallbacks =
-      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
-
-    commStorage.setTargetCallbacks(
-      targetName, commCallbacks.removeOpenCallback(func))
-
-    this
-  }
-
-  /**
-   * Adds an entry to the list of msg Comm handlers.
-   *
-   * @param targetName The name of the target whose msg event to monitor
-   * @param func The handler function to trigger when a msg is received
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def addMsgHandler(targetName: String, func: MsgCallback) =
-    addMsgHandlerImpl(targetName)(func)
-
-  /**
-   * Adds an entry to the list of msg Comm handlers.
-   *
-   * @param func The handler function to trigger when a msg is received
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def addMsgHandler(func: MsgCallback) = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    addMsgHandlerImpl(defaultTargetName.get)(func)
-  }
-
-  private def addMsgHandlerImpl(targetName: String)(func: MsgCallback) = {
-    val commCallbacks =
-      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
-
-    commStorage.setTargetCallbacks(
-      targetName, commCallbacks.addMsgCallback(func))
-
-    this
-  }
-
-  /**
-   * Removes the specified callback from the list of msg Comm handlers.
-   *
-   * @param targetName The name of the target to remove the msg callback
-   * @param func The callback to remove
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def removeMsgHandler(targetName: String, func: MsgCallback) =
-    removeMsgHandlerImpl(targetName)(func)
-
-  /**
-   * Removes the specified callback from the list of msg Comm handlers.
-   *
-   * @param func The callback to remove
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def removeMsgHandler(func: MsgCallback) = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    removeMsgHandlerImpl(defaultTargetName.get)(func)
-  }
-
-  private def removeMsgHandlerImpl(targetName: String)(func: MsgCallback) = {
-    val commCallbacks =
-      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
-
-    commStorage.setTargetCallbacks(
-      targetName, commCallbacks.removeMsgCallback(func))
-
-    this
-  }
-
-  /**
-   * Adds an entry to the list of close Comm handlers.
-   *
-   * @param targetName The name of the target whose close event to monitor
-   * @param func The handler function to trigger when a close is received
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def addCloseHandler(targetName: String, func: CloseCallback) =
-    addCloseHandlerImpl(targetName)(func)
-
-  /**
-   * Adds an entry to the list of close Comm handlers.
-   *
-   * @param func The handler function to trigger when a close is received
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def addCloseHandler(func: CloseCallback) = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    addCloseHandlerImpl(defaultTargetName.get)(func)
-  }
-
-  private def addCloseHandlerImpl(targetName: String)(func: CloseCallback) = {
-    val commCallbacks =
-      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
-
-    commStorage.setTargetCallbacks(
-      targetName, commCallbacks.addCloseCallback(func))
-
-    this
-  }
-
-  /**
-   * Removes the specified callback from the list of close Comm handlers.
-   *
-   * @param targetName The name of the target to remove the close callback
-   * @param func The callback to remove
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def removeCloseHandler(targetName: String, func: CloseCallback) =
-    removeCloseHandlerImpl(targetName)(func)
-
-  /**
-   * Removes the specified callback from the list of close Comm handlers.
-   *
-   * @param func The callback to remove
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The current registrar (for chaining methods)
-   */
-  def removeCloseHandler(func: CloseCallback) = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    removeCloseHandlerImpl(defaultTargetName.get)(func)
-  }
-
-  private def removeCloseHandlerImpl(targetName: String)(
-    func: CloseCallback
-  ) = {
-    val commCallbacks =
-      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
-
-    commStorage.setTargetCallbacks(
-      targetName, commCallbacks.removeCloseCallback(func))
-
-    this
-  }
-
-  /**
-   * Retrieves all open callbacks for the target.
-   *
-   * @param targetName The name of the target whose open callbacks to retrieve
-   *
-   * @return The collection of open callbacks
-   */
-  def getOpenHandlers(targetName: String): Seq[OpenCallback] =
-    getOpenHandlersImpl(targetName)
-
-  /**
-   * Retrieves all open callbacks for the current target.
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The collection of open callbacks
-   */
-  def getOpenHandlers: Seq[OpenCallback] = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    getOpenHandlersImpl(defaultTargetName.get)
-  }
-
-  private def getOpenHandlersImpl(targetName: String): Seq[OpenCallback] = {
-    commStorage
-      .getTargetCallbacks(targetName)
-      .map(_.openCallbacks)
-      .getOrElse(Nil)
-  }
-
-  /**
-   * Retrieves all msg callbacks for the target.
-   *
-   * @param targetName The name of the target whose msg callbacks to retrieve
-   *
-   * @return The collection of msg callbacks
-   */
-  def getMsgHandlers(targetName: String): Seq[MsgCallback] =
-    getMsgHandlersImpl(targetName)
-
-  /**
-   * Retrieves all msg callbacks for the current target.
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The collection of msg callbacks
-   */
-  def getMsgHandlers: Seq[MsgCallback] = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    getMsgHandlersImpl(defaultTargetName.get)
-  }
-
-  private def getMsgHandlersImpl(targetName: String): Seq[MsgCallback] = {
-    commStorage
-      .getTargetCallbacks(targetName)
-      .map(_.msgCallbacks)
-      .getOrElse(Nil)
-  }
-
-  /**
-   * Retrieves all close callbacks for the target.
-   *
-   * @param targetName The name of the target whose close callbacks to retrieve
-   *
-   * @return The collection of close callbacks
-   */
-  def getCloseHandlers(targetName: String): Seq[CloseCallback] =
-    getCloseHandlersImpl(targetName)
-
-  /**
-   * Retrieves all close callbacks for the current target.
-   *
-   * @throws AssertionError When not chaining off of a register call
-   *
-   * @return The collection of close callbacks
-   */
-  def getCloseHandlers: Seq[CloseCallback] = {
-    assert(defaultTargetName.nonEmpty, "No default target name provided!")
-
-    getCloseHandlersImpl(defaultTargetName.get)
-  }
-
-  private def getCloseHandlersImpl(targetName: String): Seq[CloseCallback] = {
-    commStorage
-      .getTargetCallbacks(targetName)
-      .map(_.closeCallbacks)
-      .getOrElse(Nil)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/comm/CommStorage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/comm/CommStorage.scala b/protocol/src/main/scala/com/ibm/spark/comm/CommStorage.scala
deleted file mode 100644
index 0aaff9a..0000000
--- a/protocol/src/main/scala/com/ibm/spark/comm/CommStorage.scala
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-
-import scala.collection.immutable
-
-/**
- * Represents the storage structure for Comm-related data.
- *
- * @param callbackStorage The structure used to connect targets with callbacks
- * @param linkStorage The structure used to connect targets to specific ids
- */
-@Experimental
-class CommStorage(
-  private val callbackStorage: collection.mutable.Map[String, CommCallbacks] =
-    new collection.mutable.HashMap[String, CommCallbacks](),
-  private val linkStorage: collection.mutable.Map[String, immutable.IndexedSeq[v5.UUID]] =
-    new collection.mutable.HashMap[String, immutable.IndexedSeq[v5.UUID]]()
-) {
-  /**
-   * Sets the Comm callbacks for the specified target.
-   *
-   * @param targetName The name of the target whose callbacks to set
-   * @param commCallbacks The new callbacks for the target
-   */
-  def setTargetCallbacks(targetName: String, commCallbacks: CommCallbacks) =
-    callbackStorage(targetName) = commCallbacks
-
-  /**
-   * Removes the Comm callbacks from the specified target.
-   *
-   * @param targetName The name of the target whose callbacks to remove
-   *
-   * @return Some CommCallbacks if removed, otherwise None
-   */
-  def removeTargetCallbacks(targetName: String) =
-    callbackStorage.remove(targetName)
-
-  /**
-   * Retrieves the current Comm callbacks for the specified target.
-   *
-   * @param targetName The name of the target whose callbacks to get
-   *
-   * @return Some CommCallbacks if found, otherwise None
-   */
-  def getTargetCallbacks(targetName: String): Option[CommCallbacks] =
-    callbackStorage.get(targetName)
-
-  /**
-   * Determines if the specified target has any callbacks.
-   *
-   * @param targetName The name of the target
-   *
-   * @return True if a CommCallbacks instance is found, otherwise false
-   */
-  def hasTargetCallbacks(targetName: String) =
-    callbackStorage.contains(targetName)
-
-  /**
-   * Sets the Comm ids associated with the specified target.
-   *
-   * @param targetName The name of the target whose Comm ids to set
-   * @param links The sequence of Comm ids to attach to the target
-   */
-  def setTargetCommIds(
-    targetName: String, links: immutable.IndexedSeq[v5.UUID]
-  ) = linkStorage(targetName) = links
-
-  /**
-   * Removes the Comm ids associated with the specified target.
-   *
-   * @param targetName The name of the target whose Comm ids to remove
-   *
-   * @return Some sequence of Comm ids if removed, otherwise None
-   */
-  def removeTargetCommIds(targetName: String) = linkStorage.remove(targetName)
-
-  /**
-   * Removes the specified Comm id from the first target with a match.
-   *
-   * @param commId The Comm id to remove
-   *
-   * @return Some name of target linked to Comm id if removed, otherwise None
-   */
-  def removeCommIdFromTarget(commId: v5.UUID): Option[v5.UUID] = {
-    val targetName = getTargetFromCommId(commId)
-
-    targetName match {
-      case Some(name) =>
-        val commIds = getCommIdsFromTarget(name).get.filterNot(_ == commId)
-        setTargetCommIds(name, commIds)
-        Some(name)
-      case None       =>
-        None
-    }
-  }
-
-  /**
-   * Retrieves the current sequence of Comm ids for the specified target.
-   *
-   * @param targetName The name of the target whose Comm ids to get
-   *
-   * @return Some sequence of Comm ids if found, otherwise None
-   */
-  def getCommIdsFromTarget(targetName: String) = linkStorage.get(targetName)
-
-  /**
-   * Retrieves the current target for the specified Comm id.
-   *
-   * @param commId The Comm id whose target to get
-   *
-   * @return Some target name if found, otherwise None
-   */
-  def getTargetFromCommId(commId: v5.UUID): Option[String] = linkStorage.find {
-    (link) => link._2.contains(commId)
-  } match {
-    case Some(link) => Some(link._1)
-    case None       => None
-  }
-
-  /**
-   * Retrieves the current Comm callbacks for the specified Comm id.
-   *
-   * @param commId The id of the Comm whose callbacks to retrieve
-   *
-   * @return Some CommCallbacks if Comm id found, otherwise None
-   */
-  def getCommIdCallbacks(commId: v5.UUID): Option[CommCallbacks] =
-    getTargetFromCommId(commId) match {
-      case Some(targetName) => getTargetCallbacks(targetName)
-      case None             => None
-    }
-
-  /**
-   * Determines if the specified target has any linked Comm ids.
-   *
-   * @param targetName The name of the target
-   *
-   * @return True if a sequence of Comm ids is found, otherwise false
-   */
-  def hasTargetCommIds(targetName: String) =
-    linkStorage.contains(targetName)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/comm/CommWriter.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/comm/CommWriter.scala b/protocol/src/main/scala/com/ibm/spark/comm/CommWriter.scala
deleted file mode 100644
index 772e582..0000000
--- a/protocol/src/main/scala/com/ibm/spark/comm/CommWriter.scala
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.annotations.Experimental
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content._
-
-import java.io.Writer
-
-/**
- * Represents a basic writer used to communicate comm-related messages.
- *
- * @param commId The comm id associated with this writer (defaults to a
- *               random UUID)
- */
-@Experimental
-abstract class CommWriter(
-  private[comm] val commId: UUID = java.util.UUID.randomUUID().toString
-) extends Writer {
-
-  private val MessageFieldName = "message"
-
-  /**
-   * Packages and sends an open message with the provided target and data.
-   *
-   * @param targetName The name of the target (used by the recipient)
-   * @param data The optional data to send with the open message
-   */
-  def writeOpen(targetName: String, data: MsgData = MsgData.Empty) =
-    sendCommKernelMessage(CommOpen(commId, targetName, data))
-
-  /**
-   * Packages and sends a message with the provided data.
-   *
-   * @param data The data to send
-   */
-  def writeMsg(data: v5.MsgData) = {
-    require(data != null)
-
-    sendCommKernelMessage(CommMsg(commId, data))
-  }
-
-  /**
-   * Packages and sends a close message with the provided data.
-   *
-   * @param data The optional data to send with the close message
-   */
-  def writeClose(data: v5.MsgData = MsgData.Empty) =
-    sendCommKernelMessage(CommClose(commId, data))
-
-  /**
-   * Writes the data as a new message, wrapped with a "message" JSON field.
-   *
-   * @param cbuf The array of characters to send
-   * @param off The offset (0 is the start) of the array to use
-   * @param len The number of characters to send
-   */
-  override def write(cbuf: Array[Char], off: Int, len: Int): Unit = {
-    val message = new String(cbuf.slice(off, len))
-    val packedMessage = packageMessage(message)
-    sendCommKernelMessage(packedMessage)
-  }
-
-  /**
-   * Does nothing in this implementation.
-   */
-  override def flush(): Unit = {}
-
-  /**
-   * Sends a close message without any data.
-   */
-  override def close(): Unit = writeClose()
-
-  /**
-   * Packages a string message as a Comm message.
-   *
-   * @param message The string message to package
-   *
-   * @return The resulting CommMsg wrapper
-   */
-  private def packageMessage(message: String) =
-    CommMsg(commId, MsgData(MessageFieldName -> message))
-
-  /**
-   * Sends the comm message (open/msg/close) to the actor responsible for
-   * relaying messages.
-   *
-   * @param commContent The message to relay (will be packaged)
-   *
-   * @tparam T Either CommOpen, CommMsg, or CommClose
-   */
-  protected[comm] def sendCommKernelMessage[
-    T <: KernelMessageContent with CommContent
-  ](commContent: T)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/Header.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/Header.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/Header.scala
deleted file mode 100644
index 284b2bc..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/Header.scala
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-import play.api.libs.json._
-
-case class Header(
-  msg_id: UUID,
-  username: String,
-  session: UUID,  // Custom UUID type also used here
-  msg_type: String,
-  version: String   // Assuming a string since the doc says '5.0'
-)
-
-object Header {
-  implicit val headerReads = Json.reads[Header]
-  //implicit val headerWrites = Json.writes[Header]
-  implicit val headerWriters = new Writes[Header] {
-    def writes(header: Header) =
-      if (header != null) {
-        Json.obj(
-          "msg_id" -> header.msg_id,
-          "username" -> header.username,
-          "session" -> header.session,
-          "msg_type" -> header.msg_type,
-          "version" -> header.version
-        )
-      // Empty header is null
-      } else {
-        Json.obj()
-      }
-  }
-}
-
-/* LEFT FOR REFERENCE IN CREATING CUSTOM READ/WRITE
-object Header {
-  implicit val headerReads: Reads[Header] = (
-    (JsPath \ "msg_id").read[String] and
-    (JsPath \ "username").read[String] and
-    (JsPath \ "session").read[String] and
-    (JsPath \ "msg_type").read[String] and
-    (JsPath \ "version").read[String]
-  )(Header.apply _) // Case class provides the apply method
-
-  implicit val headerWrites: Writes[Header] = (
-    (JsPath \ "msg_id").write[String] and
-    (JsPath \ "username").write[String] and
-    (JsPath \ "session").write[String] and
-    (JsPath \ "msg_type").write[String] and
-    (JsPath \ "version").write[String]
-  )(unlift(Header.unapply)) // Case class provides the unapply method
-}
-*/

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilder.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilder.scala
deleted file mode 100644
index 4061ffe..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/HeaderBuilder.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-object HeaderBuilder {
-  /**
-   * Creates a new Header instance with the provided id and type.
-   * @param msgType The type of the message
-   * @param msgId (Optional) The unique identifier of the message, generates a
-   *              random UUID if none is provided
-   * @return The new Header instance
-   */
-  def create(
-    msgType: String,
-    msgId: UUID = java.util.UUID.randomUUID.toString
-  ) = Header(
-      msgId,
-      SparkKernelInfo.username,
-      SparkKernelInfo.session,
-      msgType,
-      SparkKernelInfo.protocolVersion
-    )
-
-  /**
-   * Represents an "empty" header where the message type and id are blank.
-   */
-  val empty = create("", "")
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KMBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KMBuilder.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KMBuilder.scala
deleted file mode 100644
index 4ed4ab5..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KMBuilder.scala
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-import java.util.Calendar
-
-import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
-
-/**
-  * A class for building KernelMessages.
-  * Upon creation, holds a KernelMessage with empty parameters. 
-  * A new KMBuilder holding a KernelMessage with modified
-  * parameters can be generated using the withXYZ() methods.
-  * The KernelMessage held by the KMBuilder can be obtained with build().
-  * All metadata returned by metadataDefaults() is added
-  * to the KernelMessage's metadata when build() is called.
-  *
-  * e.g.
-  * val base = KMBuilder().withParent(parentMessage)
-  *
-  * val km1 = base.withHeader(MessageType.ExecuteReply).build
-  *
-  * val km2 = base.withHeader(MessageType.ExecuteRequest)
-  *               .withContentString("content").build
-**/
-case class KMBuilder(km: KernelMessage = KernelMessage(
-                                            ids           = Seq(),
-                                            signature     = "",
-                                            header        = HeaderBuilder.empty,
-                                            parentHeader  = HeaderBuilder.empty,
-                                            metadata      = Metadata(),
-                                            contentString = ""
-                                            )) {
-  require(km != null)
-
-  def withIds(newVal: Seq[String]) : KMBuilder =
-    KMBuilder(this.km.copy(ids = newVal))
-
-  def withSignature(newVal: String) : KMBuilder =
-    KMBuilder(this.km.copy(signature = newVal))
-
-  def withHeader(newVal: Header) : KMBuilder =
-    KMBuilder(this.km.copy(header = newVal))
-
-  def withHeader(msgType: MessageType) : KMBuilder = {
-    val header = HeaderBuilder.create(msgType.toString)
-    KMBuilder(this.km.copy(header = header))
-  }
-
-  def withHeader(msgTypeString: String) : KMBuilder = {
-    val header = HeaderBuilder.create(msgTypeString)
-    KMBuilder(this.km.copy(header = header))
-  }
-
-  def withParent(parent: KernelMessage) : KMBuilder =
-    KMBuilder(this.km.copy(parentHeader = parent.header))
-
-  def withParentHeader(newVal: Header) : KMBuilder =
-    KMBuilder(this.km.copy(parentHeader = newVal))
-
-  def withMetadata(newVal: Metadata) : KMBuilder =
-    KMBuilder(this.km.copy(metadata = newVal))
-
-  def withContentString(newVal: String) : KMBuilder =
-    KMBuilder(this.km.copy(contentString = newVal))
-
-  def withContentString[T <: KernelMessageContent](contentMsg: T) : KMBuilder =
-    KMBuilder(this.km.copy(contentString = contentMsg.content))
-
-  /**
-   * Default information (e.g. timestamp) to add to the
-   * KernelMessage's metadata upon calling build().
-   */
-  protected def metadataDefaults : Metadata = {
-    val timestamp = Calendar.getInstance().getTimeInMillis.toString
-    Metadata("timestamp" -> timestamp)
-  }
-
-  /**
-   * Builds a KernelMessage using the KernelMessage held by this builder.
-   * @param includeDefaultMetadata appends default metadata (e.g. timestamp)
-   *                               to the KernelMessage's metadata when true.
-   * @return KernelMessage held by this builder with default metadata.
-   */
-  def build(implicit includeDefaultMetadata: Boolean = true) : KernelMessage = {
-    if (includeDefaultMetadata)
-      this.km.copy(metadata = km.metadata ++ metadataDefaults)
-    else
-      this.km.copy(metadata = km.metadata)
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessage.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessage.scala
deleted file mode 100644
index 5663933..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessage.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-case class KernelMessage(
-  ids: Seq[String],
-  signature: String,
-  header: Header,
-  parentHeader: ParentHeader, // TODO: This can be an empty json object of {}
-  metadata: Metadata,
-  contentString: String
-)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessageContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessageContent.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessageContent.scala
deleted file mode 100644
index ed7af7c..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/KernelMessageContent.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-trait KernelMessageContent {
-
-  /**
-   * Provides the String representation of this message used
-   * in the KernelMessage's contentString field.
-   * @return representation of this message.
-   */
-  def content : String
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/SparkKernelInfo.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/SparkKernelInfo.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/SparkKernelInfo.scala
deleted file mode 100644
index 1794c93..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/SparkKernelInfo.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-import com.ibm.spark.kernel.BuildInfo
-
-object SparkKernelInfo {
-  /**
-   * Represents the protocol version (IPython) supported by this kernel.
-   */
-  val protocolVersion         = "5.0"
-
-  /**
-   * Represents what the kernel implements.
-   */
-  val implementation          = "spark"
-
-  /**
-   * Represents the kernel version.
-   */
-  val implementationVersion   = BuildInfo.version
-
-  /**
-   * Represents the language supported by the kernel.
-   */
-  val language_info           = Map("name" -> "scala")
-
-  /**
-   * Represents the language version supported by the kernel.
-   */
-  val languageVersion         = BuildInfo.scalaVersion
-
-  /**
-   * Represents the displayed name of the kernel.
-   */
-  val banner                  = "IBM Spark Kernel"
-
-  /**
-   * Represents the name of the user who started the kernel process.
-   */
-  val username                = System.getProperty("user.name")
-
-  /**
-   * Represents the unique session id used by this instance of the kernel.
-   */
-  val session               = java.util.UUID.randomUUID.toString
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutput.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutput.scala
deleted file mode 100644
index 9b7eabe..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ClearOutput.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.functional.syntax._
-import play.api.libs.json._
-
-case class ClearOutput (
-  //  We cannot use _wait as a field because it is a method defined on all objects
-  _wait: Boolean
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ClearOutput.clearOutputWrites).toString
-}
-
-//  Single property fields are not well supported by play, this is a little funky workaround founde here:
-//  https://groups.google.com/forum/?fromgroups=#!starred/play-framework/hGrveOkbJ6U
-object ClearOutput extends TypeString {
-  implicit val clearOutputReads: Reads[ClearOutput] = (
-    (JsPath \ "wait").read[Boolean].map(ClearOutput(_)))
-  implicit val clearOutputWrites: Writes[ClearOutput] = (
-    (JsPath \ "wait").write[Boolean].contramap((c : ClearOutput) => c._wait)
-    )
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "clear_output"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommClose.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommClose.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommClose.scala
deleted file mode 100644
index e74ea72..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommClose.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5._
-import play.api.libs.json.Json
-
-case class CommClose(comm_id: UUID, data: MsgData)
-  extends KernelMessageContent with CommContent
-{
-  override def content : String =
-    Json.toJson(this)(CommClose.commCloseWrites).toString
-}
-
-object CommClose extends TypeString {
-
-  implicit val commCloseReads = Json.reads[CommClose]
-  implicit val commCloseWrites = Json.writes[CommClose]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "comm_close"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommContent.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommContent.scala
deleted file mode 100644
index 5e98e08..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommContent.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-
-/**
- * Represents a series of subclasses of KernelMessageContent that embodies the
- * Comm content types.
- */
-trait CommContent {
-  this: KernelMessageContent =>
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsg.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsg.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsg.scala
deleted file mode 100644
index e85e1f0..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommMsg.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.{MsgData, KernelMessageContent, UUID}
-import play.api.libs.json.Json
-
-case class CommMsg(comm_id: UUID, data: MsgData)
-  extends KernelMessageContent with CommContent
-{
-  override def content : String =
-    Json.toJson(this)(CommMsg.commMsgWrites).toString
-}
-
-object CommMsg extends TypeString {
-  implicit val commMsgReads = Json.reads[CommMsg]
-  implicit val commMsgWrites = Json.writes[CommMsg]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "comm_msg"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpen.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpen.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpen.scala
deleted file mode 100644
index b83d7ff..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CommOpen.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5._
-import play.api.libs.json.Json
-
-case class CommOpen(comm_id: UUID, target_name: String, data: MsgData)
-  extends KernelMessageContent with CommContent
-{
-  override def content : String =
-    Json.toJson(this)(CommOpen.commOpenWrites).toString
-}
-
-object CommOpen extends TypeString {
-  implicit val commOpenReads = Json.reads[CommOpen]
-  implicit val commOpenWrites = Json.writes[CommOpen]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "comm_open"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReply.scala
deleted file mode 100644
index 2edcfa7..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteReply.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Metadata}
-import play.api.libs.json.Json
-
-case class CompleteReply (
-  matches: List[String],
-  cursor_start: Int,
-  cursor_end: Int,
-  metadata: Metadata,
-  status: String,
-  ename: Option[String],
-  evalue: Option[String],
-  traceback: Option[List[String]]
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(CompleteReply.completeReplyWrites).toString
-}
-
-object CompleteReply extends TypeString {
-  implicit val completeReplyReads = Json.reads[CompleteReply]
-  implicit val completeReplyWrites = Json.writes[CompleteReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "complete_reply"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequest.scala
deleted file mode 100644
index 33d7e68..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/CompleteRequest.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-case class CompleteRequest(
-  code: String,
-  cursor_pos: Int
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(CompleteRequest.completeRequestWrites).toString
-}
-
-object CompleteRequest extends TypeString {
-  implicit val completeRequestReads = Json.reads[CompleteRequest]
-  implicit val completeRequestWrites = Json.writes[CompleteRequest]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "complete_request"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReply.scala
deleted file mode 100644
index 18ce82f..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectReply.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-case class ConnectReply(
-  shell_port: Int,
-  iopub_port: Int,
-  stdin_port: Int,
-  hb_port: Int
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ConnectReply.connectReplyWrites).toString
-}
-
-object ConnectReply extends TypeString {
-  implicit val connectReplyReads = Json.reads[ConnectReply]
-  implicit val connectReplyWrites = Json.writes[ConnectReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "connect_reply"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequest.scala
deleted file mode 100644
index 1c9e4a6..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ConnectRequest.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class ConnectRequest() extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ConnectRequest.connectRequestWrites).toString
-}
-
-object ConnectRequest extends TypeString {
-  private val SingleInstance = ConnectRequest()
-  private val EmptyJsonObj = Json.obj()
-
-  implicit val connectRequestReads = new Reads[ConnectRequest] {
-    override def reads(json: JsValue): JsResult[ConnectRequest] = {
-      new JsSuccess[ConnectRequest](SingleInstance)
-    }
-  }
-
-  implicit val connectRequestWrites = new Writes[ConnectRequest] {
-    override def writes(req: ConnectRequest): JsValue = EmptyJsonObj
-  }
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "connect_request"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayData.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayData.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayData.scala
deleted file mode 100644
index 7a959fa..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/DisplayData.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
-import play.api.libs.json._
-
-case class DisplayData(
-  source: String,
-  data: Data,
-  metadata: Metadata
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(DisplayData.displayDataWrites).toString
-}
-
-object DisplayData extends TypeString {
-  implicit val displayDataReads = Json.reads[DisplayData]
-  implicit val displayDataWrites = Json.writes[DisplayData]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "display_data"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContent.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContent.scala
deleted file mode 100644
index 4ba6888..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ErrorContent.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-import scala.language.implicitConversions
-
-case class ErrorContent(
-  ename: String,
-  evalue: String,
-  traceback: List[String]
-) extends KernelMessageContent{
-  override def content : String =
-    Json.toJson(this)(ErrorContent.errorContentWrites).toString
-}
-
-object ErrorContent extends TypeString {
-  implicit val errorContentReads = Json.reads[ErrorContent]
-  implicit val errorContentWrites = Json.writes[ErrorContent]
-
-  implicit def ErrorContentToString(errorContent: ErrorContent): String ={
-    Json.toJson(errorContent).toString
-  }
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "error"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInput.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInput.scala
deleted file mode 100644
index a1ec262..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteInput.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class ExecuteInput(
-  code: String,
-  execution_count: Int
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ExecuteInput.executeInputWrites).toString
-}
-
-object ExecuteInput extends TypeString {
-  implicit val executeInputReads = Json.reads[ExecuteInput]
-  implicit val executeInputWrites = Json.writes[ExecuteInput]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "execute_input"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReply.scala
deleted file mode 100644
index 3462e73..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteReply.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-// External libraries
-
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, UserExpressions, Payloads}
-import play.api.libs.json._
-
-// Internal libraries
-import scala.language.implicitConversions
-
-case class ExecuteReply(
-  status: String,
-  execution_count: Int,
-  payload: Option[Payloads],
-  user_expressions: Option[UserExpressions],
-  ename: Option[String],
-  evalue: Option[String],
-  traceback: Option[List[String]]
-) extends KernelMessageContent {
-
-  override def content : String =
-    Json.toJson(this)(ExecuteReply.executeReplyWrites).toString
-}
-
-object ExecuteReply extends TypeString {
-  implicit val executeReplyReads = Json.reads[ExecuteReply]
-  implicit val executeReplyWrites = Json.writes[ExecuteReply]
-
-  implicit def ExecuteReplyToString(executeReply: ExecuteReply): String ={
-      Json.toJson(executeReply).toString
-  }
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "execute_reply"
-}
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequest.scala
deleted file mode 100644
index 544e4c9..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteRequest.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, UserExpressions}
-import play.api.libs.json._
-
-case class ExecuteRequest(
-  code: String,
-  silent: Boolean,
-  store_history: Boolean,
-  user_expressions: UserExpressions,
-  allow_stdin: Boolean
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ExecuteRequest.executeRequestWrites).toString
-}
-
-object ExecuteRequest extends TypeString {
-  implicit val executeRequestReads = Json.reads[ExecuteRequest]
-  implicit val executeRequestWrites = Json.writes[ExecuteRequest]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "execute_request"
-}
-
-/* LEFT FOR REFERENCE IN CREATING CUSTOM READ/WRITE
-object ExecuteRequest {
-  implicit val headerReads: Reads[ExecuteRequest] = (
-    (JsPath \ "code").read[String] and
-    (JsPath \ "silent").read[Boolean] and
-    (JsPath \ "store_history").read[Boolean] and
-    (JsPath \ "user_expressions").read[UserExpressions] and
-    (JsPath \ "allow_stdin").read[Boolean]
-  )(ExecuteRequest.apply _) // Case class provides the apply method
-
-  implicit val headerWrites: Writes[ExecuteRequest] = (
-    (JsPath \ "code").write[String] and
-    (JsPath \ "silent").write[Boolean] and
-    (JsPath \ "store_history").write[Boolean] and
-    (JsPath \ "user_expressions").write[UserExpressions] and
-    (JsPath \ "allow_stdin").write[Boolean]
-  )(unlift(ExecuteRequest.unapply)) // Case class provides the unapply method
-}
-*/
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResult.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResult.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResult.scala
deleted file mode 100644
index 984b4a4..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ExecuteResult.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
-import play.api.libs.json.Json
-
-case class ExecuteResult (
-  execution_count: Int,
-  data: Data,
-  metadata: Metadata
-)  extends KernelMessageContent {
-  def hasContent = data != null && data.exists(x => x._2 != null && x._2.nonEmpty)
-  override def content : String =
-    Json.toJson(this)(ExecuteResult.executeResultWrites).toString
-}
-
-object ExecuteResult extends TypeString {
-  implicit val executeResultReads = Json.reads[ExecuteResult]
-  implicit val executeResultWrites = Json.writes[ExecuteResult]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "execute_result"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReply.scala
deleted file mode 100644
index 5f2b987..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryReply.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-
-case class HistoryReply(
-  // TODO: This is really (String, String, String | (String, String)), look
-  // TODO: into writing implicits to handle tuples
-
-  // NOTE: Currently, only handle (String, String, String)
-  history: List[String]
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(HistoryReply.historyReplyWrites).toString
-}
-
-object HistoryReply extends TypeString {
-  implicit val historyReplyReads = Json.reads[HistoryReply]
-  implicit val historyReplyWrites = Json.writes[HistoryReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "history_reply"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequest.scala
deleted file mode 100644
index 4a0a21a..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/HistoryRequest.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-case class HistoryRequest(
-  output: Boolean,
-  ras: Boolean,
-  hist_access_type: String,
-  session: Int,
-  start: Int,
-  stop: Int,
-  n: Int,
-  pattern: String,
-  unique: Boolean
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(HistoryRequest.historyRequestWrites).toString
-}
-
-object HistoryRequest extends TypeString {
-  implicit val historyRequestReads = Json.reads[HistoryRequest]
-  implicit val historyRequestWrites = Json.writes[HistoryRequest]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "history_request"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputReply.scala
deleted file mode 100644
index bf6313e..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputReply.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class InputReply(
-  value: String
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(InputReply.inputReplyWrites).toString()
-}
-
-object InputReply extends TypeString {
-  implicit val inputReplyReads = Json.reads[InputReply]
-  implicit val inputReplyWrites = Json.writes[InputReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "input_reply"
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequest.scala
deleted file mode 100644
index 0190f17..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InputRequest.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class InputRequest(
-  prompt: String,
-  password: Boolean
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(InputRequest.inputRequestWrites).toString()
-}
-
-object InputRequest extends TypeString {
-  implicit val inputRequestReads = Json.reads[InputRequest]
-  implicit val inputRequestWrites = Json.writes[InputRequest]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "input_request"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReply.scala
deleted file mode 100644
index 506a869..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectReply.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-// External libraries
-import play.api.libs.json._
-
-// Internal libraries
-import com.ibm.spark.kernel.protocol.v5._
-
-case class InspectReply(
-  status: String,
-  data: Data,
-  metadata: Metadata,
-  ename: Option[String],
-  evalue: Option[String],
-  traceback: Option[List[String]]
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(InspectReply.inspectReplyOkWrites).toString
-}
-
-object InspectReply extends TypeString {
-  implicit val inspectReplyOkReads = Json.reads[InspectReply]
-  implicit val inspectReplyOkWrites = Json.writes[InspectReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "inspect_reply"
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequest.scala
deleted file mode 100644
index c47ed11..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/InspectRequest.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class InspectRequest(
-  code: String,
-  cursor_pos: Int,
-  detail_level: Int // TODO: This is currently either 0 or 1... should we
-                    // TODO: look into enforcing that in our schema?
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(InspectRequest.inspectRequestWrites).toString
-}
-
-object InspectRequest extends TypeString {
-  implicit val inspectRequestReads = Json.reads[InspectRequest]
-  implicit val inspectRequestWrites = Json.writes[InspectRequest]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "inspect_request"
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReply.scala
deleted file mode 100644
index cf45bb7..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoReply.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-case class KernelInfoReply (
-  protocol_version: String,
-  implementation: String,
-  implementation_version: String,
-  language_info: Map[String, String],
-  language_version: String,
-  banner: String
-) extends KernelMessageContent {
-  override def content: String =
-    Json.toJson(this)(KernelInfoReply.kernelInfoReplyWrites).toString
-}
-
-object KernelInfoReply extends TypeString {
-  implicit val kernelInfoReplyReads = Json.reads[KernelInfoReply]
-  implicit val kernelInfoReplyWrites = Json.writes[KernelInfoReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "kernel_info_reply"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequest.scala
deleted file mode 100644
index 0d18dd5..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelInfoRequest.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class KernelInfoRequest() extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(KernelInfoRequest.kernelInfoRequestWrites).toString
-}
-
-object KernelInfoRequest extends TypeString {
-  private val SingleInstance = KernelInfoRequest()
-  private val EmptyJsonObj = Json.obj()
-
-  implicit val kernelInfoRequestReads = new Reads[KernelInfoRequest] {
-    override def reads(json: JsValue): JsResult[KernelInfoRequest] = {
-      new JsSuccess[KernelInfoRequest](SingleInstance)
-    }
-  }
-
-  implicit val kernelInfoRequestWrites = new Writes[KernelInfoRequest] {
-    override def writes(req: KernelInfoRequest): JsValue = EmptyJsonObj
-  }
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "kernel_info_request"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatus.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatus.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatus.scala
deleted file mode 100644
index 2a28451..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/KernelStatus.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class KernelStatus (
-  execution_state: String
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(KernelStatus.kernelStatusWrites).toString
-}
-
-object KernelStatus extends TypeString {
-  implicit val kernelStatusReads = Json.reads[KernelStatus]
-  implicit val kernelStatusWrites = Json.writes[KernelStatus]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "status"
-}
-
-object KernelStatusBusy extends KernelStatus("busy") {
-  override def toString(): String = {
-    Json.toJson(this).toString
-  }
-}
-object KernelStatusIdle extends KernelStatus("idle") {
-  override def toString(): String = {
-    Json.toJson(this).toString
-  }
-}
\ No newline at end of file



[08/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
new file mode 100644
index 0000000..4ba6888
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContent.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+import scala.language.implicitConversions
+
+case class ErrorContent(
+  ename: String,
+  evalue: String,
+  traceback: List[String]
+) extends KernelMessageContent{
+  override def content : String =
+    Json.toJson(this)(ErrorContent.errorContentWrites).toString
+}
+
+object ErrorContent extends TypeString {
+  implicit val errorContentReads = Json.reads[ErrorContent]
+  implicit val errorContentWrites = Json.writes[ErrorContent]
+
+  implicit def ErrorContentToString(errorContent: ErrorContent): String ={
+    Json.toJson(errorContent).toString
+  }
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "error"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
new file mode 100644
index 0000000..a1ec262
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInput.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class ExecuteInput(
+  code: String,
+  execution_count: Int
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ExecuteInput.executeInputWrites).toString
+}
+
+object ExecuteInput extends TypeString {
+  implicit val executeInputReads = Json.reads[ExecuteInput]
+  implicit val executeInputWrites = Json.writes[ExecuteInput]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "execute_input"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
new file mode 100644
index 0000000..3462e73
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReply.scala
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+// External libraries
+
+import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, UserExpressions, Payloads}
+import play.api.libs.json._
+
+// Internal libraries
+import scala.language.implicitConversions
+
+case class ExecuteReply(
+  status: String,
+  execution_count: Int,
+  payload: Option[Payloads],
+  user_expressions: Option[UserExpressions],
+  ename: Option[String],
+  evalue: Option[String],
+  traceback: Option[List[String]]
+) extends KernelMessageContent {
+
+  override def content : String =
+    Json.toJson(this)(ExecuteReply.executeReplyWrites).toString
+}
+
+object ExecuteReply extends TypeString {
+  implicit val executeReplyReads = Json.reads[ExecuteReply]
+  implicit val executeReplyWrites = Json.writes[ExecuteReply]
+
+  implicit def ExecuteReplyToString(executeReply: ExecuteReply): String ={
+      Json.toJson(executeReply).toString
+  }
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "execute_reply"
+}
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
new file mode 100644
index 0000000..544e4c9
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequest.scala
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, UserExpressions}
+import play.api.libs.json._
+
+case class ExecuteRequest(
+  code: String,
+  silent: Boolean,
+  store_history: Boolean,
+  user_expressions: UserExpressions,
+  allow_stdin: Boolean
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ExecuteRequest.executeRequestWrites).toString
+}
+
+object ExecuteRequest extends TypeString {
+  implicit val executeRequestReads = Json.reads[ExecuteRequest]
+  implicit val executeRequestWrites = Json.writes[ExecuteRequest]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "execute_request"
+}
+
+/* LEFT FOR REFERENCE IN CREATING CUSTOM READ/WRITE
+object ExecuteRequest {
+  implicit val headerReads: Reads[ExecuteRequest] = (
+    (JsPath \ "code").read[String] and
+    (JsPath \ "silent").read[Boolean] and
+    (JsPath \ "store_history").read[Boolean] and
+    (JsPath \ "user_expressions").read[UserExpressions] and
+    (JsPath \ "allow_stdin").read[Boolean]
+  )(ExecuteRequest.apply _) // Case class provides the apply method
+
+  implicit val headerWrites: Writes[ExecuteRequest] = (
+    (JsPath \ "code").write[String] and
+    (JsPath \ "silent").write[Boolean] and
+    (JsPath \ "store_history").write[Boolean] and
+    (JsPath \ "user_expressions").write[UserExpressions] and
+    (JsPath \ "allow_stdin").write[Boolean]
+  )(unlift(ExecuteRequest.unapply)) // Case class provides the unapply method
+}
+*/
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
new file mode 100644
index 0000000..984b4a4
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResult.scala
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
+import play.api.libs.json.Json
+
+case class ExecuteResult (
+  execution_count: Int,
+  data: Data,
+  metadata: Metadata
+)  extends KernelMessageContent {
+  def hasContent = data != null && data.exists(x => x._2 != null && x._2.nonEmpty)
+  override def content : String =
+    Json.toJson(this)(ExecuteResult.executeResultWrites).toString
+}
+
+object ExecuteResult extends TypeString {
+  implicit val executeResultReads = Json.reads[ExecuteResult]
+  implicit val executeResultWrites = Json.writes[ExecuteResult]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "execute_result"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
new file mode 100644
index 0000000..5f2b987
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReply.scala
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+
+case class HistoryReply(
+  // TODO: This is really (String, String, String | (String, String)), look
+  // TODO: into writing implicits to handle tuples
+
+  // NOTE: Currently, only handle (String, String, String)
+  history: List[String]
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(HistoryReply.historyReplyWrites).toString
+}
+
+object HistoryReply extends TypeString {
+  implicit val historyReplyReads = Json.reads[HistoryReply]
+  implicit val historyReplyWrites = Json.writes[HistoryReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "history_reply"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
new file mode 100644
index 0000000..4a0a21a
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequest.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class HistoryRequest(
+  output: Boolean,
+  ras: Boolean,
+  hist_access_type: String,
+  session: Int,
+  start: Int,
+  stop: Int,
+  n: Int,
+  pattern: String,
+  unique: Boolean
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(HistoryRequest.historyRequestWrites).toString
+}
+
+object HistoryRequest extends TypeString {
+  implicit val historyRequestReads = Json.reads[HistoryRequest]
+  implicit val historyRequestWrites = Json.writes[HistoryRequest]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "history_request"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
new file mode 100644
index 0000000..bf6313e
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputReply.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class InputReply(
+  value: String
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(InputReply.inputReplyWrites).toString()
+}
+
+object InputReply extends TypeString {
+  implicit val inputReplyReads = Json.reads[InputReply]
+  implicit val inputReplyWrites = Json.writes[InputReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "input_reply"
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
new file mode 100644
index 0000000..0190f17
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InputRequest.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class InputRequest(
+  prompt: String,
+  password: Boolean
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(InputRequest.inputRequestWrites).toString()
+}
+
+object InputRequest extends TypeString {
+  implicit val inputRequestReads = Json.reads[InputRequest]
+  implicit val inputRequestWrites = Json.writes[InputRequest]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "input_request"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
new file mode 100644
index 0000000..506a869
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectReply.scala
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+// External libraries
+import play.api.libs.json._
+
+// Internal libraries
+import com.ibm.spark.kernel.protocol.v5._
+
+case class InspectReply(
+  status: String,
+  data: Data,
+  metadata: Metadata,
+  ename: Option[String],
+  evalue: Option[String],
+  traceback: Option[List[String]]
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(InspectReply.inspectReplyOkWrites).toString
+}
+
+object InspectReply extends TypeString {
+  implicit val inspectReplyOkReads = Json.reads[InspectReply]
+  implicit val inspectReplyOkWrites = Json.writes[InspectReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "inspect_reply"
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
new file mode 100644
index 0000000..c47ed11
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequest.scala
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class InspectRequest(
+  code: String,
+  cursor_pos: Int,
+  detail_level: Int // TODO: This is currently either 0 or 1... should we
+                    // TODO: look into enforcing that in our schema?
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(InspectRequest.inspectRequestWrites).toString
+}
+
+object InspectRequest extends TypeString {
+  implicit val inspectRequestReads = Json.reads[InspectRequest]
+  implicit val inspectRequestWrites = Json.writes[InspectRequest]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "inspect_request"
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
new file mode 100644
index 0000000..cf45bb7
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReply.scala
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class KernelInfoReply (
+  protocol_version: String,
+  implementation: String,
+  implementation_version: String,
+  language_info: Map[String, String],
+  language_version: String,
+  banner: String
+) extends KernelMessageContent {
+  override def content: String =
+    Json.toJson(this)(KernelInfoReply.kernelInfoReplyWrites).toString
+}
+
+object KernelInfoReply extends TypeString {
+  implicit val kernelInfoReplyReads = Json.reads[KernelInfoReply]
+  implicit val kernelInfoReplyWrites = Json.writes[KernelInfoReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "kernel_info_reply"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
new file mode 100644
index 0000000..0d18dd5
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequest.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class KernelInfoRequest() extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(KernelInfoRequest.kernelInfoRequestWrites).toString
+}
+
+object KernelInfoRequest extends TypeString {
+  private val SingleInstance = KernelInfoRequest()
+  private val EmptyJsonObj = Json.obj()
+
+  implicit val kernelInfoRequestReads = new Reads[KernelInfoRequest] {
+    override def reads(json: JsValue): JsResult[KernelInfoRequest] = {
+      new JsSuccess[KernelInfoRequest](SingleInstance)
+    }
+  }
+
+  implicit val kernelInfoRequestWrites = new Writes[KernelInfoRequest] {
+    override def writes(req: KernelInfoRequest): JsValue = EmptyJsonObj
+  }
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "kernel_info_request"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
new file mode 100644
index 0000000..2a28451
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatus.scala
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class KernelStatus (
+  execution_state: String
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(KernelStatus.kernelStatusWrites).toString
+}
+
+object KernelStatus extends TypeString {
+  implicit val kernelStatusReads = Json.reads[KernelStatus]
+  implicit val kernelStatusWrites = Json.writes[KernelStatus]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "status"
+}
+
+object KernelStatusBusy extends KernelStatus("busy") {
+  override def toString(): String = {
+    Json.toJson(this).toString
+  }
+}
+object KernelStatusIdle extends KernelStatus("idle") {
+  override def toString(): String = {
+    Json.toJson(this).toString
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
new file mode 100644
index 0000000..6bf986b
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReply.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class ShutdownReply(
+  restart: Boolean
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ShutdownReply.shutdownReplyWrites).toString
+}
+
+object ShutdownReply extends TypeString {
+  implicit val shutdownReplyReads = Json.reads[ShutdownReply]
+  implicit val shutdownReplyWrites = Json.writes[ShutdownReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "shutdown_reply"
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
new file mode 100644
index 0000000..6681169
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequest.scala
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class ShutdownRequest(
+  restart: Boolean
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ShutdownRequest.shutdownRequestWrites).toString
+}
+
+object ShutdownRequest extends TypeString {
+  implicit val shutdownRequestReads = Json.reads[ShutdownRequest]
+  implicit val shutdownRequestWrites = Json.writes[ShutdownRequest]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "shutdown_request"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
new file mode 100644
index 0000000..12d5366
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/StreamContent.scala
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class StreamContent(
+   name: String,
+   text: String
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(StreamContent.streamContentWrites).toString
+}
+
+
+object StreamContent extends TypeString {
+  implicit val streamContentReads = Json.reads[StreamContent]
+  implicit val streamContentWrites = Json.writes[StreamContent]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "stream"
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
new file mode 100644
index 0000000..e163b28
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/TypeString.scala
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.content
+
+/**
+ * Indicates that the implementation contains a method to return the type
+ * string representing the object.
+ */
+trait TypeString {
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  def toTypeString: String
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
new file mode 100644
index 0000000..ad10884
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/package.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+package object content {
+  // Provide an ExecuteReplyOk type and object representing a
+  // partially-completed ExecuteReply
+  //
+  // TODO: Is there a way to wrap the Option arguments in Some(...)?
+  //       E.g. ExecuteReplyOk(3, [], {}) =>
+  //            ExecuteReply("ok", 3, Some([]), Some({}), None, None, None
+  type ExecuteReplyOk = ExecuteReply
+  val ExecuteReplyOk = ExecuteReply(
+    "ok", _: Int, _: Option[Payloads],
+    _: Option[UserExpressions], None, None, None
+  )
+
+  // Provide an ExecuteReplyError type and object representing a
+  // partially-completed ExecuteReply
+  type ExecuteReplyError = ExecuteReply
+  val ExecuteReplyError = ExecuteReply(
+    "error", _: Int, None, None, _: Option[String],
+    _: Option[String], _: Option[List[String]]
+  )
+
+  // Provide an ExecuteReplyAbort type and object representing a
+  // partially-completed ExecuteReply
+  type ExecuteReplyAbort = ExecuteReply
+  val ExecuteReplyAbort = ExecuteReply(
+    "abort", _: Int, None, None, None, None, None
+  )
+
+  // Provide an InspectReplyOk type and object representing a
+  // partially-completed InspectReply
+  type InspectReplyOk = InspectReply
+  val InspectReplyOk = InspectReply(
+    "ok", _: Data, _: Metadata, None, None, None
+  )
+
+  // Provide an InspectReplyOk type and object representing a
+  // partially-completed InspectReply
+  type InspectReplyError = InspectReply
+  val InspectReplyError = InspectReply(
+    "error", _: Data, _: Metadata, _: Option[String],
+    _: Option[String], _: Option[List[String]]
+  )
+
+  // Provide an CompleteReplyOk type and object representing a
+  // partially-completed CompleteReply
+  type CompleteReplyOk = CompleteReply
+  val CompleteReplyOk = CompleteReply(
+    _: List[String], _: Int, _: Int, _: Metadata, "ok", None, None, None
+  )
+
+  // Provide an CompleteReplyError type and object representing a
+  // partially-completed CompleteReply
+  type CompleteReplyError = CompleteReply
+  val CompleteReplyError = CompleteReply(
+    _: List[String], _: Int, _: Int, _: Metadata, "error", _: Option[String],
+    _: Option[String], _: Option[List[String]]
+  )
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
new file mode 100644
index 0000000..7f999dd
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol
+
+import com.ibm.spark.kernel.protocol.v5.MIMEType.MIMEType
+import play.api.libs.json.{JsValue, Json, JsObject}
+
+package object v5 {
+  // Provide a UUID type representing a string (there is no object)
+  type UUID = String
+
+  // Provide a ParentHeader type and object representing a Header
+  type ParentHeader = Header
+  val ParentHeader = Header
+
+  // Provide a Metadata type and object representing a map
+  type Metadata = Map[String, String]
+  val Metadata = Map
+
+  // Provide a Data type and object representing a map
+  type Data = Map[MIMEType, String]
+  val Data = Map
+
+  // Provide a UserExpressions type and object representing a map
+  type UserExpressions = Map[String, String]
+  val UserExpressions = Map
+
+  // Provide a Payloads type and object representing a list of maps
+  type Payloads = List[Map[String, String]]
+  val Payloads = List
+
+  // Provide a MsgData type representing an arbitrary JSON value
+  type MsgData = JsValue
+  val MsgData = new {
+    def apply(xs: (String, Json.JsValueWrapper)*) = Json.obj(xs: _*)
+
+    val Empty = Json.obj()
+  }
+
+  // TODO: Split this into client/server socket types and move them to their
+  //       respective projects
+  object SocketType extends Enumeration {
+    type SocketType = Value
+
+    // Server-specific actors
+    val Shell       = Value("shell")
+    val IOPub       = Value("io_pub")
+    val StdIn       = Value("std_in")
+    val Control     = Value("control")
+    val Heartbeat   = Value("heartbeat")
+
+    // Client-specific actors
+    val ShellClient       = Value("shell_client")
+    val IOPubClient       = Value("io_pub_client")
+    val StdInClient       = Value("std_in_client")
+    val ControlClient     = Value("control_client")
+    val HeartbeatClient   = Value("heartbeat_client")
+  }
+
+  object MessageType extends Enumeration {
+    type MessageType    = Value
+
+    /**
+     * Represents all incoming messages.
+     */
+    val Incoming = new {
+      val CompleteRequest = Value("complete_request")
+      val ConnectRequest  = Value("connect_request")
+      val ExecuteRequest  = Value("execute_request")
+      val HistoryRequest  = Value("history_request")
+      val InspectRequest  = Value("inspect_request")
+      val KernelInfoRequest  = Value("kernel_info_request")
+      val ShutdownRequest = Value("shutdown_request")
+
+      //  Stdin Router/Dealer Messages
+      val InputReply      = Value("input_reply")
+
+      // NOTE: These are not consistent with the type as they would conflict
+      val CommOpen        = Value("incoming_comm_open")
+      val CommMsg         = Value("incoming_comm_msg")
+      val CommClose       = Value("incoming_comm_close")
+    }
+
+    /**
+     * Represents all outgoing messages.
+     */
+    val Outgoing = new {
+      //  Shell Router/Dealer Messages
+      val CompleteReply   = Value("complete_reply")
+      val ConnectReply    = Value("connect_reply")
+      val ExecuteReply    = Value("execute_reply")
+      val HistoryReply    = Value("history_reply")
+      val InspectReply    = Value("inspect_reply")
+      val KernelInfoReply    = Value("kernel_info_reply")
+      val ShutdownReply   = Value("shutdown_reply")
+
+      //  Stdin Router/Dealer Messages
+      val InputRequest    = Value("input_request")
+
+      //  Pub/Sub Messages
+      val ClearOutput     = Value("clear_output")
+      val DisplayData     = Value("display_data")
+      val Error           = Value("error")
+      val ExecuteInput    = Value("execute_input")
+      val ExecuteResult   = Value("execute_result")
+      val Status          = Value("status")
+      val Stream          = Value("stream")
+
+      // NOTE: These are not consistent with the type as they would conflict
+      val CommOpen        = Value("outgoing_comm_open")
+      val CommMsg         = Value("outgoing_comm_msg")
+      val CommClose       = Value("outgoing_comm_close")
+    }
+  }
+
+  object HandlerType extends Enumeration {
+    type HandlerType = Value
+
+    val ExecuteRequestHandler = Value("execute_request_handler")
+  }
+
+  object SystemActorType extends Enumeration {
+    type SystemActorType = Value
+
+    val KernelMessageRelay  = Value("kernel_message_relay")
+    val ExecuteRequestRelay = Value("execute_request_relay")
+    val Interpreter         = Value("interpreter")
+    val MagicManager        = Value("magic_manager")
+    val StatusDispatch      = Value("status_dispatch")
+  }
+
+  object KernelStatusType extends Enumeration {
+    type KernelStatusType = Value
+
+    val Starting  = Value("starting")
+    val Busy      = Value("busy")
+    val Idle      = Value("idle")
+  }
+
+  object MIMEType extends Enumeration {
+    type MIMEType = String
+
+    val PlainText               = """text/plain"""
+    val ImagePng                = """image/png"""
+    val TextHtml                = """text/html"""
+    val ApplicationJson         = """application/json"""
+    val ApplicationJavaScript   = """application/javascript"""
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala b/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
new file mode 100644
index 0000000..517140c
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/utils/LogLike.scala
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.utils
+
+import org.slf4j.LoggerFactory
+
+/**
+ * A trait for mixing in logging. This trait
+ * exposes a {@link org.slf4j.Logger}
+ * through a protected field called logger
+ */
+trait LogLike {
+  val loggerName = this.getClass.getName
+  protected val logger = LoggerFactory.getLogger(loggerName)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/comm/CommCallbacksSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/comm/CommCallbacksSpec.scala b/protocol/src/test/scala/com/ibm/spark/comm/CommCallbacksSpec.scala
deleted file mode 100644
index a84a51d..0000000
--- a/protocol/src/test/scala/com/ibm/spark/comm/CommCallbacksSpec.scala
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-// TODO: Move duplicate code to separate project (kernel and client)
-
-import com.ibm.spark.comm.CommCallbacks._
-import com.ibm.spark.kernel.protocol.v5._
-import org.scalatest.{FunSpec, Matchers}
-
-class CommCallbacksSpec extends FunSpec with Matchers {
-
-  private val testOpenCallback: OpenCallback = (_, _, _, _) => {}
-  private val testMsgCallback: MsgCallback = (_, _, _) => {}
-  private val testCloseCallback: CloseCallback = (_, _, _) => {}
-
-  private val failOpenCallback: OpenCallback =
-    (_, _, _, _) => throw new Throwable()
-  private val failMsgCallback: MsgCallback =
-    (_, _, _) => throw new Throwable()
-  private val failCloseCallback: CloseCallback =
-    (_, _, _) => throw new Throwable()
-
-  describe("CommCallbacks") {
-    describe("#addOpenCallback") {
-      it("should append the provided callback to the internal list") {
-        val commCallbacks = new CommCallbacks()
-          .addOpenCallback(testOpenCallback)
-
-        commCallbacks.openCallbacks should contain (testOpenCallback)
-      }
-    }
-
-    describe("#addMsgCallback") {
-      it("should append the provided callback to the internal list") {
-        val commCallbacks = new CommCallbacks()
-          .addMsgCallback(testMsgCallback)
-
-        commCallbacks.msgCallbacks should contain (testMsgCallback)
-      }
-    }
-
-    describe("#addCloseCallback") {
-      it("should append the provided callback to the internal list") {
-        val commCallbacks = new CommCallbacks()
-          .addCloseCallback(testCloseCallback)
-
-        commCallbacks.closeCallbacks should contain (testCloseCallback)
-      }
-    }
-
-    describe("#removeOpenCallback") {
-      it("should remove the callback from the internal list") {
-        val commCallbacks = new CommCallbacks()
-          .addOpenCallback(testOpenCallback)
-          .removeOpenCallback(testOpenCallback)
-
-        commCallbacks.openCallbacks should not contain (testOpenCallback)
-      }
-    }
-
-    describe("#removeMsgCallback") {
-      it("should remove the callback from the internal list") {
-        val commCallbacks = new CommCallbacks()
-          .addMsgCallback(testMsgCallback)
-          .removeMsgCallback(testMsgCallback)
-
-        commCallbacks.msgCallbacks should not contain (testMsgCallback)
-      }
-    }
-
-    describe("#removeCloseCallback") {
-      it("should remove the callback from the internal list") {
-        val commCallbacks = new CommCallbacks()
-          .addCloseCallback(testCloseCallback)
-          .removeCloseCallback(testCloseCallback)
-
-        commCallbacks.closeCallbacks should not contain (testCloseCallback)
-      }
-    }
-
-    describe("#executeOpenCallbacks") {
-      it("should return an empty sequence of results if no callbacks exist") {
-        new CommCallbacks()
-          .executeOpenCallbacks(null, "", "", MsgData.Empty) shouldBe empty
-      }
-
-      it("should return a sequence of try results if callbacks exist") {
-        val commCallbacks = new CommCallbacks()
-          .addOpenCallback(testOpenCallback)
-
-        val results = commCallbacks.executeOpenCallbacks(null, "", "", MsgData.Empty)
-
-        results.head.isSuccess should be (true)
-      }
-
-      it("should return a sequence with failures if callbacks fail") {
-        val commCallbacks = new CommCallbacks()
-          .addOpenCallback(failOpenCallback)
-
-        val results = commCallbacks.executeOpenCallbacks(null, "", "", MsgData.Empty)
-
-        results.head.isFailure should be (true)
-      }
-    }
-
-    describe("#executeMsgCallbacks") {
-      it("should return an empty sequence of results if no callbacks exist") {
-        new CommCallbacks()
-          .executeMsgCallbacks(null, "", MsgData.Empty) shouldBe empty
-      }
-
-      it("should return a sequence of try results if callbacks exist") {
-        val commCallbacks = new CommCallbacks()
-          .addMsgCallback(testMsgCallback)
-
-        val results = commCallbacks.executeMsgCallbacks(null, "", MsgData.Empty)
-
-        results.head.isSuccess should be (true)
-      }
-
-      it("should return a sequence with failures if callbacks fail") {
-        val commCallbacks = new CommCallbacks()
-          .addMsgCallback(failMsgCallback)
-
-        val results = commCallbacks.executeMsgCallbacks(null, "", MsgData.Empty)
-
-        results.head.isFailure should be (true)
-      }
-    }
-
-    describe("#executeCloseCallbacks") {
-      it("should return an empty sequence of results if no callbacks exist") {
-        new CommCallbacks()
-          .executeCloseCallbacks(null, "", MsgData.Empty) shouldBe empty
-      }
-
-      it("should return a sequence of try results if callbacks exist") {
-        val commCallbacks = new CommCallbacks()
-          .addCloseCallback(testCloseCallback)
-
-        val results = commCallbacks.executeCloseCallbacks(null, "", MsgData.Empty)
-
-        results.head.isSuccess should be (true)
-      }
-
-      it("should return a sequence with failures if callbacks fail") {
-        val commCallbacks = new CommCallbacks()
-          .addCloseCallback(failCloseCallback)
-
-        val results = commCallbacks.executeCloseCallbacks(null, "", MsgData.Empty)
-
-        results.head.isFailure should be (true)
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/comm/CommManagerSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/comm/CommManagerSpec.scala b/protocol/src/test/scala/com/ibm/spark/comm/CommManagerSpec.scala
deleted file mode 100644
index f02333e..0000000
--- a/protocol/src/test/scala/com/ibm/spark/comm/CommManagerSpec.scala
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.comm.CommCallbacks.{CloseCallback, OpenCallback}
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.UUID
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommOpen}
-import org.mockito.invocation.InvocationOnMock
-import org.mockito.stubbing.Answer
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
-import org.mockito.Mockito._
-import org.mockito.Matchers.{eq => mockEq, _}
-
-class CommManagerSpec extends FunSpec with Matchers with BeforeAndAfter
-  with MockitoSugar
-{
-  private val TestTargetName = "some target"
-  private val TestCommId = java.util.UUID.randomUUID().toString
-
-  /** Creates a new Comm Manager, filling in the Comm writer method. */
-  private def newCommManager(
-    commRegistrar: CommRegistrar,
-    commWriter: CommWriter
-  ): CommManager = new CommManager(commRegistrar) {
-    override protected def newCommWriter(commId: UUID): CommWriter = commWriter
-  }
-
-  private var mockCommWriter: CommWriter = _
-  private var mockCommRegistrar: CommRegistrar = _
-  private var commManager: CommManager = _
-
-  before {
-    mockCommWriter = mock[CommWriter]
-    mockCommRegistrar = mock[CommRegistrar]
-    doReturn(mockCommRegistrar).when(mockCommRegistrar)
-      .register(anyString())
-    doReturn(mockCommRegistrar).when(mockCommRegistrar)
-      .addOpenHandler(any(classOf[OpenCallback]))
-    doReturn(mockCommRegistrar).when(mockCommRegistrar)
-      .addCloseHandler(any(classOf[CloseCallback]))
-    doReturn(mockCommRegistrar).when(mockCommRegistrar)
-      .withTarget(anyString())
-
-    commManager = newCommManager(mockCommRegistrar, mockCommWriter)
-  }
-
-  describe("CommManager") {
-    describe("#withTarget") {
-      it("should return a registrar using the target name provided") {
-        val commRegistrar = commManager.withTarget(TestTargetName)
-
-        verify(commRegistrar).withTarget(TestTargetName)
-      }
-    }
-
-    describe("#register") {
-      it("should register the target name provided") {
-        commManager.register(TestTargetName)
-
-        verify(mockCommRegistrar).register(TestTargetName)
-      }
-
-      // TODO: Is there a better/cleaner way to assert the contents of the callback?
-      it("should add a link callback to the received open events") {
-        var linkFunc: OpenCallback = null
-
-        // Setup used to extract the function of the callback
-        doAnswer(new Answer[CommRegistrar]() {
-          override def answer(p1: InvocationOnMock): CommRegistrar = {
-            linkFunc = p1.getArguments.head.asInstanceOf[OpenCallback]
-            mockCommRegistrar
-          }
-        }).when(mockCommRegistrar).addOpenHandler(any(classOf[OpenCallback]))
-
-        // Call register and verify that the underlying registrar method called
-        commManager.register(TestTargetName)
-        verify(mockCommRegistrar).addOpenHandler(any(classOf[OpenCallback]))
-
-        // Trigger the callback to test what it does
-        linkFunc(mock[CommWriter], TestCommId, TestTargetName, v5.MsgData.Empty)
-        verify(mockCommRegistrar).link(TestTargetName, TestCommId)
-      }
-
-      // TODO: Is there a better/cleaner way to assert the contents of the callback?
-      it("should add an unlink callback to the received close events") {
-        var unlinkFunc: CloseCallback = null
-
-        // Setup used to extract the function of the callback
-        doAnswer(new Answer[CommRegistrar]() {
-          override def answer(p1: InvocationOnMock): CommRegistrar = {
-            unlinkFunc = p1.getArguments.head.asInstanceOf[CloseCallback]
-            mockCommRegistrar
-          }
-        }).when(mockCommRegistrar).addCloseHandler(any(classOf[CloseCallback]))
-
-        // Call register and verify that the underlying registrar method called
-        commManager.register(TestTargetName)
-        verify(mockCommRegistrar).addCloseHandler(any(classOf[CloseCallback]))
-
-        // Trigger the callback to test what it does
-        unlinkFunc(mock[CommWriter], TestCommId, v5.MsgData.Empty)
-        verify(mockCommRegistrar).unlink(TestCommId)
-      }
-    }
-
-    describe("#unregister") {
-      it("should remove the target from the collection of targets") {
-        val commManager = newCommManager(
-          new CommRegistrar(new CommStorage()),
-          mockCommWriter
-        )
-
-        commManager.register(TestTargetName)
-        commManager.unregister(TestTargetName)
-
-        commManager.isRegistered(TestTargetName) should be (false)
-      }
-    }
-
-    describe("#isRegistered") {
-      it("should return true if the target is currently registered") {
-        val commManager = newCommManager(
-          new CommRegistrar(new CommStorage()),
-          mockCommWriter
-        )
-
-        commManager.register(TestTargetName)
-
-        commManager.isRegistered(TestTargetName) should be (true)
-      }
-
-      it("should return false if the target is not currently registered") {
-        val commManager = newCommManager(
-          new CommRegistrar(new CommStorage()),
-          mockCommWriter
-        )
-
-        commManager.register(TestTargetName)
-        commManager.unregister(TestTargetName)
-
-        commManager.isRegistered(TestTargetName) should be (false)
-      }
-
-      it("should return false if the target has never been registered") {
-        val commManager = newCommManager(
-          new CommRegistrar(new CommStorage()),
-          mockCommWriter
-        )
-
-        commManager.isRegistered(TestTargetName) should be (false)
-      }
-    }
-
-    describe("#open") {
-      it("should return a new CommWriter instance that links during open") {
-        val commWriter = commManager.open(TestTargetName, v5.MsgData.Empty)
-
-        commWriter.writeOpen(TestTargetName)
-
-        // Should have been executed once during commManager.open(...) and
-        // another time with the call above
-        verify(mockCommRegistrar, times(2))
-          .link(mockEq(TestTargetName), any[v5.UUID])
-      }
-
-      it("should return a new CommWriter instance that unlinks during close") {
-        val commWriter = commManager.open(TestTargetName, v5.MsgData.Empty)
-
-        commWriter.writeClose(v5.MsgData.Empty)
-
-        verify(mockCommRegistrar).unlink(any[v5.UUID])
-      }
-
-      it("should initiate a comm_open") {
-        commManager.open(TestTargetName, v5.MsgData.Empty)
-
-        verify(mockCommWriter).writeOpen(TestTargetName, v5.MsgData.Empty)
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/comm/CommRegistrarSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/comm/CommRegistrarSpec.scala b/protocol/src/test/scala/com/ibm/spark/comm/CommRegistrarSpec.scala
deleted file mode 100644
index ad6b7c6..0000000
--- a/protocol/src/test/scala/com/ibm/spark/comm/CommRegistrarSpec.scala
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import java.util.UUID
-
-import com.ibm.spark.comm.CommCallbacks.{CloseCallback, MsgCallback, OpenCallback}
-import org.mockito.Mockito._
-import org.scalatest.mock.MockitoSugar
-import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
-
-class CommRegistrarSpec extends FunSpec with Matchers with MockitoSugar
-  with BeforeAndAfter
-{
-  private val TestTargetName = "some target name"
-  private val TestCommId = UUID.randomUUID().toString
-  private val TestOpenFunc: OpenCallback = (_, _, _, _) => {}
-  private val TestMsgFunc: MsgCallback = (_, _, _) => {}
-  private val TestCloseFunc: CloseCallback = (_, _, _) => {}
-
-  private var commStorage: CommStorage = _
-  private var commRegistrar: CommRegistrar = _
-
-  before {
-    commStorage = new CommStorage()
-    commRegistrar = new CommRegistrar(commStorage)
-  }
-
-  describe("CommRegistrar") {
-    describe("#withTarget") {
-      it("should update the target name to the specified name") {
-        val expected = TestTargetName
-        val actual = commRegistrar.withTarget(expected).defaultTargetName.get
-
-        actual should be (expected)
-      }
-
-      it("should replace the existing target name with the specified name") {
-        val firstName = "some name"
-        val secondName = "some other name"
-
-        val firstRegistrar = commRegistrar.withTarget(firstName)
-        val secondRegisrar = firstRegistrar.withTarget(secondName)
-
-        firstRegistrar.defaultTargetName.get should be (firstName)
-        secondRegisrar.defaultTargetName.get should be (secondName)
-      }
-    }
-
-    describe("#register") {
-      it("should mark the specified target name as registered") {
-        commRegistrar.register(TestTargetName)
-
-        commRegistrar.isRegistered(TestTargetName) should be (true)
-      }
-
-      it("should not replace existing callbacks if the target exists") {
-        // Set up the initial collection of callbacks
-        val originalRegistrar = commRegistrar.register(TestTargetName)
-          .addOpenHandler(TestOpenFunc)
-          .addMsgHandler(TestMsgFunc)
-          .addCloseHandler(TestCloseFunc)
-
-        // Attempt to re-register
-        commRegistrar.register(TestTargetName)
-
-        // The original callbacks should still be in the registrar
-        originalRegistrar.getOpenHandlers should contain (TestOpenFunc)
-        originalRegistrar.getMsgHandlers should contain (TestMsgFunc)
-        originalRegistrar.getCloseHandlers should contain (TestCloseFunc)
-      }
-
-      it("should return a new wrapper with the default target name set") {
-        val expected = TestTargetName
-
-        val actual = commRegistrar.register(expected).defaultTargetName.get
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#unregister") {
-      it("should remove all of the associated target callbacks") {
-        commRegistrar.register(TestTargetName)
-
-        commRegistrar.isRegistered(TestTargetName) should be (true)
-
-        commRegistrar.unregister(TestTargetName)
-
-        commRegistrar.isRegistered(TestTargetName) should be (false)
-      }
-
-      it("should return the removed associated target callbacks") {
-        // Register and add one of each handler
-        commRegistrar.register(TestTargetName)
-          .addOpenHandler(TestOpenFunc)
-          .addMsgHandler(TestMsgFunc)
-          .addCloseHandler(TestCloseFunc)
-
-        val commCallbacks = commRegistrar.unregister(TestTargetName).get
-
-        commCallbacks.openCallbacks should contain (TestOpenFunc)
-        commCallbacks.msgCallbacks should contain (TestMsgFunc)
-        commCallbacks.closeCallbacks should contain (TestCloseFunc)
-      }
-
-      it("should return None if there is no matching target registered") {
-        commRegistrar.unregister(TestTargetName) should be (None)
-      }
-    }
-
-    describe("#isRegistered") {
-      it("should return true if the target is currently registered") {
-        commRegistrar.register(TestTargetName)
-
-        commRegistrar.isRegistered(TestTargetName) should be (true)
-      }
-
-      it("should return false if the target is not currently registered") {
-        commRegistrar.register(TestTargetName)
-        commRegistrar.unregister(TestTargetName)
-
-        commRegistrar.isRegistered(TestTargetName) should be (false)
-      }
-
-      it("should return false if the target has never been registered") {
-        commRegistrar.isRegistered(TestTargetName) should be (false)
-      }
-    }
-
-    describe("#link") {
-      it("should add the specified Comm id to the list for the target") {
-        commRegistrar.link(TestTargetName, TestCommId)
-
-        commRegistrar.getLinks(TestTargetName) should contain (TestCommId)
-      }
-
-      it("should throw an exception if no target is provided with no default") {
-        intercept[AssertionError] {
-          commRegistrar.link(TestCommId)
-        }
-      }
-
-      it("should use the default target if it exists and no other is given") {
-        commRegistrar.register(TestTargetName).link(TestCommId)
-
-        commRegistrar.getLinks(TestTargetName) should contain (TestCommId)
-      }
-    }
-
-    describe("#getTargetFromLink") {
-      it("should return Some target name if found") {
-        val expected = TestTargetName
-
-        commRegistrar.register(expected).link(TestCommId)
-
-        val actual = commRegistrar.getTargetFromLink(TestCommId).get
-
-        actual should be (expected)
-      }
-
-      it("should return None if not found") {
-        commRegistrar.getTargetFromLink(TestCommId) should be (None)
-      }
-    }
-
-    describe("#getLinks") {
-      it("should return a collection of links for the target") {
-        commRegistrar.register(TestTargetName).link(TestCommId)
-
-        commRegistrar.getLinks(TestTargetName) should contain (TestCommId)
-      }
-
-      it("should return an empty collection if the target does not exist") {
-        commRegistrar.getLinks(TestTargetName) should be (empty)
-      }
-
-      it("should use the default target name if no name is specified") {
-        val updatedCommRegistrar =
-          commRegistrar.register(TestTargetName).link(TestCommId)
-
-        updatedCommRegistrar.getLinks should contain (TestCommId)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.getLinks
-        }
-      }
-    }
-
-    describe("#unlink") {
-      it("should remove the Comm id from the underlying target") {
-        val mockCommStorage = mock[CommStorage]
-        val commRegistrar = new CommRegistrar(mockCommStorage)
-
-        commRegistrar.unlink(TestCommId)
-
-        verify(mockCommStorage).removeCommIdFromTarget(TestCommId)
-      }
-    }
-
-    describe("#addOpenHandler") {
-      it("should add the handler if given a specific target name") {
-        commRegistrar.addOpenHandler(TestTargetName, TestOpenFunc)
-
-        commRegistrar.getOpenHandlers(TestTargetName) should
-          contain (TestOpenFunc)
-      }
-
-      it("should create a new set of CommCallbacks if the target is missing") {
-        commRegistrar.addOpenHandler(TestTargetName, TestOpenFunc)
-
-        commRegistrar.getOpenHandlers(TestTargetName) should
-          contain (TestOpenFunc)
-      }
-
-      it("should add the handler if not given a target name but has a default") {
-        commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
-
-        commRegistrar.getOpenHandlers(TestTargetName) should
-          contain (TestOpenFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.addOpenHandler(TestOpenFunc)
-        }
-      }
-    }
-
-    describe("#getOpenHandlers") {
-      it("should return a collection of open handlers for the target") {
-        commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
-
-        commRegistrar.getOpenHandlers(TestTargetName) should
-          contain (TestOpenFunc)
-      }
-
-      it("should return an empty collection if the target does not exist") {
-        commRegistrar.getOpenHandlers(TestTargetName) should be (empty)
-      }
-
-      it("should use the default target name if no name is specified") {
-        val updatedCommRegistrar =
-          commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
-
-        updatedCommRegistrar.getOpenHandlers should contain (TestOpenFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.getOpenHandlers
-        }
-      }
-    }
-
-    describe("#removeOpenHandler") {
-      it("should remove the handler if given a specific target name") {
-        val updatedRegistrar =
-          commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
-        commRegistrar.removeOpenHandler(TestTargetName, TestOpenFunc)
-
-        commRegistrar.getOpenHandlers(TestTargetName) should
-          not contain (TestOpenFunc)
-      }
-
-      it("should remove the handler if not given a target name but has a default") {
-        val updatedRegistrar =
-          commRegistrar.register(TestTargetName).addOpenHandler(TestOpenFunc)
-        updatedRegistrar.removeOpenHandler(TestOpenFunc)
-
-        commRegistrar.getOpenHandlers(TestTargetName) should
-          not contain (TestOpenFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.removeOpenHandler(TestOpenFunc)
-        }
-      }
-    }
-
-    describe("#addMsgHandler") {
-      it("should add the handler if given a specific target name") {
-        commRegistrar.addMsgHandler(TestTargetName, TestMsgFunc)
-
-        commRegistrar.getMsgHandlers(TestTargetName) should
-          contain (TestMsgFunc)
-      }
-
-      it("should create a new set of CommCallbacks if the target is missing") {
-        commRegistrar.addMsgHandler(TestTargetName, TestMsgFunc)
-
-        commRegistrar.getMsgHandlers(TestTargetName) should
-          contain (TestMsgFunc)
-      }
-
-      it("should add the handler if not given a target name but has a default") {
-        commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
-
-        commRegistrar.getMsgHandlers(TestTargetName) should
-          contain (TestMsgFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.addMsgHandler(TestMsgFunc)
-        }
-      }
-    }
-    
-    describe("#getMsgHandlers") {
-      it("should return a collection of msg handlers for the target") {
-        commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
-
-        commRegistrar.getMsgHandlers(TestTargetName) should
-          contain (TestMsgFunc)
-      }
-
-      it("should return an empty collection if the target does not exist") {
-        commRegistrar.getMsgHandlers(TestTargetName) should be (empty)
-      }
-
-      it("should use the default target name if no name is specified") {
-        val updatedCommRegistrar =
-          commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
-
-        updatedCommRegistrar.getMsgHandlers should contain (TestMsgFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.getMsgHandlers
-        }
-      }
-    }
-
-    describe("#removeMsgHandler") {
-      it("should remove the handler if given a specific target name") {
-        val updatedRegistrar =
-          commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
-        commRegistrar.removeMsgHandler(TestTargetName, TestMsgFunc)
-
-        commRegistrar.getMsgHandlers(TestTargetName) should
-          not contain (TestMsgFunc)
-      }
-
-      it("should remove the handler if not given a target name but has a default") {
-        val updatedRegistrar =
-          commRegistrar.register(TestTargetName).addMsgHandler(TestMsgFunc)
-        updatedRegistrar.removeMsgHandler(TestMsgFunc)
-
-        commRegistrar.getMsgHandlers(TestTargetName) should
-          not contain (TestMsgFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.removeMsgHandler(TestMsgFunc)
-        }
-      }
-    }
-
-    describe("#addCloseHandler") {
-      it("should add the handler if given a specific target name") {
-        commRegistrar.addCloseHandler(TestTargetName, TestCloseFunc)
-
-        commRegistrar.getCloseHandlers(TestTargetName) should
-          contain (TestCloseFunc)
-      }
-
-      it("should create a new set of CommCallbacks if the target is missing") {
-        commRegistrar.addCloseHandler(TestTargetName, TestCloseFunc)
-
-        commRegistrar.getCloseHandlers(TestTargetName) should
-          contain (TestCloseFunc)
-      }
-
-      it("should add the handler if not given a target name but has a default") {
-        commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
-
-        commRegistrar.getCloseHandlers(TestTargetName) should
-          contain (TestCloseFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.addCloseHandler(TestCloseFunc)
-        }
-      }
-    }
-
-    describe("#getCloseHandlers") {
-      it("should return a collection of Close handlers for the target") {
-        commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
-
-        commRegistrar.getCloseHandlers(TestTargetName) should
-          contain (TestCloseFunc)
-      }
-
-      it("should return an empty collection if the target does not exist") {
-        commRegistrar.getCloseHandlers(TestTargetName) should be (empty)
-      }
-
-      it("should use the default target name if no name is specified") {
-        val updatedCommRegistrar =
-          commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
-
-        updatedCommRegistrar.getCloseHandlers should contain (TestCloseFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.getCloseHandlers
-        }
-      }
-    }
-    
-    describe("#removeCloseHandler") {
-      it("should remove the handler if given a specific target name") {
-        val updatedRegistrar =
-          commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
-        commRegistrar.removeCloseHandler(TestTargetName, TestCloseFunc)
-
-        commRegistrar.getCloseHandlers(TestTargetName) should
-          not contain (TestCloseFunc)
-      }
-
-      it("should remove the handler if not given a target name but has a default") {
-        val updatedRegistrar =
-          commRegistrar.register(TestTargetName).addCloseHandler(TestCloseFunc)
-        updatedRegistrar.removeCloseHandler(TestCloseFunc)
-
-        commRegistrar.getCloseHandlers(TestTargetName) should
-          not contain (TestCloseFunc)
-      }
-
-      it("should fail if not given a target name and has no default") {
-        intercept[AssertionError] {
-          commRegistrar.removeCloseHandler(TestCloseFunc)
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/com/ibm/spark/comm/CommStorageSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/com/ibm/spark/comm/CommStorageSpec.scala b/protocol/src/test/scala/com/ibm/spark/comm/CommStorageSpec.scala
deleted file mode 100644
index f92b852..0000000
--- a/protocol/src/test/scala/com/ibm/spark/comm/CommStorageSpec.scala
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.comm
-
-import com.ibm.spark.kernel.protocol.v5
-import com.ibm.spark.kernel.protocol.v5.UUID
-import org.scalatest.mock.MockitoSugar
-import org.mockito.Mockito._
-import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
-
-import scala.collection.{immutable, mutable}
-
-class CommStorageSpec extends FunSpec with Matchers with BeforeAndAfter
-  with MockitoSugar
-{
-  private val TestTargetName = "some target"
-  private val TestCommId = java.util.UUID.randomUUID().toString
-
-  private var mockLinks: immutable.IndexedSeq[v5.UUID] = _
-  private var mockCommCallbacks: CommCallbacks = _
-  private var callbackStorage: mutable.Map[String, CommCallbacks] = _
-  private var linkStorage: mutable.Map[String, immutable.IndexedSeq[UUID]] = _
-  private var commStorage: CommStorage = _
-
-  before {
-    mockLinks = mock[immutable.IndexedSeq[v5.UUID]]
-    mockCommCallbacks = mock[CommCallbacks]
-    callbackStorage = new mutable.HashMap[String, CommCallbacks]()
-    linkStorage = new mutable.HashMap[String, immutable.IndexedSeq[UUID]]()
-    commStorage = new CommStorage(callbackStorage, linkStorage)
-  }
-
-  describe("CommStorage") {
-    describe("#setTargetCallbacks") {
-      it("should set the internal callback storage using the target") {
-        commStorage.setTargetCallbacks(TestTargetName, mockCommCallbacks)
-
-        callbackStorage(TestTargetName) should be (mockCommCallbacks)
-      }
-
-      it("should overwrite any existing callbacks for the target") {
-        val otherCommCallbacks = mock[CommCallbacks]
-
-        commStorage.setTargetCallbacks(TestTargetName, otherCommCallbacks)
-        callbackStorage(TestTargetName) should be (otherCommCallbacks)
-
-        commStorage.setTargetCallbacks(TestTargetName, mockCommCallbacks)
-        callbackStorage(TestTargetName) should be (mockCommCallbacks)
-      }
-    }
-
-    describe("#removeTargetCallbacks") {
-      it("should remove the internal callback with the target") {
-        commStorage.setTargetCallbacks(TestTargetName, mock[CommCallbacks])
-        commStorage.hasTargetCallbacks(TestTargetName) should be (true)
-
-        commStorage.removeTargetCallbacks(TestTargetName)
-        commStorage.hasTargetCallbacks(TestTargetName) should be (false)
-      }
-
-      it("should return Some containing the removed callbacks") {
-        val expected = mock[CommCallbacks]
-        commStorage.setTargetCallbacks(TestTargetName, expected)
-
-        val actual = commStorage.removeTargetCallbacks(TestTargetName)
-
-        actual should be (Some(expected))
-      }
-
-      it("should return None if no callbacks removed") {
-        val expected = None
-
-        val actual = commStorage.removeTargetCallbacks(TestTargetName)
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#getTargetCallbacks") {
-      it("should return Some containing callbacks associated with the target") {
-        val expected = mock[CommCallbacks]
-
-        commStorage.setTargetCallbacks(TestTargetName, expected)
-
-        val actual = commStorage.getTargetCallbacks(TestTargetName)
-
-        actual should be (Some(expected))
-      }
-
-      it("should return None if no callbacks associated with the target") {
-        val expected = None
-
-        val actual = commStorage.getTargetCallbacks(TestTargetName)
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#hasTargetCallbacks") {
-      it("should return true if the target callbacks exist") {
-        commStorage.setTargetCallbacks(TestTargetName, mock[CommCallbacks])
-
-        commStorage.hasTargetCallbacks(TestTargetName) should be (true)
-      }
-
-      it("should return false if the target callbacks do not exist") {
-        commStorage.hasTargetCallbacks(TestTargetName) should be (false)
-      }
-    }
-
-    describe("#setTargetCommIds") {
-      it("should set the internal link storage for Comm ids for the target") {
-        commStorage.setTargetCommIds(TestTargetName, mockLinks)
-
-        linkStorage(TestTargetName) should be (mockLinks)
-      }
-
-      it("should overwrite any existing internal link storage for the target") {
-        val otherLinks = mock[immutable.IndexedSeq[v5.UUID]]
-
-        commStorage.setTargetCommIds(TestTargetName, otherLinks)
-        linkStorage(TestTargetName) should be (otherLinks)
-
-        commStorage.setTargetCommIds(TestTargetName, mockLinks)
-        linkStorage(TestTargetName) should be (mockLinks)
-      }
-    }
-
-    describe("#removeTargetCommIds") {
-      it("should remove the internal links to the target") {
-        commStorage.setTargetCommIds(TestTargetName, mockLinks)
-        commStorage.hasTargetCommIds(TestTargetName) should be (true)
-
-        commStorage.removeTargetCommIds(TestTargetName)
-        commStorage.hasTargetCommIds(TestTargetName) should be (false)
-      }
-
-      it("should return Some containing the removed links") {
-        val expected = mock[immutable.IndexedSeq[v5.UUID]]
-        commStorage.setTargetCommIds(TestTargetName, expected)
-
-        val actual = commStorage.removeTargetCommIds(TestTargetName)
-
-        actual should be (Some(expected))
-      }
-
-      it("should return None if no links were removed") {
-        val expected = None
-
-        val actual = commStorage.removeTargetCommIds(TestTargetName)
-
-        actual should be (expected)
-      }
-    }
-
-    describe("#removeCommIdFromTarget") {
-      it("should remove the Comm id from the list linked to a target") {
-        val commIds = ("1" :: TestCommId :: "2" :: Nil).toIndexedSeq
-
-        val expected = ("1" :: "2" :: Nil).toIndexedSeq
-        commStorage.setTargetCommIds(TestTargetName, commIds)
-
-        commStorage.removeCommIdFromTarget(TestCommId)
-
-        commStorage.getCommIdsFromTarget(TestTargetName) should be (Some(expected))
-      }
-
-      it("should return the Some containing target linked to removed Comm id") {
-        val commIds = ("1" :: TestCommId :: "2" :: Nil).toIndexedSeq
-
-        commStorage.setTargetCommIds(TestTargetName, commIds)
-
-        commStorage.removeCommIdFromTarget(TestCommId) should be (Some(TestTargetName))
-      }
-
-      it("should return None if no Comm id was found") {
-        commStorage.removeCommIdFromTarget(TestCommId) should be (None)
-      }
-    }
-
-    describe("#getCommIdsFromTarget") {
-      it("should return Some containing the sequence of Comm ids if found") {
-        commStorage.setTargetCommIds(TestTargetName, mockLinks)
-        commStorage.getCommIdsFromTarget(TestTargetName) should be (Some(mockLinks))
-      }
-
-      it("should return None if no Comm ids are found for the target") {
-        commStorage.getCommIdsFromTarget(TestTargetName) should be (None)
-      }
-    }
-
-    describe("#getCommIdCallbacks") {
-      it("should return Some callbacks if the Comm id is linked") {
-        val expected = mockCommCallbacks
-
-        val spyCommStorage = spy(commStorage)
-        doReturn(Some(TestTargetName)).when(spyCommStorage)
-          .getTargetFromCommId(TestCommId)
-        doReturn(Some(expected)).when(spyCommStorage)
-          .getTargetCallbacks(TestTargetName)
-
-        spyCommStorage.getCommIdCallbacks(TestCommId) should be (Some(expected))
-      }
-
-      it("should return None if the Comm id is not linked") {
-        commStorage.getCommIdCallbacks(TestCommId) should be (None)
-      }
-    }
-
-    describe("#getTargetFromCommId") {
-      it("should return Some containing the target name if found") {
-        val commIds = (TestCommId :: Nil).toIndexedSeq
-
-        commStorage.setTargetCommIds(TestTargetName, commIds)
-        commStorage.getTargetFromCommId(TestCommId) should be (Some(TestTargetName))
-      }
-
-      it("should return None if no target name is found for the Comm id") {
-        commStorage.getTargetFromCommId(TestCommId) should be (None)
-      }
-    }
-
-    describe("#hasTargetCommIds") {
-      it("should return true if the target has Comm ids associated with it") {
-        commStorage.setTargetCommIds(TestTargetName, mockLinks)
-        commStorage.hasTargetCommIds(TestTargetName) should be (true)
-      }
-
-      it("should return false if the target has no Comm ids associated with it") {
-        commStorage.hasTargetCommIds(TestTargetName) should be (false)
-      }
-    }
-  }
-}



[35/51] [abbrv] incubator-toree git commit: Renamed com.ibm.spark to org.apache.toree

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala b/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
index c95eb69..6eaf1c2 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/JeroMQSocket.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.zeromq.ZMsg
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
index 43f3f3d..80599dc 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/PubSocketRunnable.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.zeromq.ZMQ.{Socket, Context}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
index 0aa527f..8205068 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/ReqSocketRunnable.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.zeromq.ZMQ.{Socket, Context}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
index 9bf752d..2c1233d 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketLike.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 /**
  * Represents a generic interface for socket communication.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
index 7685239..edfc1fd 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketOption.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.zeromq.ZMQ
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
index 6c033cc..ea2db3d 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketRunnable.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import java.util.concurrent.ConcurrentLinkedQueue
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala b/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
index 7062d85..fdb0b6d 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/SocketType.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.zeromq.ZMQ
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
index 6fee716..cb7a7ac 100644
--- a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala
@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.utils.LogLike
 import org.zeromq.{ZMsg, ZMQ}
 import org.zeromq.ZMQ.Context
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
index 8f41861..1e38573 100644
--- a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
+++ b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.utils
+package org.apache.toree.communication.utils
 
 import akka.actor.{Actor, Stash}
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.utils.LogLike
 
 /**
  * A trait to enforce ordered processing for messages of particular types.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala b/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
index 22cd8ec..9a5cfb8 100644
--- a/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
+++ b/communication/src/test/scala/integration/JeroMQSocketIntegrationSpec.scala
@@ -18,7 +18,7 @@ package integration
 import java.net.ServerSocket
 import java.util.concurrent.ConcurrentLinkedDeque
 
-import com.ibm.spark.communication.SocketManager
+import org.apache.toree.communication.SocketManager
 import org.scalatest.concurrent.Eventually
 import org.scalatest.time.{Milliseconds, Span}
 import org.scalatest.{Matchers, OneInstancePerTest, FunSpec}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala b/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
index 73bffa7..fde73b1 100644
--- a/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
+++ b/communication/src/test/scala/integration/security/SignatureCheckerActorSpecForIntegration.scala
@@ -18,8 +18,8 @@ package integration.security
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.communication.security.{Hmac, SignatureCheckerActor}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.communication.security.{Hmac, SignatureCheckerActor}
 import com.typesafe.config.ConfigFactory
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
 import play.api.libs.json.Json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala b/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
index ac7f8ce..4ee35a3 100644
--- a/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
+++ b/communication/src/test/scala/integration/security/SignatureManagerActorSpecForIntegration.scala
@@ -18,8 +18,8 @@ package integration.security
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit}
-import com.ibm.spark.communication.security.SignatureManagerActor
-import com.ibm.spark.kernel.protocol.v5.{KernelMessage, _}
+import org.apache.toree.communication.security.SignatureManagerActor
+import org.apache.toree.kernel.protocol.v5.{KernelMessage, _}
 import com.typesafe.config.ConfigFactory
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
 import play.api.libs.json.Json

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala b/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
index 49685a8..2496164 100644
--- a/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
+++ b/communication/src/test/scala/integration/security/SignatureProducerActorSpecForIntegration.scala
@@ -18,8 +18,8 @@ package integration.security
 
 import akka.actor.{ActorRef, ActorSystem, Props}
 import akka.testkit.{ImplicitSender, TestKit}
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.communication.security.{Hmac, SignatureProducerActor}
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.communication.security.{Hmac, SignatureProducerActor}
 import com.typesafe.config.ConfigFactory
 import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala b/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
index aee869f..dfd7b6e 100644
--- a/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/security/HmacSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.security
+package org.apache.toree.communication.security
 
 import java.security.NoSuchAlgorithmException
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
index a052fcd..8318e06 100644
--- a/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/JeroMQSocketSpec.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.mockito.invocation.InvocationOnMock
 import org.mockito.stubbing.Answer

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
index 90c509c..785ae96 100644
--- a/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnableSpec.scala
@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package com.ibm.spark.communication.socket
+package org.apache.toree.communication.socket
 
 import org.scalatest.concurrent.Eventually
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
----------------------------------------------------------------------
diff --git a/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala b/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
index b10d4cb..c70e349 100644
--- a/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
+++ b/communication/src/test/scala/org/apache/toree/communication/utils/OrderedSupportSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.communication.utils
+package org.apache.toree.communication.utils
 
 import akka.actor._
 import akka.testkit.{ImplicitSender, TestKit}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/etc/bin/spark-kernel
----------------------------------------------------------------------
diff --git a/etc/bin/spark-kernel b/etc/bin/spark-kernel
index b827265..836201b 100755
--- a/etc/bin/spark-kernel
+++ b/etc/bin/spark-kernel
@@ -32,4 +32,4 @@ export PYTHONHASHSEED=0
 
 exec "$SPARK_HOME"/bin/spark-submit \
   ${SPARK_OPTS} \
-  --class com.ibm.spark.SparkKernel $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"
+  --class org.apache.toree.SparkKernel $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/etc/bin/toree-kernel
----------------------------------------------------------------------
diff --git a/etc/bin/toree-kernel b/etc/bin/toree-kernel
index 6a3f9d1..87b4ca1 100755
--- a/etc/bin/toree-kernel
+++ b/etc/bin/toree-kernel
@@ -32,4 +32,4 @@ export PYTHONHASHSEED=0
 
 exec "$SPARK_HOME"/bin/spark-submit \
   ${SPARK_OPTS} \
-  --class com.ibm.spark.SparkKernel $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"
+  --class org.apache.toree.SparkKernel $PROG_HOME/lib/${KERNEL_ASSEMBLY} "$@"

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
index 2f31cbe..292f514 100644
--- a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.dependencies
+package org.apache.toree.dependencies
 
 import java.io.PrintStream
 import java.net.URL

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
index 2465b0e..797604f 100644
--- a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.dependencies
+package org.apache.toree.dependencies
 
 import java.io.{File, PrintStream}
 import java.net.URL
@@ -87,7 +87,7 @@ class IvyDependencyDownloader(repositoryUrl: String, baseDirectory: String)
     ivyFile.deleteOnExit()
 
     val md = DefaultModuleDescriptor.newDefaultInstance(
-      ModuleRevisionId.newInstance("com.ibm.spark", "spark-kernel", "working")
+      ModuleRevisionId.newInstance("org.apache.toree", "spark-kernel", "working")
     )
 
     // Exclude all sources artifacts i.e. artifactId-version-sources.jar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala b/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
index 973c000..57cdd63 100644
--- a/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/global/StreamState.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.global
+package org.apache.toree.global
 
 import java.io.{InputStream, OutputStream, PrintStream}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
index 8103536..0148057 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/ExecuteFailure.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter
+package org.apache.toree.interpreter
 
 /**
  * Represents a generic failure in execution.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
index 6200b9b..2227fea 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter
+package org.apache.toree.interpreter
 
 import java.net.URL
 
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
index 7ecee65..ea68d66 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/InterpreterTypes.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter
+package org.apache.toree.interpreter
 
 /**
  * Contains all types associated with the interpreter interface.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
index 8bd12d0..947f903 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Results.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter
+package org.apache.toree.interpreter
 
 /**
  * Represents interpreter results, mostly taken from the

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
index 94b9a24..a01249e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerBridge.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
-import com.ibm.spark.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.api.java.JavaSparkContext
 import org.apache.spark.sql.SQLContext
 import org.apache.spark.{SparkConf, SparkContext}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
index e480aa8..399f110 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerCode.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import BrokerTypes._
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
index b059552..7d7b478 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerException.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 /**
  * Represents a generic broker exception.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
index 1482ade..47bccce 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerName.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 /**
  * Represents the interface that associates a name with a broker. Can be

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
index 5072b92..2150981 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import java.io.{OutputStream, InputStream, File, FileOutputStream}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
index 704f974..5569fea 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcessHandler.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import org.apache.commons.exec.{ExecuteException, ExecuteResultHandler}
 import org.slf4j.LoggerFactory

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
index 3fe96bf..e7fb8a3 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerPromise.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
-import com.ibm.spark.interpreter.broker.BrokerTypes.{CodeResults, CodeId}
+import org.apache.toree.interpreter.broker.BrokerTypes.{CodeResults, CodeId}
 
 import scala.concurrent.Promise
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
index 27430af..0efc002 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
-import com.ibm.spark.interpreter.broker.BrokerTypes.{Code, CodeResults}
+import org.apache.toree.interpreter.broker.BrokerTypes.{Code, CodeResults}
 import scala.concurrent.Future
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
index 409d789..cab8dbd 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import java.util.concurrent.ConcurrentHashMap
 
-import com.ibm.spark.interpreter.broker.BrokerTypes._
+import org.apache.toree.interpreter.broker.BrokerTypes._
 import org.slf4j.LoggerFactory
 
 import scala.concurrent.{Future, promise}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
index aa18648..7a51ca6 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTransformer.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
-import com.ibm.spark.interpreter.InterpreterTypes.ExecuteOutput
-import com.ibm.spark.interpreter.Results.Result
-import com.ibm.spark.interpreter.broker.BrokerTypes.CodeResults
-import com.ibm.spark.interpreter.{ExecuteError, ExecuteFailure, Results}
+import org.apache.toree.interpreter.InterpreterTypes.ExecuteOutput
+import org.apache.toree.interpreter.Results.Result
+import org.apache.toree.interpreter.broker.BrokerTypes.CodeResults
+import org.apache.toree.interpreter.{ExecuteError, ExecuteFailure, Results}
 
 import scala.concurrent.Future
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
index 71e4d3d..56ba559 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypes.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 /**
  * Represents all types associated with the broker interface.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
index 2af47e4..be4acd4 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerTypesProvider.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 /**
  * Provides broker types to the class/trait that implements this trait.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
index cda61f3..62a1b7e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/JavaSparkContextProducerLike.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker.producer
+package org.apache.toree.interpreter.broker.producer
 
 import org.apache.spark.SparkContext
 import org.apache.spark.api.java.JavaSparkContext

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
index fd46268..7835062 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/producer/SQLContextProducerLike.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.broker.producer
+package org.apache.toree.interpreter.broker.producer
 
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
index 42c5616..460a557 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperConsole.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.imports.printers
+package org.apache.toree.interpreter.imports.printers
 
 import java.io._
 
-import com.ibm.spark.utils.DynamicReflectionSupport
+import org.apache.toree.utils.DynamicReflectionSupport
 
 /**
  * Represents a wrapper for the scala.Console for Scala 2.10.4 implementation.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
index 4583680..11c798e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/imports/printers/WrapperSystem.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.interpreter.imports.printers
+package org.apache.toree.interpreter.imports.printers
 
 import java.io._
 
-import com.ibm.spark.utils.DynamicReflectionSupport
+import org.apache.toree.utils.DynamicReflectionSupport
 
 /**
  * Represents a wrapper for java.lang.System.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
index 451316d..37e0ddb 100644
--- a/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/package.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark
+package org.apache.toree
 
 // TODO: Deprecate and remove this package object as it is difficult to
 //       remember where this type comes from

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
index 1642e1b..b0c33f7 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/FactoryMethodsLike.scala
@@ -1,4 +1,4 @@
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 import java.io.{InputStream, OutputStream}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
index c9442aa..cda8546 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 import java.io.{PrintStream, InputStream, OutputStream}
 
@@ -92,7 +92,7 @@ trait KernelLike {
   val data: java.util.Map[String, Any]
 
 
-  def interpreter(name: String): Option[com.ibm.spark.interpreter.Interpreter]
+  def interpreter(name: String): Option[org.apache.toree.interpreter.Interpreter]
 
   def config: Config
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
index 00d00c9..eca1a06 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 
 object KernelOptions {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
index 24cef4c..5e22b50 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamInfo.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 /**
  * Represents a "wrapper" for information needed to stream stdout/stderr from

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
index 4e7d9d8..f22d03a 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/StreamMethodsLike.scala
@@ -1,4 +1,4 @@
-package com.ibm.spark.kernel.api
+package org.apache.toree.kernel.api
 
 /**
  * Represents the methods available to stream data from the kernel to the

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
index 3da1f04..0bb5b32 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/CellMagic.scala
@@ -1,4 +1,4 @@
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 /**
  * Cell Magics change the output of a cell in IPython

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
index 349efa6..f770608 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 /**
  * Represents a classloader that can load classes from within.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
index 0a54e85..97a2b7d 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/LineMagic.scala
@@ -1,4 +1,4 @@
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 /**
  * Line Magics perform some function and don't return anything. I.e. you cannot

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala b/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
index 0e41b35..091f91c 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/Magic.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 /**
   * Represents the base structure for a magic that is loaded and executed.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala b/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
index f74c9f6..9ca1ed5 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/MagicExecutor.scala
@@ -1,6 +1,6 @@
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
-import com.ibm.spark.utils.DynamicReflectionSupport
+import org.apache.toree.utils.DynamicReflectionSupport
 
 import scala.language.dynamics
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
index c700c9e..f8e026c 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/MagicLoader.scala
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 import java.net.{URL, URLClassLoader}
 
 import com.google.common.reflect.ClassPath
-import com.ibm.spark.magic.dependencies.DependencyMap
+import org.apache.toree.magic.dependencies.DependencyMap
 
 import scala.reflect.runtime.{universe => runtimeUniverse}
 import scala.collection.JavaConversions._
@@ -29,7 +29,7 @@ class MagicLoader(
   urls: Array[URL] = Array(),
   parentLoader: ClassLoader = null
 ) extends URLClassLoader(urls, parentLoader) {
-  private val magicPackage = "com.ibm.spark.magic.builtin"
+  private val magicPackage = "org.apache.toree.magic.builtin"
 
   /**
    * Checks whether a magic with a given name, implementing a given interface,

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
index f641a50..1f36e2b 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/DependencyMap.scala
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
 import java.io.OutputStream
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.magic.{MagicLoader, Magic}
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.magic.{MagicLoader, Magic}
 import com.typesafe.config.Config
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.SQLContext
 
 import scala.reflect.runtime.universe._
-import com.ibm.spark.dependencies.DependencyDownloader
+import org.apache.toree.dependencies.DependencyDownloader
 
 /**
  * Represents a mapping of dependency types to implementations.

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
index 675c084..1b8adbd 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeConfig.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.magic.{Magic}
+import org.apache.toree.magic.{Magic}
 import com.typesafe.config.Config
 
 trait IncludeConfig {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
index 109fbd1..34d87c6 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeDependencyDownloader.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.dependencies.DependencyDownloader
-import com.ibm.spark.magic.Magic
+import org.apache.toree.dependencies.DependencyDownloader
+import org.apache.toree.magic.Magic
 
 trait IncludeDependencyDownloader {
   this: Magic =>

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
index fb01131..477ea54 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeInterpreter.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.Magic
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.magic.Magic
 
 trait IncludeInterpreter {
   this: Magic =>

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
index fca3cb1..4bace51 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernel.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.kernel.api.KernelLike
-import com.ibm.spark.magic.Magic
+import org.apache.toree.kernel.api.KernelLike
+import org.apache.toree.magic.Magic
 
 trait IncludeKernel {
   this: Magic =>

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
index de19c07..e1d3db6 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeKernelInterpreter.scala
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.Magic
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.magic.Magic
 
 //@deprecated("Use IncludeInterpreter instead!", "2015.05.06")
 trait IncludeKernelInterpreter {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
index 0a78508..641fade 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeMagicLoader.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.magic.{MagicLoader, Magic}
+import org.apache.toree.magic.{MagicLoader, Magic}
 
 
 trait IncludeMagicLoader {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
index a3e679e..a33838a 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeOutputStream.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
 import java.io.OutputStream
 
-import com.ibm.spark.magic.Magic
+import org.apache.toree.magic.Magic
 
 trait IncludeOutputStream {
   this: Magic =>

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
index 5a9b26c..a547b2f 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSQLContext.scala
@@ -1,6 +1,6 @@
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.magic.Magic
+import org.apache.toree.magic.Magic
 import org.apache.spark.sql.SQLContext
 
 trait IncludeSQLContext {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
index df5e245..68b1a16 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/dependencies/IncludeSparkContext.scala
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic.dependencies
+package org.apache.toree.magic.dependencies
 
-import com.ibm.spark.magic.Magic
+import org.apache.toree.magic.Magic
 import org.apache.spark.SparkContext
 
 trait IncludeSparkContext {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/package.scala b/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
index 292d641..cb2e51d 100644
--- a/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/magic/package.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark
+package org.apache.toree
 
 package object magic {
   /**

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
index 2529866..20c1a2e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.security
+package org.apache.toree.security
 
 import java.security.Permission
 import java.util.UUID

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
index a748fe4..c86b7dd 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import joptsimple.{OptionSpec, OptionParser}
 import scala.collection.JavaConverters._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
index 65f7650..e458d2e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ConditionalOutputStream.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.io.OutputStream
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
index 9d36326..00b9b23 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/DownloadSupport.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.net.URL
 import java.nio.channels._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
index 73e02b6..ed6e0e7 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import language.dynamics
 import language.existentials

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala b/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
index 7869aa6..e9f41b2 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/KeyValuePairUtils.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import joptsimple.util.KeyValuePair
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
index 9ee4da1..d4cfd1b 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.lang.reflect.Method
 import java.net.{URL, URLClassLoader}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
index 6ebaf3e..e280a70 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiOutputStream.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.io.OutputStream
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
index a91e2ba..d04ebac 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/ScheduledTaskManager.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import scala.language.existentials
 import java.util.concurrent._

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala b/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
index c3a43fc..b0654df 100644
--- a/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/utils/TaskManager.scala
@@ -1,4 +1,4 @@
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.util.concurrent.atomic.AtomicInteger
 
@@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory
 import scala.concurrent.{promise, Future}
 import java.util.concurrent._
 
-import com.ibm.spark.security.KernelSecurityManager._
+import org.apache.toree.security.KernelSecurityManager._
 import TaskManager._
 
 import scala.util.Try

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
index d74867c..17d3fbf 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerBridgeSpec.scala
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
-import com.ibm.spark.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
-import com.ibm.spark.kernel.api.KernelLike
+import org.apache.toree.interpreter.broker.producer.{SQLContextProducerLike, JavaSparkContextProducerLike}
+import org.apache.toree.kernel.api.KernelLike
 import org.apache.spark.api.java.JavaSparkContext
 import org.apache.spark.sql.SQLContext
 import org.apache.spark.{SparkConf, SparkContext}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
index 35d3235..cef5cd2 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessHandlerSpec.scala
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import org.apache.commons.exec.ExecuteException
 import org.scalatest.mock.MockitoSugar

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
index 83face3..787c7fa 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import java.io.{OutputStream, InputStream, File}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
index 84a1ae7..073ae60 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerStateSpec.scala
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
 import org.scalatest.{OneInstancePerTest, Matchers, FunSpec}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
index 266c753..7c4dbcc 100644
--- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerTransformerSpec.scala
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.ibm.spark.interpreter.broker
+package org.apache.toree.interpreter.broker
 
-import com.ibm.spark.interpreter.{ExecuteError, Results}
+import org.apache.toree.interpreter.{ExecuteError, Results}
 import org.scalatest.concurrent.Eventually
 import org.scalatest.{OneInstancePerTest, Matchers, FunSpec}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala b/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
index c568c6d..1507dcf 100644
--- a/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/magic/InternalClassLoaderSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 import org.scalatest.{Matchers, FunSpec}
 import org.scalatest.mock.MockitoSugar
@@ -29,7 +29,7 @@ class InternalClassLoaderSpec extends FunSpec with Matchers with MockitoSugar {
     describe("#loadClass") {
       it("should invoke super loadClass with loader's package prepended") {
         val expected = classOf[Class[_]]
-        val packageName = "com.ibm.spark.magic"
+        val packageName = "org.apache.toree.magic"
         val className = "SomeClass"
 
         var parentLoadClassCorrectlyInvoked = false
@@ -49,7 +49,7 @@ class InternalClassLoaderSpec extends FunSpec with Matchers with MockitoSugar {
 
       it("should use loader's package instead of provided package first") {
         val expected = classOf[Class[_]]
-        val forcedPackageName = "com.ibm.spark.magic"
+        val forcedPackageName = "org.apache.toree.magic"
         val packageName = "some.other.package"
         val className = "SomeClass"
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala b/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
index 0c2b894..a65b9d9 100644
--- a/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/magic/MagicLoaderSpec.scala
@@ -14,13 +14,13 @@
 * limitations under the License.
 */
 
-package com.ibm.spark.magic
+package org.apache.toree.magic
 
 import java.io.OutputStream
 
-import com.ibm.spark.dependencies.DependencyDownloader
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.magic.dependencies._
+import org.apache.toree.dependencies.DependencyDownloader
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.magic.dependencies._
 import org.apache.spark.SparkContext
 import org.scalatest.mock.MockitoSugar
 import org.scalatest.{FunSpec, Matchers}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
index 144e90f..67c4b35 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ArgumentParsingSupportSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import org.scalatest.{BeforeAndAfter, Matchers, FunSpec}
 import joptsimple.{OptionSet, OptionSpec, OptionParser}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
index d5c4e4c..83e08cf 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ConditionalOutputStreamSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.io.OutputStream
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
index 4b0cc3d..be5eb29 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/DownloadSupportSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.io.FileNotFoundException
 import java.net.URL

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
index fdfe637..fe2eaf0 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/DynamicReflectionSupportSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.io.OutputStream
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
index cba632d..67590c6 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/KeyValuePairUtilsSpec.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import joptsimple.util.KeyValuePair
 import org.scalatest.{Matchers, FunSpec}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
index 185a85d..e23e09e 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/MultiOutputStreamSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.io.OutputStream
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
index 8db4535..f23e188 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/ScheduledTaskManagerSpec.scala
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.util.Calendar
 import java.util.concurrent.atomic.AtomicBoolean

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala b/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
index 3456d98..23b1fa3 100644
--- a/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
+++ b/kernel-api/src/test/scala/org/apache/toree/utils/TaskManagerSpec.scala
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.utils
+package org.apache.toree.utils
 
 import java.util.concurrent.{RejectedExecutionException, ExecutionException}
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/SparkKernel.scala b/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
index f532de9..1a8ac40 100644
--- a/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
+++ b/kernel/src/main/scala/org/apache/toree/SparkKernel.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark
+package org.apache.toree
 
-import com.ibm.spark.boot.layer._
-import com.ibm.spark.boot.{CommandLineOptions, KernelBootstrap}
-import com.ibm.spark.kernel.BuildInfo
+import org.apache.toree.boot.layer._
+import org.apache.toree.boot.{CommandLineOptions, KernelBootstrap}
+import org.apache.toree.kernel.BuildInfo
 
 object SparkKernel extends App {
   private val options = new CommandLineOptions(args)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
index a5acbc2..d85d0b7 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.boot
+package org.apache.toree.boot
 
 import java.io.{File, OutputStream}
 
-import com.ibm.spark.utils.KeyValuePairUtils
+import org.apache.toree.utils.KeyValuePairUtils
 import com.typesafe.config.{Config, ConfigFactory}
 import joptsimple.util.KeyValuePair
 import joptsimple.{OptionParser, OptionSpec}
@@ -175,9 +175,9 @@ class CommandLineOptions(args: Seq[String]) {
   private def interpreterPlugins: Option[java.util.List[String]] = {
     //val defaults = getAll(_default_interpreter_plugin).getOrElse(List())
     //val defaults = List[String](
-    //  "PySpark:com.ibm.spark.kernel.interpreter.pyspark.PySparkInterpreter",
-    //  "SparkR:com.ibm.spark.kernel.interpreter.sparkr.SparkRInterpreter",
-    //  "SQL:com.ibm.spark.kernel.interpreter.sql.SqlInterpreter"
+    //  "PySpark:org.apache.toree.kernel.interpreter.pyspark.PySparkInterpreter",
+    //  "SparkR:org.apache.toree.kernel.interpreter.sparkr.SparkRInterpreter",
+    //  "SQL:org.apache.toree.kernel.interpreter.sql.SqlInterpreter"
     //)
 
     val userDefined = getAll(_interpreter_plugin) match {

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala b/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
index 1e7927c..5e97457 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/KernelBootstrap.scala
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-package com.ibm.spark.boot
+package org.apache.toree.boot
 
 import akka.actor.{ActorRef, ActorSystem}
-import com.ibm.spark.boot.layer._
-import com.ibm.spark.interpreter.Interpreter
-import com.ibm.spark.kernel.api.Kernel
-import com.ibm.spark.kernel.protocol.v5.KernelStatusType._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.kernel.ActorLoader
-import com.ibm.spark.security.KernelSecurityManager
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.boot.layer._
+import org.apache.toree.interpreter.Interpreter
+import org.apache.toree.kernel.api.Kernel
+import org.apache.toree.kernel.protocol.v5.KernelStatusType._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader
+import org.apache.toree.security.KernelSecurityManager
+import org.apache.toree.utils.LogLike
 import com.typesafe.config.Config
 import org.apache.spark.SparkContext
 import org.zeromq.ZMQ

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9612a625/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
----------------------------------------------------------------------
diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
index d2d6ab9..f300659 100644
--- a/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
+++ b/kernel/src/main/scala/org/apache/toree/boot/layer/BareInitialization.scala
@@ -14,18 +14,18 @@
  *  limitations under the License.
  */
 
-package com.ibm.spark.boot.layer
+package org.apache.toree.boot.layer
 
 import akka.actor.{ActorRef, Props, ActorSystem}
-import com.ibm.spark.kernel.protocol.v5.dispatch.StatusDispatch
-import com.ibm.spark.kernel.protocol.v5.handler.{GenericSocketMessageHandler, ShutdownHandler}
-import com.ibm.spark.kernel.protocol.v5.kernel.{SimpleActorLoader, ActorLoader}
-import com.ibm.spark.communication.security.{SecurityActorType, SignatureManagerActor}
-import com.ibm.spark.kernel.protocol.v5.kernel.socket._
-import com.ibm.spark.kernel.protocol.v5._
-import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen}
-import com.ibm.spark.kernel.protocol.v5.relay.KernelMessageRelay
-import com.ibm.spark.utils.LogLike
+import org.apache.toree.kernel.protocol.v5.dispatch.StatusDispatch
+import org.apache.toree.kernel.protocol.v5.handler.{GenericSocketMessageHandler, ShutdownHandler}
+import org.apache.toree.kernel.protocol.v5.kernel.{SimpleActorLoader, ActorLoader}
+import org.apache.toree.communication.security.{SecurityActorType, SignatureManagerActor}
+import org.apache.toree.kernel.protocol.v5.kernel.socket._
+import org.apache.toree.kernel.protocol.v5._
+import org.apache.toree.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen}
+import org.apache.toree.kernel.protocol.v5.relay.KernelMessageRelay
+import org.apache.toree.utils.LogLike
 import com.typesafe.config.Config
 import play.api.libs.json.Json
 


[50/51] [abbrv] incubator-toree git commit: Fixed one leftover reference to spark-kernel

Posted by lb...@apache.org.
Fixed one leftover reference to spark-kernel


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/c7a0db1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/c7a0db1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/c7a0db1e

Branch: refs/heads/TestBranch
Commit: c7a0db1eb62531100e38e0e10427bad259bc4453
Parents: bbece2d
Author: Gino Bustelo <lb...@us.ibm.com>
Authored: Thu Jan 21 15:19:09 2016 -0600
Committer: Gino Bustelo <lb...@us.ibm.com>
Committed: Thu Jan 21 15:19:09 2016 -0600

----------------------------------------------------------------------
 .../org/apache/toree/dependencies/IvyDependencyDownloader.scala    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/c7a0db1e/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
----------------------------------------------------------------------
diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
index f569a60..a3420f8 100644
--- a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala
@@ -88,7 +88,7 @@ class IvyDependencyDownloader(repositoryUrl: String, baseDirectory: String)
     ivyFile.deleteOnExit()
 
     val md = DefaultModuleDescriptor.newDefaultInstance(
-      ModuleRevisionId.newInstance("org.apache.toree", "spark-kernel", "working")
+      ModuleRevisionId.newInstance("org.apache.toree", "kernel", "working")
     )
 
     // Exclude all sources artifacts i.e. artifactId-version-sources.jar


[09/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReply.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReply.scala
deleted file mode 100644
index 6bf986b..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownReply.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-case class ShutdownReply(
-  restart: Boolean
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ShutdownReply.shutdownReplyWrites).toString
-}
-
-object ShutdownReply extends TypeString {
-  implicit val shutdownReplyReads = Json.reads[ShutdownReply]
-  implicit val shutdownReplyWrites = Json.writes[ShutdownReply]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "shutdown_reply"
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequest.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequest.scala
deleted file mode 100644
index 6681169..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/ShutdownRequest.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json.Json
-
-case class ShutdownRequest(
-  restart: Boolean
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(ShutdownRequest.shutdownRequestWrites).toString
-}
-
-object ShutdownRequest extends TypeString {
-  implicit val shutdownRequestReads = Json.reads[ShutdownRequest]
-  implicit val shutdownRequestWrites = Json.writes[ShutdownRequest]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "shutdown_request"
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContent.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContent.scala
deleted file mode 100644
index 12d5366..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/StreamContent.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5.content
-
-import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
-import play.api.libs.json._
-
-case class StreamContent(
-   name: String,
-   text: String
-) extends KernelMessageContent {
-  override def content : String =
-    Json.toJson(this)(StreamContent.streamContentWrites).toString
-}
-
-
-object StreamContent extends TypeString {
-  implicit val streamContentReads = Json.reads[StreamContent]
-  implicit val streamContentWrites = Json.writes[StreamContent]
-
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  override def toTypeString: String = "stream"
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/TypeString.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/TypeString.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/TypeString.scala
deleted file mode 100644
index e163b28..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/TypeString.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.kernel.protocol.v5.content
-
-/**
- * Indicates that the implementation contains a method to return the type
- * string representing the object.
- */
-trait TypeString {
-  /**
-   * Returns the type string associated with this object.
-   *
-   * @return The type as a string
-   */
-  def toTypeString: String
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/package.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/package.scala
deleted file mode 100644
index ad10884..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/content/package.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol.v5
-
-package object content {
-  // Provide an ExecuteReplyOk type and object representing a
-  // partially-completed ExecuteReply
-  //
-  // TODO: Is there a way to wrap the Option arguments in Some(...)?
-  //       E.g. ExecuteReplyOk(3, [], {}) =>
-  //            ExecuteReply("ok", 3, Some([]), Some({}), None, None, None
-  type ExecuteReplyOk = ExecuteReply
-  val ExecuteReplyOk = ExecuteReply(
-    "ok", _: Int, _: Option[Payloads],
-    _: Option[UserExpressions], None, None, None
-  )
-
-  // Provide an ExecuteReplyError type and object representing a
-  // partially-completed ExecuteReply
-  type ExecuteReplyError = ExecuteReply
-  val ExecuteReplyError = ExecuteReply(
-    "error", _: Int, None, None, _: Option[String],
-    _: Option[String], _: Option[List[String]]
-  )
-
-  // Provide an ExecuteReplyAbort type and object representing a
-  // partially-completed ExecuteReply
-  type ExecuteReplyAbort = ExecuteReply
-  val ExecuteReplyAbort = ExecuteReply(
-    "abort", _: Int, None, None, None, None, None
-  )
-
-  // Provide an InspectReplyOk type and object representing a
-  // partially-completed InspectReply
-  type InspectReplyOk = InspectReply
-  val InspectReplyOk = InspectReply(
-    "ok", _: Data, _: Metadata, None, None, None
-  )
-
-  // Provide an InspectReplyOk type and object representing a
-  // partially-completed InspectReply
-  type InspectReplyError = InspectReply
-  val InspectReplyError = InspectReply(
-    "error", _: Data, _: Metadata, _: Option[String],
-    _: Option[String], _: Option[List[String]]
-  )
-
-  // Provide an CompleteReplyOk type and object representing a
-  // partially-completed CompleteReply
-  type CompleteReplyOk = CompleteReply
-  val CompleteReplyOk = CompleteReply(
-    _: List[String], _: Int, _: Int, _: Metadata, "ok", None, None, None
-  )
-
-  // Provide an CompleteReplyError type and object representing a
-  // partially-completed CompleteReply
-  type CompleteReplyError = CompleteReply
-  val CompleteReplyError = CompleteReply(
-    _: List[String], _: Int, _: Int, _: Metadata, "error", _: Option[String],
-    _: Option[String], _: Option[List[String]]
-  )
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/package.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/package.scala b/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/package.scala
deleted file mode 100644
index 7f999dd..0000000
--- a/protocol/src/main/scala/com/ibm/spark/kernel/protocol/v5/package.scala
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.kernel.protocol
-
-import com.ibm.spark.kernel.protocol.v5.MIMEType.MIMEType
-import play.api.libs.json.{JsValue, Json, JsObject}
-
-package object v5 {
-  // Provide a UUID type representing a string (there is no object)
-  type UUID = String
-
-  // Provide a ParentHeader type and object representing a Header
-  type ParentHeader = Header
-  val ParentHeader = Header
-
-  // Provide a Metadata type and object representing a map
-  type Metadata = Map[String, String]
-  val Metadata = Map
-
-  // Provide a Data type and object representing a map
-  type Data = Map[MIMEType, String]
-  val Data = Map
-
-  // Provide a UserExpressions type and object representing a map
-  type UserExpressions = Map[String, String]
-  val UserExpressions = Map
-
-  // Provide a Payloads type and object representing a list of maps
-  type Payloads = List[Map[String, String]]
-  val Payloads = List
-
-  // Provide a MsgData type representing an arbitrary JSON value
-  type MsgData = JsValue
-  val MsgData = new {
-    def apply(xs: (String, Json.JsValueWrapper)*) = Json.obj(xs: _*)
-
-    val Empty = Json.obj()
-  }
-
-  // TODO: Split this into client/server socket types and move them to their
-  //       respective projects
-  object SocketType extends Enumeration {
-    type SocketType = Value
-
-    // Server-specific actors
-    val Shell       = Value("shell")
-    val IOPub       = Value("io_pub")
-    val StdIn       = Value("std_in")
-    val Control     = Value("control")
-    val Heartbeat   = Value("heartbeat")
-
-    // Client-specific actors
-    val ShellClient       = Value("shell_client")
-    val IOPubClient       = Value("io_pub_client")
-    val StdInClient       = Value("std_in_client")
-    val ControlClient     = Value("control_client")
-    val HeartbeatClient   = Value("heartbeat_client")
-  }
-
-  object MessageType extends Enumeration {
-    type MessageType    = Value
-
-    /**
-     * Represents all incoming messages.
-     */
-    val Incoming = new {
-      val CompleteRequest = Value("complete_request")
-      val ConnectRequest  = Value("connect_request")
-      val ExecuteRequest  = Value("execute_request")
-      val HistoryRequest  = Value("history_request")
-      val InspectRequest  = Value("inspect_request")
-      val KernelInfoRequest  = Value("kernel_info_request")
-      val ShutdownRequest = Value("shutdown_request")
-
-      //  Stdin Router/Dealer Messages
-      val InputReply      = Value("input_reply")
-
-      // NOTE: These are not consistent with the type as they would conflict
-      val CommOpen        = Value("incoming_comm_open")
-      val CommMsg         = Value("incoming_comm_msg")
-      val CommClose       = Value("incoming_comm_close")
-    }
-
-    /**
-     * Represents all outgoing messages.
-     */
-    val Outgoing = new {
-      //  Shell Router/Dealer Messages
-      val CompleteReply   = Value("complete_reply")
-      val ConnectReply    = Value("connect_reply")
-      val ExecuteReply    = Value("execute_reply")
-      val HistoryReply    = Value("history_reply")
-      val InspectReply    = Value("inspect_reply")
-      val KernelInfoReply    = Value("kernel_info_reply")
-      val ShutdownReply   = Value("shutdown_reply")
-
-      //  Stdin Router/Dealer Messages
-      val InputRequest    = Value("input_request")
-
-      //  Pub/Sub Messages
-      val ClearOutput     = Value("clear_output")
-      val DisplayData     = Value("display_data")
-      val Error           = Value("error")
-      val ExecuteInput    = Value("execute_input")
-      val ExecuteResult   = Value("execute_result")
-      val Status          = Value("status")
-      val Stream          = Value("stream")
-
-      // NOTE: These are not consistent with the type as they would conflict
-      val CommOpen        = Value("outgoing_comm_open")
-      val CommMsg         = Value("outgoing_comm_msg")
-      val CommClose       = Value("outgoing_comm_close")
-    }
-  }
-
-  object HandlerType extends Enumeration {
-    type HandlerType = Value
-
-    val ExecuteRequestHandler = Value("execute_request_handler")
-  }
-
-  object SystemActorType extends Enumeration {
-    type SystemActorType = Value
-
-    val KernelMessageRelay  = Value("kernel_message_relay")
-    val ExecuteRequestRelay = Value("execute_request_relay")
-    val Interpreter         = Value("interpreter")
-    val MagicManager        = Value("magic_manager")
-    val StatusDispatch      = Value("status_dispatch")
-  }
-
-  object KernelStatusType extends Enumeration {
-    type KernelStatusType = Value
-
-    val Starting  = Value("starting")
-    val Busy      = Value("busy")
-    val Idle      = Value("idle")
-  }
-
-  object MIMEType extends Enumeration {
-    type MIMEType = String
-
-    val PlainText               = """text/plain"""
-    val ImagePng                = """image/png"""
-    val TextHtml                = """text/html"""
-    val ApplicationJson         = """application/json"""
-    val ApplicationJavaScript   = """application/javascript"""
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/com/ibm/spark/utils/LogLike.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/com/ibm/spark/utils/LogLike.scala b/protocol/src/main/scala/com/ibm/spark/utils/LogLike.scala
deleted file mode 100644
index 517140c..0000000
--- a/protocol/src/main/scala/com/ibm/spark/utils/LogLike.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- *  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.ibm.spark.utils
-
-import org.slf4j.LoggerFactory
-
-/**
- * A trait for mixing in logging. This trait
- * exposes a {@link org.slf4j.Logger}
- * through a protected field called logger
- */
-trait LogLike {
-  val loggerName = this.getClass.getName
-  protected val logger = LoggerFactory.getLogger(loggerName)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala b/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
new file mode 100644
index 0000000..d462874
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommCallbacks.scala
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5._
+
+import scala.util.Try
+
+@Experimental
+object CommCallbacks {
+  type OpenCallback = (CommWriter, UUID, String, MsgData) => Unit
+  type MsgCallback = (CommWriter, UUID, MsgData) => Unit
+  type CloseCallback = (CommWriter, UUID, MsgData) => Unit
+}
+
+import com.ibm.spark.comm.CommCallbacks._
+
+/**
+ * Represents available callbacks to be triggered when various Comm events
+ * are triggered.
+ *
+ * @param openCallbacks The sequence of open callbacks
+ * @param msgCallbacks The sequence of msg callbacks
+ * @param closeCallbacks The sequence of close callbacks
+ */
+@Experimental
+class CommCallbacks(
+  val openCallbacks: Seq[CommCallbacks.OpenCallback] = Nil,
+  val msgCallbacks: Seq[CommCallbacks.MsgCallback] = Nil,
+  val closeCallbacks: Seq[CommCallbacks.CloseCallback] = Nil
+) {
+
+  /**
+   * Adds a new open callback to be triggered.
+   *
+   * @param openCallback The open callback to add
+   *
+   * @return The updated CommCallbacks instance
+   */
+  def addOpenCallback(openCallback: OpenCallback): CommCallbacks =
+    new CommCallbacks(
+      openCallbacks :+ openCallback,
+      msgCallbacks,
+      closeCallbacks
+    )
+
+  /**
+   * Adds a new msg callback to be triggered.
+   *
+   * @param msgCallback The msg callback to add
+   *
+   * @return The updated CommCallbacks instance
+   */
+  def addMsgCallback(msgCallback: MsgCallback): CommCallbacks =
+    new CommCallbacks(
+      openCallbacks,
+      msgCallbacks :+ msgCallback,
+      closeCallbacks
+    )
+
+  /**
+   * Adds a new close callback to be triggered.
+   *
+   * @param closeCallback The close callback to add
+   *
+   * @return The updated CommCallbacks instance
+   */
+  def addCloseCallback(closeCallback: CloseCallback): CommCallbacks =
+    new CommCallbacks(
+      openCallbacks,
+      msgCallbacks,
+      closeCallbacks :+ closeCallback
+    )
+
+  /**
+   * Removes the specified open callback from the collection of callbacks.
+   *
+   * @param openCallback The open callback to remove
+   *
+   * @return The updated CommCallbacks instance
+   */
+  def removeOpenCallback(openCallback: OpenCallback): CommCallbacks =
+    new CommCallbacks(
+      openCallbacks.filterNot(_ == openCallback),
+      msgCallbacks,
+      closeCallbacks
+    )
+
+  /**
+   * Removes the specified msg callback from the collection of callbacks.
+   *
+   * @param msgCallback The msg callback to remove
+   *
+   * @return The updated CommCallbacks instance
+   */
+  def removeMsgCallback(msgCallback: MsgCallback): CommCallbacks =
+    new CommCallbacks(
+      openCallbacks,
+      msgCallbacks.filterNot(_ == msgCallback),
+      closeCallbacks
+    )
+
+  /**
+   * Removes the specified close callback from the collection of callbacks.
+   *
+   * @param closeCallback The close callback to remove
+   *
+   * @return The updated CommCallbacks instance
+   */
+  def removeCloseCallback(closeCallback: CloseCallback): CommCallbacks =
+    new CommCallbacks(
+      openCallbacks,
+      msgCallbacks,
+      closeCallbacks.filterNot(_ == closeCallback)
+    )
+
+  /**
+   * Executes all registered open callbacks and returns a sequence of results.
+   *
+   * @param commWriter The Comm Writer that can be used for responses
+   * @param commId The Comm Id to pass to all open callbacks
+   * @param targetName The Comm Target Name to pass to all open callbacks
+   * @param data The data to pass to all open callbacks
+   *
+   * @return The sequence of results from trying to execute callbacks
+   */
+  def executeOpenCallbacks(
+    commWriter: CommWriter, commId: UUID, targetName: String, data: MsgData
+  ) = openCallbacks.map(f => Try(f(commWriter, commId, targetName, data)))
+
+  /**
+   * Executes all registered msg callbacks and returns a sequence of results.
+   *
+   * @param commWriter The Comm Writer that can be used for responses
+   * @param commId The Comm Id to pass to all msg callbacks
+   * @param data The data to pass to all msg callbacks
+   *
+   * @return The sequence of results from trying to execute callbacks
+   */
+  def executeMsgCallbacks(commWriter: CommWriter, commId: UUID, data: MsgData) =
+    msgCallbacks.map(f => Try(f(commWriter, commId, data)))
+
+  /**
+   * Executes all registered close callbacks and returns a sequence of results.
+   *
+   * @param commWriter The Comm Writer that can be used for responses
+   * @param commId The Comm Id to pass to all close callbacks
+   * @param data The data to pass to all close callbacks
+   *
+   * @return The sequence of results from trying to execute callbacks
+   */
+  def executeCloseCallbacks(commWriter: CommWriter, commId: UUID, data: MsgData) =
+    closeCallbacks.map(f => Try(f(commWriter, commId, data)))
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala b/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
new file mode 100644
index 0000000..c15f1a5
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommManager.scala
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import java.util.UUID
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.comm.CommCallbacks.{CloseCallback, OpenCallback}
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content.CommContent
+
+/**
+ * Represents a manager for Comm connections that facilitates and maintains
+ * connections started and received through this service.
+ *
+ * @param commRegistrar The registrar to use for callback registration
+ */
+@Experimental
+abstract class CommManager(private val commRegistrar: CommRegistrar) {
+  /**
+   * The base function to call that performs a link given the target name and
+   * the Comm id for the specific instance.
+   */
+  private val linkFunc: OpenCallback =
+    (_, commId, targetName, _) => commRegistrar.link(targetName, commId)
+
+  /**
+   * The base function to call that performs an unlink given the Comm id for
+   * the specific instance.
+   */
+  private val unlinkFunc: CloseCallback =
+    (_, commId, _) => commRegistrar.unlink(commId)
+
+  // TODO: This is potentially bad design considering appending methods to
+  //       CommWriter will not require this class to be updated!
+  /**
+   * Represents a wrapper for a CommWriter instance that links and unlinks
+   * when invoked.
+   *
+   * @param commWriter The CommWriter instance to wrap
+   */
+  private class WrapperCommWriter(private val commWriter: CommWriter)
+    extends CommWriter(commWriter.commId)
+  {
+    override protected[comm] def sendCommKernelMessage[
+      T <: KernelMessageContent with CommContent
+    ](commContent: T): Unit = commWriter.sendCommKernelMessage(commContent)
+
+    // Overridden to unlink before sending close message
+    override def writeClose(data: MsgData): Unit = {
+      unlinkFunc(this, this.commId, data)
+      commWriter.writeClose(data)
+    }
+
+    // Overridden to unlink before sending close message
+    override def close(): Unit = {
+      unlinkFunc(this, this.commId, null)
+      commWriter.close()
+    }
+
+    // Overriden to link before sending open message
+    override def writeOpen(targetName: String, data: MsgData): Unit = {
+      linkFunc(this, this.commId, targetName, data)
+      commWriter.writeOpen(targetName, data)
+    }
+
+    override def writeMsg(data: MsgData): Unit = commWriter.writeMsg(data)
+    override def write(cbuf: Array[Char], off: Int, len: Int): Unit =
+      commWriter.write(cbuf, off, len)
+    override def flush(): Unit = commWriter.flush()
+  }
+
+  /**
+   * Loads the specified target and provides a registrar pointing to the target.
+   *
+   * @param targetName The name of the target to load
+   *
+   * @return The CommRegistrar pointing to the target
+   */
+  def withTarget(targetName: String):  CommRegistrar = {
+    commRegistrar.withTarget(targetName)
+  }
+
+  /**
+   * Registers a new Comm for use on the kernel. Establishes default callbacks
+   * to link and unlink specific Comm instances for the new target.
+   *
+   * @param targetName The name of the target to register
+   *
+   * @return The new CommRegistrar set to the provided target
+   */
+  def register(targetName: String): CommRegistrar = {
+    commRegistrar.register(targetName)
+      .addOpenHandler(linkFunc)
+      .addCloseHandler(unlinkFunc)
+  }
+
+  /**
+   * Unregisters the specified target used for Comm messages.
+   *
+   * @param targetName The name of the target to unregister
+   *
+   * @return Some collection of callbacks associated with the target if it was
+   *         registered, otherwise None
+   */
+  def unregister(targetName: String): Option[CommCallbacks] = {
+    commRegistrar.unregister(targetName)
+  }
+
+  /**
+   * Indicates whether or not the specified target is currently registered with
+   * this Comm manager.
+   *
+   * @param targetName The name of the target
+   *
+   * @return True if the target is registered, otherwise false
+   */
+  def isRegistered(targetName: String): Boolean =
+    commRegistrar.isRegistered(targetName)
+
+  /**
+   * Opens a new Comm connection. Establishes a new link between the specified
+   * target and the generated Comm id.
+   *
+   * @param targetName The name of the target to connect
+   * @param data The optional data to send
+   *
+   * @return The new CommWriter representing the connection
+   */
+  def open(targetName: String, data: v5.MsgData = v5.MsgData.Empty): CommWriter = {
+    val commId = UUID.randomUUID().toString
+
+    // Create our CommWriter and wrap it to establish links and unlink on close
+    val commWriter = new WrapperCommWriter(newCommWriter(commId))
+
+    // Establish the actual connection
+    commWriter.writeOpen(targetName, data)
+
+    commWriter
+  }
+
+  /**
+   * Creates a new CommWriter instance given the Comm id.
+   *
+   * @param commId The Comm id to use with the Comm writer
+   *
+   * @return The new CommWriter instance
+   */
+  protected def newCommWriter(commId: v5.UUID): CommWriter
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala b/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
new file mode 100644
index 0000000..84df054
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommRegistrar.scala
@@ -0,0 +1,487 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.comm.CommCallbacks._
+import com.ibm.spark.kernel.protocol.v5
+
+import scala.annotation.tailrec
+import scala.collection.immutable
+
+/**
+ * Represents a point of communication to register new Comm entities (targets)
+ * and attach handlers for various events. Uses external storage for the
+ * Comm information.
+ *
+ * @param commStorage The storage used to save/load callbacks
+ * @param defaultTargetName The default target name to use for functions
+ */
+@Experimental
+class CommRegistrar(
+  private val commStorage: CommStorage,
+  private[comm] val defaultTargetName: Option[String] = None
+) {
+
+  /**
+   * Returns an updated copy of the registrar that is using the specified
+   * target name as the default for chaining.
+   *
+   * @param targetName The name of the target to treat as the default
+   *
+   * @return The updated registrar (for chaining methods)
+   */
+  def withTarget(targetName: String): CommRegistrar = {
+    new CommRegistrar(commStorage, Some(targetName))
+  }
+
+  /**
+   * Registers a specific target for Comm communications.
+   *
+   * @param targetName The name of the target to register
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def register(targetName: String): CommRegistrar = {
+    // Mark as registered if not already
+    if (!commStorage.hasTargetCallbacks(targetName))
+      commStorage.setTargetCallbacks(targetName, new CommCallbacks())
+
+    // Return new instance with default target name specified for easier
+    // method chaining
+    new CommRegistrar(commStorage, Some(targetName))
+  }
+
+  /**
+   * Unregisters a specific target for Comm communications.
+   *
+   * @param targetName The name of the target to unregister
+   *
+   * @return Some collection of callbacks associated with the target if it was
+   *         registered, otherwise None
+   */
+  def unregister(targetName: String): Option[CommCallbacks] = {
+    commStorage.removeTargetCallbacks(targetName)
+  }
+
+  /**
+   * Indicates whether or not the specified target is currently registered
+   * with this registrar.
+   *
+   * @param targetName The name of the target
+   *
+   * @return True if the target is registered, otherwise false
+   */
+  def isRegistered(targetName: String): Boolean = {
+    commStorage.hasTargetCallbacks(targetName)
+  }
+
+  /**
+   * Links a target and a specific Comm id together.
+   *
+   * @param targetName The name of the target to link
+   * @param commId The Comm Id to link
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def link(targetName: String, commId: v5.UUID): CommRegistrar =
+    linkImpl(targetName)(commId)
+
+  /**
+   * Links a target and a specific Comm id together.
+   *
+   * @param commId The Comm Id to link
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def link(commId: v5.UUID): CommRegistrar = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    linkImpl(defaultTargetName.get)(commId)
+  }
+
+  private def linkImpl(targetName: String)(commId: v5.UUID) = {
+    val commIds = commStorage.getCommIdsFromTarget(targetName)
+      .getOrElse(immutable.Vector.empty[v5.UUID])
+
+    commStorage.setTargetCommIds(targetName, commIds :+ commId)
+
+    this
+  }
+
+  /**
+   * Retrieves the current links for the specified target.
+   *
+   * @param targetName The name of the target whose links to retrieve
+   *
+   * @return The collection of link ids
+   */
+  def getLinks(targetName: String): Seq[v5.UUID] =
+    getLinksImpl(targetName)
+
+  /**
+   * Retrieves the target associated with the specified link.
+   *
+   * @param commId The Comm id whose target to look up
+   *
+   * @return Some target name if found, otherwise None
+   */
+  def getTargetFromLink(commId: v5.UUID): Option[String] = {
+    commStorage.getTargetFromCommId(commId)
+  }
+
+  /**
+   * Retrieves the current links for the current target.
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The collection of link ids
+   */
+  def getLinks: Seq[v5.UUID] = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    getLinksImpl(defaultTargetName.get)
+  }
+
+  private def getLinksImpl(targetName: String): Seq[v5.UUID] = {
+    commStorage
+      .getCommIdsFromTarget(targetName)
+      .getOrElse(Nil)
+  }
+
+  /**
+   * Unlinks a target and a specific Comm id based on the provided id.
+   *
+   * @param commId The id of the Comm instance to unlink from its target
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def unlink(commId: v5.UUID): CommRegistrar = {
+    commStorage.removeCommIdFromTarget(commId)
+
+    this
+  }
+
+  /**
+   * Adds an entry to the list of open Comm handlers.
+   *
+   * @param targetName The name of the target whose open event to monitor
+   * @param func The handler function to trigger when an open is received
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def addOpenHandler(targetName: String, func: OpenCallback) =
+    addOpenHandlerImpl(targetName)(func)
+
+  /**
+   * Adds an entry to the list of open Comm handlers.
+   *
+   * @param func The handler function to trigger when an open is received
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def addOpenHandler(func: OpenCallback) = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    addOpenHandlerImpl(defaultTargetName.get)(func)
+  }
+
+  private def addOpenHandlerImpl(targetName: String)(func: OpenCallback) = {
+    val commCallbacks =
+      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
+
+    commStorage.setTargetCallbacks(
+      targetName, commCallbacks.addOpenCallback(func))
+
+    this
+  }
+
+  /**
+   * Removes the specified callback from the list of open Comm handlers.
+   *
+   * @param targetName The name of the target to remove the open callback
+   * @param func The callback to remove
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def removeOpenHandler(targetName: String, func: OpenCallback) =
+    removeOpenHandlerImpl(targetName)(func)
+
+  /**
+   * Removes the specified callback from the list of open Comm handlers.
+   *
+   * @param func The callback to remove
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def removeOpenHandler(func: OpenCallback) = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    removeOpenHandlerImpl(defaultTargetName.get)(func)
+  }
+
+  private def removeOpenHandlerImpl(targetName: String)(func: OpenCallback) = {
+    val commCallbacks =
+      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
+
+    commStorage.setTargetCallbacks(
+      targetName, commCallbacks.removeOpenCallback(func))
+
+    this
+  }
+
+  /**
+   * Adds an entry to the list of msg Comm handlers.
+   *
+   * @param targetName The name of the target whose msg event to monitor
+   * @param func The handler function to trigger when a msg is received
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def addMsgHandler(targetName: String, func: MsgCallback) =
+    addMsgHandlerImpl(targetName)(func)
+
+  /**
+   * Adds an entry to the list of msg Comm handlers.
+   *
+   * @param func The handler function to trigger when a msg is received
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def addMsgHandler(func: MsgCallback) = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    addMsgHandlerImpl(defaultTargetName.get)(func)
+  }
+
+  private def addMsgHandlerImpl(targetName: String)(func: MsgCallback) = {
+    val commCallbacks =
+      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
+
+    commStorage.setTargetCallbacks(
+      targetName, commCallbacks.addMsgCallback(func))
+
+    this
+  }
+
+  /**
+   * Removes the specified callback from the list of msg Comm handlers.
+   *
+   * @param targetName The name of the target to remove the msg callback
+   * @param func The callback to remove
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def removeMsgHandler(targetName: String, func: MsgCallback) =
+    removeMsgHandlerImpl(targetName)(func)
+
+  /**
+   * Removes the specified callback from the list of msg Comm handlers.
+   *
+   * @param func The callback to remove
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def removeMsgHandler(func: MsgCallback) = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    removeMsgHandlerImpl(defaultTargetName.get)(func)
+  }
+
+  private def removeMsgHandlerImpl(targetName: String)(func: MsgCallback) = {
+    val commCallbacks =
+      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
+
+    commStorage.setTargetCallbacks(
+      targetName, commCallbacks.removeMsgCallback(func))
+
+    this
+  }
+
+  /**
+   * Adds an entry to the list of close Comm handlers.
+   *
+   * @param targetName The name of the target whose close event to monitor
+   * @param func The handler function to trigger when a close is received
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def addCloseHandler(targetName: String, func: CloseCallback) =
+    addCloseHandlerImpl(targetName)(func)
+
+  /**
+   * Adds an entry to the list of close Comm handlers.
+   *
+   * @param func The handler function to trigger when a close is received
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def addCloseHandler(func: CloseCallback) = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    addCloseHandlerImpl(defaultTargetName.get)(func)
+  }
+
+  private def addCloseHandlerImpl(targetName: String)(func: CloseCallback) = {
+    val commCallbacks =
+      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
+
+    commStorage.setTargetCallbacks(
+      targetName, commCallbacks.addCloseCallback(func))
+
+    this
+  }
+
+  /**
+   * Removes the specified callback from the list of close Comm handlers.
+   *
+   * @param targetName The name of the target to remove the close callback
+   * @param func The callback to remove
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def removeCloseHandler(targetName: String, func: CloseCallback) =
+    removeCloseHandlerImpl(targetName)(func)
+
+  /**
+   * Removes the specified callback from the list of close Comm handlers.
+   *
+   * @param func The callback to remove
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The current registrar (for chaining methods)
+   */
+  def removeCloseHandler(func: CloseCallback) = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    removeCloseHandlerImpl(defaultTargetName.get)(func)
+  }
+
+  private def removeCloseHandlerImpl(targetName: String)(
+    func: CloseCallback
+  ) = {
+    val commCallbacks =
+      commStorage.getTargetCallbacks(targetName).getOrElse(new CommCallbacks())
+
+    commStorage.setTargetCallbacks(
+      targetName, commCallbacks.removeCloseCallback(func))
+
+    this
+  }
+
+  /**
+   * Retrieves all open callbacks for the target.
+   *
+   * @param targetName The name of the target whose open callbacks to retrieve
+   *
+   * @return The collection of open callbacks
+   */
+  def getOpenHandlers(targetName: String): Seq[OpenCallback] =
+    getOpenHandlersImpl(targetName)
+
+  /**
+   * Retrieves all open callbacks for the current target.
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The collection of open callbacks
+   */
+  def getOpenHandlers: Seq[OpenCallback] = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    getOpenHandlersImpl(defaultTargetName.get)
+  }
+
+  private def getOpenHandlersImpl(targetName: String): Seq[OpenCallback] = {
+    commStorage
+      .getTargetCallbacks(targetName)
+      .map(_.openCallbacks)
+      .getOrElse(Nil)
+  }
+
+  /**
+   * Retrieves all msg callbacks for the target.
+   *
+   * @param targetName The name of the target whose msg callbacks to retrieve
+   *
+   * @return The collection of msg callbacks
+   */
+  def getMsgHandlers(targetName: String): Seq[MsgCallback] =
+    getMsgHandlersImpl(targetName)
+
+  /**
+   * Retrieves all msg callbacks for the current target.
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The collection of msg callbacks
+   */
+  def getMsgHandlers: Seq[MsgCallback] = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    getMsgHandlersImpl(defaultTargetName.get)
+  }
+
+  private def getMsgHandlersImpl(targetName: String): Seq[MsgCallback] = {
+    commStorage
+      .getTargetCallbacks(targetName)
+      .map(_.msgCallbacks)
+      .getOrElse(Nil)
+  }
+
+  /**
+   * Retrieves all close callbacks for the target.
+   *
+   * @param targetName The name of the target whose close callbacks to retrieve
+   *
+   * @return The collection of close callbacks
+   */
+  def getCloseHandlers(targetName: String): Seq[CloseCallback] =
+    getCloseHandlersImpl(targetName)
+
+  /**
+   * Retrieves all close callbacks for the current target.
+   *
+   * @throws AssertionError When not chaining off of a register call
+   *
+   * @return The collection of close callbacks
+   */
+  def getCloseHandlers: Seq[CloseCallback] = {
+    assert(defaultTargetName.nonEmpty, "No default target name provided!")
+
+    getCloseHandlersImpl(defaultTargetName.get)
+  }
+
+  private def getCloseHandlersImpl(targetName: String): Seq[CloseCallback] = {
+    commStorage
+      .getTargetCallbacks(targetName)
+      .map(_.closeCallbacks)
+      .getOrElse(Nil)
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
new file mode 100644
index 0000000..0aaff9a
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommStorage.scala
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5
+
+import scala.collection.immutable
+
+/**
+ * Represents the storage structure for Comm-related data.
+ *
+ * @param callbackStorage The structure used to connect targets with callbacks
+ * @param linkStorage The structure used to connect targets to specific ids
+ */
+@Experimental
+class CommStorage(
+  private val callbackStorage: collection.mutable.Map[String, CommCallbacks] =
+    new collection.mutable.HashMap[String, CommCallbacks](),
+  private val linkStorage: collection.mutable.Map[String, immutable.IndexedSeq[v5.UUID]] =
+    new collection.mutable.HashMap[String, immutable.IndexedSeq[v5.UUID]]()
+) {
+  /**
+   * Sets the Comm callbacks for the specified target.
+   *
+   * @param targetName The name of the target whose callbacks to set
+   * @param commCallbacks The new callbacks for the target
+   */
+  def setTargetCallbacks(targetName: String, commCallbacks: CommCallbacks) =
+    callbackStorage(targetName) = commCallbacks
+
+  /**
+   * Removes the Comm callbacks from the specified target.
+   *
+   * @param targetName The name of the target whose callbacks to remove
+   *
+   * @return Some CommCallbacks if removed, otherwise None
+   */
+  def removeTargetCallbacks(targetName: String) =
+    callbackStorage.remove(targetName)
+
+  /**
+   * Retrieves the current Comm callbacks for the specified target.
+   *
+   * @param targetName The name of the target whose callbacks to get
+   *
+   * @return Some CommCallbacks if found, otherwise None
+   */
+  def getTargetCallbacks(targetName: String): Option[CommCallbacks] =
+    callbackStorage.get(targetName)
+
+  /**
+   * Determines if the specified target has any callbacks.
+   *
+   * @param targetName The name of the target
+   *
+   * @return True if a CommCallbacks instance is found, otherwise false
+   */
+  def hasTargetCallbacks(targetName: String) =
+    callbackStorage.contains(targetName)
+
+  /**
+   * Sets the Comm ids associated with the specified target.
+   *
+   * @param targetName The name of the target whose Comm ids to set
+   * @param links The sequence of Comm ids to attach to the target
+   */
+  def setTargetCommIds(
+    targetName: String, links: immutable.IndexedSeq[v5.UUID]
+  ) = linkStorage(targetName) = links
+
+  /**
+   * Removes the Comm ids associated with the specified target.
+   *
+   * @param targetName The name of the target whose Comm ids to remove
+   *
+   * @return Some sequence of Comm ids if removed, otherwise None
+   */
+  def removeTargetCommIds(targetName: String) = linkStorage.remove(targetName)
+
+  /**
+   * Removes the specified Comm id from the first target with a match.
+   *
+   * @param commId The Comm id to remove
+   *
+   * @return Some name of target linked to Comm id if removed, otherwise None
+   */
+  def removeCommIdFromTarget(commId: v5.UUID): Option[v5.UUID] = {
+    val targetName = getTargetFromCommId(commId)
+
+    targetName match {
+      case Some(name) =>
+        val commIds = getCommIdsFromTarget(name).get.filterNot(_ == commId)
+        setTargetCommIds(name, commIds)
+        Some(name)
+      case None       =>
+        None
+    }
+  }
+
+  /**
+   * Retrieves the current sequence of Comm ids for the specified target.
+   *
+   * @param targetName The name of the target whose Comm ids to get
+   *
+   * @return Some sequence of Comm ids if found, otherwise None
+   */
+  def getCommIdsFromTarget(targetName: String) = linkStorage.get(targetName)
+
+  /**
+   * Retrieves the current target for the specified Comm id.
+   *
+   * @param commId The Comm id whose target to get
+   *
+   * @return Some target name if found, otherwise None
+   */
+  def getTargetFromCommId(commId: v5.UUID): Option[String] = linkStorage.find {
+    (link) => link._2.contains(commId)
+  } match {
+    case Some(link) => Some(link._1)
+    case None       => None
+  }
+
+  /**
+   * Retrieves the current Comm callbacks for the specified Comm id.
+   *
+   * @param commId The id of the Comm whose callbacks to retrieve
+   *
+   * @return Some CommCallbacks if Comm id found, otherwise None
+   */
+  def getCommIdCallbacks(commId: v5.UUID): Option[CommCallbacks] =
+    getTargetFromCommId(commId) match {
+      case Some(targetName) => getTargetCallbacks(targetName)
+      case None             => None
+    }
+
+  /**
+   * Determines if the specified target has any linked Comm ids.
+   *
+   * @param targetName The name of the target
+   *
+   * @return True if a sequence of Comm ids is found, otherwise false
+   */
+  def hasTargetCommIds(targetName: String) =
+    linkStorage.contains(targetName)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
new file mode 100644
index 0000000..772e582
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ *  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.ibm.spark.comm
+
+import com.ibm.spark.annotations.Experimental
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.content._
+
+import java.io.Writer
+
+/**
+ * Represents a basic writer used to communicate comm-related messages.
+ *
+ * @param commId The comm id associated with this writer (defaults to a
+ *               random UUID)
+ */
+@Experimental
+abstract class CommWriter(
+  private[comm] val commId: UUID = java.util.UUID.randomUUID().toString
+) extends Writer {
+
+  private val MessageFieldName = "message"
+
+  /**
+   * Packages and sends an open message with the provided target and data.
+   *
+   * @param targetName The name of the target (used by the recipient)
+   * @param data The optional data to send with the open message
+   */
+  def writeOpen(targetName: String, data: MsgData = MsgData.Empty) =
+    sendCommKernelMessage(CommOpen(commId, targetName, data))
+
+  /**
+   * Packages and sends a message with the provided data.
+   *
+   * @param data The data to send
+   */
+  def writeMsg(data: v5.MsgData) = {
+    require(data != null)
+
+    sendCommKernelMessage(CommMsg(commId, data))
+  }
+
+  /**
+   * Packages and sends a close message with the provided data.
+   *
+   * @param data The optional data to send with the close message
+   */
+  def writeClose(data: v5.MsgData = MsgData.Empty) =
+    sendCommKernelMessage(CommClose(commId, data))
+
+  /**
+   * Writes the data as a new message, wrapped with a "message" JSON field.
+   *
+   * @param cbuf The array of characters to send
+   * @param off The offset (0 is the start) of the array to use
+   * @param len The number of characters to send
+   */
+  override def write(cbuf: Array[Char], off: Int, len: Int): Unit = {
+    val message = new String(cbuf.slice(off, len))
+    val packedMessage = packageMessage(message)
+    sendCommKernelMessage(packedMessage)
+  }
+
+  /**
+   * Does nothing in this implementation.
+   */
+  override def flush(): Unit = {}
+
+  /**
+   * Sends a close message without any data.
+   */
+  override def close(): Unit = writeClose()
+
+  /**
+   * Packages a string message as a Comm message.
+   *
+   * @param message The string message to package
+   *
+   * @return The resulting CommMsg wrapper
+   */
+  private def packageMessage(message: String) =
+    CommMsg(commId, MsgData(MessageFieldName -> message))
+
+  /**
+   * Sends the comm message (open/msg/close) to the actor responsible for
+   * relaying messages.
+   *
+   * @param commContent The message to relay (will be packaged)
+   *
+   * @tparam T Either CommOpen, CommMsg, or CommClose
+   */
+  protected[comm] def sendCommKernelMessage[
+    T <: KernelMessageContent with CommContent
+  ](commContent: T)
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
new file mode 100644
index 0000000..284b2bc
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/Header.scala
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+import play.api.libs.json._
+
+case class Header(
+  msg_id: UUID,
+  username: String,
+  session: UUID,  // Custom UUID type also used here
+  msg_type: String,
+  version: String   // Assuming a string since the doc says '5.0'
+)
+
+object Header {
+  implicit val headerReads = Json.reads[Header]
+  //implicit val headerWrites = Json.writes[Header]
+  implicit val headerWriters = new Writes[Header] {
+    def writes(header: Header) =
+      if (header != null) {
+        Json.obj(
+          "msg_id" -> header.msg_id,
+          "username" -> header.username,
+          "session" -> header.session,
+          "msg_type" -> header.msg_type,
+          "version" -> header.version
+        )
+      // Empty header is null
+      } else {
+        Json.obj()
+      }
+  }
+}
+
+/* LEFT FOR REFERENCE IN CREATING CUSTOM READ/WRITE
+object Header {
+  implicit val headerReads: Reads[Header] = (
+    (JsPath \ "msg_id").read[String] and
+    (JsPath \ "username").read[String] and
+    (JsPath \ "session").read[String] and
+    (JsPath \ "msg_type").read[String] and
+    (JsPath \ "version").read[String]
+  )(Header.apply _) // Case class provides the apply method
+
+  implicit val headerWrites: Writes[Header] = (
+    (JsPath \ "msg_id").write[String] and
+    (JsPath \ "username").write[String] and
+    (JsPath \ "session").write[String] and
+    (JsPath \ "msg_type").write[String] and
+    (JsPath \ "version").write[String]
+  )(unlift(Header.unapply)) // Case class provides the unapply method
+}
+*/

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
new file mode 100644
index 0000000..4061ffe
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/HeaderBuilder.scala
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+object HeaderBuilder {
+  /**
+   * Creates a new Header instance with the provided id and type.
+   * @param msgType The type of the message
+   * @param msgId (Optional) The unique identifier of the message, generates a
+   *              random UUID if none is provided
+   * @return The new Header instance
+   */
+  def create(
+    msgType: String,
+    msgId: UUID = java.util.UUID.randomUUID.toString
+  ) = Header(
+      msgId,
+      SparkKernelInfo.username,
+      SparkKernelInfo.session,
+      msgType,
+      SparkKernelInfo.protocolVersion
+    )
+
+  /**
+   * Represents an "empty" header where the message type and id are blank.
+   */
+  val empty = create("", "")
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
new file mode 100644
index 0000000..4ed4ab5
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+import java.util.Calendar
+
+import com.ibm.spark.kernel.protocol.v5.MessageType.MessageType
+
+/**
+  * A class for building KernelMessages.
+  * Upon creation, holds a KernelMessage with empty parameters. 
+  * A new KMBuilder holding a KernelMessage with modified
+  * parameters can be generated using the withXYZ() methods.
+  * The KernelMessage held by the KMBuilder can be obtained with build().
+  * All metadata returned by metadataDefaults() is added
+  * to the KernelMessage's metadata when build() is called.
+  *
+  * e.g.
+  * val base = KMBuilder().withParent(parentMessage)
+  *
+  * val km1 = base.withHeader(MessageType.ExecuteReply).build
+  *
+  * val km2 = base.withHeader(MessageType.ExecuteRequest)
+  *               .withContentString("content").build
+**/
+case class KMBuilder(km: KernelMessage = KernelMessage(
+                                            ids           = Seq(),
+                                            signature     = "",
+                                            header        = HeaderBuilder.empty,
+                                            parentHeader  = HeaderBuilder.empty,
+                                            metadata      = Metadata(),
+                                            contentString = ""
+                                            )) {
+  require(km != null)
+
+  def withIds(newVal: Seq[String]) : KMBuilder =
+    KMBuilder(this.km.copy(ids = newVal))
+
+  def withSignature(newVal: String) : KMBuilder =
+    KMBuilder(this.km.copy(signature = newVal))
+
+  def withHeader(newVal: Header) : KMBuilder =
+    KMBuilder(this.km.copy(header = newVal))
+
+  def withHeader(msgType: MessageType) : KMBuilder = {
+    val header = HeaderBuilder.create(msgType.toString)
+    KMBuilder(this.km.copy(header = header))
+  }
+
+  def withHeader(msgTypeString: String) : KMBuilder = {
+    val header = HeaderBuilder.create(msgTypeString)
+    KMBuilder(this.km.copy(header = header))
+  }
+
+  def withParent(parent: KernelMessage) : KMBuilder =
+    KMBuilder(this.km.copy(parentHeader = parent.header))
+
+  def withParentHeader(newVal: Header) : KMBuilder =
+    KMBuilder(this.km.copy(parentHeader = newVal))
+
+  def withMetadata(newVal: Metadata) : KMBuilder =
+    KMBuilder(this.km.copy(metadata = newVal))
+
+  def withContentString(newVal: String) : KMBuilder =
+    KMBuilder(this.km.copy(contentString = newVal))
+
+  def withContentString[T <: KernelMessageContent](contentMsg: T) : KMBuilder =
+    KMBuilder(this.km.copy(contentString = contentMsg.content))
+
+  /**
+   * Default information (e.g. timestamp) to add to the
+   * KernelMessage's metadata upon calling build().
+   */
+  protected def metadataDefaults : Metadata = {
+    val timestamp = Calendar.getInstance().getTimeInMillis.toString
+    Metadata("timestamp" -> timestamp)
+  }
+
+  /**
+   * Builds a KernelMessage using the KernelMessage held by this builder.
+   * @param includeDefaultMetadata appends default metadata (e.g. timestamp)
+   *                               to the KernelMessage's metadata when true.
+   * @return KernelMessage held by this builder with default metadata.
+   */
+  def build(implicit includeDefaultMetadata: Boolean = true) : KernelMessage = {
+    if (includeDefaultMetadata)
+      this.km.copy(metadata = km.metadata ++ metadataDefaults)
+    else
+      this.km.copy(metadata = km.metadata)
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
new file mode 100644
index 0000000..5663933
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+case class KernelMessage(
+  ids: Seq[String],
+  signature: String,
+  header: Header,
+  parentHeader: ParentHeader, // TODO: This can be an empty json object of {}
+  metadata: Metadata,
+  contentString: String
+)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
new file mode 100644
index 0000000..ed7af7c
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessageContent.scala
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+trait KernelMessageContent {
+
+  /**
+   * Provides the String representation of this message used
+   * in the KernelMessage's contentString field.
+   * @return representation of this message.
+   */
+  def content : String
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
new file mode 100644
index 0000000..1794c93
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/SparkKernelInfo.scala
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5
+
+import com.ibm.spark.kernel.BuildInfo
+
+object SparkKernelInfo {
+  /**
+   * Represents the protocol version (IPython) supported by this kernel.
+   */
+  val protocolVersion         = "5.0"
+
+  /**
+   * Represents what the kernel implements.
+   */
+  val implementation          = "spark"
+
+  /**
+   * Represents the kernel version.
+   */
+  val implementationVersion   = BuildInfo.version
+
+  /**
+   * Represents the language supported by the kernel.
+   */
+  val language_info           = Map("name" -> "scala")
+
+  /**
+   * Represents the language version supported by the kernel.
+   */
+  val languageVersion         = BuildInfo.scalaVersion
+
+  /**
+   * Represents the displayed name of the kernel.
+   */
+  val banner                  = "IBM Spark Kernel"
+
+  /**
+   * Represents the name of the user who started the kernel process.
+   */
+  val username                = System.getProperty("user.name")
+
+  /**
+   * Represents the unique session id used by this instance of the kernel.
+   */
+  val session               = java.util.UUID.randomUUID.toString
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
new file mode 100644
index 0000000..9b7eabe
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutput.scala
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.functional.syntax._
+import play.api.libs.json._
+
+case class ClearOutput (
+  //  We cannot use _wait as a field because it is a method defined on all objects
+  _wait: Boolean
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ClearOutput.clearOutputWrites).toString
+}
+
+//  Single property fields are not well supported by play, this is a little funky workaround founde here:
+//  https://groups.google.com/forum/?fromgroups=#!starred/play-framework/hGrveOkbJ6U
+object ClearOutput extends TypeString {
+  implicit val clearOutputReads: Reads[ClearOutput] = (
+    (JsPath \ "wait").read[Boolean].map(ClearOutput(_)))
+  implicit val clearOutputWrites: Writes[ClearOutput] = (
+    (JsPath \ "wait").write[Boolean].contramap((c : ClearOutput) => c._wait)
+    )
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "clear_output"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
new file mode 100644
index 0000000..e74ea72
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommClose.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import play.api.libs.json.Json
+
+case class CommClose(comm_id: UUID, data: MsgData)
+  extends KernelMessageContent with CommContent
+{
+  override def content : String =
+    Json.toJson(this)(CommClose.commCloseWrites).toString
+}
+
+object CommClose extends TypeString {
+
+  implicit val commCloseReads = Json.reads[CommClose]
+  implicit val commCloseWrites = Json.writes[CommClose]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "comm_close"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
new file mode 100644
index 0000000..5e98e08
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommContent.scala
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+
+/**
+ * Represents a series of subclasses of KernelMessageContent that embodies the
+ * Comm content types.
+ */
+trait CommContent {
+  this: KernelMessageContent =>
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
new file mode 100644
index 0000000..e85e1f0
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommMsg.scala
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.{MsgData, KernelMessageContent, UUID}
+import play.api.libs.json.Json
+
+case class CommMsg(comm_id: UUID, data: MsgData)
+  extends KernelMessageContent with CommContent
+{
+  override def content : String =
+    Json.toJson(this)(CommMsg.commMsgWrites).toString
+}
+
+object CommMsg extends TypeString {
+  implicit val commMsgReads = Json.reads[CommMsg]
+  implicit val commMsgWrites = Json.writes[CommMsg]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "comm_msg"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
new file mode 100644
index 0000000..b83d7ff
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CommOpen.scala
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import play.api.libs.json.Json
+
+case class CommOpen(comm_id: UUID, target_name: String, data: MsgData)
+  extends KernelMessageContent with CommContent
+{
+  override def content : String =
+    Json.toJson(this)(CommOpen.commOpenWrites).toString
+}
+
+object CommOpen extends TypeString {
+  implicit val commOpenReads = Json.reads[CommOpen]
+  implicit val commOpenWrites = Json.writes[CommOpen]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "comm_open"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
new file mode 100644
index 0000000..2edcfa7
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReply.scala
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Metadata}
+import play.api.libs.json.Json
+
+case class CompleteReply (
+  matches: List[String],
+  cursor_start: Int,
+  cursor_end: Int,
+  metadata: Metadata,
+  status: String,
+  ename: Option[String],
+  evalue: Option[String],
+  traceback: Option[List[String]]
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(CompleteReply.completeReplyWrites).toString
+}
+
+object CompleteReply extends TypeString {
+  implicit val completeReplyReads = Json.reads[CompleteReply]
+  implicit val completeReplyWrites = Json.writes[CompleteReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "complete_reply"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
new file mode 100644
index 0000000..33d7e68
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequest.scala
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class CompleteRequest(
+  code: String,
+  cursor_pos: Int
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(CompleteRequest.completeRequestWrites).toString
+}
+
+object CompleteRequest extends TypeString {
+  implicit val completeRequestReads = Json.reads[CompleteRequest]
+  implicit val completeRequestWrites = Json.writes[CompleteRequest]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "complete_request"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
new file mode 100644
index 0000000..18ce82f
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReply.scala
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json.Json
+
+case class ConnectReply(
+  shell_port: Int,
+  iopub_port: Int,
+  stdin_port: Int,
+  hb_port: Int
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ConnectReply.connectReplyWrites).toString
+}
+
+object ConnectReply extends TypeString {
+  implicit val connectReplyReads = Json.reads[ConnectReply]
+  implicit val connectReplyWrites = Json.writes[ConnectReply]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "connect_reply"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
new file mode 100644
index 0000000..1c9e4a6
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequest.scala
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.KernelMessageContent
+import play.api.libs.json._
+
+case class ConnectRequest() extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(ConnectRequest.connectRequestWrites).toString
+}
+
+object ConnectRequest extends TypeString {
+  private val SingleInstance = ConnectRequest()
+  private val EmptyJsonObj = Json.obj()
+
+  implicit val connectRequestReads = new Reads[ConnectRequest] {
+    override def reads(json: JsValue): JsResult[ConnectRequest] = {
+      new JsSuccess[ConnectRequest](SingleInstance)
+    }
+  }
+
+  implicit val connectRequestWrites = new Writes[ConnectRequest] {
+    override def writes(req: ConnectRequest): JsValue = EmptyJsonObj
+  }
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "connect_request"
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
----------------------------------------------------------------------
diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
new file mode 100644
index 0000000..7a959fa
--- /dev/null
+++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/content/DisplayData.scala
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5.{KernelMessageContent, Data, Metadata}
+import play.api.libs.json._
+
+case class DisplayData(
+  source: String,
+  data: Data,
+  metadata: Metadata
+) extends KernelMessageContent {
+  override def content : String =
+    Json.toJson(this)(DisplayData.displayDataWrites).toString
+}
+
+object DisplayData extends TypeString {
+  implicit val displayDataReads = Json.reads[DisplayData]
+  implicit val displayDataWrites = Json.writes[DisplayData]
+
+  /**
+   * Returns the type string associated with this object.
+   *
+   * @return The type as a string
+   */
+  override def toTypeString: String = "display_data"
+}



[27/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
new file mode 100644
index 0000000..9fdd702
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClientSpec.scala
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpecLike}
+import org.mockito.Matchers._
+import org.mockito.Mockito._
+
+class HeartbeatClientSpec extends TestKit(ActorSystem("HeartbeatActorSpec"))
+  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+
+  describe("HeartbeatClientActor") {
+    val socketFactory = mock[SocketFactory]
+    val mockActorLoader = mock[ActorLoader]
+    val probe : TestProbe = TestProbe()
+    when(socketFactory.HeartbeatClient(any(classOf[ActorSystem]), any(classOf[ActorRef]))).thenReturn(probe.ref)
+
+    val heartbeatClient = system.actorOf(Props(
+      classOf[HeartbeatClient], socketFactory, mockActorLoader, true
+    ))
+
+    describe("send heartbeat") {
+      it("should send ping ZMQMessage") {
+        heartbeatClient ! HeartbeatMessage
+        probe.expectMsgClass(classOf[ZMQMessage])
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
new file mode 100644
index 0000000..b592dcd
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import java.util.UUID
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import akka.pattern.ask
+import akka.testkit.{ImplicitSender, TestKit, TestProbe}
+import akka.util.Timeout
+import com.ibm.spark.comm.{CommCallbacks, CommRegistrar, CommStorage, CommWriter}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.kernel.protocol.v5
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.Utilities._
+import com.ibm.spark.kernel.protocol.v5.client.execution.{DeferredExecution, DeferredExecutionManager}
+import com.ibm.spark.kernel.protocol.v5.client.{ActorLoader, Utilities}
+import com.ibm.spark.kernel.protocol.v5.content.{CommClose, CommMsg, CommOpen, StreamContent}
+import com.typesafe.config.ConfigFactory
+import org.mockito.Matchers.{eq => mockEq, _}
+import org.mockito.Mockito._
+import org.scalatest.concurrent.{Eventually, ScalaFutures}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.time.{Milliseconds, Span}
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import play.api.libs.json.Json
+
+import scala.concurrent.duration._
+import scala.concurrent.{Future, Promise}
+import scala.util.Failure
+
+object IOPubClientSpec {
+  val config ="""
+    akka {
+      loglevel = "WARNING"
+    }"""
+}
+
+class IOPubClientSpec extends TestKit(ActorSystem(
+  "IOPubClientSpecSystem", ConfigFactory.parseString(IOPubClientSpec.config)
+)) with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with ScalaFutures with BeforeAndAfter with Eventually
+{
+  private val TestTimeout = Timeout(10.seconds)
+  implicit override val patienceConfig = PatienceConfig(
+    timeout = scaled(Span(200, Milliseconds)),
+    interval = scaled(Span(5, Milliseconds))
+  )
+  private val SignatureEnabled = true
+
+  private var clientSocketProbe: TestProbe = _
+  private var mockClientSocketFactory: SocketFactory = _
+  private var mockActorLoader: ActorLoader = _
+  private var mockCommRegistrar: CommRegistrar = _
+  private var spyCommStorage: CommStorage = _
+  private var mockCommCallbacks: CommCallbacks = _
+  private var ioPubClient: ActorRef = _
+
+  private var kmBuilder: KMBuilder = _
+
+  private val id = UUID.randomUUID().toString
+  private val TestTargetName = "some target"
+  private val TestCommId = UUID.randomUUID().toString
+
+  before {
+    kmBuilder = KMBuilder()
+    mockCommCallbacks = mock[CommCallbacks]
+    mockCommRegistrar = mock[CommRegistrar]
+
+    spyCommStorage = spy(new CommStorage())
+
+    clientSocketProbe = TestProbe()
+    mockActorLoader = mock[ActorLoader]
+    mockClientSocketFactory = mock[SocketFactory]
+
+    //  Stub the return value for the socket factory
+    when(mockClientSocketFactory.IOPubClient(anyObject(), any[ActorRef]))
+      .thenReturn(clientSocketProbe.ref)
+
+    //  Construct the object we will test against
+    ioPubClient = system.actorOf(Props(
+      classOf[IOPubClient], mockClientSocketFactory, mockActorLoader,
+      SignatureEnabled, mockCommRegistrar, spyCommStorage
+    ))
+  }
+
+  describe("IOPubClient") {
+    describe("#receive") {
+      it("should execute all Comm open callbacks on comm_open message") {
+        val message: ZMQMessage = kmBuilder
+          .withHeader(CommOpen.toTypeString)
+          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
+          .build
+
+        // Mark as target being provided
+        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
+          .getTargetCallbacks(anyString())
+
+        // Simulate receiving a message from the kernel
+        ioPubClient ! message
+
+        // Check to see if "eventually" the callback is triggered
+        eventually {
+          verify(mockCommCallbacks).executeOpenCallbacks(
+            any[CommWriter], mockEq(TestCommId),
+            mockEq(TestTargetName), any[v5.MsgData])
+        }
+      }
+
+      it("should not execute Comm open callbacks if the target is not found") {
+        val message: ZMQMessage = kmBuilder
+          .withHeader(CommOpen.toTypeString)
+          .withContentString(CommOpen(TestCommId, TestTargetName, v5.MsgData.Empty))
+          .build
+
+        // Mark as target NOT being provided
+        doReturn(None).when(spyCommStorage).getTargetCallbacks(anyString())
+
+        // Simulate receiving a message from the kernel
+        ioPubClient ! message
+
+        // Check to see if "eventually" the callback is NOT triggered
+        eventually {
+          // Check that we have checked if the target exists
+          verify(spyCommStorage).getTargetCallbacks(TestTargetName)
+
+          verify(mockCommCallbacks, never()).executeOpenCallbacks(
+            any[CommWriter], mockEq(TestCommId),
+            mockEq(TestTargetName), any[v5.MsgData])
+          verify(mockCommRegistrar, never()).link(TestTargetName, TestCommId)
+        }
+      }
+
+      it("should execute all Comm msg callbacks on comm_msg message") {
+        val message: ZMQMessage = kmBuilder
+          .withHeader(CommMsg.toTypeString)
+          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Mark as target being provided
+        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(any[v5.UUID])
+
+        // Simulate receiving a message from the kernel
+        ioPubClient ! message
+
+        // Check to see if "eventually" the callback is triggered
+        eventually {
+          verify(mockCommCallbacks).executeMsgCallbacks(
+            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
+        }
+      }
+
+      it("should not execute Comm msg callbacks if the Comm id is not found") {
+        val message: ZMQMessage = kmBuilder
+          .withHeader(CommMsg.toTypeString)
+          .withContentString(CommMsg(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Mark as target NOT being provided
+        doReturn(None).when(spyCommStorage).getCommIdCallbacks(any[v5.UUID])
+
+        // Simulate receiving a message from the kernel
+        ioPubClient ! message
+
+        // Check to see if "eventually" the callback is NOT triggered
+        eventually {
+          // Check that we have checked if the target exists
+          verify(spyCommStorage).getCommIdCallbacks(TestCommId)
+
+          verify(mockCommCallbacks, never()).executeMsgCallbacks(
+            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
+        }
+      }
+
+      it("should execute all Comm close callbacks on comm_close message") {
+        val message: ZMQMessage = kmBuilder
+          .withHeader(CommClose.toTypeString)
+          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Mark as target being provided
+        doReturn(Some(mockCommCallbacks)).when(spyCommStorage)
+          .getCommIdCallbacks(any[v5.UUID])
+
+        // Simulate receiving a message from the kernel
+        ioPubClient ! message
+
+        // Check to see if "eventually" the callback is triggered
+        eventually {
+          verify(mockCommCallbacks).executeCloseCallbacks(
+            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
+        }
+      }
+
+      it("should not execute Comm close callbacks if Comm id is not found") {
+        val message: ZMQMessage = kmBuilder
+          .withHeader(CommClose.toTypeString)
+          .withContentString(CommClose(TestCommId, v5.MsgData.Empty))
+          .build
+
+        // Mark as target NOT being provided
+        doReturn(None).when(spyCommStorage).getCommIdCallbacks(any[v5.UUID])
+
+        // Simulate receiving a message from the kernel
+        ioPubClient ! message
+
+        // Check to see if "eventually" the callback is NOT triggered
+        eventually {
+          // Check that we have checked if the target exists
+          verify(spyCommStorage).getCommIdCallbacks(TestCommId)
+
+          verify(mockCommCallbacks, never()).executeCloseCallbacks(
+            any[CommWriter], mockEq(TestCommId), any[v5.MsgData])
+        }
+      }
+
+      it("should call a registered callback on stream message") {
+        val result = StreamContent("foo", "bar")
+        val header = Header(id, "spark", id,
+          MessageType.Outgoing.Stream.toString, "5.0")
+        val parentHeader = Header(id, "spark", id,
+          MessageType.Incoming.ExecuteRequest.toString, "5.0")
+
+        val kernelMessage = new KernelMessage(
+          Seq[String](),
+          "",
+          header,
+          parentHeader,
+          Metadata(),
+          Json.toJson(result).toString()
+        )
+        val promise: Promise[String] = Promise()
+        val de: DeferredExecution = DeferredExecution().onStream(
+          (content: StreamContent) => {
+            promise.success(content.text)
+          }
+        )
+        DeferredExecutionManager.add(id, de)
+        // Send the message to the IOPubClient
+        val zmqMessage: ZMQMessage = kernelMessage
+
+        ioPubClient ! zmqMessage
+
+        whenReady(promise.future) {
+          case res: String =>
+            res should be eq("bar")
+          case _ =>
+            fail(s"Received failure when asking IOPubClient")
+        }
+      }
+
+      it("should not invoke callback when stream message's parent header is null") {
+        // Construct the kernel message
+        val result = StreamContent("foo", "bar")
+        val header = Header(id, "spark", id,
+          MessageType.Outgoing.Stream.toString, "5.0")
+
+        val kernelMessage = new KernelMessage(
+          Seq[String](),
+          "",
+          header,
+          null,
+          Metadata(),
+          Json.toJson(result).toString()
+        )
+
+        // Send the message to the IOPubClient
+        val zmqMessage: ZMQMessage = kernelMessage
+        val futureResult: Future[Any] = ioPubClient.ask(zmqMessage)(TestTimeout)
+        whenReady(futureResult) {
+          case result: Failure[Any] =>
+            //  Getting the value of the failure will cause the underlying exception will be thrown
+            try {
+              result.get
+            } catch {
+              case t:RuntimeException =>
+                t.getMessage should be("Parent Header was null in Kernel Message.")
+            }
+          case result =>
+            fail(s"Did not receive failure!! ${result}")
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
new file mode 100644
index 0000000..0110dfd
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/ShellClientSpec.scala
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * 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.ibm.spark.kernel.protocol.v5.client.socket
+
+import java.util.UUID
+
+import akka.actor.{ActorRef, ActorSystem, Props}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.communication.security.SecurityActorType
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.content.ExecuteRequest
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{Matchers, FunSpecLike}
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+import play.api.libs.json.Json
+
+class ShellClientSpec extends TestKit(ActorSystem("ShellActorSpec"))
+  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar {
+  private val SignatureEnabled = true
+
+  describe("ShellClientActor") {
+    val socketFactory = mock[SocketFactory]
+    val mockActorLoader = mock[ActorLoader]
+    val probe : TestProbe = TestProbe()
+    when(socketFactory.ShellClient(
+      any(classOf[ActorSystem]), any(classOf[ActorRef])
+    )).thenReturn(probe.ref)
+
+    val signatureManagerProbe = TestProbe()
+    doReturn(system.actorSelection(signatureManagerProbe.ref.path.toString))
+      .when(mockActorLoader).load(SecurityActorType.SignatureManager)
+
+    val shellClient = system.actorOf(Props(
+      classOf[ShellClient], socketFactory, mockActorLoader, SignatureEnabled
+    ))
+
+    describe("send execute request") {
+      it("should send execute request") {
+        val request = ExecuteRequest(
+          "foo", false, true, UserExpressions(), true
+        )
+        val header = Header(
+          UUID.randomUUID().toString, "spark",
+          UUID.randomUUID().toString, MessageType.Incoming.ExecuteRequest.toString,
+          "5.0"
+        )
+        val kernelMessage = KernelMessage(
+          Seq[String](), "",
+          header, HeaderBuilder.empty,
+          Metadata(), Json.toJson(request).toString
+        )
+        shellClient ! kernelMessage
+
+        // Echo back the kernel message sent to have a signature injected
+        signatureManagerProbe.expectMsgClass(classOf[KernelMessage])
+        signatureManagerProbe.reply(kernelMessage)
+
+        probe.expectMsgClass(classOf[ZMQMessage])
+      }
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
----------------------------------------------------------------------
diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
new file mode 100644
index 0000000..877c4f5
--- /dev/null
+++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/StdinClientSpec.scala
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  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.ibm.spark.kernel.protocol.v5.client.socket
+
+import akka.actor.{ActorRef, Props, ActorSystem}
+import akka.testkit.{TestProbe, ImplicitSender, TestKit}
+import com.ibm.spark.communication.ZMQMessage
+import com.ibm.spark.communication.security.SecurityActorType
+import com.ibm.spark.kernel.protocol.v5._
+import com.ibm.spark.kernel.protocol.v5.client.ActorLoader
+import com.ibm.spark.kernel.protocol.v5.client.socket.StdinClient.ResponseFunction
+import com.ibm.spark.kernel.protocol.v5.content.{InputReply, InputRequest, ClearOutput, ExecuteRequest}
+import org.scalatest.mock.MockitoSugar
+import org.scalatest.{BeforeAndAfter, FunSpecLike, Matchers}
+import com.ibm.spark.kernel.protocol.v5.client.Utilities._
+import play.api.libs.json.Json
+import scala.concurrent.duration._
+
+import org.mockito.Mockito._
+import org.mockito.Matchers._
+
+class StdinClientSpec extends TestKit(ActorSystem("StdinActorSpec"))
+  with ImplicitSender with FunSpecLike with Matchers with MockitoSugar
+  with BeforeAndAfter
+{
+  private val SignatureEnabled = true
+  private val TestReplyString = "some value"
+  private val TestResponseFunc: ResponseFunction = (_, _) => TestReplyString
+
+  private var mockSocketFactory: SocketFactory = _
+  private var mockActorLoader: ActorLoader = _
+  private var signatureManagerProbe: TestProbe = _
+  private var socketProbe: TestProbe = _
+  private var stdinClient: ActorRef = _
+
+  before {
+    socketProbe = TestProbe()
+    signatureManagerProbe = TestProbe()
+    mockSocketFactory = mock[SocketFactory]
+    mockActorLoader = mock[ActorLoader]
+    doReturn(system.actorSelection(signatureManagerProbe.ref.path.toString))
+      .when(mockActorLoader).load(SecurityActorType.SignatureManager)
+    doReturn(socketProbe.ref).when(mockSocketFactory)
+      .StdinClient(any[ActorSystem], any[ActorRef])
+
+    stdinClient = system.actorOf(Props(
+      classOf[StdinClient], mockSocketFactory, mockActorLoader, SignatureEnabled
+    ))
+
+    // Set the response function for our client socket
+    stdinClient ! TestResponseFunc
+  }
+
+  describe("StdinClient") {
+    describe("#receive") {
+      it("should update the response function if receiving a new one") {
+        val expected = "some other value"
+        val replacementFunc: ResponseFunction = (_, _) => expected
+
+        // Update the function
+        stdinClient ! replacementFunc
+
+        val inputRequestMessage: ZMQMessage = KMBuilder()
+          .withHeader(InputRequest.toTypeString)
+          .withContentString(InputRequest("", false))
+          .build
+
+        stdinClient ! inputRequestMessage
+
+        // Echo back the kernel message sent to have a signature injected
+        signatureManagerProbe.expectMsgPF() {
+          case kernelMessage: KernelMessage =>
+            signatureManagerProbe.reply(kernelMessage)
+            true
+        }
+
+        socketProbe.expectMsgPF() {
+          case zmqMessage: ZMQMessage =>
+            val kernelMessage: KernelMessage = zmqMessage
+            val inputReply =
+              Json.parse(kernelMessage.contentString).as[InputReply]
+            inputReply.value should be (expected)
+        }
+      }
+
+      it("should do nothing if the incoming message is not an input_request") {
+        val notInputRequestMessage: ZMQMessage = KMBuilder()
+          .withHeader(ClearOutput.toTypeString)
+          .build
+
+        stdinClient ! notInputRequestMessage
+
+        socketProbe.expectNoMsg(300.milliseconds)
+      }
+
+      it("should respond with an input_reply if the incoming message is " +
+        "an input_request") {
+        val inputRequestMessage: ZMQMessage = KMBuilder()
+          .withHeader(InputRequest.toTypeString)
+          .withContentString(InputRequest("", false))
+          .build
+
+        stdinClient ! inputRequestMessage
+
+        // Echo back the kernel message sent to have a signature injected
+        signatureManagerProbe.expectMsgPF() {
+          case kernelMessage: KernelMessage =>
+            signatureManagerProbe.reply(kernelMessage)
+            true
+        }
+
+        socketProbe.expectMsgPF() {
+          case zmqMessage: ZMQMessage =>
+            val kernelMessage: KernelMessage = zmqMessage
+            val messageType = kernelMessage.header.msg_type
+            messageType should be (InputReply.toTypeString)
+        }
+      }
+
+      it("should use the result from the response function if the incoming " +
+        "message is an input_request") {
+        val inputRequestMessage: ZMQMessage = KMBuilder()
+          .withHeader(InputRequest.toTypeString)
+          .withContentString(InputRequest("", false))
+          .build
+
+        stdinClient ! inputRequestMessage
+
+        // Echo back the kernel message sent to have a signature injected
+        signatureManagerProbe.expectMsgPF() {
+          case kernelMessage: KernelMessage =>
+            signatureManagerProbe.reply(kernelMessage)
+            true
+        }
+
+        socketProbe.expectMsgPF() {
+          case zmqMessage: ZMQMessage =>
+            val kernelMessage: KernelMessage = zmqMessage
+            val inputReply =
+              Json.parse(kernelMessage.contentString).as[InputReply]
+            inputReply.value should be (TestReplyString)
+        }
+      }
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/SocketManager.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/SocketManager.scala b/communication/src/main/scala/com/ibm/spark/communication/SocketManager.scala
deleted file mode 100644
index 994360f..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/SocketManager.scala
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication
-
-import java.util.UUID
-import java.util.concurrent.ConcurrentHashMap
-import com.ibm.spark.communication.socket._
-import org.zeromq.ZMQ
-
-import scala.collection.JavaConverters._
-
-/**
- * Represents the factory for sockets that also manages ZMQ contexts and
- * facilitates closing of sockets created by the factory.
- */
-class SocketManager {
-  /**
-   * Creates a new ZMQ context with a single IO thread.
-   *
-   * @return The new ZMQ context
-   */
-  protected def newZmqContext(): ZMQ.Context = ZMQ.context(1)
-
-  private val socketToContextMap =
-    new ConcurrentHashMap[SocketLike, ZMQ.Context]().asScala
-
-  /**
-   * Provides and registers a new ZMQ context, used for creating a new socket.
-   * @param mkSocket a function that creates a socket using a given context
-   * @return the new socket
-   * @see newZmqContext
-   */
-  private def withNewContext[A <: SocketLike](mkSocket: ZMQ.Context => A): A = {
-    val ctx = newZmqContext()
-    val socket = mkSocket(ctx)
-    socketToContextMap.put(socket, ctx)
-    socket
-  }
-
-  /**
-   * Closes the socket provided and also closes the context if no more sockets
-   * are using the context.
-   *
-   * @param socket The socket to close
-   */
-  def closeSocket(socket: SocketLike) = {
-    socket.close()
-
-    socketToContextMap.remove(socket).foreach(context => {
-      if (!socketToContextMap.values.exists(_ == context)) context.close()
-    })
-  }
-
-  /**
-   * Creates a new request socket.
-   *
-   * @param address The address to associate with the socket
-   * @param inboundMessageCallback The callback to use for incoming messages
-   *
-   * @return The new socket instance
-   */
-  def newReqSocket(
-    address: String,
-    inboundMessageCallback: (Seq[String]) => Unit
-  ): SocketLike = withNewContext{ ctx =>
-     new JeroMQSocket(new ReqSocketRunnable(
-      ctx,
-      Some(inboundMessageCallback),
-      Connect(address),
-      Linger(0)
-    ))
-  }
-
-  /**
-   * Creates a new reply socket.
-   *
-   * @param address The address to associate with the socket
-   * @param inboundMessageCallback The callback to use for incoming messages
-   *
-   * @return The new socket instance
-   */
-  def newRepSocket(
-    address: String,
-    inboundMessageCallback: (Seq[String]) => Unit
-  ): SocketLike = withNewContext{ ctx =>
-    new JeroMQSocket(new ZeroMQSocketRunnable(
-      ctx,
-      RepSocket,
-      Some(inboundMessageCallback),
-      Bind(address),
-      Linger(0)
-    ))
-  }
-
-  /**
-   * Creates a new publish socket.
-   *
-   * @param address The address to associate with the socket
-   *
-   * @return The new socket instance
-   */
-  def newPubSocket(
-    address: String
-  ): SocketLike = withNewContext{ ctx =>
-    new JeroMQSocket(new PubSocketRunnable(
-      ctx,
-      Bind(address),
-      Linger(0)
-    ))
-  }
-
-  /**
-   * Creates a new subscribe socket.
-   *
-   * @param address The address to associate with the socket
-   * @param inboundMessageCallback The callback to use for incoming messages
-   *
-   * @return The new socket instance
-   */
-  def newSubSocket(
-    address: String,
-    inboundMessageCallback: (Seq[String]) => Unit
-  ): SocketLike = withNewContext { ctx =>
-    new JeroMQSocket(new ZeroMQSocketRunnable(
-      ctx,
-      SubSocket,
-      Some(inboundMessageCallback),
-      Connect(address),
-      Linger(0),
-      Subscribe.all
-    ))
-  }
-
-  /**
-   * Creates a new router socket.
-   *
-   * @param address The address to associate with the socket
-   * @param inboundMessageCallback The callback to use for incoming messages
-   *
-   * @return The new socket instance
-   */
-  def newRouterSocket(
-    address: String,
-    inboundMessageCallback: (Seq[String]) => Unit
-  ): SocketLike = withNewContext { ctx =>
-    new JeroMQSocket(new ZeroMQSocketRunnable(
-      ctx,
-      RouterSocket,
-      Some(inboundMessageCallback),
-      Bind(address),
-      Linger(0)
-    ))
-  }
-
-  /**
-   * Creates a new dealer socket.
-   *
-   * @param address The address to associate with the socket
-   * @param inboundMessageCallback The callback to use for incoming messages
-   *
-   * @return The new socket instance
-   */
-  def newDealerSocket(
-    address: String,
-    inboundMessageCallback: (Seq[String]) => Unit,
-    identity: String = UUID.randomUUID().toString
-  ): SocketLike = withNewContext{ ctx =>
-    new JeroMQSocket(new ZeroMQSocketRunnable(
-      ctx,
-      DealerSocket,
-      Some(inboundMessageCallback),
-      Connect(address),
-      Linger(0),
-      Identity(identity.getBytes(ZMQ.CHARSET))
-    ))
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/ZMQMessage.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/ZMQMessage.scala b/communication/src/main/scala/com/ibm/spark/communication/ZMQMessage.scala
deleted file mode 100644
index ffa7705..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/ZMQMessage.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication
-
-import akka.util.ByteString
-
-/**
- * Represents a ZeroMQ message containing a collection of Akka ByteString
- * instances.
- *
- * @note This is left in for backwards compatibility!
- *
- * @param frames The collection of Akka ByteString instances
- */
-case class ZMQMessage(frames: ByteString*) {
-  def frame(i: Int) = frames(i)
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/actors/DealerSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/actors/DealerSocketActor.scala b/communication/src/main/scala/com/ibm/spark/communication/actors/DealerSocketActor.scala
deleted file mode 100644
index 0f0497d..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/actors/DealerSocketActor.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.actors
-
-import akka.actor.{Actor, ActorRef}
-import akka.util.ByteString
-import com.ibm.spark.communication.{ZMQMessage, SocketManager}
-import com.ibm.spark.utils.LogLike
-import org.zeromq.ZMQ
-
-/**
- * Represents an actor containing a dealer socket.
- *
- * @param connection The address to connect to
- * @param listener The actor to send incoming messages back to
- */
-class DealerSocketActor(connection: String, listener: ActorRef)
-  extends Actor with LogLike
-{
-  logger.debug(s"Initializing dealer socket actor for $connection")
-  private val manager: SocketManager = new SocketManager
-  private val socket = manager.newDealerSocket(connection, (message: Seq[String]) => {
-    listener ! ZMQMessage(message.map(ByteString.apply): _*)
-  })
-
-  override def postStop(): Unit = {
-    manager.closeSocket(socket)
-  }
-
-  override def receive: Actor.Receive = {
-    case zmqMessage: ZMQMessage =>
-      val frames = zmqMessage.frames.map(byteString =>
-        new String(byteString.toArray, ZMQ.CHARSET))
-      socket.send(frames: _*)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/actors/PubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/actors/PubSocketActor.scala b/communication/src/main/scala/com/ibm/spark/communication/actors/PubSocketActor.scala
deleted file mode 100644
index f74764e..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/actors/PubSocketActor.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.actors
-
-import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.communication.{SocketManager, ZMQMessage}
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.utils.LogLike
-import org.zeromq.ZMQ
-
-/**
- * Represents an actor containing a publish socket.
- *
- * Note: OrderedSupport is used to ensure correct processing order.
- *       A similar pattern may be useful for other socket actors if
- *       issues arise in the future.
- *
- * @param connection The address to bind to
- */
-class PubSocketActor(connection: String)
-  extends Actor with LogLike with OrderedSupport
-{
-  logger.debug(s"Initializing publish socket actor for $connection")
-  private val manager: SocketManager = new SocketManager
-  private val socket = manager.newPubSocket(connection)
-
-  override def postStop(): Unit = {
-    manager.closeSocket(socket)
-  }
-
-  override def receive: Actor.Receive = {
-    case zmqMessage: ZMQMessage => withProcessing {
-      val frames = zmqMessage.frames.map(byteString =>
-        new String(byteString.toArray, ZMQ.CHARSET))
-
-      socket.send(frames: _*)
-    }
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[ZMQMessage])
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/actors/RepSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/actors/RepSocketActor.scala b/communication/src/main/scala/com/ibm/spark/communication/actors/RepSocketActor.scala
deleted file mode 100644
index b8643f5..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/actors/RepSocketActor.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.actors
-
-import akka.actor.{Actor, ActorRef}
-import akka.util.ByteString
-import com.ibm.spark.communication.{SocketManager, ZMQMessage}
-import com.ibm.spark.utils.LogLike
-import org.zeromq.ZMQ
-
-/**
- * Represents an actor containing a reply socket.
- *
- * @param connection The address to bind to
- * @param listener The actor to send incoming messages back to
- */
-class RepSocketActor(connection: String, listener: ActorRef)
-  extends Actor with LogLike
-{
-  logger.debug(s"Initializing reply socket actor for $connection")
-  private val manager: SocketManager = new SocketManager
-  private val socket = manager.newRepSocket(connection, (message: Seq[String]) => {
-    listener ! ZMQMessage(message.map(ByteString.apply): _*)
-  })
-
-  override def postStop(): Unit = {
-    manager.closeSocket(socket)
-  }
-
-  override def receive: Actor.Receive = {
-    case zmqMessage: ZMQMessage =>
-      val frames = zmqMessage.frames.map(byteString =>
-        new String(byteString.toArray, ZMQ.CHARSET))
-      socket.send(frames: _*)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/actors/ReqSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/actors/ReqSocketActor.scala b/communication/src/main/scala/com/ibm/spark/communication/actors/ReqSocketActor.scala
deleted file mode 100644
index e38f2a0..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/actors/ReqSocketActor.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.actors
-
-import akka.actor.{Actor, ActorRef}
-import akka.util.ByteString
-import com.ibm.spark.communication.{ZMQMessage, SocketManager}
-import com.ibm.spark.utils.LogLike
-import org.zeromq.ZMQ
-
-/**
- * Represents an actor containing a request socket.
- *
- * @param connection The address to connect to
- * @param listener The actor to send incoming messages back to
- */
-class ReqSocketActor(connection: String, listener: ActorRef)
-  extends Actor with LogLike
-{
-  logger.debug(s"Initializing request socket actor for $connection")
-  private val manager: SocketManager = new SocketManager
-  private val socket = manager.newReqSocket(connection, (message: Seq[String]) => {
-    listener ! ZMQMessage(message.map(ByteString.apply): _*)
-  })
-
-  override def postStop(): Unit = {
-    manager.closeSocket(socket)
-  }
-
-  override def receive: Actor.Receive = {
-    case zmqMessage: ZMQMessage =>
-      val frames = zmqMessage.frames.map(byteString =>
-        new String(byteString.toArray, ZMQ.CHARSET))
-      socket.send(frames: _*)
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/actors/RouterSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/actors/RouterSocketActor.scala b/communication/src/main/scala/com/ibm/spark/communication/actors/RouterSocketActor.scala
deleted file mode 100644
index 6aa3bc5..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/actors/RouterSocketActor.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.actors
-
-import akka.actor.{Actor, ActorRef}
-import akka.util.ByteString
-import com.ibm.spark.communication.{SocketManager, ZMQMessage}
-import com.ibm.spark.utils.LogLike
-import org.zeromq.ZMQ
-
-/**
- * Represents an actor containing a router socket.
- *
- * @param connection The address to bind to
- * @param listener The actor to send incoming messages back to
- */
-class RouterSocketActor(connection: String, listener: ActorRef)
-  extends Actor with LogLike
-{
-  logger.debug(s"Initializing router socket actor for $connection")
-  private val manager: SocketManager = new SocketManager
-  private val socket = manager.newRouterSocket(connection, (message: Seq[String]) => {
-    listener ! ZMQMessage(message.map(ByteString.apply): _*)
-  })
-
-  override def postStop(): Unit = {
-    manager.closeSocket(socket)
-  }
-
-  override def receive: Actor.Receive = {
-    case zmqMessage: ZMQMessage =>
-      val frames = zmqMessage.frames.map(byteString =>
-        new String(byteString.toArray, ZMQ.CHARSET))
-      socket.send(frames: _*)
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/actors/SubSocketActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/actors/SubSocketActor.scala b/communication/src/main/scala/com/ibm/spark/communication/actors/SubSocketActor.scala
deleted file mode 100644
index 8fef496..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/actors/SubSocketActor.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.actors
-
-import akka.actor.{Actor, ActorRef}
-import akka.util.ByteString
-import com.ibm.spark.communication.{ZMQMessage, SocketManager}
-import com.ibm.spark.utils.LogLike
-
-/**
- * Represents an actor containing a subscribe socket.
- *
- * @param connection The address to connect to
- * @param listener The actor to send incoming messages back to
- */
-class SubSocketActor(connection: String, listener: ActorRef)
-  extends Actor with LogLike
-{
-  logger.debug(s"Initializing subscribe socket actor for $connection")
-  private val manager: SocketManager = new SocketManager
-  private val socket = manager.newSubSocket(connection, (message: Seq[String]) => {
-    listener ! ZMQMessage(message.map(ByteString.apply): _*)
-  })
-
-  override def postStop(): Unit = {
-    manager.closeSocket(socket)
-  }
-
-  override def receive: Actor.Receive = {
-    case _ =>
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/security/Hmac.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/security/Hmac.scala b/communication/src/main/scala/com/ibm/spark/communication/security/Hmac.scala
deleted file mode 100644
index 9f44177..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/security/Hmac.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.security
-
-import javax.crypto.Mac
-import javax.crypto.spec.SecretKeySpec
-
-import com.ibm.spark.communication.security.HmacAlgorithm.HmacAlgorithm
-
-object HmacAlgorithm extends Enumeration {
-  type HmacAlgorithm = Value
-
-  def apply(key: String) = Value(key)
-
-  val MD5     = Value("HmacMD5")
-  val SHA1    = Value("HmacSHA1")
-  val SHA256  = Value("HmacSHA256")
-}
-
-object Hmac {
-  
-  def apply(key: String, algorithm: HmacAlgorithm = HmacAlgorithm.SHA256) =
-    new Hmac(key, algorithm)
-  
-  def newMD5(key: String): Hmac     = this(key, HmacAlgorithm.MD5)
-  def newSHA1(key: String): Hmac    = this(key, HmacAlgorithm.SHA1)
-  def newSHA256(key: String): Hmac  = this(key, HmacAlgorithm.SHA256)
-}
-
-class Hmac(
-  val key: String,
-  val algorithm: HmacAlgorithm = HmacAlgorithm.SHA256
-) {
-
-  private var mac: Mac = _
-  private var secretKeySpec: SecretKeySpec = _
-
-  if (key.nonEmpty) {
-    mac = Mac.getInstance(algorithm.toString)
-    secretKeySpec = new SecretKeySpec(key.getBytes, algorithm.toString)
-    mac.init(secretKeySpec)
-  }
-
-  def apply(items: String*): String = digest(items)
-
-  def digest(items: Seq[String]): String = if (key.nonEmpty) {
-    mac synchronized {
-      items.map(_.getBytes("UTF-8")).foreach(mac.update)
-      mac.doFinal().map("%02x" format _).mkString
-    }
-  } else ""
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/security/SignatureCheckerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/security/SignatureCheckerActor.scala b/communication/src/main/scala/com/ibm/spark/communication/security/SignatureCheckerActor.scala
deleted file mode 100644
index c3fabd7..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/security/SignatureCheckerActor.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.security
-
-import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.utils.LogLike
-
-/**
- * Verifies whether or not a kernel message has a valid signature.
- * @param hmac The HMAC to use for signature validation
- */
-class SignatureCheckerActor(
-  private val hmac: Hmac
-) extends Actor with LogLike with OrderedSupport {
-  override def receive: Receive = {
-    case (signature: String, blob: Seq[_]) => withProcessing {
-      val stringBlob: Seq[String] = blob.map(_.toString)
-      val hmacString = hmac(stringBlob: _*)
-      val isValidSignature = hmacString == signature
-      logger.trace(s"Signature ${signature} validity checked against " +
-        s"hmac ${hmacString} with outcome ${isValidSignature}")
-      sender ! isValidSignature
-    }
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[(String, Seq[_])])
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/security/SignatureManagerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/security/SignatureManagerActor.scala b/communication/src/main/scala/com/ibm/spark/communication/security/SignatureManagerActor.scala
deleted file mode 100644
index f381644..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/security/SignatureManagerActor.scala
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.security
-
-import akka.actor.{Props, ActorRef, Actor}
-import akka.util.Timeout
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.utils.LogLike
-
-import scala.concurrent.duration._
-import akka.pattern.ask
-import akka.pattern.pipe
-
-class SignatureManagerActor(
-  key: String, scheme: String
-) extends Actor with LogLike with OrderedSupport {
-  private val hmac = Hmac(key, HmacAlgorithm(scheme))
-
-  def this(key: String) = this(key, HmacAlgorithm.SHA256.toString)
-
-  // NOTE: Required to provide the execution context for futures with akka
-  import context._
-
-  // NOTE: Required for ask (?) to function... maybe can define elsewhere?
-  implicit val timeout = Timeout(5.seconds)
-
-  //
-  // List of child actors that the signature manager contains
-  //
-  private var signatureChecker: ActorRef = _
-  private var signatureProducer: ActorRef = _
-
-  /**
-   * Initializes all child actors performing tasks for the interpreter.
-   */
-  override def preStart() = {
-    signatureChecker = context.actorOf(
-      Props(classOf[SignatureCheckerActor], hmac),
-      name = SignatureManagerChildActorType.SignatureChecker.toString
-    )
-    signatureProducer = context.actorOf(
-      Props(classOf[SignatureProducerActor], hmac),
-      name = SignatureManagerChildActorType.SignatureProducer.toString
-    )
-  }
-
-  override def receive: Receive = {
-    // Check blob strings for matching digest
-    case (signature: String, blob: Seq[_]) =>
-      startProcessing()
-      val destActor = sender()
-      val sigFuture = signatureChecker ? ((signature, blob))
-
-      sigFuture foreach { case isValid =>
-          destActor ! isValid
-          finishedProcessing()
-      }
-
-    case message: KernelMessage =>
-      startProcessing()
-      val destActor = sender()
-
-      // TODO: Proper error handling for possible exception from mapTo
-      val sigFuture = (signatureProducer ? message).mapTo[String].map(
-        result => message.copy(signature = result)
-      )
-
-      sigFuture foreach { case kernelMessage =>
-        destActor ! kernelMessage
-        finishedProcessing()
-      }
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  override def orderedTypes(): Seq[Class[_]] = Seq(
-    classOf[(String, Seq[_])],
-    classOf[KernelMessage]
-  )
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/security/SignatureProducerActor.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/security/SignatureProducerActor.scala b/communication/src/main/scala/com/ibm/spark/communication/security/SignatureProducerActor.scala
deleted file mode 100644
index 36b5688..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/security/SignatureProducerActor.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.security
-
-import akka.actor.Actor
-import com.ibm.spark.communication.utils.OrderedSupport
-import com.ibm.spark.kernel.protocol.v5.KernelMessage
-import com.ibm.spark.utils.LogLike
-import play.api.libs.json.Json
-
-/**
- * Constructs a signature from any kernel message received.
- * @param hmac The HMAC to use for signature construction
- */
-class SignatureProducerActor(
-  private val hmac: Hmac
-) extends Actor with LogLike with OrderedSupport {
-  override def receive: Receive = {
-    case message: KernelMessage => withProcessing {
-      val signature = hmac(
-        Json.stringify(Json.toJson(message.header)),
-        Json.stringify(Json.toJson(message.parentHeader)),
-        Json.stringify(Json.toJson(message.metadata)),
-        message.contentString
-      )
-      sender ! signature
-    }
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  override def orderedTypes(): Seq[Class[_]] = Seq(classOf[KernelMessage])
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/security/package.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/security/package.scala b/communication/src/main/scala/com/ibm/spark/communication/security/package.scala
deleted file mode 100644
index 5c5b1d5..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/security/package.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication
-
-package object security {
-  object SecurityActorType extends Enumeration {
-    type SecurityActorType = Value
-
-    val SignatureManager    = Value("signature_manager")
-  }
-
-  object SignatureManagerChildActorType extends Enumeration {
-    type SignatureManagerChildActorType = Value
-
-    val SignatureChecker  = Value("signature_checker")
-    val SignatureProducer = Value("signature_producer")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/JeroMQSocket.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/JeroMQSocket.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/JeroMQSocket.scala
deleted file mode 100644
index c95eb69..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/JeroMQSocket.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.zeromq.ZMsg
-
-/**
- * Represents a socket implemented using JeroMQ.
- *
- * @param runnable The underlying ZeroMQ socket runnable to use for the thread
- *                 managed by this socket
- */
-class JeroMQSocket(private val runnable: ZeroMQSocketRunnable)
-  extends SocketLike {
-
-  private val socketThread = new Thread(runnable)
-  socketThread.start()
-
-  /**
-   * Sends a message using this socket.
-   *
-   * @param message The message to send
-   */
-  override def send(message: String*): Unit = {
-    assert(isAlive, "Socket is not alive to be able to send messages!")
-
-    runnable.offer(ZMsg.newStringMsg(message: _*))
-  }
-
-  /**
-   * Closes the socket by closing the runnable and waiting for the underlying
-   * thread to close.
-   */
-  override def close(): Unit = {
-    runnable.close()
-    socketThread.join()
-  }
-
-  /**
-   * Indicates whether or not this socket is alive.
-   *
-   * @return True if alive (thread running), otherwise false
-   */
-  override def isAlive: Boolean = socketThread.isAlive
-
-  /**
-   * Indicates whether or not this socket is ready to send/receive messages.
-   *
-   * @return True if ready (runnable processing messages), otherwise false
-   */
-  override def isReady: Boolean = runnable.isProcessing
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/PubSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/PubSocketRunnable.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/PubSocketRunnable.scala
deleted file mode 100644
index 43f3f3d..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/PubSocketRunnable.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.zeromq.ZMQ.{Socket, Context}
-
-/**
- * Represents the runnable component of a socket specifically targeted towards
- * publish sockets. No incoming messages are processed.
- *
- * @param context The ZMQ context to use with this runnable to create a socket
- * @param socketOptions The options to use when creating the socket
- */
-class PubSocketRunnable(
-  private val context: Context,
-  private val socketOptions: SocketOption*
-) extends ZeroMQSocketRunnable(
-  context,
-  PubSocket,
-  None,
-  socketOptions: _*
-) {
-  /** Does nothing. */
-  override protected def processNextInboundMessage(
-    socket: Socket,
-    flags: Int
-  ): Unit = {}
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/ReqSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/ReqSocketRunnable.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/ReqSocketRunnable.scala
deleted file mode 100644
index 0aa527f..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/ReqSocketRunnable.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.zeromq.ZMQ.{Socket, Context}
-
-/**
- * Represents the runnable component of a socket that processes messages and
- * sends messages placed on an outbound queue. Targeted towards the request
- * socket, this runnable ensures that a message is sent out first and then a
- * response is received before sending the next message.
- *
- * @param context The ZMQ context to use with this runnable to create a socket
- * @param inboundMessageCallback The callback to invoke when receiving a message
- *                               on the socket created
- * @param socketOptions The options to use when creating the socket
- */
-class ReqSocketRunnable(
-  private val context: Context,
-  private val inboundMessageCallback: Option[(Seq[String]) => Unit],
-  private val socketOptions: SocketOption*
-) extends ZeroMQSocketRunnable(
-  context,
-  ReqSocket,
-  inboundMessageCallback,
-  socketOptions: _*
-) {
-  /** Does nothing. */
-  override protected def processNextInboundMessage(
-    socket: Socket,
-    flags: Int
-  ): Unit = {}
-
-  /**
-   * Sends a message and then waits for an incoming response (if a message
-   * was sent from the outbound queue).
-   *
-   * @param socket The socket to use when sending the message
-   *
-   * @return True if a message was sent, otherwise false
-   */
-  override protected def processNextOutboundMessage(socket: Socket): Boolean = {
-    val shouldReceiveMessage = super.processNextOutboundMessage(socket)
-
-    if (shouldReceiveMessage) {
-      super.processNextInboundMessage(socket, 0)
-    }
-
-    shouldReceiveMessage
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/SocketLike.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketLike.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/SocketLike.scala
deleted file mode 100644
index 9bf752d..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketLike.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-/**
- * Represents a generic interface for socket communication.
- */
-trait SocketLike {
-  /**
-   * Sends a message through the socket if alive.
-   *
-   * @throws AssertionError If the socket is not alive when attempting to send
-   *                        a message
-   *
-   * @param message The message to send
-   */
-  def send(message: String*): Unit
-
-  /**
-   * Closes the socket, marking it no longer able to process or send messages.
-   */
-  def close(): Unit
-
-  /**
-   * Returns whether or not the socket is alive (processing new messages and
-   * capable of sending out messages).
-   *
-   * @return True if alive, otherwise false
-   */
-  def isAlive: Boolean
-
-  /**
-   * Returns whether or not the socket is ready to send/receive messages.
-   *
-   * @return True if ready, otherwise false
-   */
-  def isReady: Boolean
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/SocketOption.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketOption.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/SocketOption.scala
deleted file mode 100644
index 7685239..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketOption.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.zeromq.ZMQ
-
-/** Represents an option to provide to a socket. */
-sealed trait SocketOption
-
-/**
- * Represents the linger option used to communicate the millisecond duration
- * to continue processing messages after the socket has been told to close.
- *
- * @note Provide -1 as the duration to wait until all messages are processed
- *
- * @param milliseconds The duration in milliseconds
- */
-case class Linger(milliseconds: Int) extends SocketOption
-
-/**
- * Represents the subscribe option used to filter messages coming into a
- * socket subscribing to a publisher. Uses the provided byte prefix to filter
- * incoming messages.
- *
- * @param topic The array of bytes to use as a filter based on the
- *              bytes at the beginning of incoming messages
- */
-case class Subscribe(topic: Array[Byte]) extends SocketOption
-object Subscribe {
-  val all = Subscribe(ZMQ.SUBSCRIPTION_ALL)
-}
-
-/**
- * Represents the identity option used to identify the socket.
- *
- * @param identity The identity to use with the socket
- */
-case class Identity(identity: Array[Byte]) extends SocketOption
-
-/**
- * Represents the bind option used to tell the socket what address to bind to.
- *
- * @param address The address for the socket to use
- */
-case class Bind(address: String) extends SocketOption
-
-/**
- * Represents the connect option used to tell the socket what address to
- * connect to.
- *
- * @param address The address for the socket to use
- */
-case class Connect(address: String) extends SocketOption

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/SocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketRunnable.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/SocketRunnable.scala
deleted file mode 100644
index 6c033cc..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketRunnable.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import java.util.concurrent.ConcurrentLinkedQueue
-
-/**
- * Represents the interface for a runnable used to send and receive messages
- * for a socket.
- *
- * @param inboundMessageCallback The callback to use when receiving a message
- *                               through this runnable
- */
-abstract class SocketRunnable[T](
-   private val inboundMessageCallback: Option[(Seq[String]) => Unit]
-) extends Runnable {
-
-  /** The collection of messages to be sent out through the socket. */
-  val outboundMessages: ConcurrentLinkedQueue[T] =
-    new ConcurrentLinkedQueue[T]()
-
-  /**
-   * Attempts to add a new message to the outbound queue to be sent out.
-   *
-   * @param message The message to add to the queue
-   *
-   * @return True if successfully queued the message, otherwise false
-   */
-  def offer(message: T): Boolean = outboundMessages.offer(message)
-
-  /**
-   * Indicates whether or not the runnable is processing messages (both
-   * sending and receiving).
-   *
-   * @return True if processing, otherwise false
-   */
-  def isProcessing: Boolean
-
-  /**
-   * Closes the runnable such that it no longer processes messages and also
-   * closes the underlying socket associated with the runnable.
-   */
-  def close(): Unit
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/SocketType.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketType.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/SocketType.scala
deleted file mode 100644
index 7062d85..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/SocketType.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import org.zeromq.ZMQ
-
-/**
- * Represents the type option used to indicate the type of socket to create.
- *
- * @param `type` The type as an integer
- */
-sealed class SocketType(val `type`: Int)
-
-/** Represents a publish socket. */
-case object PubSocket extends SocketType(ZMQ.PUB)
-
-/** Represents a subscribe socket. */
-case object SubSocket extends SocketType(ZMQ.SUB)
-
-/** Represents a reply socket. */
-case object RepSocket extends SocketType(ZMQ.REP)
-
-/** Represents a request socket. */
-case object ReqSocket extends SocketType(ZMQ.REQ)
-
-/** Represents a router socket. */
-case object RouterSocket extends SocketType(ZMQ.ROUTER)
-
-/** Represents a dealer socket. */
-case object DealerSocket extends SocketType(ZMQ.DEALER)

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnable.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnable.scala b/communication/src/main/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnable.scala
deleted file mode 100644
index 6fee716..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/socket/ZeroMQSocketRunnable.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2015 IBM Corp.
- *
- *  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.ibm.spark.communication.socket
-
-import com.ibm.spark.utils.LogLike
-import org.zeromq.{ZMsg, ZMQ}
-import org.zeromq.ZMQ.Context
-
-import scala.collection.JavaConverters._
-import scala.util.Try
-
-/**
- * Represents the runnable component of a socket that processes messages and
- * sends messages placed on an outbound queue.
- *
- * @param context The ZMQ context to use with this runnable to create a socket
- * @param socketType The type of socket to create
- * @param inboundMessageCallback The callback to invoke when receiving a message
- *                               on the socket created
- * @param socketOptions The options to use when creating the socket
- */
-class ZeroMQSocketRunnable(
-  private val context: Context,
-  private val socketType: SocketType,
-  private val inboundMessageCallback: Option[(Seq[String]) => Unit],
-  private val socketOptions: SocketOption*
-) extends SocketRunnable[ZMsg](inboundMessageCallback)
-  with LogLike {
-  require(socketOptions.count {
-    case _: Bind    => true
-    case _: Connect => true
-    case _          => false
-  } == 1, "ZeroMQ socket needs exactly one bind or connect!")
-
-  @volatile private var notClosed: Boolean = true
-  @volatile private var _isProcessing: Boolean = false
-
-  /**
-   * Indicates the processing state of this runnable.
-   *
-   * @return True if processing messages, otherwise false
-   */
-  override def isProcessing: Boolean = _isProcessing
-
-  /**
-   * Processes the provided options, performing associated actions on the
-   * specified socket.
-   *
-   * @param socket The socket to apply actions on
-   */
-  protected def processOptions(socket: ZMQ.Socket): Unit = {
-    val socketOptionsString = socketOptions.map("\n- " + _.toString).mkString("")
-    logger.trace(
-      s"Processing options for socket $socketType: $socketOptionsString"
-    )
-
-    // Split our options based on connection (bind/connect) and everything else
-    val (connectionOptions, otherOptions) = socketOptions.partition {
-      case Bind(_) | Connect(_) => true
-      case _ => false
-    }
-
-    // Apply non-connection options first since some (like identity) must be
-    // run before the socket does a bind/connect
-    otherOptions.foreach {
-      case Linger(milliseconds) => socket.setLinger(milliseconds)
-      case Subscribe(topic)     => socket.subscribe(topic)
-      case Identity(identity)   => socket.setIdentity(identity)
-      case option               => logger.warn(s"Unknown option: $option")
-    }
-
-    // Perform our bind or connect
-    connectionOptions.foreach {
-      case Bind(address)        => socket.bind(address)
-      case Connect(address)     => socket.connect(address)
-      case option               =>
-        logger.warn(s"Unknown connection option: $option")
-    }
-
-    _isProcessing = true
-  }
-
-  /**
-   * Sends the next outbound message from the outbound message queue.
-   *
-   * @param socket The socket to use when sending the message
-   *
-   * @return True if a message was sent, otherwise false
-   */
-  protected def processNextOutboundMessage(socket: ZMQ.Socket): Boolean = {
-    val message = Option(outboundMessages.poll())
-
-    message.foreach(_.send(socket))
-
-    message.nonEmpty
-  }
-
-  /**
-   * Retrieves the next inbound message (if available) and invokes the
-   * inbound message callback.
-   *
-   * @param socket The socket whose next incoming message to retrieve
-   */
-  protected def processNextInboundMessage(
-    socket: ZMQ.Socket,
-    flags: Int = ZMQ.DONTWAIT
-  ): Unit = {
-    Option(ZMsg.recvMsg(socket, flags)).foreach(zMsg => {
-      inboundMessageCallback.foreach(_(zMsg.asScala.toSeq
-        .map(zFrame => new String(zFrame.getData, ZMQ.CHARSET))
-      ))
-    })
-  }
-
-  /**
-   * Creates a new instance of a ZMQ Socket.
-   *
-   * @param zmqContext The context to use to create the socket
-   * @param socketType The type of socket to create
-   *
-   * @return The new ZMQ.Socket instance
-   */
-  protected def newZmqSocket(zmqContext: ZMQ.Context, socketType: Int) =
-    zmqContext.socket(socketType)
-
-  override def run(): Unit = {
-    val socket = newZmqSocket(context, socketType.`type`)//context.socket(socketType.`type`)
-
-    try {
-      processOptions(socket)
-
-      while (notClosed) {
-        Try(processNextOutboundMessage(socket)).failed.foreach(
-          logger.error("Failed to send next outgoing message!", _: Throwable)
-        )
-        Try(processNextInboundMessage(socket)).failed.foreach(
-          logger.error("Failed to retrieve next incoming message!", _: Throwable)
-        )
-        Thread.sleep(1)
-      }
-    } catch {
-      case ex: Exception =>
-        logger.error("Unexpected exception in 0mq socket runnable!", ex)
-    } finally {
-      try{
-        socket.close()
-      } catch {
-        case ex: Exception =>
-          logger.error("Failed to close socket!", _: Throwable)
-      }
-    }
-  }
-
-  /**
-   * Marks the runnable as closed such that it eventually stops processing
-   * messages and closes the socket.
-   *
-   * @throws AssertionError If the runnable is not processing messages or has
-   *                        already been closed
-   */
-  override def close(): Unit = {
-    assert(_isProcessing && notClosed,
-      "Runnable is not processing or is closed!")
-
-    _isProcessing = false
-    notClosed = false
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/communication/src/main/scala/com/ibm/spark/communication/utils/OrderedSupport.scala
----------------------------------------------------------------------
diff --git a/communication/src/main/scala/com/ibm/spark/communication/utils/OrderedSupport.scala b/communication/src/main/scala/com/ibm/spark/communication/utils/OrderedSupport.scala
deleted file mode 100644
index 8f41861..0000000
--- a/communication/src/main/scala/com/ibm/spark/communication/utils/OrderedSupport.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2014 IBM Corp.
- *
- * 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.ibm.spark.communication.utils
-
-import akka.actor.{Actor, Stash}
-import com.ibm.spark.utils.LogLike
-
-/**
- * A trait to enforce ordered processing for messages of particular types.
- */
-trait OrderedSupport extends Actor with Stash with LogLike {
-  /**
-   * Executes instead of the default receive when the Actor has begun
-   * processing. Stashes incoming messages of particular types, defined by
-   * {@link #orderedTypes() orderedTypes} function, for later processing. Uses
-   * the default receive method for all other types. Upon receiving a
-   * FinishedProcessing message, resumes processing all messages with the
-   * default receive.
-   * @return
-   */
-  def waiting : Receive = {
-    case FinishedProcessing =>
-      context.unbecome()
-      unstashAll()
-    case aVal: Any if (orderedTypes().contains(aVal.getClass)) =>
-      logger.trace(s"Stashing message ${aVal} of type ${aVal.getClass}.")
-      stash()
-    case aVal: Any =>
-      logger.trace(s"Forwarding message ${aVal} of type ${aVal.getClass} " +
-        "to default receive.")
-      receive(aVal)
-  }
-
-  /**
-   * Suspends the default receive method for types defined by the
-   * {@link #orderedTypes() orderedTypes} function.
-   */
-  def startProcessing(): Unit = {
-    logger.debug("Actor is in processing state and will stash messages of " +
-      s"types: ${orderedTypes.mkString(" ")}")
-    context.become(waiting, discardOld = false)
-  }
-
-  /**
-   * Resumes the default receive method for all message types.
-   */
-  def finishedProcessing(): Unit = {
-    logger.debug("Actor is no longer in processing state.")
-    self ! FinishedProcessing
-  }
-
-  /**
-   * Executes a block of code, wrapping it in start/finished processing
-   * needed for ordered execution.
-   *
-   * @param block The block to execute
-   * @tparam T The return type of the block
-   * @return The result of executing the block
-   */
-  def withProcessing[T](block: => T): T = {
-    startProcessing()
-    val results = block
-    finishedProcessing()
-    results
-  }
-
-  /**
-   * Defines the types that will be stashed by {@link #waiting() waiting}
-   * while the Actor is in processing state.
-   * @return
-   */
-  def orderedTypes(): Seq[Class[_]]
-
-  case object FinishedProcessing
-}