import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import org.apache.commons.lang.text.StrBuilder
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintCatalogService
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
import java.util.UUID
@Service
-open class BluePrintCatalogLoadService(private val controllerBlueprintsCatalogService: BluePrintCatalogService) {
+open class BlueprintCatalogLoadService(private val controllerBlueprintsCatalogService: BlueprintCatalogService) {
- private val log = LoggerFactory.getLogger(BluePrintCatalogLoadService::class.java)
+ private val log = LoggerFactory.getLogger(BlueprintCatalogLoadService::class.java)
- open fun loadPathsBluePrintModelCatalog(paths: List<String>) {
- paths.forEach { loadPathBluePrintModelCatalog(it) }
+ open fun loadPathsBlueprintModelCatalog(paths: List<String>) {
+ paths.forEach { loadPathBlueprintModelCatalog(it) }
}
- open fun loadPathBluePrintModelCatalog(path: String) {
+ open fun loadPathBlueprintModelCatalog(path: String) {
val files = File(path).listFiles()
runBlocking {
for (file in files) {
deferredResults += async {
- loadBluePrintModelCatalog(errorBuilder, file)
+ loadBlueprintModelCatalog(errorBuilder, file)
}
}
}
}
- open suspend fun loadBluePrintModelCatalog(errorBuilder: StrBuilder, file: File) {
+ open suspend fun loadBlueprintModelCatalog(errorBuilder: StrBuilder, file: File) {
try {
controllerBlueprintsCatalogService.saveToDatabase(UUID.randomUUID().toString(), file)
} catch (e: Exception) {