aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-core
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-03-29 12:55:06 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-29 12:55:06 +0000
commitcf6a08425cc50b871cec9ae386e617388816b27d (patch)
treeb28a25b623b143354364b4d778f01bdb4b0784c4 /ms/controllerblueprints/modules/blueprint-core
parent837f8493fe6c7cd0569c43105b923e42549dcf7b (diff)
parentc3811effed948926f8d94615df7530c99d490092 (diff)
Merge "Improve blueprint save"
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt7
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt14
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