aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-common/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-12-18 18:54:27 +0100
committerRobert Jaros <rjaros@finn.pl>2018-12-18 18:54:27 +0100
commit161264957dc1b41cd6716ee7777139c5e29589f5 (patch)
treec7977850428319b17888f2c7ceffc2557e68a360 /kvision-modules/kvision-common/src/main
parent1fbd940e57b6917ab6677ff285f632f0d10f4809 (diff)
downloadkvision-161264957dc1b41cd6716ee7777139c5e29589f5.tar.gz
kvision-161264957dc1b41cd6716ee7777139c5e29589f5.tar.bz2
kvision-161264957dc1b41cd6716ee7777139c5e29589f5.zip
Refactor modules.
Diffstat (limited to 'kvision-modules/kvision-common/src/main')
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt107
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt37
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt37
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt45
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt102
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt28
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt34
7 files changed, 0 insertions, 390 deletions
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
deleted file mode 100644
index cb1b44d0..00000000
--- a/kvision-modules/kvision-common/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/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
deleted file mode 100644
index 7953ea01..00000000
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
+++ /dev/null
@@ -1,37 +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
-
-import kotlinx.serialization.Serializable
-
-@Serializable
-data class JsonRpcRequest(val id: Int, val method: String, val params: List<String?>, val jsonrpc: String = "2.0") {
- constructor() : this(0, "", listOf())
-}
-
-@Serializable
-data class JsonRpcResponse(
- val id: Int? = null,
- val result: String? = null,
- val error: String? = null,
- val jsonrpc: String = "2.0"
-)
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
deleted file mode 100644
index cf822e66..00000000
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
+++ /dev/null
@@ -1,37 +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 server request.
- */
-expect interface Request
-
-/**
- * A user profile.
- */
-expect class Profile
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
deleted file mode 100644
index 6f696475..00000000
--- a/kvision-modules/kvision-common/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<String, Pair<String, RpcHttpMethod>> = mapOf()
-
-}
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
deleted file mode 100644
index 90926656..00000000
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
+++ /dev/null
@@ -1,102 +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
-
-import kotlin.reflect.KClass
-
-/**
- * Multiplatform service manager for Spring Boot.
- */
-expect open class SpringServiceManager<T : Any>(serviceClass: KClass<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.() -> 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) -> 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) -> 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) -> 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) -> 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) -> RET,
- route: String? = null,
- method: RpcHttpMethod = RpcHttpMethod.POST
- )
-}
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
deleted file mode 100644
index 86a72b33..00000000
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ /dev/null
@@ -1,28 +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.types
-
-expect class Date
-
-expect fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date
-
-expect fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt
deleted file mode 100644
index ce4adca4..00000000
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt
+++ /dev/null
@@ -1,34 +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.types
-
-import kotlinx.serialization.Serializable
-
-/**
- * A serializable class for a multiplatform File type.
- */
-@Serializable
-data class KFile(
- val name: String,
- val size: Int,
- val content: String? = null
-)