diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 2186e87d7..4362e05cf 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -2,7 +2,7 @@ import org.springframework.boot.gradle.tasks.bundling.BootJar plugins { kotlin("jvm") - id("org.springframework.boot") version "3.2.1" + id("org.springframework.boot") version "3.2.2" id("io.spring.dependency-management") version "1.1.4" kotlin("plugin.spring") kotlin("kapt") @@ -43,7 +43,7 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-undertow") implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - kapt("org.springframework:spring-context-indexer:6.1.2") + kapt("org.springframework:spring-context-indexer:6.1.3") testImplementation(project(":nebulosa-skycatalog-stellarium")) testImplementation(project(":nebulosa-test")) } diff --git a/api/src/test/kotlin/SimbadDatabaseGenerator.kt b/api/src/test/kotlin/SimbadDatabaseGenerator.kt index f2b99dcfa..8f194f059 100644 --- a/api/src/test/kotlin/SimbadDatabaseGenerator.kt +++ b/api/src/test/kotlin/SimbadDatabaseGenerator.kt @@ -1,6 +1,6 @@ import de.siegmar.fastcsv.reader.CommentStrategy import de.siegmar.fastcsv.reader.CsvReader -import de.siegmar.fastcsv.reader.NamedCsvRow +import de.siegmar.fastcsv.reader.NamedCsvRecord import nebulosa.adql.* import nebulosa.api.atlas.SimbadDatabaseWriter import nebulosa.api.atlas.SimbadEntity @@ -49,25 +49,25 @@ object SimbadDatabaseGenerator { @JvmStatic private val CALDWELL = resource("caldwell.csv")!! .use { stream -> - CSV_READER.build(InputStreamReader(stream, Charsets.UTF_8)) + CSV_READER.ofCsvRecord(InputStreamReader(stream, Charsets.UTF_8)) .associate { it.getField(1).ifEmpty { it.getField(2) } to it.getField(0) } } @JvmStatic private val BENNETT = resource("bennett.csv")!! .use { stream -> - CSV_READER.build(InputStreamReader(stream, Charsets.UTF_8)) + CSV_READER.ofCsvRecord(InputStreamReader(stream, Charsets.UTF_8)) .associate { it.getField(1) to it.getField(0) } } @JvmStatic private val DUNLOP = resource("dunlop.csv")!! .use { stream -> - CSV_READER.build(InputStreamReader(stream, Charsets.UTF_8)) + CSV_READER.ofCsvRecord(InputStreamReader(stream, Charsets.UTF_8)) .associate { it.getField(1) to it.getField(0) } } @JvmStatic private val HERSHEL = resource("hershel.csv")!! .use { stream -> - CSV_READER.build(InputStreamReader(stream, Charsets.UTF_8)) + CSV_READER.ofCsvRecord(InputStreamReader(stream, Charsets.UTF_8)) .associate { it.getField(1) to it.getField(0) } } @@ -225,7 +225,7 @@ object SimbadDatabaseGenerator { } @JvmStatic - private fun List.parse(entities: MutableList): List { + private fun List.parse(entities: MutableList): List { var writeCount = 0 for (row in this) { diff --git a/build.gradle.kts b/build.gradle.kts index d259d2bf2..2aaef195b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0-Beta2") - classpath("org.jetbrains.kotlin:kotlin-allopen:2.0.0-Beta2") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0-Beta3") + classpath("org.jetbrains.kotlin:kotlin-allopen:2.0.0-Beta3") classpath("com.adarshr:gradle-test-logger-plugin:4.0.0") classpath("io.objectbox:objectbox-gradle-plugin:3.7.1") } diff --git a/nebulosa-astap/src/main/kotlin/nebulosa/astap/plate/solving/AstapPlateSolver.kt b/nebulosa-astap/src/main/kotlin/nebulosa/astap/plate/solving/AstapPlateSolver.kt index ccf844f73..23afc4292 100644 --- a/nebulosa-astap/src/main/kotlin/nebulosa/astap/plate/solving/AstapPlateSolver.kt +++ b/nebulosa-astap/src/main/kotlin/nebulosa/astap/plate/solving/AstapPlateSolver.kt @@ -104,7 +104,7 @@ class AstapPlateSolver(path: Path) : PlateSolver { header.add(NOAOExt.CD2_1, cd21) header.add(NOAOExt.CD2_2, cd22) - val solution = PlateSolution(true, crota2.deg, cdelt2.deg, crval1.deg, crval2.deg, width.deg, height.deg, header = header) + val solution = PlateSolution(true, crota2.deg, cdelt2.deg, crval1.deg, crval2.deg, width.deg, height.deg) LOG.info("astap solved. calibration={}", solution) diff --git a/nebulosa-astap/src/main/kotlin/nebulosa/astap/star/detection/AstapStarDetector.kt b/nebulosa-astap/src/main/kotlin/nebulosa/astap/star/detection/AstapStarDetector.kt index 4b604591c..87306d63d 100644 --- a/nebulosa-astap/src/main/kotlin/nebulosa/astap/star/detection/AstapStarDetector.kt +++ b/nebulosa-astap/src/main/kotlin/nebulosa/astap/star/detection/AstapStarDetector.kt @@ -1,6 +1,7 @@ package nebulosa.astap.star.detection -import de.siegmar.fastcsv.reader.NamedCsvReader +import de.siegmar.fastcsv.reader.CommentStrategy +import de.siegmar.fastcsv.reader.CsvReader import nebulosa.common.process.ProcessExecutor import nebulosa.log.loggerFor import nebulosa.star.detection.ImageStar @@ -35,7 +36,7 @@ class AstapStarDetector(path: Path) : StarDetector { try { csvFile.inputStream().use { - for (record in CSV_READER.build(InputStreamReader(it, Charsets.UTF_8))) { + for (record in CSV_READER.ofNamedCsvRecord(InputStreamReader(it, Charsets.UTF_8))) { detectedStars.add( Star( record.getField("x").toDouble(), @@ -58,10 +59,10 @@ class AstapStarDetector(path: Path) : StarDetector { @JvmStatic private val LOG = loggerFor() - @JvmStatic private val CSV_READER = NamedCsvReader.builder() + @JvmStatic private val CSV_READER = CsvReader.builder() .fieldSeparator(',') .quoteCharacter('"') .commentCharacter('#') - .skipComments(true) + .commentStrategy(CommentStrategy.SKIP) } } diff --git a/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverter.kt b/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverter.kt index 4508cc1d3..dbb51bdb6 100644 --- a/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverter.kt +++ b/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverter.kt @@ -1,15 +1,15 @@ package nebulosa.retrofit -import de.siegmar.fastcsv.reader.NamedCsvReader -import de.siegmar.fastcsv.reader.NamedCsvRow +import de.siegmar.fastcsv.reader.CsvReader +import de.siegmar.fastcsv.reader.NamedCsvRecord import okhttp3.ResponseBody import retrofit2.Converter import java.io.InputStreamReader -data class CSVRecordListConverter(private val reader: NamedCsvReader.NamedCsvReaderBuilder) : Converter> { +data class CSVRecordListConverter(private val reader: CsvReader.CsvReaderBuilder) : Converter> { - override fun convert(value: ResponseBody): List { + override fun convert(value: ResponseBody): List { val charset = value.contentType()?.charset() ?: Charsets.UTF_8 - return value.use { reader.build(InputStreamReader(value.byteStream(), charset)).toList() } + return value.use { reader.ofNamedCsvRecord(InputStreamReader(value.byteStream(), charset)).toList() } } } diff --git a/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverterFactory.kt b/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverterFactory.kt index 8c39da918..c127affd7 100644 --- a/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverterFactory.kt +++ b/nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverterFactory.kt @@ -1,11 +1,11 @@ package nebulosa.retrofit -import de.siegmar.fastcsv.reader.NamedCsvReader +import de.siegmar.fastcsv.reader.CsvReader import retrofit2.Converter import retrofit2.Retrofit import java.lang.reflect.Type -data class CSVRecordListConverterFactory(private val reader: NamedCsvReader.NamedCsvReaderBuilder) : Converter.Factory() { +data class CSVRecordListConverterFactory(private val reader: CsvReader.CsvReaderBuilder) : Converter.Factory() { override fun responseBodyConverter( type: Type, diff --git a/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/Simbad.kt b/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/Simbad.kt index a3fa5c28e..fcee0faa0 100644 --- a/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/Simbad.kt +++ b/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/Simbad.kt @@ -1,6 +1,6 @@ package nebulosa.simbad -import de.siegmar.fastcsv.reader.NamedCsvRow +import de.siegmar.fastcsv.reader.NamedCsvRecord import okhttp3.FormBody import retrofit2.Call import retrofit2.http.Body @@ -9,5 +9,5 @@ import retrofit2.http.POST interface Simbad { @POST("simbad/sim-tap/sync") - fun query(@Body body: FormBody): Call> + fun query(@Body body: FormBody): Call> } diff --git a/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/SimbadService.kt b/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/SimbadService.kt index ae7b7676a..7a089c55a 100644 --- a/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/SimbadService.kt +++ b/nebulosa-simbad/src/main/kotlin/nebulosa/simbad/SimbadService.kt @@ -1,7 +1,8 @@ package nebulosa.simbad -import de.siegmar.fastcsv.reader.NamedCsvReader -import de.siegmar.fastcsv.reader.NamedCsvRow +import de.siegmar.fastcsv.reader.CommentStrategy +import de.siegmar.fastcsv.reader.CsvReader +import de.siegmar.fastcsv.reader.NamedCsvRecord import nebulosa.adql.* import nebulosa.log.loggerFor import nebulosa.math.* @@ -31,11 +32,11 @@ class SimbadService( private val service by lazy { retrofit.create() } - fun query(query: Query): Call> { + fun query(query: Query): Call> { return query("$query") } - fun query(query: String): Call> { + fun query(query: String): Call> { val body = FormBody.Builder() .add("request", "doQuery") .add("lang", "adql") @@ -49,9 +50,8 @@ class SimbadService( } fun search(query: Query): List { - val rows = query(query).execute().body() - if (rows.isNullOrEmpty()) return emptyList() - val res = ArrayList(rows.size) + val rows = query(query).execute().body() ?: return emptyList() + val res = ArrayList() val currentTime = UTC.now() fun matchName(name: String): String? { @@ -160,11 +160,11 @@ class SimbadService( @JvmStatic private val LOG = loggerFor() - @JvmStatic private val CSV_READER = NamedCsvReader.builder() + @JvmStatic private val CSV_READER = CsvReader.builder() .fieldSeparator('\t') .quoteCharacter('"') .commentCharacter('#') - .skipComments(true) + .commentStrategy(CommentStrategy.SKIP) @JvmStatic private val BASIC_TABLE = From("basic").alias("b") @JvmStatic private val FLUX_TABLE = From("allfluxes").alias("f") diff --git a/nebulosa-skycatalog-hyg/src/main/kotlin/nebulosa/skycatalog/hyg/HygDatabase.kt b/nebulosa-skycatalog-hyg/src/main/kotlin/nebulosa/skycatalog/hyg/HygDatabase.kt index d4deecf20..f60ba0852 100644 --- a/nebulosa-skycatalog-hyg/src/main/kotlin/nebulosa/skycatalog/hyg/HygDatabase.kt +++ b/nebulosa-skycatalog-hyg/src/main/kotlin/nebulosa/skycatalog/hyg/HygDatabase.kt @@ -1,6 +1,7 @@ package nebulosa.skycatalog.hyg -import de.siegmar.fastcsv.reader.NamedCsvReader +import de.siegmar.fastcsv.reader.CommentStrategy +import de.siegmar.fastcsv.reader.CsvReader import nebulosa.math.deg import nebulosa.math.hours import nebulosa.math.kms @@ -23,7 +24,7 @@ class HygDatabase : SkyCatalog(118005) { fun load(stream: InputStream) { clear() - val reader = CSV_READER.build(InputStreamReader(stream, Charsets.UTF_8)) + val reader = CSV_READER.ofNamedCsvRecord(InputStreamReader(stream, Charsets.UTF_8)) val names = ArrayList(7) val currentTime = UTC.now() @@ -79,10 +80,10 @@ class HygDatabase : SkyCatalog(118005) { companion object { - @JvmStatic private val CSV_READER = NamedCsvReader.builder() + @JvmStatic private val CSV_READER = CsvReader.builder() .fieldSeparator(',') .quoteCharacter('"') .commentCharacter('#') - .skipComments(true) + .commentStrategy(CommentStrategy.SKIP) } } diff --git a/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAP.kt b/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAP.kt index e90d9a312..a7ddb0901 100644 --- a/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAP.kt +++ b/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAP.kt @@ -1,6 +1,6 @@ package nebulosa.vizier -import de.siegmar.fastcsv.reader.NamedCsvRow +import de.siegmar.fastcsv.reader.NamedCsvRecord import okhttp3.FormBody import retrofit2.Call import retrofit2.http.Body @@ -9,5 +9,5 @@ import retrofit2.http.POST interface VizierTAP { @POST("TAPVizieR/tap/sync") - fun query(@Body body: FormBody): Call> + fun query(@Body body: FormBody): Call> } diff --git a/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAPService.kt b/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAPService.kt index e21ec2bd9..144993be8 100644 --- a/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAPService.kt +++ b/nebulosa-vizier/src/main/kotlin/nebulosa/vizier/VizierTAPService.kt @@ -1,7 +1,8 @@ package nebulosa.vizier -import de.siegmar.fastcsv.reader.NamedCsvReader -import de.siegmar.fastcsv.reader.NamedCsvRow +import de.siegmar.fastcsv.reader.CommentStrategy +import de.siegmar.fastcsv.reader.CsvReader +import de.siegmar.fastcsv.reader.NamedCsvRecord import nebulosa.retrofit.CSVRecordListConverterFactory import nebulosa.retrofit.RetrofitService import okhttp3.FormBody @@ -23,7 +24,7 @@ class VizierTAPService(url: String = "") : RetrofitService(url.ifBlank { URL }) private val service by lazy { retrofit.create() } - fun query(query: String): Call> { + fun query(query: String): Call> { val body = FormBody.Builder() .add("request", "doQuery") .add("lang", "adql") @@ -38,10 +39,10 @@ class VizierTAPService(url: String = "") : RetrofitService(url.ifBlank { URL }) const val URL = "http://tapvizier.cds.unistra.fr/" - @JvmStatic private val CSV_READER = NamedCsvReader.builder() + @JvmStatic private val CSV_READER = CsvReader.builder() .fieldSeparator(',') .quoteCharacter('"') .commentCharacter('#') - .skipComments(true) + .commentStrategy(CommentStrategy.SKIP) } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 36a95f805..d26534d3e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,11 +26,11 @@ dependencyResolutionManagement { library("netty-transport", "io.netty:netty-transport:4.1.106.Final") library("netty-codec", "io.netty:netty-codec:4.1.106.Final") library("xml", "com.fasterxml:aalto-xml:1.3.2") - library("csv", "de.siegmar:fastcsv:2.2.2") + library("csv", "de.siegmar:fastcsv:3.0.0") library("apache-lang3", "org.apache.commons:commons-lang3:3.14.0") library("apache-codec", "commons-codec:commons-codec:1.16.0") library("apache-collections", "org.apache.commons:commons-collections4:4.4") - library("oshi", "com.github.oshi:oshi-core:6.4.10") + library("oshi", "com.github.oshi:oshi-core:6.4.11") library("timeshape", "net.iakovlev:timeshape:2022g.17") library("jna", "net.java.dev.jna:jna:5.14.0") library("kotest-assertions-core", "io.kotest:kotest-assertions-core:5.8.0")