- suspend fun upload(filePart: FilePart): String {
- val saveId = UUID.randomUUID().toString()
- val blueprintArchive = normalizedPathName(bluePrintPathConfiguration.blueprintArchivePath, saveId)
- val blueprintWorking = normalizedPathName(bluePrintPathConfiguration.blueprintWorkingPath, saveId)
- try {
-
- val compressedFile = normalizedFile(blueprintArchive, "cba.zip")
- compressedFile.parentFile.reCreateNBDirs()
- // Copy the File Part to Local File
- copyFromFilePart(filePart, compressedFile)
- // Save the Copied file to Database
- return bluePrintCatalogService.saveToDatabase(saveId, compressedFile, true)
- } catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Upload CBA: ${e.message}", e)
- } finally {
- deleteNBDir(blueprintArchive)
- deleteNBDir(blueprintWorking)
- }
- }
-
- suspend fun remove(name: String, version: String) {
- bluePrintCatalogService.deleteFromDatabase(name, version)
- }
-
- suspend fun process(executionServiceInput: ExecutionServiceInput,
- responseObserver: StreamObserver<org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>) {