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 | 7 +----- .../pl/treksoft/kvision/remote/KVServiceManager.kt | 7 +----- .../kotlin/pl/treksoft/kvision/remote/Profile.kt | 29 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt (limited to 'kvision-modules/kvision-server-ktor') diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt index 81d6ee34..29084e5d 100644 --- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt +++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt @@ -27,9 +27,4 @@ import kotlinx.coroutines.async as coroutinesAsync /** * A Ktor based server. */ -actual open class KVServer(val services: List>) - -/** - * A user profile. - */ -actual typealias Profile = CommonProfile +open class KVServer(val services: List>) diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index ecf2d290..471eff2a 100644 --- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -36,7 +36,7 @@ import kotlin.reflect.KClass * Multiplatform service manager for Ktor. */ @UseExperimental(ExperimentalCoroutinesApi::class) -actual open class KVServiceManager actual constructor(val serviceClass: KClass) : ServiceManager { +actual open class KVServiceManager actual constructor(val serviceClass: KClass) { companion object { val LOG: Logger = LoggerFactory.getLogger(KVServiceManager::class.java.name) @@ -392,9 +392,4 @@ actual open class KVServiceManager actual constructor(val serviceClass: } } ?: null as T } - - /** - * Applies all defined routes to the given server. - */ - actual fun applyRoutes(k: KVServer) {} } diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt new file mode 100644 index 00000000..77ceb339 --- /dev/null +++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/Profile.kt @@ -0,0 +1,29 @@ +/* + * 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 + +import org.pac4j.core.profile.CommonProfile + +/** + * A user profile. + */ +actual typealias Profile = CommonProfile -- cgit