diff --git a/helper-cli/src/main/kotlin/commands/ImportScanResultsCommand.kt b/helper-cli/src/main/kotlin/commands/ImportScanResultsCommand.kt index 454285b100ce8..081e56479729c 100644 --- a/helper-cli/src/main/kotlin/commands/ImportScanResultsCommand.kt +++ b/helper-cli/src/main/kotlin/commands/ImportScanResultsCommand.kt @@ -26,7 +26,7 @@ import com.github.ajalt.clikt.parameters.options.required import com.github.ajalt.clikt.parameters.types.file import org.ossreviewtoolkit.helper.utils.readOrtResult -import org.ossreviewtoolkit.scanner.storages.FileBasedStorage +import org.ossreviewtoolkit.scanner.storages.PackageBasedFileStorage import org.ossreviewtoolkit.utils.common.expandTilde import org.ossreviewtoolkit.utils.ort.storage.LocalFileStorage @@ -51,7 +51,7 @@ internal class ImportScanResultsCommand : CliktCommand( override fun run() { val ortResult = readOrtResult(ortFile) - val scanResultsStorage = FileBasedStorage(LocalFileStorage(scanResultsStorageDir)) + val scanResultsStorage = PackageBasedFileStorage(LocalFileStorage(scanResultsStorageDir)) val ids = ortResult.getProjects().map { it.id } + ortResult.getPackages().map { it.metadata.id } ids.forEach { id -> diff --git a/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt b/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt index b7db5664414e9..4b9697f86a6e8 100644 --- a/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt +++ b/helper-cli/src/main/kotlin/commands/packageconfig/CreateCommand.kt @@ -43,7 +43,7 @@ import org.ossreviewtoolkit.model.config.PackageConfiguration import org.ossreviewtoolkit.model.config.VcsMatcher import org.ossreviewtoolkit.model.licenses.LicenseClassifications import org.ossreviewtoolkit.model.readValue -import org.ossreviewtoolkit.scanner.storages.FileBasedStorage +import org.ossreviewtoolkit.scanner.storages.PackageBasedFileStorage import org.ossreviewtoolkit.utils.common.expandTilde import org.ossreviewtoolkit.utils.common.safeMkdirs import org.ossreviewtoolkit.utils.ort.storage.LocalFileStorage @@ -119,7 +119,7 @@ internal class CreateCommand : CliktCommand( override fun run() { outputDir.safeMkdirs() - val scanResultsStorage = FileBasedStorage(LocalFileStorage(scanResultsStorageDir)) + val scanResultsStorage = PackageBasedFileStorage(LocalFileStorage(scanResultsStorageDir)) val scanResults = scanResultsStorage.read(Package.EMPTY.copy(id = packageId)).getOrThrow().run { listOfNotNull( find { it.provenance is RepositoryProvenance }, diff --git a/scanner/src/funTest/kotlin/storages/FileBasedStorageFunTest.kt b/scanner/src/funTest/kotlin/storages/PackageBasedFileStorageFunTest.kt similarity index 84% rename from scanner/src/funTest/kotlin/storages/FileBasedStorageFunTest.kt rename to scanner/src/funTest/kotlin/storages/PackageBasedFileStorageFunTest.kt index 2235d16af2eb7..35b097bc113b2 100644 --- a/scanner/src/funTest/kotlin/storages/FileBasedStorageFunTest.kt +++ b/scanner/src/funTest/kotlin/storages/PackageBasedFileStorageFunTest.kt @@ -23,6 +23,6 @@ import io.kotest.engine.spec.tempdir import org.ossreviewtoolkit.utils.ort.storage.LocalFileStorage -class FileBasedStorageFunTest : AbstractPackageBasedScanStorageFunTest() { - override fun createStorage() = FileBasedStorage(LocalFileStorage(tempdir())) +class PackageBasedFileStorageFunTest : AbstractPackageBasedScanStorageFunTest() { + override fun createStorage() = PackageBasedFileStorage(LocalFileStorage(tempdir())) } diff --git a/scanner/src/funTest/kotlin/storages/PostgresStorageFunTest.kt b/scanner/src/funTest/kotlin/storages/PackageBasedPostgresStorageFunTest.kt similarity index 81% rename from scanner/src/funTest/kotlin/storages/PostgresStorageFunTest.kt rename to scanner/src/funTest/kotlin/storages/PackageBasedPostgresStorageFunTest.kt index 8b28921fea909..ef71291581f43 100644 --- a/scanner/src/funTest/kotlin/storages/PostgresStorageFunTest.kt +++ b/scanner/src/funTest/kotlin/storages/PackageBasedPostgresStorageFunTest.kt @@ -23,6 +23,6 @@ import org.ossreviewtoolkit.utils.test.PostgresListener private val postgresListener = PostgresListener() -class PostgresStorageFunTest : AbstractPackageBasedScanStorageFunTest(postgresListener) { - override fun createStorage() = PostgresStorage(dataSource = postgresListener.dataSource) +class PackageBasedPostgresStorageFunTest : AbstractPackageBasedScanStorageFunTest(postgresListener) { + override fun createStorage() = PackageBasedPostgresStorage(dataSource = postgresListener.dataSource) } diff --git a/scanner/src/main/kotlin/ScanStorages.kt b/scanner/src/main/kotlin/ScanStorages.kt index 32a3c92fbaeb0..51b7f685a8d22 100644 --- a/scanner/src/main/kotlin/ScanStorages.kt +++ b/scanner/src/main/kotlin/ScanStorages.kt @@ -37,8 +37,8 @@ import org.ossreviewtoolkit.scanner.provenance.ResolvedArtifactProvenance import org.ossreviewtoolkit.scanner.provenance.ResolvedRepositoryProvenance import org.ossreviewtoolkit.scanner.provenance.UnresolvedPackageProvenance import org.ossreviewtoolkit.scanner.storages.ClearlyDefinedStorage -import org.ossreviewtoolkit.scanner.storages.FileBasedStorage -import org.ossreviewtoolkit.scanner.storages.PostgresStorage +import org.ossreviewtoolkit.scanner.storages.PackageBasedFileStorage +import org.ossreviewtoolkit.scanner.storages.PackageBasedPostgresStorage import org.ossreviewtoolkit.scanner.storages.ProvenanceBasedFileStorage import org.ossreviewtoolkit.scanner.storages.ProvenanceBasedPostgresStorage import org.ossreviewtoolkit.scanner.storages.Sw360Storage @@ -132,13 +132,13 @@ private fun createStorage(config: ScanStorageConfiguration): ScanStorage = private fun createFileBasedStorage(config: FileBasedStorageConfiguration) = when (config.type) { - StorageType.PACKAGE_BASED -> FileBasedStorage(config.backend.createFileStorage()) + StorageType.PACKAGE_BASED -> PackageBasedFileStorage(config.backend.createFileStorage()) StorageType.PROVENANCE_BASED -> ProvenanceBasedFileStorage(config.backend.createFileStorage()) } private fun createPostgresStorage(config: PostgresStorageConfiguration) = when (config.type) { - StorageType.PACKAGE_BASED -> PostgresStorage( + StorageType.PACKAGE_BASED -> PackageBasedPostgresStorage( DatabaseUtils.createHikariDataSource(config = config.connection, applicationNameSuffix = TOOL_NAME) ) StorageType.PROVENANCE_BASED -> ProvenanceBasedPostgresStorage( diff --git a/scanner/src/main/kotlin/storages/FileBasedStorage.kt b/scanner/src/main/kotlin/storages/PackageBasedFileStorage.kt similarity index 99% rename from scanner/src/main/kotlin/storages/FileBasedStorage.kt rename to scanner/src/main/kotlin/storages/PackageBasedFileStorage.kt index 7f2d94572a391..fe3deba447137 100644 --- a/scanner/src/main/kotlin/storages/FileBasedStorage.kt +++ b/scanner/src/main/kotlin/storages/PackageBasedFileStorage.kt @@ -43,7 +43,7 @@ const val SCAN_RESULTS_FILE_NAME = "scan-results.yml" /** * A [PackageBasedScanStorage] using a [FileStorage] as backend. Scan results are serialized using [YAML][yamlMapper]. */ -class FileBasedStorage( +class PackageBasedFileStorage( /** * The [FileStorage] to use for storing scan results. */ diff --git a/scanner/src/main/kotlin/storages/PostgresStorage.kt b/scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt similarity index 99% rename from scanner/src/main/kotlin/storages/PostgresStorage.kt rename to scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt index a3bfc876e1acd..9538a4e0a2e96 100644 --- a/scanner/src/main/kotlin/storages/PostgresStorage.kt +++ b/scanner/src/main/kotlin/storages/PackageBasedPostgresStorage.kt @@ -55,7 +55,7 @@ private val TABLE_NAME = ScanResults.tableName /** * The Postgres storage back-end. */ -class PostgresStorage( +class PackageBasedPostgresStorage( /** * The JDBC data source to obtain database connections. */