aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-10-08 22:11:21 +0200
committerRobert Jaros <rjaros@finn.pl>2018-10-08 22:11:21 +0200
commit470953c78c2509224bb452c16f8bbea54e53b3d7 (patch)
treee67b9c03d09bb9ff61b387f6267bdeb2eac48b5b
parenteddd58f3f31954809645bdf2222833424c3f9a73 (diff)
downloadkvision-470953c78c2509224bb452c16f8bbea54e53b3d7.tar.gz
kvision-470953c78c2509224bb452c16f8bbea54e53b3d7.tar.bz2
kvision-470953c78c2509224bb452c16f8bbea54e53b3d7.zip
Better server class abstraction.
-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.kt4
-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.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt)4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt2
6 files changed, 12 insertions, 12 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)
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt b/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
index fcd6b0ab..a1cc40ca 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
@@ -25,10 +25,10 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
/**
- * A Jooby based server.
+ * A server.
* Not used on the js platform.
*/
-actual open class JoobyServer
+actual open class KVServer
/**
* A server request.
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
index 961bf176..c6487494 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
@@ -127,7 +127,7 @@ actual open class ServiceManager<out T> actual constructor(service: T) {
* Applies all defined routes to the given server.
* Not used on the js platform.
*/
- actual fun applyRoutes(k: JoobyServer) {
+ actual fun applyRoutes(k: KVServer) {
}
/**