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:18 UTC
[10/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/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