diff options
author | 2019-03-25 17:01:08 -0400 | |
---|---|---|
committer | 2019-03-27 13:23:06 -0400 | |
commit | c3811effed948926f8d94615df7530c99d490092 (patch) | |
tree | dff68af7c67bc9db332fa43b7a882d1a1b05b4db /ms/controllerblueprints/modules/blueprint-core/src | |
parent | 10164a7ab851859bfd548e32b4fe3c0610f3d614 (diff) |
Improve blueprint save
Change-Id: Ibac2ef9cd7e217db809a6a695ea0ee39a6bd2e21
Issue-ID: CCSDK-1137
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core/src')
3 files changed, 19 insertions, 10 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt index 6744b625e..bda60ea73 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt @@ -84,6 +84,14 @@ fun normalizedPathName(path: String, vararg more: String?): String { return normalizedPath(path, *more).toString() } +suspend fun File.reCreateNBDirs(): File = withContext(Dispatchers.IO) { + reCreateDirs() +} + +suspend fun deleteNBDir(path: String, vararg more: String?) = withContext(Dispatchers.IO) { + normalizedFile(path, *more).deleteRecursively() +} + suspend fun File.readNBText(): String = withContext(Dispatchers.IO) { readText(Charset.defaultCharset()) } diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt index 2815bad4c..8674c4d40 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt @@ -16,12 +16,15 @@ package org.onap.ccsdk.cds.controllerblueprints.core.config -open class BluePrintLoadConfiguration { +open class BluePrintPathConfiguration { lateinit var blueprintDeployPath: String lateinit var blueprintArchivePath: String - lateinit var blueprintEnrichmentPath: String + lateinit var blueprintWorkingPath: String +} + +open class BluePrintLoadConfiguration : BluePrintPathConfiguration() { var loadInitialData: Boolean = false var loadBluePrint: Boolean = false var loadBluePrintPaths: String? = null diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt index d71569ea2..9b4f6b56e 100755 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt @@ -16,8 +16,6 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.jetbrains.annotations.NotNull -import org.jetbrains.annotations.Nullable import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import java.io.File import java.nio.file.Path @@ -26,14 +24,14 @@ interface BluePrintCatalogService { /** * Save the CBA to database. + * @param processingId Processing Id * @param blueprintFile Either a directory, or an archive * @param validate whether to validate blueprint content. Default true. * @return The unique blueprint identifier * @throws BluePrintException if process failed */ - @NotNull @Throws(BluePrintException::class) - fun saveToDatabase(@NotNull blueprintFile: File, @Nullable validate: Boolean = true): String + suspend fun saveToDatabase(processingId: String, blueprintFile: File, validate: Boolean = true): String /** * Retrieve the CBA from database either archived or extracted. @@ -43,9 +41,9 @@ interface BluePrintCatalogService { * @return Path where CBA is located * @throws BluePrintException if process failed */ - @NotNull + @Throws(BluePrintException::class) - fun getFromDatabase(@NotNull name: String, @NotNull version: String, @Nullable extract: Boolean = true): Path + suspend fun getFromDatabase(name: String, version: String, extract: Boolean = true): Path /** * Delete the CBA from database. @@ -53,7 +51,7 @@ interface BluePrintCatalogService { * @param version Version of the blueprint * @throws BluePrintException if process failed */ - @NotNull + @Throws(BluePrintException::class) - fun deleteFromDatabase(@NotNull name: String, @NotNull version: String) + suspend fun deleteFromDatabase(name: String, version: String) }
\ No newline at end of file |