diff options
author | vlad <vlad@drivergrp.com> | 2016-07-16 15:55:19 -0400 |
---|---|---|
committer | vlad <vlad@drivergrp.com> | 2016-07-16 15:55:19 -0400 |
commit | c948b1f2c1c7a5246d5c1a7cba05e6e27a9d7b57 (patch) | |
tree | 8737b3bc5e49c287173f52ca936d36fceb86b4d0 /src/main/scala/com/drivergrp/core/module.scala | |
parent | 482459a63433c281b7a576236111e6a86e4521c9 (diff) | |
download | driver-core-c948b1f2c1c7a5246d5c1a7cba05e6e27a9d7b57.tar.gz driver-core-c948b1f2c1c7a5246d5c1a7cba05e6e27a9d7b57.tar.bz2 driver-core-c948b1f2c1c7a5246d5c1a7cba05e6e27a9d7b57.zip |
Modules consolidation
Diffstat (limited to 'src/main/scala/com/drivergrp/core/module.scala')
-rw-r--r-- | src/main/scala/com/drivergrp/core/module.scala | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/main/scala/com/drivergrp/core/module.scala b/src/main/scala/com/drivergrp/core/module.scala deleted file mode 100644 index 94dd6a3..0000000 --- a/src/main/scala/com/drivergrp/core/module.scala +++ /dev/null @@ -1,39 +0,0 @@ -package com.drivergrp.core - -import akka.http.scaladsl.server.{Route, RouteConcatenation} - - -object module { - import scala.reflect.runtime.universe._ - - trait Module { - val name: String - def route: Route - def routeTypes: Seq[Type] - - def activate(): Unit = {} - def deactivate(): Unit = {} - } - - class SimpleModule(val name: String, val route: Route, routeType: Type) extends Module { - def routeTypes: Seq[Type] = Seq(routeType) - } - - /** - * Module implementation which may be used to composed a few - * - * @param name more general name of the composite module, - * must be provided as there is no good way to automatically - * generalize the name from the composed modules' names - * @param modules modules to compose into a single one - */ - class CompositeModule(val name: String, modules: Seq[Module]) - extends Module with RouteConcatenation { - - def route: Route = modules.map(_.route).reduce(_ ~ _) - def routeTypes = modules.flatMap(_.routeTypes) - - override def activate() = modules.foreach(_.activate()) - override def deactivate() = modules.reverse.foreach(_.deactivate()) - } -}
\ No newline at end of file |