├── core ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle.kts ├── src │ └── main │ │ └── kotlin │ │ └── com │ │ └── aseemsavio │ │ └── bibilia │ │ └── core │ │ └── api │ │ ├── BibiliaServiceApi.kt │ │ └── BibiliaMapService.kt ├── gradlew.bat └── gradlew ├── rest ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle.kts ├── gradlew.bat ├── src │ └── main │ │ └── kotlin │ │ └── com │ │ └── aseemsavio │ │ └── vertx │ │ └── rest │ │ └── dsl │ │ └── RestDsl.kt └── gradlew ├── database ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle.kts ├── src │ └── main │ │ └── kotlin │ │ └── com │ │ └── aseemsavio │ │ └── bibilia │ │ └── database │ │ ├── api │ │ ├── BibiliaDatabaseApi.kt │ │ └── BibiliaInMemoryDatabase.kt │ │ └── extensions │ │ └── BibiliaDatabaseExtensions.kt ├── gradlew.bat └── gradlew ├── gradle.properties ├── server ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle.kts ├── src │ └── main │ │ └── kotlin │ │ └── com.aseemsavio.bibilia.server │ │ └── MainVerticle.kt ├── gradlew.bat └── gradlew ├── data-preparation ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle.kts ├── src │ └── main │ │ └── kotlin │ │ └── com │ │ └── aseemsavio │ │ └── bibilia │ │ └── data │ │ ├── BibiliaDataReader.kt │ │ └── BibliaMapStructure.kt ├── gradlew.bat └── gradlew ├── rest-entrypoint ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle.kts ├── gradlew.bat ├── gradlew └── src │ └── main │ └── kotlin │ └── com │ └── aseemsavio │ └── bibilia │ └── rest │ └── endpoint │ └── routes │ └── BibiliaRoutes.kt ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── domain ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── src │ └── main │ │ └── kotlin │ │ └── com │ │ └── aseemsavio │ │ └── bibilia │ │ └── data │ │ ├── ConfigData.kt │ │ ├── BibiliaJsonData.kt │ │ └── BibiliaData.kt ├── build.gradle.kts ├── gradlew.bat └── gradlew ├── settings.gradle.kts ├── utils └── config │ ├── build.gradle.kts │ └── src │ └── main │ ├── resources │ └── application.json │ └── kotlin │ └── com │ └── aseemsavio │ └── bibilia │ └── utils │ └── config │ └── lightbend │ ├── ConfigurationDsl.kt │ └── Configuration.kt ├── README.md ├── gradlew.bat ├── gradlew ├── LICENSE └── documentation └── api-docs └── api-doc-v1.0.0.md /core/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official -------------------------------------------------------------------------------- /server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data-preparation/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest-entrypoint/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .idea 3 | .gradle 4 | .editorconfig 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aseemsavio/Biblia-Sacra-Vulgata/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /domain/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aseemsavio/Biblia-Sacra-Vulgata/HEAD/domain/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /core/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /domain/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /rest/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /database/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /data-preparation/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /rest-entrypoint/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "biblia-sacra-vulgata" 2 | include( 3 | "data-preparation", 4 | "database", 5 | "core", 6 | "rest", 7 | "domain", 8 | "rest-entrypoint", 9 | "server" 10 | ) 11 | include( 12 | "utils:config" 13 | ) 14 | -------------------------------------------------------------------------------- /core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | } 7 | 8 | dependencies { 9 | implementation(kotlin("stdlib-jdk8")) 10 | implementation(project(":database")) 11 | implementation(project(":domain")) 12 | } 13 | -------------------------------------------------------------------------------- /database/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | } 7 | 8 | dependencies { 9 | implementation(kotlin("stdlib-jdk8")) 10 | implementation(project(":domain")) 11 | implementation(project(":data-preparation")) 12 | } 13 | -------------------------------------------------------------------------------- /domain/src/main/kotlin/com/aseemsavio/bibilia/data/ConfigData.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.data 2 | 3 | data class ConfigData( 4 | val port: Int, 5 | val developers: List, 6 | val database: String, 7 | val versionInfo: List 8 | ) 9 | 10 | data class ConfigVersionData( 11 | val name: String, 12 | val link: String, 13 | ) 14 | -------------------------------------------------------------------------------- /utils/config/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | } 7 | 8 | val vertxVersion = "4.1.4" 9 | 10 | dependencies { 11 | implementation(kotlin("stdlib-jdk8")) 12 | implementation("io.vertx:vertx-config:4.2.1") 13 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") 14 | 15 | /* https://github.com/lightbend/config */ 16 | implementation("com.typesafe:config:1.4.1") 17 | 18 | implementation(project(":domain")) 19 | } 20 | -------------------------------------------------------------------------------- /utils/config/src/main/resources/application.json: -------------------------------------------------------------------------------- 1 | { 2 | "port": 8080, 3 | "developers": [ 4 | "Aseem Savio" 5 | ], 6 | "database": "InMemory", 7 | "versions": [ 8 | { 9 | "version": "Vulgate", 10 | "link": "https://raw.githubusercontent.com/aseemsavio/Latin-Vulgate-English-Translation-JSON/master/Generated-JSON/Bibles/vulgate.json" 11 | }, 12 | { 13 | "version": "CPDV", 14 | "link": "https://raw.githubusercontent.com/aseemsavio/Latin-Vulgate-English-Translation-JSON/master/Generated-JSON/Bibles/cpdv.json" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /domain/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | id("org.jetbrains.kotlin.plugin.serialization") 7 | } 8 | 9 | dependencies { 10 | implementation(kotlin("stdlib-jdk8")) 11 | // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core 12 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") 13 | // Kotlin JSON serialization 14 | implementation("org.jetbrains.kotlin:kotlin-serialization:1.5.30") 15 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2") 16 | } 17 | -------------------------------------------------------------------------------- /data-preparation/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | id("org.jetbrains.kotlin.plugin.serialization") 7 | } 8 | 9 | dependencies { 10 | implementation(kotlin("stdlib-jdk8")) 11 | implementation(project(":domain")) 12 | // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core 13 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") 14 | // Kotlin JSON serialization 15 | implementation("org.jetbrains.kotlin:kotlin-serialization:1.5.30") 16 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2") 17 | } 18 | -------------------------------------------------------------------------------- /utils/config/src/main/kotlin/com/aseemsavio/bibilia/utils/config/lightbend/ConfigurationDsl.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.utils.config.lightbend 2 | 3 | import com.typesafe.config.Config 4 | 5 | /** 6 | * Gives the [Int] value of a config property 7 | */ 8 | fun Config.int(fn: () -> String): Int = getInt(fn()) 9 | 10 | /** 11 | * Gives the [String] value of a config property 12 | */ 13 | fun Config.string(fn: () -> String): String = getString(fn()) 14 | 15 | /** 16 | * Gives the [List] of [String] values of a config property 17 | */ 18 | fun Config.strings(fn: () -> String): List = getStringList(fn()) 19 | 20 | /** 21 | * Gives the [Boolean] value of a config property 22 | */ 23 | fun Config.boolean(fn: () -> String): Boolean = getBoolean(fn()) 24 | 25 | /** 26 | * Gives a [List] of [Config] objects of a config property 27 | */ 28 | fun Config.list(fn: () -> String): List = getConfigList(fn()) 29 | -------------------------------------------------------------------------------- /utils/config/src/main/kotlin/com/aseemsavio/bibilia/utils/config/lightbend/Configuration.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.utils.config.lightbend 2 | 3 | import com.aseemsavio.bibilia.data.ConfigData 4 | import com.aseemsavio.bibilia.data.ConfigVersionData 5 | import com.typesafe.config.ConfigFactory 6 | 7 | /** 8 | * Loads configuration and returns a [Config] object. 9 | * Config information can be retrieved from it. 10 | */ 11 | private suspend fun loadConfig() = ConfigFactory.load() 12 | 13 | suspend fun config(): ConfigData = with(loadConfig()) { 14 | ConfigData( 15 | port = int { "port" }, 16 | developers = strings { "developers" }, 17 | database = string { "database" }, 18 | versionInfo = list { "versions" }.map { 19 | ConfigVersionData( 20 | it.string { "version" }, 21 | it.string { "link" } 22 | ) 23 | } 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /rest/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | id("org.jetbrains.kotlin.plugin.serialization") 7 | } 8 | 9 | val vertxVersion = "4.1.4" 10 | 11 | dependencies { 12 | implementation(kotlin("stdlib-jdk8")) 13 | 14 | /* Vert.x */ 15 | implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion")) 16 | implementation("io.vertx:vertx-web-client") 17 | implementation("io.vertx:vertx-web") 18 | implementation("io.vertx:vertx-lang-kotlin") 19 | 20 | /* Coroutines */ 21 | implementation("io.vertx:vertx-lang-kotlin-coroutines") 22 | // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core 23 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") 24 | 25 | /* Kotlin JSON serialization */ 26 | implementation("org.jetbrains.kotlin:kotlin-serialization:1.5.30") 27 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2") 28 | } 29 | -------------------------------------------------------------------------------- /server/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | } 7 | 8 | val vertxVersion = "4.1.4" 9 | 10 | dependencies { 11 | implementation(kotlin("stdlib-jdk8")) 12 | 13 | /* Vert.x */ 14 | implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion")) 15 | implementation("io.vertx:vertx-web-client") 16 | implementation("io.vertx:vertx-web") 17 | implementation("io.vertx:vertx-lang-kotlin") 18 | 19 | /* Coroutines */ 20 | implementation("io.vertx:vertx-lang-kotlin-coroutines") 21 | // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core 22 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") 23 | 24 | implementation(project(":database")) 25 | implementation(project(":core")) 26 | implementation(project(":domain")) 27 | implementation(project(":rest-entrypoint")) 28 | implementation(project(":data-preparation")) 29 | implementation(project(":utils:config")) 30 | } 31 | -------------------------------------------------------------------------------- /data-preparation/src/main/kotlin/com/aseemsavio/bibilia/data/BibiliaDataReader.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.data 2 | 3 | import kotlinx.coroutines.* 4 | import kotlinx.serialization.decodeFromString 5 | import kotlinx.serialization.json.Json 6 | import java.net.URL 7 | 8 | suspend fun bible(url: URL): BibleJson = Json { ignoreUnknownKeys = true }.decodeFromString(getRawBibleJson(url)) 9 | 10 | val VULGATE_URL = URL("https://raw.githubusercontent.com/aseemsavio/Latin-Vulgate-English-Translation-JSON/master/Generated-JSON/Bibles/vulgate.json") 11 | val CPDV_URL = URL("https://raw.githubusercontent.com/aseemsavio/Latin-Vulgate-English-Translation-JSON/master/Generated-JSON/Bibles/cpdv.json") 12 | 13 | private suspend fun getRawBibleJson(url: URL): String = 14 | withContext(Dispatchers.IO) { url.readText() } 15 | 16 | /** 17 | * Does map operation in parallel 18 | * 19 | * todo: add this in its own module in the future 20 | */ 21 | suspend fun Iterable.pMap(fn: suspend (A) -> B): List = coroutineScope { 22 | map { async { fn(it) } }.awaitAll() 23 | } 24 | -------------------------------------------------------------------------------- /rest-entrypoint/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("prepareKotlinBuildScriptModel") {} 2 | 3 | plugins { 4 | kotlin("jvm") 5 | application 6 | } 7 | 8 | val vertxVersion = "4.1.4" 9 | 10 | dependencies { 11 | implementation(kotlin("stdlib-jdk8")) 12 | implementation(project(":core")) 13 | implementation(project(":rest")) 14 | implementation(project(":domain")) 15 | 16 | 17 | /* Vert.x */ 18 | implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion")) 19 | implementation("io.vertx:vertx-web-client") 20 | implementation("io.vertx:vertx-web") 21 | implementation("io.vertx:vertx-lang-kotlin") 22 | 23 | /* Coroutines */ 24 | implementation("io.vertx:vertx-lang-kotlin-coroutines") 25 | // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core 26 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") 27 | 28 | /*// Kotlin JSON serialization 29 | implementation("org.jetbrains.kotlin:kotlin-serialization:1.5.30") 30 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2")*/ 31 | } 32 | -------------------------------------------------------------------------------- /domain/src/main/kotlin/com/aseemsavio/bibilia/data/BibiliaJsonData.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.data 2 | 3 | import kotlinx.serialization.Serializable 4 | import java.net.URL 5 | 6 | @Serializable 7 | data class JsonVerse( 8 | val chapter: Int, 9 | val verse: Int, 10 | val text: String, 11 | val notes: String? = null 12 | ) 13 | 14 | @Serializable 15 | data class JsonChapter( 16 | val chapter: Int, 17 | val verses: List 18 | ) 19 | 20 | @Serializable 21 | data class JsonBook( 22 | val bookNumber: Int, 23 | val book: String, 24 | val testament: String, 25 | val chapters: List 26 | ) 27 | 28 | @Serializable 29 | data class JsonTestament( 30 | val testament: String, 31 | val books: List 32 | ) 33 | 34 | @Serializable 35 | data class BookNamesItem( 36 | val testament: String, 37 | val bookNames: Set 38 | ) 39 | 40 | @JvmInline 41 | value class Version(val value: String) 42 | 43 | data class VersionInfo( 44 | val version: Version, 45 | val url: URL 46 | ) 47 | 48 | typealias BibleJson = List 49 | 50 | val String.v get() = Version(this) 51 | -------------------------------------------------------------------------------- /server/src/main/kotlin/com.aseemsavio.bibilia.server/MainVerticle.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.server 2 | 3 | import com.aseemsavio.bibilia.database.extensions.initialiseDatabases 4 | import com.aseemsavio.bibilia.database.extensions.versions 5 | import com.aseemsavio.bibilia.core.api.BibiliaMapService 6 | import com.aseemsavio.bibilia.database.extensions.db 7 | import com.aseemsavio.bibilia.rest.endpoint.routes.BibiliaRoutes 8 | import com.aseemsavio.bibilia.utils.config.lightbend.config 9 | 10 | import io.vertx.kotlin.coroutines.CoroutineVerticle 11 | import io.vertx.ext.web.Router 12 | import io.vertx.kotlin.coroutines.await 13 | 14 | class MainVerticle : CoroutineVerticle() { 15 | override suspend fun start() { 16 | val config = config() 17 | val router = Router.router(vertx) 18 | val databases = initialiseDatabases(versions(config), config.database.db) 19 | val service = BibiliaMapService(databases) 20 | BibiliaRoutes(service).configureRoutes(router) 21 | vertx.createHttpServer() 22 | .requestHandler(router) 23 | .listen(config.port) 24 | .await() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /database/src/main/kotlin/com/aseemsavio/bibilia/database/api/BibiliaDatabaseApi.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.database.api 2 | 3 | import com.aseemsavio.bibilia.data.* 4 | 5 | interface BibiliaDatabase : TestamentDatabase, BooksDatabase, ChaptersDatabase, VersesDatabase 6 | 7 | interface TestamentDatabase { 8 | fun getTestamentNames(): TestamentNames 9 | fun getTestament(testament: Testament): BooksMap 10 | } 11 | 12 | interface BooksDatabase { 13 | fun getBookNames(testament: Testament?): BookNames 14 | fun getBook(testament: Testament, book: BibleBookName): ChaptersMap 15 | } 16 | 17 | interface ChaptersDatabase { 18 | fun getTotalChapters(testament: Testament, book: BibleBookName): TotalChapters 19 | fun getChapter(testament: Testament, book: BibleBookName, chapter: BibleChapter): VersesList 20 | } 21 | 22 | interface VersesDatabase { 23 | fun getTotalVerses(testament: Testament, book: BibleBookName, chapter: BibleChapter): TotalVerses 24 | fun getVerse(testament: Testament, book: BibleBookName, chapter: BibleChapter, verse: VerseNumber): Verse? 25 | fun getVerses( 26 | testament: Testament, 27 | book: BibleBookName, 28 | chapter: BibleChapter, 29 | from: VerseNumber, 30 | to: VerseNumber 31 | ): VersesList 32 | } 33 | -------------------------------------------------------------------------------- /domain/src/main/kotlin/com/aseemsavio/bibilia/data/BibiliaData.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.data 2 | 3 | @JvmInline 4 | value class Testament(val value: String) 5 | 6 | @JvmInline 7 | value class BibleBookName(val value: String) 8 | 9 | @JvmInline 10 | value class BibleChapter(val value: Int) 11 | 12 | data class Books( 13 | val books: Map 14 | ) 15 | 16 | data class Book( 17 | val book: Map 18 | ) 19 | 20 | data class Chapter( 21 | val book: BibleBookName, 22 | val verses: List 23 | ) 24 | 25 | data class Verse( 26 | val book: BibleBookName, 27 | val testament: Testament, 28 | val chapter: Int, 29 | val verse: Int, 30 | val text: String, 31 | val notes: String? 32 | ) 33 | 34 | val String.t get() = Testament(this) 35 | val String.b get() = BibleBookName(this) 36 | val Int.c get() = BibleChapter(this) 37 | 38 | 39 | typealias BibiliaMap = TestamentMap 40 | typealias TestamentMap = Map 41 | typealias BooksMap = Map 42 | typealias ChaptersMap = Map 43 | typealias VersesList = List 44 | 45 | typealias BookNames = Map?> 46 | typealias VerseNumber = Int 47 | typealias TotalChapters = Int 48 | typealias TotalVerses = Int 49 | typealias TestamentNames = Set 50 | -------------------------------------------------------------------------------- /data-preparation/src/main/kotlin/com/aseemsavio/bibilia/data/BibliaMapStructure.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.data 2 | 3 | /** 4 | * The main purpose of this function is to build independent [Verse] objects from multiple JSON objects. 5 | * This will enable storing them in an efficient data structure - [BibiliaMap], which enables for efficient querying. 6 | */ 7 | fun BibleJson.verses(): List = 8 | this.map { 9 | it.chapters.map { c -> 10 | Chapter( 11 | BibleBookName(it.book), 12 | c.verses.map { v -> 13 | Verse(BibleBookName(it.book), Testament(it.testament), c.chapter, v.verse, v.text, v.notes) 14 | }) 15 | } 16 | }.flatten() 17 | .map { it.verses } 18 | .flatten() 19 | 20 | /** 21 | * This function groups the list of [Verse]s into a multi-layered map in the following order: 22 | * 23 | * 1. [Testament] 24 | * 2. [BibleBookName] 25 | * 3. [BibleChapter] 26 | * 27 | * The final layer, [BibleChapter] will finally have a list of [Verse]s mimicking the original 28 | * organisation in the Scriptures. 29 | */ 30 | fun List.toMap(): BibiliaMap { 31 | return this.groupBy { Testament(it.testament.value) } 32 | .mapValues { (_, testament) -> 33 | testament.groupBy { BibleBookName(it.book.value) } 34 | .mapValues { (_, book) -> 35 | book.groupBy { BibleChapter(it.chapter) } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/aseemsavio/bibilia/core/api/BibiliaServiceApi.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.core.api 2 | 3 | import com.aseemsavio.bibilia.data.* 4 | 5 | interface BibiliaService : TestamentService, BookService, ChaptersService, VersesService 6 | 7 | interface TestamentService { 8 | fun getTestamentNames(version: Version): Set 9 | fun getTestaments(version: Version, testamentName: String?): List 10 | } 11 | 12 | interface BookService { 13 | fun getBookNames(version: Version, testamentName: String? = null): List 14 | fun getBook(version: Version, bookName: String): JsonBook? 15 | } 16 | 17 | interface ChaptersService { 18 | fun getTotalChapters(version: Version, testament: Testament, book: BibleBookName): TotalChapters 19 | fun getChapter(version: Version, testament: Testament, book: BibleBookName, chapter: BibleChapter): List 20 | } 21 | 22 | interface VersesService { 23 | fun getTotalVerses(version: Version, testament: Testament, book: BibleBookName, chapter: BibleChapter): TotalVerses 24 | fun getVerse(version: Version, testament: Testament, book: BibleBookName, chapter: BibleChapter, verse: VerseNumber): JsonVerse? 25 | fun getVerses( 26 | version: Version, 27 | testament: Testament, 28 | book: BibleBookName, 29 | chapter: BibleChapter, 30 | from: VerseNumber, 31 | to: VerseNumber 32 | ): List 33 | } 34 | -------------------------------------------------------------------------------- /database/src/main/kotlin/com/aseemsavio/bibilia/database/extensions/BibiliaDatabaseExtensions.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.database.extensions 2 | 3 | import com.aseemsavio.bibilia.data.* 4 | import com.aseemsavio.bibilia.database.api.BibiliaDatabase 5 | import com.aseemsavio.bibilia.database.api.BibiliaInMemoryDatabase 6 | import java.lang.IllegalArgumentException 7 | import java.net.URL 8 | 9 | sealed class Database 10 | object InMemoryDatabase : Database() 11 | 12 | /** 13 | * Data will always be brought in as a [BibleJson] object. 14 | * Depending on the type of [Database] requested, this function returns it after 15 | * injecting it with the transformed data it needs. 16 | */ 17 | fun BibleJson.initiateDatabase(database: Database): BibiliaDatabase { 18 | return when (database) { 19 | is InMemoryDatabase -> BibiliaInMemoryDatabase(this.verses().toMap()) 20 | } 21 | } 22 | 23 | /** 24 | * Initialises all the versions' databases. 25 | */ 26 | suspend fun initialiseDatabases( 27 | versions: List, 28 | databaseType: Database 29 | ) = versions.pMap { it.version to bible(it.url).initiateDatabase(databaseType) }.toMap() 30 | 31 | /** 32 | * Gives a list of supported versions 33 | */ 34 | fun versions(configData: ConfigData): List = configData.versionInfo.map { 35 | VersionInfo(Version(it.name), URL(it.link)) 36 | } 37 | 38 | typealias BibiliaDatabases = Map 39 | 40 | /** 41 | * Getting a [Database] type from a [String]. 42 | * New databases when added need to be added here. 43 | */ 44 | val String.db get() = when(this) { 45 | "InMemory" -> InMemoryDatabase 46 | else -> throw IllegalArgumentException("Unknown database type requested!") 47 | } 48 | -------------------------------------------------------------------------------- /database/src/main/kotlin/com/aseemsavio/bibilia/database/api/BibiliaInMemoryDatabase.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.database.api 2 | 3 | import com.aseemsavio.bibilia.data.* 4 | 5 | /** 6 | * Map based Database Implementation for Bibilia Sacra Vulgata 7 | */ 8 | class BibiliaInMemoryDatabase (private val bible: BibiliaMap) : BibiliaDatabase { 9 | 10 | override fun getTestamentNames(): TestamentNames = bible.keys 11 | 12 | override fun getTestament(testament: Testament): BooksMap = 13 | bible[testament] ?: emptyMap() 14 | 15 | override fun getBookNames(testament: Testament?): BookNames = 16 | if (testament == null) getTestamentNames().associateWith { bible[it]?.keys } else 17 | when (testament) { 18 | Testament("OT") -> setOf(Testament("OT")).associateWith { bible[it]?.keys } 19 | Testament("NT") -> setOf(Testament("NT")).associateWith { bible[it]?.keys } 20 | else -> emptyMap() 21 | } 22 | 23 | override fun getBook(testament: Testament, book: BibleBookName): ChaptersMap = bible[testament]?.get(book) ?: emptyMap() 24 | 25 | override fun getTotalChapters(testament: Testament, book: BibleBookName): TotalChapters = 26 | bible[testament]?.get(book)?.size ?: 0 27 | 28 | override fun getChapter(testament: Testament, book: BibleBookName, chapter: BibleChapter): VersesList = 29 | bible[testament]?.get(book)?.get(chapter) ?: emptyList() 30 | 31 | override fun getTotalVerses(testament: Testament, book: BibleBookName, chapter: BibleChapter): TotalVerses = 32 | bible[testament]?.get(book)?.get(chapter)?.size ?: 0 33 | 34 | override fun getVerse(testament: Testament, book: BibleBookName, chapter: BibleChapter, verse: VerseNumber): Verse? = 35 | bible[testament]?.get(book)?.get(chapter)?.firstOrNull { it.verse == verse } 36 | 37 | override fun getVerses( 38 | testament: Testament, 39 | book: BibleBookName, 40 | chapter: BibleChapter, 41 | from: VerseNumber, 42 | to: VerseNumber 43 | ): VersesList = bible[testament]?.get(book)?.get(chapter)?.filter { it.verse in from..to } ?: emptyList() 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/kotlin/com/aseemsavio/bibilia/core/api/BibiliaMapService.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.core.api 2 | 3 | import com.aseemsavio.bibilia.data.* 4 | import com.aseemsavio.bibilia.database.extensions.BibiliaDatabases 5 | 6 | class BibiliaMapService(private val databases: BibiliaDatabases) : BibiliaService { 7 | 8 | override fun getTestamentNames(version: Version): Set = 9 | databases[version]?.getTestamentNames()?.map { it.value }?.toSet() ?: emptySet() 10 | 11 | override fun getTestaments(version: Version, testamentName: String?): List { 12 | TODO("Not yet implemented") 13 | } 14 | 15 | override fun getBookNames(version: Version, testamentName: String?): List { 16 | fun getBooks(t: String) = databases[version]?.getBookNames(Testament(t))?.map { testament -> 17 | testament.value?.map { it.value }?.let { BookNamesItem(testament.key.value, it.toSet()) } 18 | }?.filterNotNull() ?: emptyList() 19 | 20 | return if (testamentName == null) getTestamentNames(version).map { t -> getBooks(t) }.flatten() 21 | else getBooks(testamentName) 22 | } 23 | 24 | override fun getBook(version: Version, bookName: String): JsonBook? { 25 | TODO("Not yet implemented") 26 | } 27 | 28 | override fun getTotalChapters(version: Version, testament: Testament, book: BibleBookName): TotalChapters = 29 | databases[version]?.getTotalChapters(testament, book) ?: 0 30 | 31 | override fun getChapter( 32 | version: Version, 33 | testament: Testament, 34 | book: BibleBookName, 35 | chapter: BibleChapter 36 | ): List = 37 | databases[version]?.getChapter(testament, book, chapter)?.map { 38 | JsonVerse(it.chapter, it.verse, it.text, it.notes) 39 | } ?: emptyList() 40 | 41 | 42 | override fun getTotalVerses( 43 | version: Version, 44 | testament: Testament, 45 | book: BibleBookName, 46 | chapter: BibleChapter 47 | ): TotalVerses = 48 | databases[version]?.getTotalVerses(testament, book, chapter) ?: 0 49 | 50 | override fun getVerse( 51 | version: Version, 52 | testament: Testament, 53 | book: BibleBookName, 54 | chapter: BibleChapter, 55 | verse: VerseNumber 56 | ): JsonVerse? = databases[version]?.getVerse(testament, book, chapter, verse)?.let { 57 | JsonVerse(it.chapter, it.verse, it.text, it.notes) 58 | } 59 | 60 | override fun getVerses( 61 | version: Version, 62 | testament: Testament, 63 | book: BibleBookName, 64 | chapter: BibleChapter, 65 | from: VerseNumber, 66 | to: VerseNumber 67 | ): List = databases[version]?.getVerses(testament, book, chapter, from, to)?.map { 68 | JsonVerse(it.chapter, it.verse, it.text, it.notes) 69 | } ?: emptyList() 70 | } 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ⛪️ Biblia Sacra Vulgata - v1.0.0 2 | 3 | ![](src/resources/images/catholic.jpg) 4 | 5 | Biblia Sacra Vulgata is an [Apache 2.0](LICENSE) licenced, open-sourced API project primarily serving the 6 | _Original Latin Vulgate_ ( ✝️ Biblia Sacra Vulgata) and its English Translation - 7 | Catholic Public Domain Version (CPDV) with study notes. 8 | In addition to the Vulgate, it will also support the other versions and/or translations of the Scriptures approved by the Church in the future. 9 | 10 | This API does not employ a backing database, in lieu, uses an in-house built in-memory data store, 11 | which allows for constant time look-ups. In other words, the user get lightning fast replies 💨. 12 | 13 | This API is designed to be lenient (or forgiving 🥺, if you will) with the requests, given the nature of the content served by the application. 14 | For example, If the user requests verses 2 through 30 from a chapter with only 20 verses, 15 | the application would respond with the available information (verses 2 through 20) rather than throwing an error. This is a 16 | conscious design decision and contributors are solicited to be mindful of it. 17 | 18 | > **Caution:** This application is not production-ready yet. Check out the releases tab for the first release. 19 | 20 | ### 👉🏻 Contents 21 | 1. [REST API Documentation](documentation/api-docs/api-doc-v1.0.0.md) 22 | 2. [Running the application locally](#running-the-app-locally) 23 | 24 | --- 25 | 26 | ### Running the app locally 27 | 28 | The official version of the app is shipped as docker images 🐟. However, if you wish to contribute or 29 | tweak the app for personal use, you may proceed with the following steps. 30 | 31 | #### Prerequisites: 32 | 33 | 1. ☕️ **Java** v11.0 or above 34 | 2. **Gradle** (optional) - If you do not have Gradle installed, you could possibly get away with 35 | the included Gradle Wrapper. 36 | 3. 💡 **IntelliJ Idea** (optional) - I personally prefer this IDE for its incredible support for building 37 | JVM applications. But, hey, your preferred IDE would do just fine too! 😊 38 | 39 | After cloning the project, here are some gradle scripts to trigger 40 | some customary functionalities. 41 | 42 | #### To launch your tests: 43 | ``` 44 | ./gradlew clean test 45 | ``` 46 | 47 | #### To package your application: 48 | ``` 49 | ./gradlew clean assemble 50 | ``` 51 | 52 | #### To run your application: 53 | ``` 54 | ./gradlew clean run 55 | ``` 56 | 57 | --- 58 | **Disclaimer:** Some parts of the CPDV or the Latin Vulgate may look different 59 | from the versions used in the Church today (verse number, and such. You can read about it [here](https://bible.usccb.org/bible/psalms/0)). Hence, it is adviced to use the Vulgate 60 | for study and the newer translations (which, by the way will become available in this application soon!! 🙌🏼 🎉 🎊) in/for the Divine Liturgy. 61 | 62 | To contribute, feel free to fork and create PRs! 😇 63 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /core/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /domain/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /rest/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /server/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /database/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /data-preparation/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /rest-entrypoint/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /rest/src/main/kotlin/com/aseemsavio/vertx/rest/dsl/RestDsl.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.vertx.rest.dsl 2 | 3 | import io.vertx.ext.web.RoutingContext 4 | import kotlinx.serialization.encodeToString 5 | import kotlinx.serialization.json.Json 6 | import java.lang.IllegalArgumentException 7 | 8 | /** 9 | * Returns the value of a path parameter as a [String]. 10 | */ 11 | fun RoutingContext.pp(fn: () -> String): String = pathParam(fn()) 12 | 13 | /** 14 | * Returns the query param as a String. 15 | * If null, it returns the default value. 16 | */ 17 | fun RoutingContext.qp(default: String = "", fn: () -> String): String = queryParam(fn())?.firstOrNull() ?: default 18 | 19 | /** 20 | * Returns the value of a path parameter as an [Int]. 21 | */ 22 | fun RoutingContext.ppAsInt(fn: () -> String): Int = pathParam(fn()).toInt() 23 | 24 | /** 25 | * Handles success responses. Takes in an optional status code (defaulted to 200) and a text or JSON payload. 26 | */ 27 | fun RoutingContext.ok(statusCode: Int = 200, fn: RestResponseBuilder.() -> Unit) { 28 | if (statusCode in 200..299) this.request().response().statusCode = statusCode 29 | else throw IllegalArgumentException("Success status codes must be between 200 and 299.") 30 | RestResponseBuilder().apply(fn).build(this) 31 | } 32 | 33 | /** 34 | * Handles not found requests. 35 | */ 36 | fun RoutingContext.notFound(fn: RestResponseBuilder.() -> Unit) { 37 | this.request().response().statusCode = 404 38 | RestResponseBuilder().apply(fn).build(this) 39 | } 40 | 41 | /** 42 | * Takes in a nullable response (This can be a nullable collection or a nullable object), 43 | * a success response (eg: [ok]) and a failure response (eg: [notFound]). 44 | * If the response is either null or empty, the failure function is executed. 45 | * For the flip case, the success function is executed. 46 | */ 47 | fun fold(response: Any?, success: () -> Unit, failure: () -> Unit) { 48 | when (response) { 49 | is Int -> if (response == 0) failure() else success() /* This is specific to this app only */ 50 | is Collection<*> -> if (response.isEmpty()) failure() else success() 51 | else -> if (response == null) failure() else success() 52 | } 53 | } 54 | 55 | /** 56 | * Builds the REST response. 57 | */ 58 | class RestResponseBuilder { 59 | var json: String? = null 60 | private var text: String? = null 61 | 62 | val format: Json = Json { encodeDefaults = false } 63 | 64 | /** 65 | * Serialises an object annotated with @[Serializable] into a JSON string. 66 | */ 67 | inline fun json(fn: () -> T?) { 68 | this.json = format.encodeToString(fn()) 69 | } 70 | 71 | /** 72 | * Serialises a Kotlin/Java object to plain text. 73 | */ 74 | fun text(fn: () -> Any?) { 75 | this.text = fn()?.toString() 76 | } 77 | 78 | fun build(context: RoutingContext) { 79 | if (json != null && text != null) 80 | throw IllegalArgumentException("Only one of the properties (json, text) is allowed to be set.") 81 | 82 | if (json == null && text == null) { 83 | context.request().response().end() 84 | return 85 | } 86 | 87 | context.request().response() 88 | .also { 89 | if (json == null) { 90 | it.putHeader("content-type", "text/plain") 91 | it.end(text) 92 | } else { 93 | it.putHeader("content-type", "application/json") 94 | it.end(json) 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /core/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /domain/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /rest/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /server/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /database/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /data-preparation/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /rest-entrypoint/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /rest-entrypoint/src/main/kotlin/com/aseemsavio/bibilia/rest/endpoint/routes/BibiliaRoutes.kt: -------------------------------------------------------------------------------- 1 | package com.aseemsavio.bibilia.rest.endpoint.routes 2 | 3 | import com.aseemsavio.bibilia.core.api.BibiliaService 4 | import com.aseemsavio.bibilia.data.b 5 | import com.aseemsavio.bibilia.data.c 6 | import com.aseemsavio.bibilia.data.t 7 | import com.aseemsavio.bibilia.data.v 8 | import com.aseemsavio.vertx.rest.dsl.* 9 | import io.vertx.ext.web.Route 10 | import io.vertx.ext.web.Router 11 | import io.vertx.ext.web.RoutingContext 12 | import io.vertx.kotlin.coroutines.dispatcher 13 | import kotlinx.coroutines.CoroutineScope 14 | import kotlinx.coroutines.Dispatchers 15 | import kotlinx.coroutines.launch 16 | import kotlin.coroutines.CoroutineContext 17 | 18 | /** 19 | * @author Aseem Savio 20 | * @since v1 21 | * 22 | * This is where all the route configuration should go. 23 | */ 24 | class BibiliaRoutes( 25 | private val service: BibiliaService 26 | ) : CoroutineScope { 27 | 28 | private val default = "Vulgate" 29 | 30 | suspend fun configureRoutes(router: Router) { 31 | with(router) { 32 | `health check route`(this) 33 | `testament routes`(this) 34 | `get book names in testament route`(this) 35 | `get all book names route`(this) 36 | `chapter count route`(this) 37 | `get chapter route`(this) 38 | `verse count route`(this) 39 | `get verse route`(this) 40 | `get verses route`(this) 41 | } 42 | } 43 | 44 | private suspend fun `health check route`(router: Router) { 45 | router.get("/").serve { 46 | with(it) { 47 | val res = 48 | "Gloria Patri, et filio, et spiritui sancto in saecula saeculorum! Biblia Sacra Vulgata is UP!!" 49 | ok { text { res } } 50 | } 51 | } 52 | } 53 | 54 | private suspend fun `testament routes`(router: Router) { 55 | router.get("$PREFIX/testaments").serve { 56 | with(it) { 57 | val version = qp(default) { "version" } 58 | val res = service.getTestamentNames(version.v) 59 | fold( 60 | res, 61 | { ok { json { res } } }, 62 | { notFound { } } 63 | ) 64 | } 65 | } 66 | } 67 | 68 | private suspend fun `get book names in testament route`(router: Router) { 69 | router.get("$PREFIX/testament/:testament/books").serve { 70 | with(it) { 71 | val testament = pp { "testament" } 72 | val version = qp(default) { "version" } 73 | val res = service.getBookNames(version.v, testament) 74 | fold( 75 | res, 76 | { ok { json { res } } }, 77 | { notFound { } } 78 | ) 79 | } 80 | } 81 | } 82 | 83 | private suspend fun `get all book names route`(router: Router) { 84 | router.get("$PREFIX/books").serve { 85 | with(it) { 86 | val version = qp(default) { "version" } 87 | val res = service.getBookNames(version.v) 88 | fold( 89 | res, 90 | { ok { json { res } } }, 91 | { notFound { } } 92 | ) 93 | } 94 | } 95 | } 96 | 97 | private suspend fun `chapter count route`(router: Router) { 98 | router.get("$PREFIX/testament/:testament/book/:book/chapterCount").serve { 99 | with(it) { 100 | val testament = pp { "testament" } 101 | val book = pp { "book" } 102 | val version = qp(default) { "version" } 103 | val res = service.getTotalChapters(version.v, testament.t, book.b) 104 | fold( 105 | res, 106 | { ok { text { res } } }, 107 | { notFound { } } 108 | ) 109 | } 110 | } 111 | } 112 | 113 | private suspend fun `get chapter route`(router: Router) { 114 | router.get("$PREFIX/testament/:testament/book/:book/chapter/:chapter").serve { 115 | with(it) { 116 | val testament = pp { "testament" } 117 | val book = pp { "book" } 118 | val chapter = ppAsInt { "chapter" } 119 | val version = qp(default) { "version" } 120 | val res = service.getChapter(version.v, testament.t, book.b, chapter.c) 121 | fold( 122 | res, 123 | { ok { json { res } } }, 124 | { notFound { } } 125 | ) 126 | } 127 | } 128 | } 129 | 130 | private suspend fun `verse count route`(router: Router) { 131 | router.get("$PREFIX/testament/:testament/book/:book/chapter/:chapter/verseCount").serve { 132 | with(it) { 133 | val testament = pp { "testament" } 134 | val book = pp { "book" } 135 | val chapter = ppAsInt { "chapter" } 136 | val version = qp(default) { "version" } 137 | val res = service.getTotalVerses(version.v, testament.t, book.b, chapter.c) 138 | fold( 139 | res, 140 | { ok { text { res } } }, 141 | { notFound { } } 142 | ) 143 | } 144 | } 145 | } 146 | 147 | private suspend fun `get verse route`(router: Router) { 148 | router.get("$PREFIX/testament/:testament/book/:book/chapter/:chapter/verse/:verse").serve { 149 | with(it) { 150 | val testament = pp { "testament" } 151 | val book = pp { "book" } 152 | val chapter = ppAsInt { "chapter" } 153 | val verse = ppAsInt { "verse" } 154 | val version = qp(default) { "version" } 155 | val res = service.getVerse(version.v, testament.t, book.b, chapter.c, verse) 156 | fold( 157 | res, 158 | { ok { json { res } } }, 159 | { notFound { } } 160 | ) 161 | } 162 | } 163 | } 164 | 165 | private suspend fun `get verses route`(router: Router) { 166 | router.get("$PREFIX/testament/:testament/book/:book/chapter/:chapter/verses/from/:from/to/:to").serve { 167 | with(it) { 168 | val testament = pp { "testament" } 169 | val book = pp { "book" } 170 | val chapter = ppAsInt { "chapter" } 171 | val from = ppAsInt { "from" } 172 | val to = ppAsInt { "to" } 173 | val version = qp(default) { "version" } 174 | val res = service.getVerses(version.v, testament.t, book.b, chapter.c, from, to) 175 | fold( 176 | res, 177 | { ok { json { res } } }, 178 | { notFound { } } 179 | ) 180 | } 181 | } 182 | } 183 | 184 | override val coroutineContext: CoroutineContext 185 | get() = Dispatchers.IO 186 | 187 | /** 188 | * An extension method for simplifying coroutines usage with Vert.x Web routers 189 | */ 190 | private suspend fun Route.serve(fn: suspend (RoutingContext) -> Unit) { 191 | handler { context -> 192 | launch(context.vertx().dispatcher()) { 193 | try { 194 | fn(context) 195 | } catch (e: Exception) { 196 | e.printStackTrace() 197 | context.fail(e) 198 | } 199 | } 200 | } 201 | } 202 | } 203 | 204 | private const val PREFIX = "/api/v1" 205 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /documentation/api-docs/api-doc-v1.0.0.md: -------------------------------------------------------------------------------- 1 | # ⛪️ Biblia Sacra Vulgata 2 | 3 | --- 4 | 5 | ## API Documentation - v1.0.0 6 | 7 | All the routes below can be accompanied by the optional query param - `version` to query 8 | a certain _supported_ version of the Scriptures. 9 | If not given, the version will be defaulted to the **Vulgate**. 10 | 11 | Example: 12 | 13 | ```shell 14 | curl "https://example.com/api/v1/testaments?version=Vulgate" 15 | ``` 16 | The open source version of this application supports two versions namely, Vulgate and CPDV (Catholic Public Domain Version). 17 | 18 | > Be informed that the CPDV or the Vulgate cannot be utilised in the Sacred Liturgy 19 | due to a slightly deviant numbering system in certain books. 20 | 21 | ## Testaments 22 | 23 | > Version 1.0.0 24 | 25 | Gives the name-codes of the testaments in the Bible. Only these will be accepted by the API 26 | through the rest of the end points. 27 | 28 | ```plaintext 29 | GET /testaments 30 | ``` 31 | 32 | Example request: 33 | 34 | ```shell 35 | curl "https://example.com/api/v1/testaments" 36 | ``` 37 | 38 | Example response: 39 | 40 | ```json 41 | [ 42 | "OT", 43 | "NT" 44 | ] 45 | ``` 46 | 47 | --- 48 | ## Book Names in a Testament 49 | 50 | > Version 1.0.0 51 | 52 | Gives info on the books in the given testament. Only these names will be accepted 53 | by the API. 54 | 55 | ```plaintext 56 | GET /testament/:testament/books 57 | ``` 58 | 59 | Supported attributes: 60 | 61 | | Attribute | Type | Required | Description | Example | 62 | |:------------|:---------|:---------|:----------------------------|:----------| 63 | | `testament` | String | Yes | Code Name of the testament. | NT | 64 | 65 | Supported Query Params: 66 | 67 | | Attribute | Type | Required | Description | Example | 68 | |:------------|:---------|:---------|:----------------------------|:----------| 69 | | `version` | String | No | Bible Version | Vulgate | 70 | 71 | Example request: 72 | 73 | ```shell 74 | curl "https://example.com/api/v1/testament/NT/books" 75 | ``` 76 | 77 | Example response: 78 | 79 | ```json 80 | [ 81 | { 82 | "testament": "NT", 83 | "bookNames": [ 84 | "Matthew", 85 | "Mark", 86 | "Luke", 87 | "John", 88 | "Acts", 89 | "Romans", 90 | "1-Corinthians", 91 | "2-Corinthians", 92 | "Galatians", 93 | "Ephesians", 94 | "Philippians", 95 | "Colossians", 96 | "1-Thessalonians", 97 | "2-Thessalonians", 98 | "1-Timothy", 99 | "2-Timothy", 100 | "Titus", 101 | "Philemon", 102 | "Hebrews", 103 | "James", 104 | "1-Peter", 105 | "2-Peter", 106 | "1-John", 107 | "2-John", 108 | "3-John", 109 | "Jude", 110 | "Revelation" 111 | ] 112 | } 113 | ] 114 | ``` 115 | --- 116 | ## Get all the Books 117 | 118 | > Version 1.0.0 119 | 120 | Gives info on all the books in the Bible. Only these names will be accepted 121 | by the API. 122 | 123 | ```plaintext 124 | GET /books 125 | ``` 126 | 127 | Example request: 128 | 129 | ```shell 130 | curl "https://example.com/api/v1/books" 131 | ``` 132 | 133 | Example response: 134 | 135 | ```json 136 | [ 137 | { 138 | "testament": "OT", 139 | "bookNames": [ 140 | "Genesis", 141 | "Exodus", 142 | "Leviticus", 143 | "Numbers", 144 | "Deuteronomy", 145 | "Joshua", 146 | "Judges", 147 | "Ruth", 148 | "1-Samuel", 149 | "2-Samuel", 150 | "1-Kings", 151 | "2-Kings", 152 | "1-Chronicles", 153 | "2-Chronicles", 154 | "Ezra", 155 | "Nehemiah", 156 | "Tobit", 157 | "Judith", 158 | "Esther", 159 | "Job", 160 | "Psalms", 161 | "Proverbs", 162 | "Ecclesiastes", 163 | "Song", 164 | "Wisdom", 165 | "Sirach", 166 | "Isaiah", 167 | "Jeremiah", 168 | "Lamentations", 169 | "Baruch", 170 | "Ezekiel", 171 | "Daniel", 172 | "Hosea", 173 | "Joel", 174 | "Amos", 175 | "Obadiah", 176 | "Jonah", 177 | "Micah", 178 | "Nahum", 179 | "Habakkuk", 180 | "Zephaniah", 181 | "Haggai", 182 | "Zechariah", 183 | "Malachi", 184 | "1-Maccabees", 185 | "2-Maccabees" 186 | ] 187 | }, 188 | { 189 | "testament": "NT", 190 | "bookNames": [ 191 | "Matthew", 192 | "Mark", 193 | "Luke", 194 | "John", 195 | "Acts", 196 | "Romans", 197 | "1-Corinthians", 198 | "2-Corinthians", 199 | "Galatians", 200 | "Ephesians", 201 | "Philippians", 202 | "Colossians", 203 | "1-Thessalonians", 204 | "2-Thessalonians", 205 | "1-Timothy", 206 | "2-Timothy", 207 | "Titus", 208 | "Philemon", 209 | "Hebrews", 210 | "James", 211 | "1-Peter", 212 | "2-Peter", 213 | "1-John", 214 | "2-John", 215 | "3-John", 216 | "Jude", 217 | "Revelation" 218 | ] 219 | } 220 | ] 221 | ``` 222 | --- 223 | ## Chapter Count in a Book 224 | 225 | > Version 1.0.0 226 | 227 | Gives the chapter count in a book. This route will be deprecated in the future 228 | and will be replaced by an `info` route that provides metadata on the book. 229 | 230 | ```plaintext 231 | GET /testament/:testament/book/:book/chapterCount 232 | ``` 233 | 234 | Supported attributes: 235 | 236 | | Attribute | Type | Required | Description |Example | 237 | |:------------|:---------|:---------|:-----------------------------|:----------| 238 | | `testament` | String | Yes | Code Name of the Testament. | OT | 239 | | `book` | String | Yes | Code Name of the Book. | Sirach | 240 | 241 | Supported Query Params: 242 | 243 | | Attribute | Type | Required | Description | Example | 244 | |:------------|:---------|:---------|:----------------------------|:----------| 245 | | `version` | String | No | Bible Version | CPDV | 246 | 247 | Example request: 248 | 249 | ```shell 250 | curl "https://example.com/api/v1/testament/OT/book/Sirach/chapterCount?version=CPDV" 251 | ``` 252 | 253 | Example response: 254 | 255 | ```json 256 | 52 257 | ``` 258 | 259 | --- 260 | 261 | ## Get all the verses in a chapter 262 | 263 | > Version 1.0.0 264 | 265 | Gives all the verses in a chapter. 266 | 267 | ```plaintext 268 | GET /testament/:testament/book/:book/chapter/:chapter 269 | ``` 270 | 271 | Supported attributes: 272 | 273 | | Attribute | Type | Required | Description | Example | 274 | |:------------|:---------|:---------|:----------------------------|:----------| 275 | | `testament` | String | Yes | Code Name of the Testament. | OT | 276 | | `book` | String | Yes | Code Name of the Book. | Psalms | 277 | | `chapter` | Int | Yes | Chapter Number. | 116 | 278 | 279 | Supported Query Params: 280 | 281 | | Attribute | Type | Required | Description | Example | 282 | |:------------|:---------|:---------|:----------------------------|:----------| 283 | | `version` | String | No | Bible Version | CPDV | 284 | 285 | Example request: 286 | 287 | ```shell 288 | curl "https://example.com/api/v1/testament/OT/book/Psalms/chapter/116?version=CPDV" 289 | ``` 290 | 291 | Example response: 292 | 293 | ```json 294 | [ 295 | { 296 | "chapter": 116, 297 | "verse": 1, 298 | "text": "Alleluia. All nations, praise the Lord. All peoples, praise him." 299 | }, 300 | { 301 | "chapter": 116, 302 | "verse": 2, 303 | "text": "For his mercy has been confirmed over us. And the truth of the Lord remains for all eternity." 304 | } 305 | ] 306 | ``` 307 | Note that the chapter 117 is 116 here (in the Latin Vulgate version). Read more about why [here](https://bible.usccb.org/bible/psalms/0). 308 | 309 | --- 310 | 311 | ## Verse Count in a Chapter 312 | 313 | > Version 1.0.0 314 | 315 | Gives the verse count in a chapter. 316 | 317 | ```plaintext 318 | GET /testament/:testament/book/:book/chapter/:chapter/verseCount 319 | ``` 320 | 321 | Supported attributes: 322 | 323 | | Attribute | Type | Required | Description |Example | 324 | |:------------|:---------|:---------|:-----------------------------|:----------| 325 | | `testament` | String | Yes | Code Name of the Testament. | OT | 326 | | `book` | String | Yes | Code Name of the Book. | Sirach | 327 | | `chapter` | Int | Yes | Chapter Number. | Sirach | 328 | 329 | Supported Query Params: 330 | 331 | | Attribute | Type | Required | Description | Example | 332 | |:------------|:---------|:---------|:----------------------------|:----------| 333 | | `version` | String | No | Bible Version | Vulgate | 334 | 335 | Example request: 336 | 337 | ```shell 338 | curl "https://example.com/api/v1/testament/OT/book/Sirach/chapter/12/verseCount" 339 | ``` 340 | 341 | Example response: 342 | 343 | ```json 344 | 19 345 | ``` 346 | 347 | --- 348 | 349 | ## Get a specific Verse 350 | 351 | > Version 1.0.0 352 | 353 | Gives a specific verse. 354 | 355 | ```plaintext 356 | GET /testament/:testament/book/:book/chapter/:chapter/verse/:verse 357 | ``` 358 | 359 | Supported attributes: 360 | 361 | | Attribute | Type | Required | Description | Example | 362 | |:------------|:---------|:---------|:----------------------------|:----------| 363 | | `testament` | String | Yes | Code Name of the Testament. | OT | 364 | | `book` | String | Yes | Code Name of the Book. | Psalms | 365 | | `chapter` | Int | Yes | Chapter Number. | 116 | 366 | | `verse` | Int | Yes | Verse Number. | 2 | 367 | 368 | Supported Query Params: 369 | 370 | | Attribute | Type | Required | Description | Example | 371 | |:------------|:---------|:---------|:----------------------------|:----------| 372 | | `version` | String | No | Bible Version | Vulgate | 373 | 374 | Example request: 375 | 376 | ```shell 377 | curl "https://example.com/api/v1/testament/OT/book/Psalms/chapter/116/verse/2" 378 | ``` 379 | 380 | Example response: 381 | 382 | ```json 383 | { 384 | "chapter": 116, 385 | "verse": 2, 386 | "text": "Quoniam confirmata est super nos misericordia eius: et veritas Domini manet in æternum." 387 | } 388 | ``` 389 | 390 | --- 391 | 392 | ## Get Verses within a range 393 | 394 | > Version 1.0.0 395 | 396 | Gives the verses between two verse numbers. 397 | 398 | ```plaintext 399 | GET /testament/:testament/book/:book/chapter/:chapter/verses/from/:from/to/:to 400 | ``` 401 | 402 | Supported attributes: 403 | 404 | | Attribute | Type | Required | Description | Example | 405 | |:------------|:---------|:---------|:----------------------------|:----------| 406 | | `testament` | String | Yes | Code Name of the Testament. | OT | 407 | | `book` | String | Yes | Code Name of the Book. | Psalms | 408 | | `chapter` | Int | Yes | Chapter Number. | 117 | 409 | | `from` | Int | Yes | Verse Number. | 2 | 410 | | `to` | Int | Yes | Verse Number. | 8 | 411 | 412 | Supported Query Params: 413 | 414 | | Attribute | Type | Required | Description | Example | 415 | |:------------|:---------|:---------|:----------------------------|:----------| 416 | | `version` | String | No | Bible Version | CPDV | 417 | 418 | Example request: 419 | 420 | ```shell 421 | curl "https://example.com/api/v1/testament/OT/book/Psalms/chapter/117/verses/from/2/to/8?version=CPDV" 422 | ``` 423 | 424 | Example response: 425 | 426 | ```json 427 | [ 428 | { 429 | "chapter": 117, 430 | "verse": 2, 431 | "text": "Let Israel now say: For he is good, for his mercy is forever." 432 | }, 433 | { 434 | "chapter": 117, 435 | "verse": 3, 436 | "text": "Let the house of Aaron now say: For his mercy is forever." 437 | }, 438 | { 439 | "chapter": 117, 440 | "verse": 4, 441 | "text": "Let those who fear the Lord now say: For his mercy is forever." 442 | }, 443 | { 444 | "chapter": 117, 445 | "verse": 5, 446 | "text": "In my tribulation, I called upon the Lord. And the Lord heeded me with generosity." 447 | }, 448 | { 449 | "chapter": 117, 450 | "verse": 6, 451 | "text": "The Lord is my helper. I will not fear what man can do to me." 452 | }, 453 | { 454 | "chapter": 117, 455 | "verse": 7, 456 | "text": "The Lord is my helper. And I will look down upon my enemies." 457 | }, 458 | { 459 | "chapter": 117, 460 | "verse": 8, 461 | "text": "It is good to trust in the Lord, rather than to trust in man." 462 | } 463 | ] 464 | ``` 465 | 466 | --- 467 | 468 | --------------------------------------------------------------------------------