package org.onap.ccsdk.cds.controllerblueprints.core.scripts
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintScriptsService
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintScriptsService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintFileUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import java.util.ArrayList
-open class BlueprintScriptsServiceImpl : BlueprintScriptsService {
+open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
- val log = logger(BlueprintScriptsServiceImpl::class)
+ val log = logger(BluePrintScriptsServiceImpl::class)
- override suspend fun <T> scriptInstance(bluePrintSourceCode: BlueprintSourceCode, scriptClassName: String): T {
- val bluePrintCompileService = BlueprintCompileService()
+ override suspend fun <T> scriptInstance(bluePrintSourceCode: BluePrintSourceCode, scriptClassName: String): T {
+ val bluePrintCompileService = BluePrintCompileService()
return bluePrintCompileService.eval(bluePrintSourceCode, scriptClassName, null)
}
): T {
val sources: MutableList<String> = arrayListOf()
- sources.add(normalizedPathName(blueprintBasePath, BlueprintConstants.TOSCA_SCRIPTS_KOTLIN_DIR))
+ sources.add(normalizedPathName(blueprintBasePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR))
- val scriptSource = BlueprintSourceCode()
+ val scriptSource = BluePrintSourceCode()
scriptSource.blueprintKotlinSources = sources
scriptSource.moduleName = "$artifactName-$artifactVersion-cba-kts"
- scriptSource.cacheKey = BlueprintFileUtils.compileCacheKey(blueprintBasePath)
- scriptSource.targetJarFile = BlueprintFileUtils.compileJarFile(blueprintBasePath, artifactName, artifactVersion)
+ scriptSource.cacheKey = BluePrintFileUtils.compileCacheKey(blueprintBasePath)
+ scriptSource.targetJarFile = BluePrintFileUtils.compileJarFile(blueprintBasePath, artifactName, artifactVersion)
scriptSource.regenerate = reCompile
return scriptInstance(scriptSource, scriptClassName)
}
scriptClassName: String,
reCompile: Boolean
): T {
- val toscaMetaData = BlueprintMetadataUtils.toscaMetaData(blueprintBasePath)
+ val toscaMetaData = BluePrintMetadataUtils.toscaMetaData(blueprintBasePath)
checkNotNull(toscaMetaData.templateName) { "couldn't find 'Template-Name' key in TOSCA.meta" }
checkNotNull(toscaMetaData.templateVersion) { "couldn't find 'Template-Version' key in TOSCA.meta" }
return scriptInstance(
override suspend fun <T> scriptInstance(cacheKey: String, scriptClassName: String): T {
val args = ArrayList<Any?>()
- return BlueprintCompileCache.classLoader(cacheKey).loadClass(scriptClassName).constructors
+ return BluePrintCompileCache.classLoader(cacheKey).loadClass(scriptClassName).constructors
.single().newInstance(*args.toArray()) as T
}