diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-10-08 22:11:21 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-10-08 22:11:21 +0200 |
commit | 470953c78c2509224bb452c16f8bbea54e53b3d7 (patch) | |
tree | e67b9c03d09bb9ff61b387f6267bdeb2eac48b5b /kvision-modules | |
parent | eddd58f3f31954809645bdf2222833424c3f9a73 (diff) | |
download | kvision-470953c78c2509224bb452c16f8bbea54e53b3d7.tar.gz kvision-470953c78c2509224bb452c16f8bbea54e53b3d7.tar.bz2 kvision-470953c78c2509224bb452c16f8bbea54e53b3d7.zip |
Better server class abstraction.
Diffstat (limited to 'kvision-modules')
-rw-r--r-- | kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt) | 4 | ||||
-rw-r--r-- | kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt | 4 | ||||
-rw-r--r-- | kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt (renamed from kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt) | 2 | ||||
-rw-r--r-- | kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt index ec348a25..cf822e66 100644 --- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt +++ b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt @@ -22,9 +22,9 @@ package pl.treksoft.kvision.remote /** - * A Jooby based server. + * A server. */ -expect open class JoobyServer +expect open class KVServer /** * A server request. diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt index 8225a785..07f60851 100644 --- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt +++ b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt @@ -128,9 +128,9 @@ expect open class ServiceManager<out T>(service: T) { /** * Applies all defined routes to the given server. - * @param k a Jooby server + * @param k a server */ - fun applyRoutes(k: JoobyServer) + fun applyRoutes(k: KVServer) /** * Returns the map of defined paths. diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt index 928892a2..76f1ee30 100644 --- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt +++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt @@ -36,7 +36,7 @@ import kotlinx.coroutines.async as coroutinesAsync /** * A Jooby based server. */ -actual open class JoobyServer(init: JoobyServer.() -> Unit) : Kooby() { +actual open class KVServer(init: KVServer.() -> Unit) : Kooby() { init { @Suppress("LeakingThis") assets("/", "index.html") diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt index edaa9ba3..b37d7319 100644 --- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt +++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt @@ -39,7 +39,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) { val LOG: Logger = LoggerFactory.getLogger(ServiceManager::class.java.name) } - protected val routes: MutableList<JoobyServer.() -> Unit> = mutableListOf() + protected val routes: MutableList<KVServer.() -> Unit> = mutableListOf() val mapper = jacksonObjectMapper() var counter: Int = 0 @@ -299,7 +299,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) { method: RpcHttpMethod, path: String, handler: (Request, Response) -> Unit - ): JoobyServer.() -> Unit { + ): KVServer.() -> Unit { return { when (method) { RpcHttpMethod.POST -> post(path, handler) @@ -322,9 +322,9 @@ actual open class ServiceManager<out T> actual constructor(val service: T) { /** * Applies all defined routes to the given server. - * @param k a Jooby server + * @param k a server */ - actual fun applyRoutes(k: JoobyServer) { + actual fun applyRoutes(k: KVServer) { routes.forEach { it.invoke(k) } |