diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-07-18 19:13:00 -0400 |
---|---|---|
committer | Brinda Santh <brindasanth@in.ibm.com> | 2019-07-19 10:50:25 -0400 |
commit | b52a648f3c77a495539d64bba1e43fcbbdaa0364 (patch) | |
tree | d482c1d2a72d10d3a52d85ae5004325186533f90 /ms/blueprintsprocessor/modules | |
parent | 086f23e7dbe0cc7df7105002628ee3e84cf29c76 (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')
2 files changed, 12 insertions, 4 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") diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt index 49a2c62b1..a16c52069 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt @@ -76,7 +76,8 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat } BluePrintConstants.SCRIPT_KOTLIN -> { val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl() - scriptComponent = bluePrintScriptsService.scriptInstance<T>(bluePrintContext, scriptClassReference, false) + scriptComponent = bluePrintScriptsService.scriptInstance<T>(bluePrintContext.rootPath, + bluePrintContext.name(), bluePrintContext.version(), scriptClassReference, false) } BluePrintConstants.SCRIPT_JYTHON -> { scriptComponent = blueprintJythonService.jythonComponentInstance(bluePrintContext, scriptClassReference) as T |