aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons/db-lib/src
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-07-18 19:13:00 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-07-19 10:50:25 -0400
commitb52a648f3c77a495539d64bba1e43fcbbdaa0364 (patch)
treed482c1d2a72d10d3a52d85ae5004325186533f90 /ms/blueprintsprocessor/modules/commons/db-lib/src
parent086f23e7dbe0cc7df7105002628ee3e84cf29c76 (diff)
Improve script file accessing through cache.
Change-Id: If94e837975701dc7b2235c38acb46b3b883a424b Issue-ID: CCSDK-1503 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/db-lib/src')
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt13
1 files changed, 10 insertions, 3 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
index 3e1f0715b..9faf879f0 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
@@ -26,6 +26,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.db.resources.BlueprintCatalogServiceImpl
import org.slf4j.LoggerFactory
import org.springframework.dao.DataIntegrityViolationException
@@ -46,12 +48,17 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString())
override suspend fun delete(name: String, version: String) {
+ // Clean blueprint script cache
+ val cacheKey = BluePrintFileUtils
+ .compileCacheKey(normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, name, version))
+ BluePrintCompileCache.cleanClassLoader(cacheKey)
+ log.info("removed cba file name($name), version($version) from cache")
// Cleaning Deployed Blueprint
deleteNBDir(bluePrintPathConfiguration.blueprintDeployPath, name, version)
log.info("removed cba file name($name), version($version) from deploy location")
// Cleaning Data Base
blueprintModelRepository
- .deleteByArtifactNameAndArtifactVersion(name, version)
+ .deleteByArtifactNameAndArtifactVersion(name, version)
log.info("removed cba file name($name), version($version) from database")
}
@@ -60,7 +67,7 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
val deployFile = normalizedFile(bluePrintPathConfiguration.blueprintDeployPath, name, version)
val cbaFile = normalizedFile(bluePrintPathConfiguration.blueprintArchivePath,
- UUID.randomUUID().toString(), "cba.zip")
+ UUID.randomUUID().toString(), "cba.zip")
if (extract && deployFile.exists()) {
log.info("cba file name($name), version($version) already present(${deployFile.absolutePath})")
@@ -110,7 +117,7 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
log.info("Overwriting blueprint model :$artifactName::$artifactVersion")
blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
val deployFile =
- normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, artifactName, artifactVersion)
+ normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, artifactName, artifactVersion)
deleteNBDir(deployFile).let {
if (it) log.info("Deleted deployed blueprint model :$artifactName::$artifactVersion")
else log.info("Fail to delete deployed blueprint model :$artifactName::$artifactVersion")