aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-common-remote/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-12-20 10:19:55 +0100
committerRobert Jaros <rjaros@finn.pl>2018-12-20 10:19:55 +0100
commitb995f4b927c230e0ae15d51920390dc6afff6caa (patch)
tree9ad79bf5ecdbb85cac89b20afb85e3e318a80136 /kvision-modules/kvision-common-remote/src/main
parent474195d3aa862686712cfe6c800dc43f8fee8ec5 (diff)
downloadkvision-b995f4b927c230e0ae15d51920390dc6afff6caa.tar.gz
kvision-b995f4b927c230e0ae15d51920390dc6afff6caa.tar.bz2
kvision-b995f4b927c230e0ae15d51920390dc6afff6caa.zip
Refactor server side modules.
Diffstat (limited to 'kvision-modules/kvision-common-remote/src/main')
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt107
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt (renamed from kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt)11
2 files changed, 8 insertions, 110 deletions
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
deleted file mode 100644
index cb1b44d0..00000000
--- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package pl.treksoft.kvision.remote
-
-/**
- * Multiplatform service manager for Jooby.
- */
-expect open class JoobyServiceManager<T : Any>(service: T) : ServiceManager {
-
- /**
- * Binds a given route with a function of the receiver.
- * @param function a function of the receiver
- * @param route a route
- * @param method a HTTP method
- */
- protected inline fun <reified RET> bind(
- noinline function: suspend T.(Request?) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-
- /**
- * Binds a given route with a function of the receiver.
- * @param function a function of the receiver
- * @param route a route
- * @param method a HTTP method
- */
- protected inline fun <reified PAR, reified RET> bind(
- noinline function: suspend T.(PAR, Request?) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-
- /**
- * Binds a given route with a function of the receiver.
- * @param function a function of the receiver
- * @param route a route
- * @param method a HTTP method
- */
- protected inline fun <reified PAR1, reified PAR2, reified RET> bind(
- noinline function: suspend T.(PAR1, PAR2, Request?) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-
- /**
- * Binds a given route with a function of the receiver.
- * @param function a function of the receiver
- * @param route a route
- * @param method a HTTP method
- */
- protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
- noinline function: suspend T.(PAR1, PAR2, PAR3, Request?) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-
- /**
- * Binds a given route with a function of the receiver.
- * @param function a function of the receiver
- * @param route a route
- * @param method a HTTP method
- */
- protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
- noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, Request?) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-
- /**
- * Binds a given route with a function of the receiver.
- * @param function a function of the receiver
- * @param route a route
- * @param method a HTTP method
- */
- protected inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified RET> bind(
- noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5, Request?) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-
- /**
- * Applies all defined routes to the given server.
- * @param k a server
- */
- fun applyRoutes(k: KVServer)
-
-}
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index bc45d72b..4b4fcfd2 100644
--- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -24,9 +24,9 @@ package pl.treksoft.kvision.remote
import kotlin.reflect.KClass
/**
- * Multiplatform service manager for Spring Boot.
+ * Multiplatform service manager.
*/
-expect open class SpringServiceManager<T : Any>(serviceClass: KClass<T>) : ServiceManager {
+expect open class KVServiceManager<T : Any>(serviceClass: KClass<T>) : ServiceManager {
/**
* Binds a given route with a function of the receiver.
@@ -105,6 +105,11 @@ expect open class SpringServiceManager<T : Any>(serviceClass: KClass<T>) : Servi
* @param function a function of the receiver
*/
protected fun bind(
- function: T.(String) -> List<RemoteSelectOption>
+ function: T.(String?, String?) -> List<RemoteSelectOption>
)
+
+ /**
+ * Applies all defined routes to the given server.
+ */
+ fun applyRoutes(k: KVServer)
}