From 110ba60c6557bf16a3bfc5f7ff5af46a98164c75 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Fri, 1 Feb 2019 11:54:25 +0100 Subject: Refactor server-side interfaces. --- .../kotlin/pl/treksoft/kvision/remote/KVServer.kt | 32 --------------- .../pl/treksoft/kvision/remote/KVServiceManager.kt | 22 ++++++++--- .../kotlin/pl/treksoft/kvision/remote/Profile.kt | 27 +++++++++++++ .../pl/treksoft/kvision/remote/ServiceManager.kt | 45 ---------------------- 4 files changed, 43 insertions(+), 83 deletions(-) delete mode 100644 kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt create mode 100644 kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt delete mode 100644 kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt (limited to 'kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft') diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt deleted file mode 100644 index 4933624e..00000000 --- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt +++ /dev/null @@ -1,32 +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 - -/** - * A server. - */ -expect open class KVServer - -/** - * A user profile. - */ -expect class Profile diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 4b4fcfd2..224a8542 100644 --- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -23,10 +23,25 @@ package pl.treksoft.kvision.remote import kotlin.reflect.KClass +enum class RpcHttpMethod { + POST, + PUT, + DELETE, + OPTIONS +} + +enum class HttpMethod { + GET, + POST, + PUT, + DELETE, + OPTIONS +} + /** * Multiplatform service manager. */ -expect open class KVServiceManager(serviceClass: KClass) : ServiceManager { +expect open class KVServiceManager(serviceClass: KClass) { /** * Binds a given route with a function of the receiver. @@ -107,9 +122,4 @@ expect open class KVServiceManager(serviceClass: KClass) : ServiceMa protected fun bind( function: T.(String?, String?) -> List ) - - /** - * Applies all defined routes to the given server. - */ - fun applyRoutes(k: KVServer) } diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt new file mode 100644 index 00000000..16deb350 --- /dev/null +++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt @@ -0,0 +1,27 @@ +/* + * 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 + +/** + * A user profile. + */ +expect class Profile diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt deleted file mode 100644 index 6f696475..00000000 --- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt +++ /dev/null @@ -1,45 +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 - -enum class RpcHttpMethod { - POST, - PUT, - DELETE, - OPTIONS -} - -enum class HttpMethod { - GET, - POST, - PUT, - DELETE, - OPTIONS -} - -interface ServiceManager { - /** - * Returns the map of defined paths. - */ - fun getCalls(): Map> = mapOf() - -} -- cgit