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:16 UTC

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

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)
-      }
-    }
-  }
-}