[PIO-104] Make proper implementation of plugins - Remove start() method of EventServerPlugin and EngineServerPlugin - Send prediction result to outputSniffers in the engine server
Closes #407 Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/965c73f0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/965c73f0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/965c73f0 Branch: refs/heads/livedoc Commit: 965c73f0f5dae726b930f4de12cf613fbe23bf58 Parents: 5813b80 Author: Naoki Takezoe <[email protected]> Authored: Fri Jul 28 13:27:49 2017 -0700 Committer: Donald Szeto <[email protected]> Committed: Fri Jul 28 13:27:49 2017 -0700 ---------------------------------------------------------------------- .../scala/org/apache/predictionio/workflow/CreateServer.scala | 4 ++++ .../org/apache/predictionio/workflow/EngineServerPlugin.scala | 2 -- .../org/apache/predictionio/data/api/EventServerPlugin.scala | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/965c73f0/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala b/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala index 8ef36e2..8f0aed7 100644 --- a/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala +++ b/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala @@ -579,6 +579,7 @@ class ServerActor[Q, P]( pluginContext.outputBlockers.values.foldLeft(result) { case (r, p) => p.process(engineInstance, queryJValue, r, pluginContext) } + pluginsActorRef ! (engineInstance, queryJValue, result) // Bookkeeping val servingEndTime = DateTime.now @@ -679,6 +680,9 @@ class ServerActor[Q, P]( val pluginType = segments(0) val pluginName = segments(1) pluginType match { + case EngineServerPlugin.outputBlocker => + pluginContext.outputBlockers(pluginName).handleREST( + pluginArgs) case EngineServerPlugin.outputSniffer => pluginsActorRef ? PluginsActor.HandleREST( pluginName = pluginName, http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/965c73f0/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPlugin.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPlugin.scala b/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPlugin.scala index 545fdb3..0857405 100644 --- a/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPlugin.scala +++ b/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPlugin.scala @@ -26,8 +26,6 @@ trait EngineServerPlugin { val pluginDescription: String val pluginType: String - def start(context: EngineServerPluginContext): Unit - def process( engineInstance: EngineInstance, query: JValue, http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/965c73f0/data/src/main/scala/org/apache/predictionio/data/api/EventServerPlugin.scala ---------------------------------------------------------------------- diff --git a/data/src/main/scala/org/apache/predictionio/data/api/EventServerPlugin.scala b/data/src/main/scala/org/apache/predictionio/data/api/EventServerPlugin.scala index cfb5ee2..5fe46a3 100644 --- a/data/src/main/scala/org/apache/predictionio/data/api/EventServerPlugin.scala +++ b/data/src/main/scala/org/apache/predictionio/data/api/EventServerPlugin.scala @@ -23,8 +23,6 @@ trait EventServerPlugin { val pluginDescription: String val pluginType: String - def start(context: EventServerPluginContext): Unit - def process(eventInfo: EventInfo, context: EventServerPluginContext) def handleREST(appId: Int, channelId: Option[Int], arguments: Seq[String]): String
