Renaming Files having BluePrint to have Blueprint
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / k8s-profile-upload / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / k8s / profile / upload / K8sProfileUploadComponent.kt
index 23d47dc..39da9c1 100644 (file)
@@ -23,20 +23,20 @@ import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.node.ArrayNode
 import com.fasterxml.jackson.databind.node.ObjectNode
 import org.apache.commons.io.FileUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService
 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
 import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
 import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintVelocityTemplateService
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.ArchiveType
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintArchiveUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import org.slf4j.LoggerFactory
 import org.springframework.beans.factory.config.ConfigurableBeanFactory
@@ -51,7 +51,7 @@ import java.nio.file.Paths
 @Component("component-k8s-profile-upload")
 @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
 open class K8sProfileUploadComponent(
-    private var bluePrintPropertiesService: BluePrintPropertiesService,
+    private var bluePrintPropertiesService: BlueprintPropertiesService,
     private val resourceResolutionService: ResourceResolutionService
 ) :
 
@@ -145,15 +145,15 @@ open class K8sProfileUploadComponent(
                 val profileNamespace: String? = prefixInputParamsMap[INPUT_K8S_PROFILE_NAMESPACE]?.returnNullIfMissing()?.asText()
                 var profileSource: String? = prefixInputParamsMap[INPUT_K8S_PROFILE_SOURCE]?.returnNullIfMissing()?.asText()
                 if (profileNamespace == null)
-                    throw BluePrintProcessorException("Profile $profileName namespace is missing")
+                    throw BlueprintProcessorException("Profile $profileName namespace is missing")
                 if (profileSource == null) {
                     profileSource = profileName
                     log.info("Profile name used instead of profile source")
                 }
                 val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
                 val artifact: ArtifactDefinition = bluePrintContext.nodeTemplateArtifact(nodeTemplateName, profileSource)
-                if (artifact.type != BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE)
-                    throw BluePrintProcessorException(
+                if (artifact.type != BlueprintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE)
+                    throw BlueprintProcessorException(
                         "Unexpected profile artifact type for profile source " +
                             "$profileSource. Expecting: $artifact.type"
                     )
@@ -178,7 +178,7 @@ open class K8sProfileUploadComponent(
     }
 
     override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
-        bluePrintRuntimeService.getBluePrintError().addError(runtimeException.message!!)
+        bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!)
     }
 
     private fun getTemplatePrefixList(node: JsonNode?): ArrayList<String> {
@@ -238,19 +238,19 @@ open class K8sProfileUploadComponent(
                         tempProfilePath, manifestFiles
                     )
                 } else
-                    throw BluePrintProcessorException("Manifest file is missing")
+                    throw BlueprintProcessorException("Manifest file is missing")
                 // Preparation of the final profile content
                 val finalProfileFilePath = Paths.get(
                     tempMainPath.toString().plus(File.separator).plus(
                         "$k8sRbProfileName.tar.gz"
                     )
                 )
-                if (!BluePrintArchiveUtils.compress(
+                if (!BlueprintArchiveUtils.compress(
                         tempProfilePath, finalProfileFilePath.toFile(),
                         ArchiveType.TarGz
                     )
                 ) {
-                    throw BluePrintProcessorException("Profile compression has failed")
+                    throw BlueprintProcessorException("Profile compression has failed")
                 }
                 FileUtils.deleteDirectory(tempProfilePath)
 
@@ -260,7 +260,7 @@ open class K8sProfileUploadComponent(
                 throw t
             }
         } else
-            throw BluePrintProcessorException("Profile source $ks8ProfileLocation is missing in CBA folder")
+            throw BlueprintProcessorException("Profile source $ks8ProfileLocation is missing in CBA folder")
     }
 
     private fun readManifestFiles(profileSource: File, destinationFolder: File): ArrayList<File>? {
@@ -352,7 +352,7 @@ open class K8sProfileUploadComponent(
         if (!isFileInTheManifestFiles(finalFile, manifestFiles))
             return
         val fileContent = templatedFile.bufferedReader().readText()
-        val finalFileContent = BluePrintVelocityTemplateService.generateContent(
+        val finalFileContent = BlueprintVelocityTemplateService.generateContent(
             fileContent,
             params, true
         )