diff options
author | 2021-01-22 11:49:51 -0500 | |
---|---|---|
committer | 2021-01-22 12:08:19 -0500 | |
commit | adcd4f2bc695840e9ecbc05003bc52c675f22fec (patch) | |
tree | 5db58ce9b6b3e86977ca3c697ce3e8998523eb61 /ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org | |
parent | dc8252f3cfa1ddd0c1c8c70513c16c738d840822 (diff) |
Renaming Files having BluePrint to have Blueprint
Replacing BluePrint with Blueprint throughout
Issue-ID: CCSDK-3098
Signed-off-by: KAPIL SINGAL <ks220y@att.com>
Change-Id: Ibee8bad07ae7d9287073db2d4f2f2cd730fa8b96
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org')
58 files changed, 1123 insertions, 1123 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt deleted file mode 100644 index 1c769932f..000000000 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.core - -import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition - -/** - * - * - * @author Brinda Santh - */ -object BluePrintTypes { - - @JvmStatic - val validNodeTypeDerivedFroms: MutableList<String> = arrayListOf( - BluePrintConstants.MODEL_TYPE_NODES_ROOT, - BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW, - BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, - BluePrintConstants.MODEL_TYPE_NODE_VNF, - BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, - BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA, - BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE, - BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT, - BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON, - BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON, - BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT - ) - - @JvmStatic - val validArtifactTypeDerivedFroms: MutableList<String> = arrayListOf( - BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT, - BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION - ) - - @JvmStatic - val validDataTypeDerivedFroms: MutableList<String> = arrayListOf( - BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT, - BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC - ) - - @JvmStatic - val validRelationShipDerivedFroms: MutableList<String> = arrayListOf( - BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, - BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON, - BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON, - BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO, - BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO, - BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO - ) - - @JvmStatic - val validCapabilityTypes: MutableList<String> = arrayListOf( - BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_RESTCONF, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH, - BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP - ) - - @JvmStatic - fun validModelTypes(): List<String> { - val validTypes: MutableList<String> = arrayListOf() - validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) - validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE) - validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE) - validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE) - validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) - return validTypes - } - - @JvmStatic - fun validPropertyTypes(): List<String> { - val validTypes: MutableList<String> = arrayListOf() - validTypes.addAll(validPrimitiveTypes()) - validTypes.addAll(validComplexTypes()) - validTypes.addAll(validCollectionTypes()) - return validTypes - } - - @JvmStatic - fun validPrimitiveTypes(): List<String> { - val validTypes: MutableList<String> = arrayListOf() - validTypes.add(BluePrintConstants.DATA_TYPE_STRING) - validTypes.add(BluePrintConstants.DATA_TYPE_INTEGER) - validTypes.add(BluePrintConstants.DATA_TYPE_FLOAT) - validTypes.add(BluePrintConstants.DATA_TYPE_DOUBLE) - validTypes.add(BluePrintConstants.DATA_TYPE_BOOLEAN) - validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP) - validTypes.add(BluePrintConstants.DATA_TYPE_NULL) - return validTypes - } - - @JvmStatic - fun validComplexTypes(): List<String> { - val validTypes: MutableList<String> = arrayListOf() - validTypes.add(BluePrintConstants.DATA_TYPE_JSON) - validTypes.add(BluePrintConstants.DATA_TYPE_MAP) - return validTypes - } - - @JvmStatic - fun validCollectionTypes(): List<String> { - val validTypes: MutableList<String> = arrayListOf() - validTypes.add(BluePrintConstants.DATA_TYPE_LIST) - return validTypes - } - - @JvmStatic - fun validPrimitiveOrCollectionPrimitive(propertyDefinition: PropertyDefinition): Boolean { - val entrySchema = propertyDefinition.entrySchema?.type ?: BluePrintConstants.DATA_TYPE_NULL - return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type) && - BluePrintTypes.validPrimitiveTypes().contains(entrySchema) - } - - @JvmStatic - fun validCommands(): List<String> { - return listOf( - BluePrintConstants.EXPRESSION_DSL_REFERENCE, - BluePrintConstants.EXPRESSION_GET_INPUT, - BluePrintConstants.EXPRESSION_GET_ATTRIBUTE, - BluePrintConstants.EXPRESSION_GET_PROPERTY, - BluePrintConstants.EXPRESSION_GET_ARTIFACT, - BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT, - BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE - ) - } - - @JvmStatic - fun rootNodeTypes(): List<String> { - return listOf(BluePrintConstants.MODEL_TYPE_NODES_ROOT) - } - - @JvmStatic - fun rootRelationshipTypes(): List<String> { - return listOf(BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT) - } - - @JvmStatic - fun rootDataTypes(): List<String> { - return listOf(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT) - } -} diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintConstants.kt index 9439c2d98..fdd1d5d83 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintConstants.kt @@ -18,11 +18,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core /** - * BluePrintConstants + * BlueprintConstants * * @author Brinda Santh */ -object BluePrintConstants { +object BlueprintConstants { val APP_NAME = System.getenv("APP_NAME") ?: "cds-controller" diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt index 71a107171..b4d95ca3b 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core -class BluePrintError { +class BlueprintError { var errors: MutableList<String> = arrayListOf() diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintException.kt index 74e6bb6bd..10e6f5959 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintException.kt @@ -22,7 +22,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core * * @author Brinda Santh */ -class BluePrintException : BluePrintProcessorException { +class BlueprintException : BlueprintProcessorException { constructor(cause: Throwable) : super(cause) constructor(message: String) : super(message) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintExtensionFunctions.kt index daf833494..0a1b0954a 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintExtensionFunctions.kt @@ -18,9 +18,9 @@ package org.onap.ccsdk.cds.controllerblueprints.core import org.onap.ccsdk.cds.controllerblueprints.core.annotations.ArtifactExpression import org.onap.ccsdk.cds.controllerblueprints.core.annotations.AttributeExpression -import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsConstrain -import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsDataType -import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsProperty +import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BlueprintsConstrain +import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BlueprintsDataType +import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BlueprintsProperty import org.onap.ccsdk.cds.controllerblueprints.core.annotations.DSLExpression import org.onap.ccsdk.cds.controllerblueprints.core.annotations.InputExpression import org.onap.ccsdk.cds.controllerblueprints.core.annotations.OperationOutputExpression @@ -41,9 +41,9 @@ import kotlin.reflect.KProperty1 import kotlin.reflect.KType import kotlin.reflect.full.declaredMemberProperties -fun <T : KClass<*>> T.asBluePrintsDataTypes(): DataType { - val annotation = this.annotations.filter { it is BluePrintsDataType }.single() as BluePrintsDataType - checkNotNull(annotation) { "BluePrintsDataType annotation definition not found" } +fun <T : KClass<*>> T.asBlueprintsDataTypes(): DataType { + val annotation = this.annotations.filter { it is BlueprintsDataType }.single() as BlueprintsDataType + checkNotNull(annotation) { "BlueprintsDataType annotation definition not found" } val dataType = DataType().apply { id = annotation.name version = annotation.version @@ -67,20 +67,20 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition { property.id = this.name val getter = this.getter property.required = !this.returnType.isMarkedNullable - property.type = this.returnType.asBluePrintsDataType(this.name) + property.type = this.returnType.asBlueprintsDataType(this.name) if (this.returnType.arguments.isNotEmpty()) { property.entrySchema = this.returnType.entitySchema() } this.annotations.forEach { fieldAnnotation -> // println("Field : ${this.name} : Annotation : $fieldAnnotation") when (fieldAnnotation) { - is BluePrintsProperty -> + is BlueprintsProperty -> property.description = fieldAnnotation.description is PropertyDefaultValue -> property.value = fieldAnnotation.value.asJsonType(property.type) - is BluePrintsConstrain -> { + is BlueprintsConstrain -> { if (property.constraints == null) property.constraints = arrayListOf() - property.constraints!!.add(fieldAnnotation.asBluePrintConstraintClause()) + property.constraints!!.add(fieldAnnotation.asBlueprintConstraintClause()) } is InputExpression -> { property.value = getInput(fieldAnnotation.propertyName) @@ -117,32 +117,32 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition { return property } -internal fun BluePrintsConstrain.asBluePrintConstraintClause(): ConstraintClause { +internal fun BlueprintsConstrain.asBlueprintConstraintClause(): ConstraintClause { TODO() } internal fun <T : KType> T.entitySchema(): EntrySchema { val entrySchema = EntrySchema() if (this.arguments.size == 1) { - entrySchema.type = this.arguments[0].type!!.asBluePrintsDataType("") + entrySchema.type = this.arguments[0].type!!.asBlueprintsDataType("") } else if (this.arguments.size == 2) { - entrySchema.type = this.arguments[1].type!!.asBluePrintsDataType("") + entrySchema.type = this.arguments[1].type!!.asBlueprintsDataType("") } return entrySchema } -internal fun <T : KType> T.asBluePrintsDataType(propertyName: String): String { +internal fun <T : KType> T.asBlueprintsDataType(propertyName: String): String { val simpleName = (this.classifier as? KClass<*>)?.java?.simpleName - ?: throw BluePrintException("filed to get simple name.") + ?: throw BlueprintException("filed to get simple name.") return when (simpleName) { - "String", "Date" -> BluePrintConstants.DATA_TYPE_STRING - "int" -> BluePrintConstants.DATA_TYPE_INTEGER - "Boolean" -> BluePrintConstants.DATA_TYPE_BOOLEAN - "Float" -> BluePrintConstants.DATA_TYPE_FLOAT - "Double" -> BluePrintConstants.DATA_TYPE_DOUBLE - "List" -> BluePrintConstants.DATA_TYPE_LIST - "Map" -> BluePrintConstants.DATA_TYPE_MAP - "Object", "JsonNode", "ObjectNode", "ArrayNode" -> BluePrintConstants.DATA_TYPE_JSON + "String", "Date" -> BlueprintConstants.DATA_TYPE_STRING + "int" -> BlueprintConstants.DATA_TYPE_INTEGER + "Boolean" -> BlueprintConstants.DATA_TYPE_BOOLEAN + "Float" -> BlueprintConstants.DATA_TYPE_FLOAT + "Double" -> BlueprintConstants.DATA_TYPE_DOUBLE + "List" -> BlueprintConstants.DATA_TYPE_LIST + "Map" -> BlueprintConstants.DATA_TYPE_MAP + "Object", "JsonNode", "ObjectNode", "ArrayNode" -> BlueprintConstants.DATA_TYPE_JSON else -> simpleName } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintProcessorException.kt index c818b0a44..10a299bd0 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintProcessorException.kt @@ -27,7 +27,7 @@ import org.onap.ccsdk.cds.error.catalog.core.ErrorMessage * * @author Brinda Santh */ -open class BluePrintProcessorException : ErrorCatalogException, ErrorCatalogExceptionFluent<BluePrintProcessorException> { +open class BlueprintProcessorException : ErrorCatalogException, ErrorCatalogExceptionFluent<BlueprintProcessorException> { constructor(message: String, cause: Throwable) : super(message, cause) constructor(message: String) : super(message) @@ -37,48 +37,48 @@ open class BluePrintProcessorException : ErrorCatalogException, ErrorCatalogExce constructor(code: Int, message: String) : super(code, message) constructor(code: Int, message: String, cause: Throwable) : super(code, message, cause) - override fun code(code: Int): BluePrintProcessorException { + override fun code(code: Int): BlueprintProcessorException { return this.updateCode(code) } - override fun domain(domain: String): BluePrintProcessorException { + override fun domain(domain: String): BlueprintProcessorException { return this.updateDomain(domain) } - override fun action(action: String): BluePrintProcessorException { + override fun action(action: String): BlueprintProcessorException { return this.updateAction(action) } - override fun http(type: String): BluePrintProcessorException { + override fun http(type: String): BlueprintProcessorException { return this.updateHttp(type) } - override fun grpc(type: String): BluePrintProcessorException { + override fun grpc(type: String): BlueprintProcessorException { return this.updateGrpc(type) } - override fun convertToHttp(): BluePrintProcessorException { + override fun convertToHttp(): BlueprintProcessorException { return this.inverseToHttp() } - override fun convertToGrpc(): BluePrintProcessorException { + override fun convertToGrpc(): BlueprintProcessorException { return this.inverseToHttp() } - override fun payloadMessage(message: String): BluePrintProcessorException { + override fun payloadMessage(message: String): BlueprintProcessorException { return this.updatePayloadMessage(message) } - override fun addErrorPayloadMessage(message: String): BluePrintProcessorException { + override fun addErrorPayloadMessage(message: String): BlueprintProcessorException { return this.updateErrorPayloadMessage(message) } - override fun addSubError(errorMessage: ErrorMessage): BluePrintProcessorException { + override fun addSubError(errorMessage: ErrorMessage): BlueprintProcessorException { return this.updateSubError(errorMessage) } } -class BluePrintRetryException : RuntimeException { +class BlueprintRetryException : RuntimeException { constructor(message: String, cause: Throwable) : super(message, cause) constructor(message: String) : super(message) constructor(cause: Throwable) : super(cause) @@ -87,89 +87,89 @@ class BluePrintRetryException : RuntimeException { /** Extension Functions */ -fun processorException(message: String): BluePrintProcessorException { - return BluePrintProcessorException(message) +fun processorException(message: String): BlueprintProcessorException { + return BlueprintProcessorException(message) } -fun processorException(message: String, cause: Throwable): BluePrintProcessorException { - return BluePrintProcessorException(message, cause) +fun processorException(message: String, cause: Throwable): BlueprintProcessorException { + return BlueprintProcessorException(message, cause) } -fun processorException(cause: Throwable, message: String, vararg args: Any?): BluePrintProcessorException { - return BluePrintProcessorException(cause, message, args) +fun processorException(cause: Throwable, message: String, vararg args: Any?): BlueprintProcessorException { + return BlueprintProcessorException(cause, message, args) } -fun processorException(code: Int, message: String): BluePrintProcessorException { +fun processorException(code: Int, message: String): BlueprintProcessorException { return processorException(message).code(code) } -fun processorException(code: Int, message: String, cause: Throwable): BluePrintProcessorException { +fun processorException(code: Int, message: String, cause: Throwable): BlueprintProcessorException { return processorException(message, cause).code(code) } -fun processorException(code: Int, cause: Throwable, message: String, vararg args: Any?): BluePrintProcessorException { +fun processorException(code: Int, cause: Throwable, message: String, vararg args: Any?): BlueprintProcessorException { return processorException(cause, message, args).code(code) } -fun httpProcessorException(type: String, message: String): BluePrintProcessorException { +fun httpProcessorException(type: String, message: String): BlueprintProcessorException { return processorException(message).http(type) } -fun grpcProcessorException(type: String, message: String): BluePrintProcessorException { +fun grpcProcessorException(type: String, message: String): BlueprintProcessorException { return processorException(message).grpc(type) } -fun httpProcessorException(type: String, domain: String, message: String): BluePrintProcessorException { +fun httpProcessorException(type: String, domain: String, message: String): BlueprintProcessorException { val bluePrintProcessorException = processorException(message).http(type) return bluePrintProcessorException.addDomainAndErrorMessage(domain, message) } -fun grpcProcessorException(type: String, domain: String, message: String): BluePrintProcessorException { +fun grpcProcessorException(type: String, domain: String, message: String): BlueprintProcessorException { val bluePrintProcessorException = processorException(message).grpc(type) return bluePrintProcessorException.addDomainAndErrorMessage(domain, message) } fun httpProcessorException(type: String, domain: String, message: String, cause: Throwable): - BluePrintProcessorException { + BlueprintProcessorException { val bluePrintProcessorException = processorException(message, cause).http(type) return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause)) } fun grpcProcessorException(type: String, domain: String, message: String, cause: Throwable): - BluePrintProcessorException { + BlueprintProcessorException { val bluePrintProcessorException = processorException(message, cause).grpc(type) return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause)) } fun httpProcessorException(type: String, domain: String, message: String, cause: Throwable, vararg args: Any?): - BluePrintProcessorException { + BlueprintProcessorException { val bluePrintProcessorException = processorException(cause, message, args).http(type) return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause)) } fun grpcProcessorException(type: String, domain: String, message: String, cause: Throwable, vararg args: Any?): - BluePrintProcessorException { + BlueprintProcessorException { val bluePrintProcessorException = processorException(cause, message, args).grpc(type) return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause)) } -fun BluePrintProcessorException.updateErrorMessage(domain: String, message: String, cause: String): - BluePrintProcessorException { +fun BlueprintProcessorException.updateErrorMessage(domain: String, message: String, cause: String): + BlueprintProcessorException { return this.addDomainAndErrorMessage(domain, message, cause).domain(domain) .addErrorPayloadMessage(message) .payloadMessage(message) } -fun BluePrintProcessorException.updateErrorMessage(domain: String, message: String): BluePrintProcessorException { +fun BlueprintProcessorException.updateErrorMessage(domain: String, message: String): BlueprintProcessorException { return this.addDomainAndErrorMessage(domain, message).domain(domain) .addErrorPayloadMessage(message) .payloadMessage(message) } -private fun BluePrintProcessorException.addDomainAndErrorMessage( +private fun BlueprintProcessorException.addDomainAndErrorMessage( domain: String, message: String, cause: String = "" -): BluePrintProcessorException { +): BlueprintProcessorException { return this.addSubError(ErrorMessage(domain, message, cause)).domain(domain) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintTypes.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintTypes.kt new file mode 100644 index 000000000..cb78ea19f --- /dev/null +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintTypes.kt @@ -0,0 +1,170 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.controllerblueprints.core + +import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition + +/** + * + * + * @author Brinda Santh + */ +object BlueprintTypes { + + @JvmStatic + val validNodeTypeDerivedFroms: MutableList<String> = arrayListOf( + BlueprintConstants.MODEL_TYPE_NODES_ROOT, + BlueprintConstants.MODEL_TYPE_NODE_WORKFLOW, + BlueprintConstants.MODEL_TYPE_NODE_COMPONENT, + BlueprintConstants.MODEL_TYPE_NODE_VNF, + BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + BlueprintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA, + BlueprintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE, + BlueprintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT, + BlueprintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON, + BlueprintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON, + BlueprintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT + ) + + @JvmStatic + val validArtifactTypeDerivedFroms: MutableList<String> = arrayListOf( + BlueprintConstants.MODEL_TYPE_ARTIFACTS_ROOT, + BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION + ) + + @JvmStatic + val validDataTypeDerivedFroms: MutableList<String> = arrayListOf( + BlueprintConstants.MODEL_TYPE_DATATYPES_ROOT, + BlueprintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC + ) + + @JvmStatic + val validRelationShipDerivedFroms: MutableList<String> = arrayListOf( + BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, + BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON, + BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON, + BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO, + BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO, + BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO + ) + + @JvmStatic + val validCapabilityTypes: MutableList<String> = arrayListOf( + BlueprintConstants.MODEL_TYPE_CAPABILITIES_ROOT, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_RESTCONF, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH, + BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP + ) + + @JvmStatic + fun validModelTypes(): List<String> { + val validTypes: MutableList<String> = arrayListOf() + validTypes.add(BlueprintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) + validTypes.add(BlueprintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE) + validTypes.add(BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE) + validTypes.add(BlueprintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE) + validTypes.add(BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) + return validTypes + } + + @JvmStatic + fun validPropertyTypes(): List<String> { + val validTypes: MutableList<String> = arrayListOf() + validTypes.addAll(validPrimitiveTypes()) + validTypes.addAll(validComplexTypes()) + validTypes.addAll(validCollectionTypes()) + return validTypes + } + + @JvmStatic + fun validPrimitiveTypes(): List<String> { + val validTypes: MutableList<String> = arrayListOf() + validTypes.add(BlueprintConstants.DATA_TYPE_STRING) + validTypes.add(BlueprintConstants.DATA_TYPE_INTEGER) + validTypes.add(BlueprintConstants.DATA_TYPE_FLOAT) + validTypes.add(BlueprintConstants.DATA_TYPE_DOUBLE) + validTypes.add(BlueprintConstants.DATA_TYPE_BOOLEAN) + validTypes.add(BlueprintConstants.DATA_TYPE_TIMESTAMP) + validTypes.add(BlueprintConstants.DATA_TYPE_NULL) + return validTypes + } + + @JvmStatic + fun validComplexTypes(): List<String> { + val validTypes: MutableList<String> = arrayListOf() + validTypes.add(BlueprintConstants.DATA_TYPE_JSON) + validTypes.add(BlueprintConstants.DATA_TYPE_MAP) + return validTypes + } + + @JvmStatic + fun validCollectionTypes(): List<String> { + val validTypes: MutableList<String> = arrayListOf() + validTypes.add(BlueprintConstants.DATA_TYPE_LIST) + return validTypes + } + + @JvmStatic + fun validPrimitiveOrCollectionPrimitive(propertyDefinition: PropertyDefinition): Boolean { + val entrySchema = propertyDefinition.entrySchema?.type ?: BlueprintConstants.DATA_TYPE_NULL + return BlueprintTypes.validPropertyTypes().contains(propertyDefinition.type) && + BlueprintTypes.validPrimitiveTypes().contains(entrySchema) + } + + @JvmStatic + fun validCommands(): List<String> { + return listOf( + BlueprintConstants.EXPRESSION_DSL_REFERENCE, + BlueprintConstants.EXPRESSION_GET_INPUT, + BlueprintConstants.EXPRESSION_GET_ATTRIBUTE, + BlueprintConstants.EXPRESSION_GET_PROPERTY, + BlueprintConstants.EXPRESSION_GET_ARTIFACT, + BlueprintConstants.EXPRESSION_GET_OPERATION_OUTPUT, + BlueprintConstants.EXPRESSION_GET_NODE_OF_TYPE + ) + } + + @JvmStatic + fun rootNodeTypes(): List<String> { + return listOf(BlueprintConstants.MODEL_TYPE_NODES_ROOT) + } + + @JvmStatic + fun rootRelationshipTypes(): List<String> { + return listOf(BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT) + } + + @JvmStatic + fun rootDataTypes(): List<String> { + return listOf(BlueprintConstants.MODEL_TYPE_DATATYPES_ROOT) + } +} diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt index ebe682611..25abcd30b 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt @@ -113,7 +113,7 @@ fun <T : Any?> T.asJsonPrimitive(): JsonNode { is Double -> this.asJsonPrimitive() else -> - throw BluePrintException("$this type is not supported") + throw BlueprintException("$this type is not supported") } } } @@ -121,11 +121,11 @@ fun <T : Any?> T.asJsonPrimitive(): JsonNode { /** Based on Blueprint DataType Convert string value to JsonNode Type **/ fun String.asJsonType(bpDataType: String): JsonNode { return when (bpDataType.toLowerCase()) { - BluePrintConstants.DATA_TYPE_STRING -> this.asJsonPrimitive() - BluePrintConstants.DATA_TYPE_BOOLEAN -> this.toBoolean().asJsonPrimitive() - BluePrintConstants.DATA_TYPE_INTEGER -> this.toInt().asJsonPrimitive() - BluePrintConstants.DATA_TYPE_FLOAT -> this.toFloat().asJsonPrimitive() - BluePrintConstants.DATA_TYPE_DOUBLE -> this.toDouble().asJsonPrimitive() + BlueprintConstants.DATA_TYPE_STRING -> this.asJsonPrimitive() + BlueprintConstants.DATA_TYPE_BOOLEAN -> this.toBoolean().asJsonPrimitive() + BlueprintConstants.DATA_TYPE_INTEGER -> this.toInt().asJsonPrimitive() + BlueprintConstants.DATA_TYPE_FLOAT -> this.toFloat().asJsonPrimitive() + BlueprintConstants.DATA_TYPE_DOUBLE -> this.toDouble().asJsonPrimitive() // For List, Map and Complex Types. else -> this.jsonAsJsonType() } @@ -182,7 +182,7 @@ fun <T : Any> Map<String, *>.castValue(key: String, valueType: KClass<T>): T { if (containsKey(key)) { return get(key) as T } else { - throw BluePrintException("couldn't find the key $key") + throw BlueprintException("couldn't find the key $key") } } @@ -197,7 +197,7 @@ fun JsonNode.asByteArray(): ByteArray { fun <T> JsonNode.asType(clazzType: Class<T>): T { return JacksonUtils.readValue(this, clazzType) - ?: throw BluePrintException("couldn't convert JsonNode of type $clazzType") + ?: throw BlueprintException("couldn't convert JsonNode of type $clazzType") } fun JsonNode.asListOfString(): List<String> { @@ -226,7 +226,7 @@ fun JsonNode.rootFieldsToMap(): MutableMap<String, JsonNode> { } return propertyMap } else { - throw BluePrintException("json node should be Object Node Type") + throw BlueprintException("json node should be Object Node Type") } } @@ -248,19 +248,19 @@ fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) { } fun Map<String, JsonNode>.getAsString(key: String): String { - return this[key]?.asText() ?: throw BluePrintException("couldn't find value for key($key)") + return this[key]?.asText() ?: throw BlueprintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getAsBoolean(key: String): Boolean { - return this[key]?.asBoolean() ?: throw BluePrintException("couldn't find value for key($key)") + return this[key]?.asBoolean() ?: throw BlueprintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getAsInt(key: String): Int { - return this[key]?.asInt() ?: throw BluePrintException("couldn't find value for key($key)") + return this[key]?.asInt() ?: throw BlueprintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getAsDouble(key: String): Double { - return this[key]?.asDouble() ?: throw BluePrintException("couldn't find value for key($key)") + return this[key]?.asDouble() ?: throw BlueprintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getOptionalAsString(key: String): String? { @@ -285,7 +285,7 @@ inline fun checkEquals(value1: String?, value2: String?, lazyMessage: () -> Any) if (value1.equals(value2, ignoreCase = true)) { return true } else { - throw BluePrintException(lazyMessage().toString()) + throw BlueprintException(lazyMessage().toString()) } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt index 518e9b236..ca3d815f3 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.apache.commons.io.FileUtils -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintArchiveUtils import java.io.File import java.io.InputStream import java.nio.charset.Charset @@ -39,7 +39,7 @@ fun File.reCreateDirs(): File { // this.mkdirs() FileUtils.forceMkdir(this) check(this.exists()) { - throw BluePrintException("failed to re create dir(${this.absolutePath})") + throw BlueprintException("failed to re create dir(${this.absolutePath})") } return this } @@ -52,7 +52,7 @@ fun File.compress(targetZipFileName: String): File { * Compress the current Dir to the target zip file and return the target zip file */ fun File.compress(targetZipFile: File): File { - BluePrintArchiveUtils.compress(this, targetZipFile) + BlueprintArchiveUtils.compress(this, targetZipFile) return targetZipFile } @@ -64,7 +64,7 @@ fun File.deCompress(targetFileName: String): File { * De-Compress the current zip file to the target file and return the target file */ fun File.deCompress(targetFile: File): File { - BluePrintArchiveUtils.deCompress(this, targetFile.path) + BlueprintArchiveUtils.deCompress(this, targetFile.path) return targetFile } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BlueprintsAnnotations.kt index c39442976..a72860ae2 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BlueprintsAnnotations.kt @@ -16,25 +16,25 @@ package org.onap.ccsdk.cds.controllerblueprints.core.annotations -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import kotlin.reflect.KClass @Target(AnnotationTarget.CLASS) -annotation class BluePrintsDataType( +annotation class BlueprintsDataType( val name: String, - val version: String = BluePrintConstants.DEFAULT_VERSION_NUMBER, + val version: String = BlueprintConstants.DEFAULT_VERSION_NUMBER, val description: String, val derivedFrom: String = "tosca.datatypes.root" ) @Target(AnnotationTarget.CLASS) -annotation class BluePrintsWorkflowInput +annotation class BlueprintsWorkflowInput @Target(AnnotationTarget.CLASS) -annotation class BluePrintsWorkflowOutput +annotation class BlueprintsWorkflowOutput @Target(AnnotationTarget.CLASS) -annotation class BluePrintsNodeType( +annotation class BlueprintsNodeType( val propertiesType: KClass<*>, val attributesType: KClass<*>, val inputsType: KClass<*>, @@ -42,14 +42,14 @@ annotation class BluePrintsNodeType( ) @Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY) -annotation class BluePrintsProperty( +annotation class BlueprintsProperty( val name: String = "", val description: String = "" ) @Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY) @Repeatable -annotation class BluePrintsConstrain() +annotation class BlueprintsConstrain() @Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY) annotation class PropertyDefaultValue(val value: String) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BlueprintLoadConfiguration.kt index adfbf2905..5176ffefd 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BlueprintLoadConfiguration.kt @@ -17,13 +17,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core.config -open class BluePrintLoadConfiguration { +open class BlueprintLoadConfiguration { lateinit var blueprintDeployPath: String lateinit var blueprintArchivePath: String lateinit var blueprintWorkingPath: String - var loadBluePrintPaths: String? = null + var loadBlueprintPaths: String? = null var loadModeTypePaths: String? = null var loadResourceDictionaryPaths: String? = null } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintExpressionData.kt index 37c128714..37c128714 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintExpressionData.kt diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintGraph.kt index b833db755..b833db755 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintGraph.kt diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintModel.kt index 9f32d8830..49736c18b 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintModel.kt @@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonPropertyOrder import com.fasterxml.jackson.databind.JsonNode import io.swagger.annotations.ApiModelProperty -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType /** @@ -248,7 +248,7 @@ class Implementation { var dependencies: MutableList<String>? = null @get:JsonProperty("operation_host") - var operationHost: String = BluePrintConstants.PROPERTY_SELF + var operationHost: String = BlueprintConstants.PROPERTY_SELF // Timeout value in seconds var timeout: Int = 180 @@ -732,5 +732,5 @@ class ToscaMetaData { lateinit var templateName: String lateinit var templateVersion: String lateinit var templateTags: String - var templateType: String = BluePrintConstants.BLUEPRINT_TYPE_DEFAULT + var templateType: String = BlueprintConstants.BLUEPRINT_TYPE_DEFAULT } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintDSL.kt index 88f852d41..503e07048 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintDSL.kt @@ -17,8 +17,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType @@ -35,9 +35,9 @@ fun blueprint( version: String, author: String, tags: String, - block: DSLBluePrintBuilder.() -> Unit -): DSLBluePrint { - return DSLBluePrintBuilder(name, version, author, tags).apply(block).build() + block: DSLBlueprintBuilder.() -> Unit +): DSLBlueprint { + return DSLBlueprintBuilder(name, version, author, tags).apply(block).build() } // TOSCA DSLs @@ -172,59 +172,59 @@ fun getNodeTemplateOperationOutput( /** Blueprint Type Extensions */ fun ServiceTemplateBuilder.nodeTypeComponent() { - val nodeType = BluePrintTypes.nodeTypeComponent() + val nodeType = BlueprintTypes.nodeTypeComponent() if (this.nodeTypes == null) this.nodeTypes = hashMapOf() this.nodeTypes!![nodeType.id!!] = nodeType } -fun BluePrintTypes.nodeTypeComponent(): NodeType { +fun BlueprintTypes.nodeTypeComponent(): NodeType { return nodeType( - id = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT, + id = BlueprintConstants.MODEL_TYPE_NODE_COMPONENT, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT, description = "This is default Component Node" ) { } } @Deprecated("CDS won't support, use implerative workflow definitions.") -fun BluePrintTypes.nodeTypeWorkflow(): NodeType { +fun BlueprintTypes.nodeTypeWorkflow(): NodeType { return nodeType( - id = BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT, + id = BlueprintConstants.MODEL_TYPE_NODE_WORKFLOW, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT, description = "This is default Workflow Node" ) { } } fun ServiceTemplateBuilder.nodeTypeVnf() { - val nodeType = BluePrintTypes.nodeTypeVnf() + val nodeType = BlueprintTypes.nodeTypeVnf() if (this.nodeTypes == null) this.nodeTypes = hashMapOf() this.nodeTypes!![nodeType.id!!] = nodeType } -fun BluePrintTypes.nodeTypeVnf(): NodeType { +fun BlueprintTypes.nodeTypeVnf(): NodeType { return nodeType( - id = BluePrintConstants.MODEL_TYPE_NODE_VNF, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT, + id = BlueprintConstants.MODEL_TYPE_NODE_VNF, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT, description = "This is default VNF Node" ) { } } fun ServiceTemplateBuilder.nodeTypeResourceSource() { - val nodeType = BluePrintTypes.nodeTypeResourceSource() + val nodeType = BlueprintTypes.nodeTypeResourceSource() if (this.nodeTypes == null) this.nodeTypes = hashMapOf() this.nodeTypes!![nodeType.id!!] = nodeType } -fun BluePrintTypes.nodeTypeResourceSource(): NodeType { +fun BlueprintTypes.nodeTypeResourceSource(): NodeType { return nodeType( - id = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT, + id = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT, description = "This is default Resource Source Node" ) { } @@ -232,16 +232,16 @@ fun BluePrintTypes.nodeTypeResourceSource(): NodeType { /** Artifacts */ fun ServiceTemplateBuilder.artifactTypeTemplateVelocity() { - val artifactType = BluePrintTypes.artifactTypeTemplateVelocity() + val artifactType = BlueprintTypes.artifactTypeTemplateVelocity() if (this.artifactTypes == null) this.artifactTypes = hashMapOf() this.artifactTypes!![artifactType.id!!] = artifactType } -fun BluePrintTypes.artifactTypeTemplateVelocity(): ArtifactType { +fun BlueprintTypes.artifactTypeTemplateVelocity(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Velocity Artifact" ) { fileExt("vtl") @@ -249,16 +249,16 @@ fun BluePrintTypes.artifactTypeTemplateVelocity(): ArtifactType { } fun ServiceTemplateBuilder.artifactTypeTempleJinja() { - val artifactType = BluePrintTypes.artifactTypeTempleJinja() + val artifactType = BlueprintTypes.artifactTypeTempleJinja() if (this.artifactTypes == null) this.artifactTypes = hashMapOf() this.artifactTypes!![artifactType.id!!] = artifactType } -fun BluePrintTypes.artifactTypeTempleJinja(): ArtifactType { +fun BlueprintTypes.artifactTypeTempleJinja(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Jinja Artifact" ) { fileExt("jinja") @@ -266,16 +266,16 @@ fun BluePrintTypes.artifactTypeTempleJinja(): ArtifactType { } fun ServiceTemplateBuilder.artifactTypeMappingResource() { - val artifactType = BluePrintTypes.artifactTypeMappingResource() + val artifactType = BlueprintTypes.artifactTypeMappingResource() if (this.artifactTypes == null) this.artifactTypes = hashMapOf() this.artifactTypes!![artifactType.id!!] = artifactType } -fun BluePrintTypes.artifactTypeMappingResource(): ArtifactType { +fun BlueprintTypes.artifactTypeMappingResource(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Mapping Resource Artifact" ) { fileExt("json") @@ -283,11 +283,11 @@ fun BluePrintTypes.artifactTypeMappingResource(): ArtifactType { } @Deprecated("CDS won't support", replaceWith = ReplaceWith("artifactTypeScriptKotlin")) -fun BluePrintTypes.artifactTypeScriptJython(): ArtifactType { +fun BlueprintTypes.artifactTypeScriptJython(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Jython Script Artifact" ) { fileExt("py") @@ -295,16 +295,16 @@ fun BluePrintTypes.artifactTypeScriptJython(): ArtifactType { } fun ServiceTemplateBuilder.artifactTypeScriptKotlin() { - val artifactType = BluePrintTypes.artifactTypeScriptKotlin() + val artifactType = BlueprintTypes.artifactTypeScriptKotlin() if (this.artifactTypes == null) this.artifactTypes = hashMapOf() this.artifactTypes!![artifactType.id!!] = artifactType } -fun BluePrintTypes.artifactTypeScriptKotlin(): ArtifactType { +fun BlueprintTypes.artifactTypeScriptKotlin(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Kotlin Script Artifact" ) { fileExt("kts") @@ -312,27 +312,27 @@ fun BluePrintTypes.artifactTypeScriptKotlin(): ArtifactType { } fun ServiceTemplateBuilder.artifactTypeK8sProfileFolder() { - val artifactType = BluePrintTypes.artifactTypeK8sProfileFolder() + val artifactType = BlueprintTypes.artifactTypeK8sProfileFolder() if (this.artifactTypes == null) this.artifactTypes = hashMapOf() this.artifactTypes!![artifactType.id!!] = artifactType } -fun BluePrintTypes.artifactTypeK8sProfileFolder(): ArtifactType { +fun BlueprintTypes.artifactTypeK8sProfileFolder(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "K8s Profile Folder Artifact" ) { } } @Deprecated("CDS won't support, use implerative workflow definitions.") -fun BluePrintTypes.artifactTypeDirectedGraph(): ArtifactType { +fun BlueprintTypes.artifactTypeDirectedGraph(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Directed Graph Artifact" ) { fileExt("xml", "json") @@ -340,16 +340,16 @@ fun BluePrintTypes.artifactTypeDirectedGraph(): ArtifactType { } fun ServiceTemplateBuilder.artifactTypeComponentJar() { - val artifactType = BluePrintTypes.artifactTypeComponentJar() + val artifactType = BlueprintTypes.artifactTypeComponentJar() if (this.artifactTypes == null) this.artifactTypes = hashMapOf() this.artifactTypes!![artifactType.id!!] = artifactType } -fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType { +fun BlueprintTypes.artifactTypeComponentJar(): ArtifactType { return artifactType( - id = BluePrintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, + id = BlueprintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION, description = "Component Artifact" ) { fileExt("jar") @@ -359,49 +359,49 @@ fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType { /** Relationship Types */ fun ServiceTemplateBuilder.relationshipTypeConnectsTo() { - val relationshipType = BluePrintTypes.relationshipTypeConnectsTo() + val relationshipType = BlueprintTypes.relationshipTypeConnectsTo() if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf() this.relationshipTypes!![relationshipType.id!!] = relationshipType } -fun BluePrintTypes.relationshipTypeConnectsTo(): RelationshipType { +fun BlueprintTypes.relationshipTypeConnectsTo(): RelationshipType { return relationshipType( - id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, + id = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, description = "Relationship connects to" ) { - validTargetTypes(arrayListOf(BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT)) + validTargetTypes(arrayListOf(BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT)) } } fun ServiceTemplateBuilder.relationshipTypeDependsOn() { - val relationshipType = BluePrintTypes.relationshipTypeDependsOn() + val relationshipType = BlueprintTypes.relationshipTypeDependsOn() if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf() this.relationshipTypes!![relationshipType.id!!] = relationshipType } -fun BluePrintTypes.relationshipTypeDependsOn(): RelationshipType { +fun BlueprintTypes.relationshipTypeDependsOn(): RelationshipType { return relationshipType( - id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, + id = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, description = "Relationship depends on" ) { } } fun ServiceTemplateBuilder.relationshipTypeHostedOn() { - val relationshipType = BluePrintTypes.relationshipTypeHostedOn() + val relationshipType = BlueprintTypes.relationshipTypeHostedOn() if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf() this.relationshipTypes!![relationshipType.id!!] = relationshipType } -fun BluePrintTypes.relationshipTypeHostedOn(): RelationshipType { +fun BlueprintTypes.relationshipTypeHostedOn(): RelationshipType { return relationshipType( - id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON, - version = BluePrintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, + id = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON, + version = BlueprintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT, description = "Relationship hosted on" ) { } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintDSLBuilder.kt index b469ded74..f92a955a5 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintDSLBuilder.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType @@ -30,14 +30,14 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.Step /** * @author Brinda Santh */ -class DSLBluePrintBuilder( +class DSLBlueprintBuilder( private val name: String, private val version: String, private val author: String, private val tags: String ) { - private var dslBluePrint = DSLBluePrint() + private var dslBlueprint = DSLBlueprint() private var metadata: MutableMap<String, String> = hashMapOf() var properties: MutableMap<String, JsonNode>? = null var dataTypes: MutableMap<String, DataType> = hashMapOf() @@ -47,10 +47,10 @@ class DSLBluePrintBuilder( var workflows: MutableMap<String, DSLWorkflow> = hashMapOf() private fun initMetaData() { - metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] = name - metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] = version - metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] = author - metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] = tags + metadata[BlueprintConstants.METADATA_TEMPLATE_NAME] = name + metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION] = version + metadata[BlueprintConstants.METADATA_TEMPLATE_AUTHOR] = author + metadata[BlueprintConstants.METADATA_TEMPLATE_TAGS] = tags } fun metadata(id: String, value: String) { @@ -117,16 +117,16 @@ class DSLBluePrintBuilder( workflows[id] = DSLWorkflowBuilder(id, description).apply(block).build() } - fun build(): DSLBluePrint { + fun build(): DSLBlueprint { initMetaData() - dslBluePrint.metadata = metadata - dslBluePrint.properties = properties - dslBluePrint.dataTypes = dataTypes - dslBluePrint.artifactTypes = artifactTypes - dslBluePrint.components = components - dslBluePrint.registryComponents = registryComponents - dslBluePrint.workflows = workflows - return dslBluePrint + dslBlueprint.metadata = metadata + dslBlueprint.properties = properties + dslBlueprint.dataTypes = dataTypes + dslBlueprint.artifactTypes = artifactTypes + dslBlueprint.components = components + dslBlueprint.registryComponents = registryComponents + dslBlueprint.workflows = workflows + return dslBlueprint } } @@ -190,7 +190,7 @@ class DSLComponentBuilder( properties!![id] = property } - fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) { + fun implementation(timeout: Int, operationHost: String? = BlueprintConstants.PROPERTY_SELF) { implementation = Implementation().apply { this.operationHost = operationHost!! this.timeout = timeout @@ -291,7 +291,7 @@ class DSLRegistryComponentBuilder( properties!![id] = expression.asJsonType() } - fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) { + fun implementation(timeout: Int, operationHost: String? = BlueprintConstants.PROPERTY_SELF) { implementation = Implementation().apply { this.operationHost = operationHost!! this.timeout = timeout @@ -413,7 +413,7 @@ class DSLWorkflowBuilder(private val actionName: String, private val description class DSLAttributeDefinitionBuilder( private val id: String, - private val type: String? = BluePrintConstants.DATA_TYPE_STRING, + private val type: String? = BlueprintConstants.DATA_TYPE_STRING, private val required: Boolean? = false, private val expression: JsonNode, private val description: String? = "" @@ -446,7 +446,7 @@ class DSLAttributeDefinitionBuilder( class DSLPropertyDefinitionBuilder( private val id: String, - private val type: String? = BluePrintConstants.DATA_TYPE_STRING, + private val type: String? = BlueprintConstants.DATA_TYPE_STRING, private val required: Boolean? = false, private val expression: JsonNode, private val description: String? = "" diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintDSLData.kt index 370531d2a..8f1a8d145 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintDSLData.kt @@ -31,7 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.Step * @author Brinda Santh */ -class DSLBluePrint { +class DSLBlueprint { var metadata: MutableMap<String, String> = hashMapOf() var properties: MutableMap<String, JsonNode>? = null diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintServiceTemplateGenerator.kt index d07fc9c71..21bc8c7d8 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintServiceTemplateGenerator.kt @@ -18,7 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.NullNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.bpClone import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition @@ -38,7 +38,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow * Generate Service Template for the simplified DSL. * @author Brinda Santh */ -class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) { +class BlueprintServiceTemplateGenerator(private val dslBlueprint: DSLBlueprint) { private var serviceTemplate = ServiceTemplate() @@ -47,11 +47,11 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) private val dataTypes: MutableMap<String, DataType> = hashMapOf() fun serviceTemplate(): ServiceTemplate { - serviceTemplate.metadata = dslBluePrint.metadata - serviceTemplate.dslDefinitions = dslBluePrint.properties + serviceTemplate.metadata = dslBlueprint.metadata + serviceTemplate.dslDefinitions = dslBlueprint.properties - dataTypes.putAll(dslBluePrint.dataTypes) - artifactTypes.putAll(dslBluePrint.artifactTypes) + dataTypes.putAll(dslBlueprint.dataTypes) + artifactTypes.putAll(dslBlueprint.artifactTypes) serviceTemplate.dataTypes = dataTypes serviceTemplate.artifactTypes = artifactTypes @@ -74,7 +74,7 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) val nodeTemplates: MutableMap<String, NodeTemplate> = hashMapOf() // For New or Dynamic Components - val components = dslBluePrint.components + val components = dslBlueprint.components components.forEach { (dslCompName, dslComp) -> val nodeTemplate = NodeTemplate() nodeTemplate.type = dslComp.type @@ -88,7 +88,7 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) } // For Registry Components - val registryComponents = dslBluePrint.registryComponents + val registryComponents = dslBlueprint.registryComponents registryComponents.forEach { (dslCompName, dslComp) -> val nodeTemplate = NodeTemplate() nodeTemplate.type = dslComp.type @@ -102,10 +102,10 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) private fun populateWorkflow(): MutableMap<String, Workflow>? { var workflows: MutableMap<String, Workflow>? = null - if (dslBluePrint.workflows.isNotEmpty()) { + if (dslBlueprint.workflows.isNotEmpty()) { workflows = hashMapOf() - dslBluePrint.workflows.forEach { (dslWorkflowName, dslWorkflow) -> + dslBlueprint.workflows.forEach { (dslWorkflowName, dslWorkflow) -> val workflow = Workflow() workflow.description = dslWorkflow.description workflow.steps = dslWorkflow.steps @@ -119,7 +119,7 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) private fun populateNodeType(dslComponent: DSLComponent): NodeType { val nodeType = NodeType() - nodeType.derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT + nodeType.derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT nodeType.version = dslComponent.version nodeType.description = dslComponent.description nodeType.interfaces = populateInterfaceDefinitions(dslComponent, nodeType) @@ -136,13 +136,13 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) operationDefinition.outputs = propertyDefinitions(dslComponent.outputs) val operations: MutableMap<String, OperationDefinition> = hashMapOf() - operations[BluePrintConstants.DEFAULT_STEP_OPERATION] = operationDefinition + operations[BlueprintConstants.DEFAULT_STEP_OPERATION] = operationDefinition val interfaceDefinition = InterfaceDefinition() interfaceDefinition.operations = operations val interfaces: MutableMap<String, InterfaceDefinition> = hashMapOf() - interfaces[BluePrintConstants.DEFAULT_STEP_INTERFACE] = interfaceDefinition + interfaces[BlueprintConstants.DEFAULT_STEP_INTERFACE] = interfaceDefinition return interfaces } @@ -153,7 +153,7 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) operationAssignment.outputs = dslComponent.outputs val operations: MutableMap<String, OperationAssignment> = hashMapOf() - operations[BluePrintConstants.DEFAULT_STEP_OPERATION] = operationAssignment + operations[BlueprintConstants.DEFAULT_STEP_OPERATION] = operationAssignment val interfaceAssignment = InterfaceAssignment() interfaceAssignment.operations = operations @@ -170,13 +170,13 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint) operationAssignment.outputs = propertyAssignments(dslComponent.outputs) val operations: MutableMap<String, OperationAssignment> = hashMapOf() - operations[BluePrintConstants.DEFAULT_STEP_OPERATION] = operationAssignment + operations[BlueprintConstants.DEFAULT_STEP_OPERATION] = operationAssignment val interfaceAssignment = InterfaceAssignment() interfaceAssignment.operations = operations val interfaces: MutableMap<String, InterfaceAssignment> = hashMapOf() - interfaces[BluePrintConstants.DEFAULT_STEP_INTERFACE] = interfaceAssignment + interfaces[BlueprintConstants.DEFAULT_STEP_INTERFACE] = interfaceAssignment return interfaces } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintTemplateDSLBuilder.kt index 3a3503403..f8f6080ad 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintTemplateDSLBuilder.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment @@ -156,7 +156,7 @@ open class NodeTemplateBuilder( if (interfaces == null) interfaces = hashMapOf() val interfaceAssignment = InterfaceAssignment() - val defaultOperationName = BluePrintConstants.DEFAULT_STEP_OPERATION + val defaultOperationName = BlueprintConstants.DEFAULT_STEP_OPERATION interfaceAssignment.operations = hashMapOf() interfaceAssignment.operations!![defaultOperationName] = OperationAssignmentBuilder<In, Out>(defaultOperationName, description).apply(block).build() @@ -380,7 +380,7 @@ class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : Propert operationAssignment.implementation = implementation } - fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) { + fun implementation(timeout: Int, operationHost: String? = BlueprintConstants.PROPERTY_SELF) { operationAssignment.implementation = Implementation().apply { this.operationHost = operationHost!! this.timeout = timeout @@ -389,7 +389,7 @@ class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : Propert fun implementation( timeout: Int, - operationHost: String? = BluePrintConstants.PROPERTY_SELF, + operationHost: String? = BlueprintConstants.PROPERTY_SELF, block: ImplementationBuilder.() -> Unit ) { operationAssignment.implementation = ImplementationBuilder(timeout, operationHost!!).apply(block).build() diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintTypeDSLBuilder.kt index 3dfdbac57..3b3b4b41f 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintTypeDSLBuilder.kt @@ -18,7 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ArrayNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString @@ -285,7 +285,7 @@ class CapabilityDefinitionBuilder(private val id: String, private val type: Stri private var capabilityDefinition = CapabilityDefinition() private val properties: MutableMap<String, PropertyDefinition> = hashMapOf() - fun property(id: String, type: String? = BluePrintConstants.DATA_TYPE_STRING, required: Boolean? = false, description: String? = "") { + fun property(id: String, type: String? = BlueprintConstants.DATA_TYPE_STRING, required: Boolean? = false, description: String? = "") { val property = PropertyDefinitionBuilder(id, type, required, description).build() properties[id] = property } @@ -361,7 +361,7 @@ class OperationDefinitionBuilder( class AttributeDefinitionBuilder( private val id: String, - private val type: String? = BluePrintConstants.DATA_TYPE_STRING, + private val type: String? = BlueprintConstants.DATA_TYPE_STRING, private val required: Boolean? = false, private val description: String? = "" ) { @@ -432,7 +432,7 @@ class PropertiesDefinitionBuilder { class PropertyDefinitionBuilder( private val id: String, - private val type: String? = BluePrintConstants.DATA_TYPE_STRING, + private val type: String? = BlueprintConstants.DATA_TYPE_STRING, private val required: Boolean? = false, private val description: String? = "" ) { diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintWorkflowDSLBuilder.kt index 8a1a9d63c..0de1a510c 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BlueprintWorkflowDSLBuilder.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap import org.onap.ccsdk.cds.controllerblueprints.core.data.Activity import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition @@ -111,7 +111,7 @@ class StepBuilder( step.id = id step.target = target // Add Default Activity, Assumption is only one Operation - activity(".${BluePrintConstants.DEFAULT_STEP_OPERATION}") + activity(".${BlueprintConstants.DEFAULT_STEP_OPERATION}") step.description = description step.activities = activities step.onSuccess = onSuccess diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/ServiceTemplateBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/ServiceTemplateBuilder.kt index 254e644b3..4391e89e0 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/ServiceTemplateBuilder.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/ServiceTemplateBuilder.kt @@ -17,8 +17,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.asBluePrintsDataTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.asBlueprintsDataTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap @@ -51,10 +51,10 @@ class ServiceTemplateBuilder( var policyTypes: MutableMap<String, PolicyType>? = null private fun initMetaData() { - metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] = name - metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] = version - metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] = author - metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] = tags + metadata[BlueprintConstants.METADATA_TEMPLATE_NAME] = name + metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION] = version + metadata[BlueprintConstants.METADATA_TEMPLATE_AUTHOR] = author + metadata[BlueprintConstants.METADATA_TEMPLATE_TAGS] = tags } fun metadata(id: String, value: String) { @@ -73,7 +73,7 @@ class ServiceTemplateBuilder( } fun dataType(dataType: KClass<*>) { - dataType(dataType.asBluePrintsDataTypes()) + dataType(dataType.asBlueprintsDataTypes()) } fun dsl(id: String, content: Any) { diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintCatalogService.kt index bd45bed06..87ee0e4f9 100755..100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintCatalogService.kt @@ -16,11 +16,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import java.io.File import java.nio.file.Path -interface BluePrintCatalogService { +interface BlueprintCatalogService { /** * Save the CBA to database. @@ -28,9 +28,9 @@ interface BluePrintCatalogService { * @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 + * @throws BlueprintException if process failed */ - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) suspend fun saveToDatabase(processingId: String, blueprintFile: File, validate: Boolean = true): String /** @@ -39,19 +39,19 @@ interface BluePrintCatalogService { * @param version Version of the blueprint * @param extract true to extract the content, false for archived content. Default to true * @return Path where CBA is located - * @throws BluePrintException if process failed + * @throws BlueprintException if process failed */ - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) suspend fun getFromDatabase(name: String, version: String, extract: Boolean = true): Path /** * Delete the CBA from database. * @param name Name of the blueprint * @param version Version of the blueprint - * @throws BluePrintException if process failed + * @throws BlueprintException if process failed */ - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) suspend fun deleteFromDatabase(name: String, version: String) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintDefinitions.kt index fcc9bf2d7..109bc7b85 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintDefinitions.kt @@ -18,7 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate -interface BluePrintDefinitions { +interface BlueprintDefinitions { /** Define the service Template Model */ fun serviceTemplate(): ServiceTemplate @@ -35,7 +35,7 @@ interface BluePrintDefinitions { fun otherDefinitions(): MutableMap<String, Any> } -abstract class AbstractBluePrintDefinitions : BluePrintDefinitions { +abstract class AbstractBlueprintDefinitions : BlueprintDefinitions { private val otherDefinitionMap: MutableMap<String, Any> = hashMapOf() diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintEnhancer.kt index 2080cd161..318fd2b91 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintEnhancer.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate @@ -29,71 +29,71 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService -interface BluePrintEnhancer<T> { +interface BlueprintEnhancer<T> { - fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T) + fun enhance(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, type: T) } -interface BluePrintServiceTemplateEnhancer : BluePrintEnhancer<ServiceTemplate> +interface BlueprintServiceTemplateEnhancer : BlueprintEnhancer<ServiceTemplate> -interface BluePrintTopologyTemplateEnhancer : BluePrintEnhancer<TopologyTemplate> +interface BlueprintTopologyTemplateEnhancer : BlueprintEnhancer<TopologyTemplate> -interface BluePrintWorkflowEnhancer : BluePrintEnhancer<Workflow> +interface BlueprintWorkflowEnhancer : BlueprintEnhancer<Workflow> -interface BluePrintNodeTemplateEnhancer : BluePrintEnhancer<NodeTemplate> +interface BlueprintNodeTemplateEnhancer : BlueprintEnhancer<NodeTemplate> -interface BluePrintNodeTypeEnhancer : BluePrintEnhancer<NodeType> +interface BlueprintNodeTypeEnhancer : BlueprintEnhancer<NodeType> -interface BluePrintRelationshipTemplateEnhancer : BluePrintEnhancer<RelationshipTemplate> +interface BlueprintRelationshipTemplateEnhancer : BlueprintEnhancer<RelationshipTemplate> -interface BluePrintRelationshipTypeEnhancer : BluePrintEnhancer<RelationshipType> +interface BlueprintRelationshipTypeEnhancer : BlueprintEnhancer<RelationshipType> -interface BluePrintArtifactDefinitionEnhancer : BluePrintEnhancer<ArtifactDefinition> +interface BlueprintArtifactDefinitionEnhancer : BlueprintEnhancer<ArtifactDefinition> -interface BluePrintPolicyTypeEnhancer : BluePrintEnhancer<PolicyType> +interface BlueprintPolicyTypeEnhancer : BlueprintEnhancer<PolicyType> -interface BluePrintPropertyDefinitionEnhancer : BluePrintEnhancer<PropertyDefinition> +interface BlueprintPropertyDefinitionEnhancer : BlueprintEnhancer<PropertyDefinition> -interface BluePrintAttributeDefinitionEnhancer : BluePrintEnhancer<AttributeDefinition> +interface BlueprintAttributeDefinitionEnhancer : BlueprintEnhancer<AttributeDefinition> -interface BluePrintEnhancerService { +interface BlueprintEnhancerService { - @Throws(BluePrintException::class) - suspend fun enhance(basePath: String, enrichedBasePath: String): BluePrintContext + @Throws(BlueprintException::class) + suspend fun enhance(basePath: String, enrichedBasePath: String): BlueprintContext - @Throws(BluePrintException::class) - suspend fun enhance(basePath: String): BluePrintContext + @Throws(BlueprintException::class) + suspend fun enhance(basePath: String): BlueprintContext } -interface BluePrintTypeEnhancerService { +interface BlueprintTypeEnhancerService { - fun getServiceTemplateEnhancers(): List<BluePrintServiceTemplateEnhancer> + fun getServiceTemplateEnhancers(): List<BlueprintServiceTemplateEnhancer> - fun getTopologyTemplateEnhancers(): List<BluePrintTopologyTemplateEnhancer> + fun getTopologyTemplateEnhancers(): List<BlueprintTopologyTemplateEnhancer> - fun getWorkflowEnhancers(): List<BluePrintWorkflowEnhancer> + fun getWorkflowEnhancers(): List<BlueprintWorkflowEnhancer> - fun getNodeTemplateEnhancers(): List<BluePrintNodeTemplateEnhancer> + fun getNodeTemplateEnhancers(): List<BlueprintNodeTemplateEnhancer> - fun getNodeTypeEnhancers(): List<BluePrintNodeTypeEnhancer> + fun getNodeTypeEnhancers(): List<BlueprintNodeTypeEnhancer> - fun getRelationshipTemplateEnhancers(): List<BluePrintRelationshipTemplateEnhancer> + fun getRelationshipTemplateEnhancers(): List<BlueprintRelationshipTemplateEnhancer> - fun getRelationshipTypeEnhancers(): List<BluePrintRelationshipTypeEnhancer> + fun getRelationshipTypeEnhancers(): List<BlueprintRelationshipTypeEnhancer> - fun getArtifactDefinitionEnhancers(): List<BluePrintArtifactDefinitionEnhancer> + fun getArtifactDefinitionEnhancers(): List<BlueprintArtifactDefinitionEnhancer> - fun getPolicyTypeEnhancers(): List<BluePrintPolicyTypeEnhancer> + fun getPolicyTypeEnhancers(): List<BlueprintPolicyTypeEnhancer> - fun getPropertyDefinitionEnhancers(): List<BluePrintPropertyDefinitionEnhancer> + fun getPropertyDefinitionEnhancers(): List<BlueprintPropertyDefinitionEnhancer> - fun getAttributeDefinitionEnhancers(): List<BluePrintAttributeDefinitionEnhancer> + fun getAttributeDefinitionEnhancers(): List<BlueprintAttributeDefinitionEnhancer> fun enhanceServiceTemplate( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate ) { @@ -102,7 +102,7 @@ interface BluePrintTypeEnhancerService { } fun enhanceTopologyTemplate( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate ) { @@ -110,13 +110,13 @@ interface BluePrintTypeEnhancerService { doEnhancement(bluePrintRuntimeService, name, topologyTemplate, enhancers) } - fun enhanceWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) { + fun enhanceWorkflow(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, workflow: Workflow) { val enhancers = getWorkflowEnhancers() doEnhancement(bluePrintRuntimeService, name, workflow, enhancers) } fun enhanceNodeTemplate( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate ) { @@ -124,13 +124,13 @@ interface BluePrintTypeEnhancerService { doEnhancement(bluePrintRuntimeService, name, nodeTemplate, enhancers) } - fun enhanceNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) { + fun enhanceNodeType(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, nodeType: NodeType) { val enhancers = getNodeTypeEnhancers() doEnhancement(bluePrintRuntimeService, name, nodeType, enhancers) } fun enhanceRelationshipTemplate( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, relationshipTemplate: RelationshipTemplate ) { @@ -139,7 +139,7 @@ interface BluePrintTypeEnhancerService { } fun enhanceRelationshipType( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, relationshipType: RelationshipType ) { @@ -148,7 +148,7 @@ interface BluePrintTypeEnhancerService { } fun enhanceArtifactDefinition( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition ) { @@ -156,31 +156,31 @@ interface BluePrintTypeEnhancerService { doEnhancement(bluePrintRuntimeService, name, artifactDefinition, enhancers) } - fun enhancePolicyType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, policyType: PolicyType) { + fun enhancePolicyType(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, policyType: PolicyType) { val enhancers = getPolicyTypeEnhancers() doEnhancement(bluePrintRuntimeService, name, policyType, enhancers) } fun enhancePropertyDefinitions( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition> ) { - val errorMap = linkedMapOf<String, BluePrintException>() + val errorMap = linkedMapOf<String, BlueprintException>() properties.forEach { propertyName, propertyDefinition -> try { enhancePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition) - } catch (e: BluePrintException) { + } catch (e: BlueprintException) { errorMap[propertyName] = e } } if (errorMap.isNotEmpty()) { val nestedErrors = errorMap.keys.map { "[ property: ${errorMap[it]?.message} ]" }.joinToString(";") - throw BluePrintException("Failed to enhance properties $nestedErrors") + throw BlueprintException("Failed to enhance properties $nestedErrors") } } fun enhancePropertyDefinition( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition ) { @@ -189,25 +189,25 @@ interface BluePrintTypeEnhancerService { } fun enhanceAttributeDefinitions( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition> ) { - val errorMap = linkedMapOf<String, BluePrintException>() + val errorMap = linkedMapOf<String, BlueprintException>() attributes.forEach { attributeName, attributeDefinition -> try { enhanceAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition) - } catch (e: BluePrintException) { + } catch (e: BlueprintException) { errorMap[attributeName] = e } } if (errorMap.isNotEmpty()) { val nestedErrors = errorMap.keys.map { "[ attribute: ${errorMap[it]?.message} ]" }.joinToString(";") - throw BluePrintException("Failed to enhance attributes $nestedErrors") + throw BlueprintException("Failed to enhance attributes $nestedErrors") } } fun enhanceAttributeDefinition( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition ) { @@ -217,17 +217,17 @@ interface BluePrintTypeEnhancerService { @Suppress("UNCHECKED_CAST") private fun <T> doEnhancement( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, definition: Any, - enhancers: List<BluePrintEnhancer<T>> + enhancers: List<BlueprintEnhancer<T>> ) { if (enhancers.isNotEmpty()) { - val errorMap = linkedMapOf<String, BluePrintException>() + val errorMap = linkedMapOf<String, BlueprintException>() enhancers.forEach { try { it.enhance(bluePrintRuntimeService, name, definition as T) - } catch (e: BluePrintException) { + } catch (e: BlueprintException) { errorMap[name] = e } } @@ -235,7 +235,7 @@ interface BluePrintTypeEnhancerService { val nestedErrors = errorMap.keys.map { "${errorMap[it]?.message ?: errorMap[it].toString()}" }.joinToString(";") - throw BluePrintException("$name-->$nestedErrors") + throw BlueprintException("$name-->$nestedErrors") } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt index b56fac541..4f6689022 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt @@ -18,29 +18,29 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces import kotlinx.coroutines.runBlocking -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException import java.util.function.Function interface BlueprintFunctionNode<T, R> : Function<T, R> { fun getName(): String - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) fun prepareRequest(executionRequest: T): T = runBlocking { prepareRequestNB(executionRequest) } - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) fun process(executionRequest: T) = runBlocking { processNB(executionRequest) } - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) fun recover(runtimeException: RuntimeException, executionRequest: T) = runBlocking { recoverNB(runtimeException, executionRequest) } - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) fun prepareResponse(): R = runBlocking { prepareResponseNB() } @@ -55,18 +55,18 @@ interface BlueprintFunctionNode<T, R> : Function<T, R> { return prepareResponse() } - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) suspend fun prepareRequestNB(executionRequest: T): T - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) suspend fun processNB(executionRequest: T) - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: T) - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) suspend fun prepareResponseNB(): R - @Throws(BluePrintProcessorException::class) + @Throws(BlueprintProcessorException::class) suspend fun applyNB(t: T): R } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintRepoService.kt index 8d04e5489..631236a40 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintRepoService.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType @@ -26,25 +26,25 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType import java.io.Serializable /** - * BluePrintRepoFileService + * BlueprintRepoFileService * @author Brinda Santh * */ -interface BluePrintRepoService : Serializable { +interface BlueprintRepoService : Serializable { - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) fun getNodeType(nodeTypeName: String): NodeType - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) fun getDataType(dataTypeName: String): DataType - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) fun getArtifactType(artifactTypeName: String): ArtifactType - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) fun getRelationshipType(relationshipTypeName: String): RelationshipType - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintScriptsService.kt index aa61b0c4d..b7a06e264 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintScriptsService.kt @@ -17,11 +17,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintSourceCode +import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BlueprintSourceCode -interface BluePrintScriptsService { +interface BlueprintScriptsService { - suspend fun <T> scriptInstance(bluePrintSourceCode: BluePrintSourceCode, scriptClassName: String): T + suspend fun <T> scriptInstance(bluePrintSourceCode: BlueprintSourceCode, scriptClassName: String): T suspend fun <T> scriptInstance( blueprintBasePath: String, diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt index 1958e23ac..799011568 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt @@ -18,7 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces import com.fasterxml.jackson.core.io.CharTypes import com.fasterxml.jackson.databind.node.JsonNodeFactory import com.fasterxml.jackson.databind.node.TextNode -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService interface BlueprintTemplateService { @@ -35,7 +35,7 @@ interface BlueprintTemplateService { * **/ suspend fun generateContent( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, nodeTemplateName: String, artifactName: String, jsonData: String = "", @@ -47,14 +47,14 @@ interface BlueprintTemplateService { /** * Customise JsonNodeFactory and TextNode, Since it introduces quotes for string data. */ -open class BluePrintJsonNodeFactory : JsonNodeFactory() { +open class BlueprintJsonNodeFactory : JsonNodeFactory() { override fun textNode(text: String): TextNode { - return BluePrintTextNode(text) + return BlueprintTextNode(text) } } -open class BluePrintTextNode(v: String) : TextNode(v) { +open class BlueprintTextNode(v: String) : TextNode(v) { override fun toString(): String { var len = this._value.length diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt index 0d9876b81..5f36e8ede 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition @@ -28,85 +28,85 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService -interface BluePrintValidator<T> { +interface BlueprintValidator<T> { - fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T) + fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, type: T) } -interface BluePrintServiceTemplateValidator : BluePrintValidator<ServiceTemplate> +interface BlueprintServiceTemplateValidator : BlueprintValidator<ServiceTemplate> -interface BluePrintTopologyTemplateValidator : BluePrintValidator<TopologyTemplate> +interface BlueprintTopologyTemplateValidator : BlueprintValidator<TopologyTemplate> -interface BluePrintArtifactTypeValidator : BluePrintValidator<ArtifactType> +interface BlueprintArtifactTypeValidator : BlueprintValidator<ArtifactType> -interface BluePrintArtifactDefinitionValidator : BluePrintValidator<ArtifactDefinition> +interface BlueprintArtifactDefinitionValidator : BlueprintValidator<ArtifactDefinition> -interface BluePrintDataTypeValidator : BluePrintValidator<DataType> +interface BlueprintDataTypeValidator : BlueprintValidator<DataType> -interface BluePrintNodeTypeValidator : BluePrintValidator<NodeType> +interface BlueprintNodeTypeValidator : BlueprintValidator<NodeType> -interface BluePrintNodeTemplateValidator : BluePrintValidator<NodeTemplate> +interface BlueprintNodeTemplateValidator : BlueprintValidator<NodeTemplate> -interface BluePrintWorkflowValidator : BluePrintValidator<Workflow> +interface BlueprintWorkflowValidator : BlueprintValidator<Workflow> -interface BluePrintPropertyDefinitionValidator : BluePrintValidator<PropertyDefinition> +interface BlueprintPropertyDefinitionValidator : BlueprintValidator<PropertyDefinition> -interface BluePrintAttributeDefinitionValidator : BluePrintValidator<AttributeDefinition> +interface BlueprintAttributeDefinitionValidator : BlueprintValidator<AttributeDefinition> /** * Blueprint Validation Interface. */ -interface BluePrintValidatorService { +interface BlueprintValidatorService { - @Throws(BluePrintException::class) - suspend fun validateBluePrints(basePath: String): Boolean + @Throws(BlueprintException::class) + suspend fun validateBlueprints(basePath: String): Boolean - @Throws(BluePrintException::class) - suspend fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean + @Throws(BlueprintException::class) + suspend fun validateBlueprints(bluePrintRuntimeService: BlueprintRuntimeService<*>): Boolean } -interface BluePrintTypeValidatorService { +interface BlueprintTypeValidatorService { - fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? + fun <T : BlueprintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? - fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? + fun <T : BlueprintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? - fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? + fun <T : BlueprintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? - fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> + fun getServiceTemplateValidators(): List<BlueprintServiceTemplateValidator> - fun getDataTypeValidators(): List<BluePrintDataTypeValidator> + fun getDataTypeValidators(): List<BlueprintDataTypeValidator> - fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> + fun getArtifactTypeValidators(): List<BlueprintArtifactTypeValidator> - fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> + fun getArtifactDefinitionsValidators(): List<BlueprintArtifactDefinitionValidator> - fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> + fun getNodeTypeValidators(): List<BlueprintNodeTypeValidator> - fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> + fun getTopologyTemplateValidators(): List<BlueprintTopologyTemplateValidator> - fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> + fun getNodeTemplateValidators(): List<BlueprintNodeTemplateValidator> - fun getWorkflowValidators(): List<BluePrintWorkflowValidator> + fun getWorkflowValidators(): List<BlueprintWorkflowValidator> - fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> + fun getPropertyDefinitionValidators(): List<BlueprintPropertyDefinitionValidator> - fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> + fun getAttributeDefinitionValidators(): List<BlueprintAttributeDefinitionValidator> - fun validateServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { + fun validateServiceTemplate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { val validators = getServiceTemplateValidators() doValidation(bluePrintRuntimeService, name, serviceTemplate, validators) } - fun validateArtifactType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) { + fun validateArtifactType(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, artifactType: ArtifactType) { val validators = getArtifactTypeValidators() doValidation(bluePrintRuntimeService, name, artifactType, validators) } fun validateArtifactDefinition( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition ) { @@ -114,59 +114,59 @@ interface BluePrintTypeValidatorService { doValidation(bluePrintRuntimeService, name, artifactDefinition, validators) } - fun validateDataType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) { + fun validateDataType(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, dataType: DataType) { val validators = getDataTypeValidators() doValidation(bluePrintRuntimeService, name, dataType, validators) } - fun validateNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) { + fun validateNodeType(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, nodeType: NodeType) { val validators = getNodeTypeValidators() doValidation(bluePrintRuntimeService, name, nodeType, validators) } - fun validateTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { + fun validateTopologyTemplate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { val validators = getTopologyTemplateValidators() doValidation(bluePrintRuntimeService, name, topologyTemplate, validators) } - fun validateNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { + fun validateNodeTemplate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { val validators = getNodeTemplateValidators() doValidation(bluePrintRuntimeService, name, nodeTemplate, validators) } - fun validateWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) { + fun validateWorkflow(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, workflow: Workflow) { val validators = getWorkflowValidators() doValidation(bluePrintRuntimeService, name, workflow, validators) } - fun validatePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition>) { + fun validatePropertyDefinitions(bluePrintRuntimeService: BlueprintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition>) { properties.forEach { propertyName, propertyDefinition -> validatePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition) } } - fun validatePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { + fun validatePropertyDefinition(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { val validators = getPropertyDefinitionValidators() doValidation(bluePrintRuntimeService, name, propertyDefinition, validators) } - fun validateAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition>) { + fun validateAttributeDefinitions(bluePrintRuntimeService: BlueprintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition>) { attributes.forEach { attributeName, attributeDefinition -> validateAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition) } } - fun validateAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) { + fun validateAttributeDefinition(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) { val validators = getAttributeDefinitionValidators() doValidation(bluePrintRuntimeService, name, attributeDefinition, validators) } @Suppress("UNCHECKED_CAST") private fun <T> doValidation( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, definition: Any, - validators: List<BluePrintValidator<T>> + validators: List<BlueprintValidator<T>> ) { validators.forEach { it.validate(bluePrintRuntimeService, name, definition as T) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintWorkflowExecutionService.kt index 70c797326..4f20a1a33 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintWorkflowExecutionService.kt @@ -16,12 +16,12 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService -interface BluePrintWorkflowExecutionService<Input, Output> { +interface BlueprintWorkflowExecutionService<Input, Output> { - suspend fun executeBluePrintWorkflow( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + suspend fun executeBlueprintWorkflow( + bluePrintRuntimeService: BlueprintRuntimeService<*>, executionServiceInput: Input, properties: MutableMap<String, Any> = hashMapOf() ): Output diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintCompileService.kt index 230097f3c..5cf0a93af 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintCompileService.kt @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler import org.jetbrains.kotlin.config.Services -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists import org.onap.ccsdk.cds.controllerblueprints.core.logger import java.io.File @@ -40,9 +40,9 @@ import kotlin.script.experimental.api.SourceCode import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty import kotlin.system.measureTimeMillis -open class BluePrintCompileService { +open class BlueprintCompileService { - val log = logger(BluePrintCompileService::class) + val log = logger(BlueprintCompileService::class) companion object { @@ -55,7 +55,7 @@ open class BluePrintCompileService { /** Compile the [bluePrintSourceCode] and get the [kClassName] instance for the constructor [args] */ suspend fun <T> eval( - bluePrintSourceCode: BluePrintSourceCode, + bluePrintSourceCode: BlueprintSourceCode, kClassName: String, args: ArrayList<Any?>? ): T { @@ -68,14 +68,14 @@ open class BluePrintCompileService { } } - val classLoaderWithDependencies = BluePrintCompileCache.classLoader(bluePrintSourceCode.cacheKey) + val classLoaderWithDependencies = BlueprintCompileCache.classLoader(bluePrintSourceCode.cacheKey) /** Create the instance from the class loader */ return instance(classLoaderWithDependencies, kClassName, args) } /** Compile [bluePrintSourceCode] and put into cache */ - suspend fun compile(bluePrintSourceCode: BluePrintSourceCode) { + suspend fun compile(bluePrintSourceCode: BlueprintSourceCode) { // TODO("Include Multiple folders") val sourcePath = bluePrintSourceCode.blueprintKotlinSources.first() val compiledJarFile = bluePrintSourceCode.targetJarFile @@ -110,7 +110,7 @@ open class BluePrintCompileService { checkFileExists(compiledJarFile) { "couldn't generate compiled jar(${compiledJarFile.absolutePath})" } } else -> { - throw BluePrintException("$exitCode :${messageCollector.errors().joinToString("\n")}") + throw BlueprintException("$exitCode :${messageCollector.errors().joinToString("\n")}") } } } @@ -123,21 +123,21 @@ open class BluePrintCompileService { /** create class [kClassName] instance from [classLoader] */ fun <T> instance(classLoader: URLClassLoader, kClassName: String, args: ArrayList<Any?>? = arrayListOf()): T { val kClazz = classLoader.loadClass(kClassName) - ?: throw BluePrintException("failed to load class($kClassName) from current class loader.") + ?: throw BlueprintException("failed to load class($kClassName) from current class loader.") val instance = if (args.isNullOrEmpty()) { kClazz.newInstance() } else { kClazz.constructors .single().newInstance(*args.toArray()) - } ?: throw BluePrintException("failed to create class($kClassName) instance for constructor argument($args).") + } ?: throw BlueprintException("failed to create class($kClassName) instance for constructor argument($args).") return instance as T } } /** Compile source code information */ -open class BluePrintSourceCode : SourceCode { +open class BlueprintSourceCode : SourceCode { lateinit var blueprintKotlinSources: MutableList<String> lateinit var moduleName: String diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintCompilerCache.kt index a0efc619c..a6d4571a2 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintCompilerCache.kt @@ -19,18 +19,18 @@ package org.onap.ccsdk.cds.controllerblueprints.core.scripts import com.google.common.cache.CacheBuilder import com.google.common.cache.CacheLoader import com.google.common.cache.LoadingCache -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintFileUtils import java.net.URLClassLoader -object BluePrintCompileCache { +object BlueprintCompileCache { - val log = logger(BluePrintCompileCache::class) + val log = logger(BlueprintCompileCache::class) private val classLoaderCache: LoadingCache<String, URLClassLoader> = CacheBuilder.newBuilder() .maximumSize(50) - .build(BluePrintClassLoader) + .build(BlueprintClassLoader) fun classLoader(key: String): URLClassLoader { return classLoaderCache.get(key) @@ -54,14 +54,14 @@ object BluePrintCompileCache { } } -object BluePrintClassLoader : CacheLoader<String, URLClassLoader>() { +object BlueprintClassLoader : CacheLoader<String, URLClassLoader>() { - val log = logger(BluePrintClassLoader::class) + val log = logger(BlueprintClassLoader::class) override fun load(key: String) = try { log.info("loading compiled cache($key)") - BluePrintFileUtils.getURLClassLoaderFromDirectory(key) + BlueprintFileUtils.getURLClassLoaderFromDirectory(key) } catch (e: Exception) { - throw BluePrintException("failed to load cache($key) with Exception($e)") + throw BlueprintException("failed to load cache($key) with Exception($e)") } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintScriptsServiceImpl.kt index f3eb1a2b9..c89d74dfb 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintScriptsServiceImpl.kt @@ -17,20 +17,20 @@ 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) } @@ -43,13 +43,13 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService { ): 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) } @@ -59,7 +59,7 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService { 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( @@ -70,7 +70,7 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService { 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 } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintChainedService.kt index 1a43c3066..e0a0f170b 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintChainedService.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition @@ -31,11 +31,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition * * @author Brinda Santh */ -internal class BluePrintChainedService { +internal class BlueprintChainedService { - var bpc: BluePrintContext + var bpc: BlueprintContext - constructor(bpc: BluePrintContext) { + constructor(bpc: BlueprintContext) { this.bpc = bpc } @@ -105,7 +105,7 @@ internal class BluePrintChainedService { val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName) nodeType.id = nodeTypeName val derivedFrom: String = nodeType.derivedFrom - if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) { + if (!BlueprintTypes.rootNodeTypes().contains(derivedFrom)) { recNodeTypesChained(derivedFrom, nodeTypes) } nodeTypes!!.add(nodeType) @@ -116,7 +116,7 @@ internal class BluePrintChainedService { val dataType: DataType = bpc.dataTypeByName(dataTypeName)!! dataType.id = dataTypeName val derivedFrom: String = dataType.derivedFrom - if (!BluePrintTypes.rootDataTypes().contains(derivedFrom)) { + if (!BlueprintTypes.rootDataTypes().contains(derivedFrom)) { recDataTypesChained(derivedFrom, dataTypes) } dataTypes!!.add(dataType) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt index 7b11f71a2..b79b86747 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt @@ -19,8 +19,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment @@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory * * @author Brinda Santh */ -class BluePrintContext(val serviceTemplate: ServiceTemplate) { +class BlueprintContext(val serviceTemplate: ServiceTemplate) { private val log = LoggerFactory.getLogger(this::class.toString()) @@ -86,36 +86,36 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { return JacksonUtils.getJson(serviceTemplate, pretty) } - fun name(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_NAME) - ?: throw BluePrintException("could't get template name from meta data") + fun name(): String = metadata?.get(BlueprintConstants.METADATA_TEMPLATE_NAME) + ?: throw BlueprintException("could't get template name from meta data") - fun version(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_VERSION) - ?: throw BluePrintException("could't get template version from meta data") + fun version(): String = metadata?.get(BlueprintConstants.METADATA_TEMPLATE_VERSION) + ?: throw BlueprintException("could't get template version from meta data") - fun author(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR) - ?: throw BluePrintException("could't get template author from meta data") + fun author(): String = metadata?.get(BlueprintConstants.METADATA_TEMPLATE_AUTHOR) + ?: throw BlueprintException("could't get template author from meta data") // Workflow fun workflows(): MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows fun workflowByName(workFlowName: String): Workflow = workflows()?.get(workFlowName) - ?: throw BluePrintException("could't get workflow($workFlowName)") + ?: throw BlueprintException("could't get workflow($workFlowName)") fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs fun workflowStepByName(workFlowName: String, stepName: String): Step { return workflowByName(workFlowName).steps?.get(stepName) - ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)") + ?: throw BlueprintException("could't get step($stepName) for workflow($workFlowName)") } fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String { return workflowStepByName(workFlowName, stepName).target - ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)") + ?: throw BlueprintException("could't get node template name for workflow($workFlowName)'s step($stepName)") } fun workflowFirstStepNodeTemplate(workFlowName: String): String { val firstStepName = workflowByName(workFlowName).steps?.keys?.first() - ?: throw BluePrintException("could't get first step for workflow($workFlowName)") + ?: throw BlueprintException("could't get first step for workflow($workFlowName)") return workflowStepNodeTemplate(workFlowName, firstStepName) } @@ -124,12 +124,12 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { workFlowName, stepName ).activities?.filter { it.callOperation != null }?.single()?.callOperation - ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ") + ?: throw BlueprintException("couldn't get first callOperation for WorkFlow($workFlowName) ") } // DSL fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name) - ?: throw BluePrintException("couldn't get policy type for the dsl($name)") + ?: throw BlueprintException("couldn't get policy type for the dsl($name)") // Data Type fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name) @@ -141,7 +141,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun policyTypes(): MutableMap<String, PolicyType>? = serviceTemplate.policyTypes fun policyTypeByName(policyName: String) = policyTypes()?.get(policyName) - ?: throw BluePrintException("could't get policy type for the name($policyName)") + ?: throw BlueprintException("could't get policy type for the name($policyName)") fun policyTypesDerivedFrom(name: String): MutableMap<String, PolicyType>? { return policyTypes()?.filterValues { policyType -> policyType.derivedFrom == name }?.toMutableMap() @@ -162,7 +162,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun nodeTypeByName(name: String): NodeType = nodeTypes()?.get(name) - ?: throw BluePrintException("could't get node type for the name($name)") + ?: throw BlueprintException("could't get node type for the name($name)") fun nodeTypeDerivedFrom(name: String): MutableMap<String, NodeType>? { return nodeTypes()?.filterValues { nodeType -> nodeType.derivedFrom == name }?.toMutableMap() @@ -170,7 +170,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition { return nodeTypeByName(nodeTypeName).interfaces?.get(interfaceName) - ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)") + ?: throw BlueprintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)") } fun nodeTypeInterfaceOperation( @@ -179,12 +179,12 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { operationName: String ): OperationDefinition { return nodeTypeInterface(nodeTypeName, interfaceName).operations?.get(operationName) - ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)") + ?: throw BlueprintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)") } fun interfaceNameForNodeType(nodeTypeName: String): String { return nodeTypeByName(nodeTypeName).interfaces?.keys?.first() - ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name") + ?: throw BlueprintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name") } fun nodeTypeInterfaceOperationInputs( @@ -207,13 +207,13 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun relationshipTypes(): MutableMap<String, RelationshipType>? = serviceTemplate.relationshipTypes fun relationshipTypeByName(name: String): RelationshipType = relationshipTypes()?.get(name) - ?: throw BluePrintException("could't get relationship type for the name($name)") + ?: throw BlueprintException("could't get relationship type for the name($name)") // Node Template Methods fun nodeTemplates(): MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates fun nodeTemplateByName(name: String): NodeTemplate = - nodeTemplates()?.get(name) ?: throw BluePrintException("could't get node template for the name($name)") + nodeTemplates()?.get(name) ?: throw BlueprintException("could't get node template for the name($name)") fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? { return nodeTemplates()?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap() @@ -238,27 +238,27 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition { return checkNodeTemplateArtifact(nodeTemplateName, artifactName) - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)") } fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition { return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0) - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)") } fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment { return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first() - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment") } fun nodeTemplateFirstInterfaceName(nodeTemplateName: String): String { return nodeTemplateByName(nodeTemplateName).interfaces?.keys?.first() - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name") } fun nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName: String): String { return nodeTemplateFirstInterface(nodeTemplateName).operations?.keys?.first() - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name") } fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String): @@ -284,7 +284,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { fun nodeTemplateInterface(nodeTemplateName: String, interfaceName: String): InterfaceAssignment { return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName) - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)") } fun nodeTemplateInterfaceOperation( @@ -293,23 +293,23 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { operationName: String ): OperationAssignment { return nodeTemplateInterface(nodeTemplateName, interfaceName).operations?.get(operationName) - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)") } fun nodeTemplateCapability(nodeTemplateName: String, capabilityName: String): CapabilityAssignment { return nodeTemplateByName(nodeTemplateName).capabilities?.get(capabilityName) - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)") } fun nodeTemplateRequirement(nodeTemplateName: String, requirementName: String): RequirementAssignment { return nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName) - ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)") + ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)") } fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate { val filteredNodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node - ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ") + ?: throw BlueprintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ") return nodeTemplateByName(filteredNodeTemplateName) } @@ -322,7 +322,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { serviceTemplate.topologyTemplate?.relationshipTemplates fun relationshipTemplateByName(name: String): RelationshipTemplate = relationshipTemplates()?.get(name) - ?: throw BluePrintException("could't get relationship template for the name($name)") + ?: throw BlueprintException("could't get relationship template for the name($name)") fun relationshipTemplateProperty(relationshipTemplateName: String, propertyName: String): Any? { return nodeTemplateByName(relationshipTemplateName).properties?.get(propertyName) @@ -341,10 +341,10 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { // Chained Functions fun nodeTypeChained(nodeTypeName: String): NodeType { - return BluePrintChainedService(this).nodeTypeChained(nodeTypeName) + return BlueprintChainedService(this).nodeTypeChained(nodeTypeName) } fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? { - return BluePrintChainedService(this).nodeTypeChainedProperties(nodeTypeName) + return BlueprintChainedService(this).nodeTypeChainedProperties(nodeTypeName) } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintDependencyService.kt index e8457283e..8f3308568 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintDependencyService.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException import org.springframework.context.ApplicationContext import org.springframework.context.ConfigurableApplicationContext import kotlin.reflect.KClass @@ -29,12 +29,12 @@ import kotlin.reflect.KClass * @author Brinda Santh */ -object BluePrintDependencyService { +object BlueprintDependencyService { lateinit var applicationContext: ApplicationContext fun inject(applicationContext: ApplicationContext) { - BluePrintDependencyService.applicationContext = applicationContext + BlueprintDependencyService.applicationContext = applicationContext } /** Used to inject [instance] into spring application context for the [key], @@ -47,16 +47,16 @@ object BluePrintDependencyService { inline fun <reified T> instance(name: String): T { return applicationContext.getBean(name) as? T - ?: throw BluePrintProcessorException("failed to get instance($name)") + ?: throw BlueprintProcessorException("failed to get instance($name)") } inline fun <reified T> instance(type: Class<T>): T { return applicationContext.getBean(type) - ?: throw BluePrintProcessorException("failed to get instance($type)") + ?: throw BlueprintProcessorException("failed to get instance($type)") } inline fun <reified T> instance(type: KClass<*>): T { return applicationContext.getBean(type.java) as? T - ?: throw BluePrintProcessorException("failed to get instance($type)") + ?: throw BlueprintProcessorException("failed to get instance($type)") } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintExpressionService.kt index 193ff7888..ac90705a1 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintExpressionService.kt @@ -21,9 +21,9 @@ import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ArrayNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.databind.node.TextNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactExpression import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeExpression import org.onap.ccsdk.cds.controllerblueprints.core.data.DSLExpression @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory * * @author Brinda Santh */ -object BluePrintExpressionService { +object BlueprintExpressionService { val log = LoggerFactory.getLogger(this::class.toString()) @@ -47,9 +47,9 @@ object BluePrintExpressionService { val json = propertyAssignmentNode.toString() // FIXME("Check if any Optimisation needed") return ( - json.contains(BluePrintConstants.EXPRESSION_GET_INPUT) || - json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE) || - json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY) + json.contains(BlueprintConstants.EXPRESSION_GET_INPUT) || + json.contains(BlueprintConstants.EXPRESSION_GET_ATTRIBUTE) || + json.contains(BlueprintConstants.EXPRESSION_GET_PROPERTY) ) } @@ -58,35 +58,35 @@ object BluePrintExpressionService { log.trace("Assignment Data/Expression : {}", propertyAssignmentNode) val expressionData = ExpressionData(valueNode = propertyAssignmentNode) if (propertyAssignmentNode is ObjectNode) { - val commands: Set<String> = propertyAssignmentNode.fieldNames().asSequence().toList().intersect(BluePrintTypes.validCommands()) + val commands: Set<String> = propertyAssignmentNode.fieldNames().asSequence().toList().intersect(BlueprintTypes.validCommands()) if (commands.isNotEmpty()) { expressionData.isExpression = true expressionData.command = commands.first() expressionData.expressionNode = propertyAssignmentNode when (expressionData.command) { - BluePrintConstants.EXPRESSION_GET_INPUT -> { + BlueprintConstants.EXPRESSION_GET_INPUT -> { expressionData.inputExpression = populateInputExpression(propertyAssignmentNode) } - BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> { + BlueprintConstants.EXPRESSION_GET_ATTRIBUTE -> { expressionData.attributeExpression = populateAttributeExpression(propertyAssignmentNode) } - BluePrintConstants.EXPRESSION_GET_PROPERTY -> { + BlueprintConstants.EXPRESSION_GET_PROPERTY -> { expressionData.propertyExpression = populatePropertyExpression(propertyAssignmentNode) } - BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> { + BlueprintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> { expressionData.operationOutputExpression = populateOperationOutputExpression(propertyAssignmentNode) } - BluePrintConstants.EXPRESSION_GET_ARTIFACT -> { + BlueprintConstants.EXPRESSION_GET_ARTIFACT -> { expressionData.artifactExpression = populateArtifactExpression(propertyAssignmentNode) } } } } else if (propertyAssignmentNode is TextNode && - propertyAssignmentNode.textValue().startsWith(BluePrintConstants.EXPRESSION_DSL_REFERENCE) + propertyAssignmentNode.textValue().startsWith(BlueprintConstants.EXPRESSION_DSL_REFERENCE) ) { expressionData.isExpression = true - expressionData.command = BluePrintConstants.EXPRESSION_DSL_REFERENCE + expressionData.command = BlueprintConstants.EXPRESSION_DSL_REFERENCE expressionData.dslExpression = populateDSLExpression(propertyAssignmentNode) } return expressionData @@ -96,7 +96,7 @@ object BluePrintExpressionService { fun populateDSLExpression(jsonNode: TextNode): DSLExpression { return DSLExpression( propertyName = jsonNode.textValue() - .removePrefix(BluePrintConstants.EXPRESSION_DSL_REFERENCE) + .removePrefix(BlueprintConstants.EXPRESSION_DSL_REFERENCE) ) } @@ -109,7 +109,7 @@ object BluePrintExpressionService { fun populatePropertyExpression(jsonNode: JsonNode): PropertyExpression { val arrayNode: ArrayNode = jsonNode.first() as ArrayNode check(arrayNode.size() >= 2) { - throw BluePrintException( + throw BlueprintException( String.format( "missing property expression, " + "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " + @@ -149,7 +149,7 @@ object BluePrintExpressionService { fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression { val arrayNode: ArrayNode = jsonNode.first() as ArrayNode check(arrayNode.size() >= 2) { - throw BluePrintException( + throw BlueprintException( String.format( "missing attribute expression, " + "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," + @@ -190,7 +190,7 @@ object BluePrintExpressionService { val arrayNode: ArrayNode = jsonNode.first() as ArrayNode check(arrayNode.size() >= 4) { - throw BluePrintException( + throw BlueprintException( String.format( "missing operation output expression, " + "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}", @@ -217,7 +217,7 @@ object BluePrintExpressionService { val arrayNode: ArrayNode = jsonNode.first() as ArrayNode check(arrayNode.size() >= 2) { - throw BluePrintException( + throw BlueprintException( String.format( "missing artifact expression, " + "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintImportService.kt index 80b742705..6dbacd199 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintImportService.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ImportDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.utils.ServiceTemplateUtils @@ -28,7 +28,7 @@ import java.net.URL import java.net.URLDecoder import java.nio.charset.Charset -class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate, private val blueprintBasePath: String) { +class BlueprintImportService(private val parentServiceTemplate: ServiceTemplate, private val blueprintBasePath: String) { companion object { private const val PARENT_SERVICE_TEMPLATE: String = "parent" @@ -85,10 +85,10 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate, serviceTemplate = ServiceTemplateUtils.getServiceTemplate(importDefinition.file) } } catch (e: Exception) { - throw BluePrintException("failed to populate service template for ${importDefinition.file} original error: ${e.message}", e) + throw BlueprintException("failed to populate service template for ${importDefinition.file} original error: ${e.message}", e) } if (serviceTemplate == null) { - throw BluePrintException("failed to populate service template for : ${importDefinition.file}") + throw BlueprintException("failed to populate service template for : ${importDefinition.file}") } return serviceTemplate } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintJinjaTemplateService.kt index fdc348bf7..ac85cb3e8 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintJinjaTemplateService.kt @@ -24,9 +24,9 @@ import com.hubspot.jinjava.JinjavaConfig import com.hubspot.jinjava.interpret.JinjavaInterpreter import com.hubspot.jinjava.loader.ResourceLocator import com.hubspot.jinjava.loader.ResourceNotFoundException -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.config.BlueprintLoadConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintJsonNodeFactory import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode import java.io.IOException @@ -34,13 +34,13 @@ import java.nio.charset.Charset import java.nio.file.Files.readAllBytes import java.nio.file.Paths -object BluePrintJinjaTemplateService { +object BlueprintJinjaTemplateService { /** * To enable inheritance within CBA, we need Jinja runtime to know where to load the templates. */ class BlueprintRelatedTemplateLocator( - private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, + private val bluePrintLoadConfiguration: BlueprintLoadConfiguration, private val artifactName: String, private val artifactVersion: String ) : ResourceLocator { @@ -68,7 +68,7 @@ object BluePrintJinjaTemplateService { json: String, ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>, - bluePrintLoadConfiguration: BluePrintLoadConfiguration, + bluePrintLoadConfiguration: BlueprintLoadConfiguration, artifactName: String, artifactVersion: String ): String { @@ -95,13 +95,13 @@ object BluePrintJinjaTemplateService { } val mapper = ObjectMapper() - val nodeFactory = BluePrintJsonNodeFactory() + val nodeFactory = BlueprintJsonNodeFactory() mapper.nodeFactory = nodeFactory // Add the JSON Data to the context if (json.isNotEmpty()) { val jsonNode = mapper.readValue<JsonNode>(json, JsonNode::class.java) - ?: throw BluePrintProcessorException("couldn't get json node from json") + ?: throw BlueprintProcessorException("couldn't get json node from json") if (ignoreJsonNull) { jsonNode.removeNullNode() } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintRepoFileService.kt index 1f71495a3..dd07bade2 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintRepoFileService.kt @@ -16,61 +16,61 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintRepoService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory -open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService { +open class BlueprintRepoFileService(modelTypePath: String) : BlueprintRepoService { - private val log = LoggerFactory.getLogger(BluePrintRepoFileService::class.toString()) + private val log = LoggerFactory.getLogger(BlueprintRepoFileService::class.toString()) - private val dataTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) - private val nodeTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE) - private val artifactTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE) + private val dataTypePath = modelTypePath.plus(BlueprintConstants.PATH_DIVIDER).plus(BlueprintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE) + private val nodeTypePath = modelTypePath.plus(BlueprintConstants.PATH_DIVIDER).plus(BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE) + private val artifactTypePath = modelTypePath.plus(BlueprintConstants.PATH_DIVIDER).plus(BlueprintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE) private val capabilityTypePath = - modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE) + modelTypePath.plus(BlueprintConstants.PATH_DIVIDER).plus(BlueprintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE) private val relationshipTypePath = - modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) + modelTypePath.plus(BlueprintConstants.PATH_DIVIDER).plus(BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE) private val extension = ".json" override fun getDataType(dataTypeName: String): DataType { - val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER) + val fileName = dataTypePath.plus(BlueprintConstants.PATH_DIVIDER) .plus(dataTypeName).plus(extension) return getModelType(fileName, DataType::class.java) } override fun getNodeType(nodeTypeName: String): NodeType { - val fileName = nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension) + val fileName = nodeTypePath.plus(BlueprintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension) return getModelType(fileName, NodeType::class.java) } override fun getArtifactType(artifactTypeName: String): ArtifactType { - val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER) + val fileName = artifactTypePath.plus(BlueprintConstants.PATH_DIVIDER) .plus(artifactTypeName).plus(extension) return getModelType(fileName, ArtifactType::class.java) } override fun getRelationshipType(relationshipTypeName: String): RelationshipType { - val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER) + val fileName = relationshipTypePath.plus(BlueprintConstants.PATH_DIVIDER) .plus(relationshipTypeName).plus(extension) return getModelType(fileName, RelationshipType::class.java) } override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition { - val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER) + val fileName = capabilityTypePath.plus(BlueprintConstants.PATH_DIVIDER) .plus(capabilityDefinitionName).plus(extension) return getModelType(fileName, CapabilityDefinition::class.java) } private fun <T> getModelType(fileName: String, valueType: Class<T>): T { return JacksonUtils.readValueFromFile(fileName, valueType) - ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}") + ?: throw BlueprintException("couldn't get file($fileName) for type(${valueType.name}") } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintRuntimeService.kt index 873e3a082..c05b94260 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintRuntimeService.kt @@ -21,9 +21,9 @@ import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.NullNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants.LOG_REDACTED @@ -32,16 +32,16 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.PropertyDefinitionUtils.Companion.hasLogProtect import org.slf4j.LoggerFactory import java.io.File -interface BluePrintRuntimeService<T> { +interface BlueprintRuntimeService<T> { fun id(): String - fun bluePrintContext(): BluePrintContext + fun bluePrintContext(): BlueprintContext fun getExecutionContext(): T @@ -63,9 +63,9 @@ interface BluePrintRuntimeService<T> { fun getAsDouble(key: String): Double? - fun getBluePrintError(): BluePrintError + fun getBlueprintError(): BlueprintError - fun setBluePrintError(bluePrintError: BluePrintError) + fun setBlueprintError(bluePrintError: BlueprintError) fun loadEnvironments(type: String, fileName: String) @@ -211,30 +211,30 @@ interface BluePrintRuntimeService<T> { * * @author Brinda Santh */ -open class DefaultBluePrintRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext) : - BluePrintRuntimeService<MutableMap<String, JsonNode>> { +open class DefaultBlueprintRuntimeService(private var id: String, private var bluePrintContext: BlueprintContext) : + BlueprintRuntimeService<MutableMap<String, JsonNode>> { @Transient - private val log = LoggerFactory.getLogger(BluePrintRuntimeService::class.toString()) + private val log = LoggerFactory.getLogger(BlueprintRuntimeService::class.toString()) private var store: MutableMap<String, JsonNode> = hashMapOf() - private var bluePrintError = BluePrintError() + private var bluePrintError = BlueprintError() init { /** * Load Blueprint Environments Properties */ val absoluteEnvFilePath = bluePrintContext.rootPath.plus(File.separator) - .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR) - loadEnvironments(BluePrintConstants.PROPERTY_BPP, absoluteEnvFilePath) + .plus(BlueprintConstants.TOSCA_ENVIRONMENTS_DIR) + loadEnvironments(BlueprintConstants.PROPERTY_BPP, absoluteEnvFilePath) } override fun id(): String { return id } - override fun bluePrintContext(): BluePrintContext { + override fun bluePrintContext(): BlueprintContext { return bluePrintContext } @@ -252,7 +252,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl } override fun get(key: String): JsonNode { - return store[key] ?: throw BluePrintProcessorException("failed to get execution property($key)") + return store[key] ?: throw BlueprintProcessorException("failed to get execution property($key)") } override fun check(key: String): Boolean { @@ -283,16 +283,16 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl return get(key).asDouble() } - override fun getBluePrintError(): BluePrintError { + override fun getBlueprintError(): BlueprintError { return this.bluePrintError } - override fun setBluePrintError(bluePrintError: BluePrintError) { + override fun setBlueprintError(bluePrintError: BlueprintError) { this.bluePrintError = bluePrintError } override fun loadEnvironments(type: String, fileName: String) { - BluePrintMetadataUtils.environmentFileProperties(fileName).forEach { key, value -> + BlueprintMetadataUtils.environmentFileProperties(fileName).forEach { key, value -> setNodeTemplateAttributeValue(type, key.toString(), value.asJsonType()) } } @@ -300,7 +300,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl override fun resolveWorkflowOutputs(workflowName: String): MutableMap<String, JsonNode> { log.info("resolveWorkflowOutputs for workflow($workflowName)") val outputs = bluePrintContext.workflowByName(workflowName).outputs ?: mutableMapOf() - return resolvePropertyDefinitions(BluePrintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, "WORKFLOW", outputs) + return resolvePropertyDefinitions(BlueprintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, "WORKFLOW", outputs) } /** @@ -309,7 +309,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl */ override fun resolveDSLExpression(dslPropertyName: String): JsonNode { val propertyAssignments = bluePrintContext.dslPropertiesByName(dslPropertyName) - return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments) && + return if (BlueprintExpressionService.checkContainsExpression(propertyAssignments) && propertyAssignments is ObjectNode ) { val rootKeyMap = propertyAssignments.rootFieldsToMap() @@ -318,7 +318,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val propertyAssignmentExpression = PropertyAssignmentService(this) propertyAssignmentValue[propertyName] = propertyAssignmentExpression .resolveAssignmentExpression( - BluePrintConstants.MODEL_DEFINITION_TYPE_DSL, + BlueprintConstants.MODEL_DEFINITION_TYPE_DSL, "DSL", propertyName, propertyValue @@ -381,7 +381,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl } /** If property is Map type, then resolve the property value, It may have expressions */ - if (nodeTypeProperty.type == BluePrintConstants.DATA_TYPE_MAP && + if (nodeTypeProperty.type == BlueprintConstants.DATA_TYPE_MAP && resolvedValue.returnNullIfMissing() != null ) { val mapResolvedValue = resolvePropertyAssignments( @@ -443,7 +443,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl propertyAssignments: MutableMap<String, JsonNode> ): MutableMap<String, JsonNode> { return resolvePropertyAssignments( - BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, + BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, nodeTemplateName, propertyDefinitions, propertyAssignments ) } @@ -547,7 +547,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName) return nodeTemplate.artifacts?.get(artifactName) - ?: throw BluePrintProcessorException( + ?: throw BlueprintProcessorException( "failed to get artifact definition($artifactName) from the node template" ) } @@ -561,7 +561,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl // Get the Relationship Type Definitions val propertiesDefinitions = bluePrintContext.relationshipTypeByName(relationshipTemplate.type).properties - ?: throw BluePrintProcessorException("failed to get ${relationshipTemplate.type} properties.") + ?: throw BlueprintProcessorException("failed to get ${relationshipTemplate.type} properties.") /** * Resolve the RelationshipTemplate Property Assignment Values. @@ -579,13 +579,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl propertyAssignments: MutableMap<String, JsonNode> ): MutableMap<String, JsonNode> { return resolvePropertyAssignments( - BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE, + BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE, relationshipTemplateName, propertyDefinitions, propertyAssignments ) } override fun setInputValue(propertyName: String, value: JsonNode) { - val path = """${BluePrintConstants.PATH_INPUTS}${BluePrintConstants.PATH_DIVIDER}$propertyName""" + val path = """${BlueprintConstants.PATH_INPUTS}${BlueprintConstants.PATH_DIVIDER}$propertyName""" put(path, value) } @@ -595,27 +595,27 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl propertyDefinition: PropertyDefinition, value: JsonNode ) { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS) - .append(BluePrintConstants.PATH_DIVIDER).append(workflowName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_WORKFLOWS) + .append(BlueprintConstants.PATH_DIVIDER).append(workflowName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_INPUTS) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() put(path, value) } override fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() put(path, value) } override fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES) - .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_ATTRIBUTES) + .append(BlueprintConstants.PATH_DIVIDER).append(attributeName).toString() put(path, value) } @@ -626,14 +626,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl propertyName: String, value: JsonNode ) { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES) - .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS) - .append(BluePrintConstants.PATH_DIVIDER).append(operationName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_INTERFACES) + .append(BlueprintConstants.PATH_DIVIDER).append(interfaceName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_OPERATIONS) + .append(BlueprintConstants.PATH_DIVIDER).append(operationName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() log.trace("setting operation property path ({}), values ({})", path, value) put(path, value) } @@ -645,15 +645,15 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl propertyName: String, value: JsonNode ) { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES) - .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS) - .append(BluePrintConstants.PATH_DIVIDER).append(operationName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_INTERFACES) + .append(BlueprintConstants.PATH_DIVIDER).append(interfaceName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_OPERATIONS) + .append(BlueprintConstants.PATH_DIVIDER).append(operationName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_INPUTS) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() put(path, value) } @@ -664,21 +664,21 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl propertyName: String, value: JsonNode ) { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES) - .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS) - .append(BluePrintConstants.PATH_DIVIDER).append(operationName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_INTERFACES) + .append(BlueprintConstants.PATH_DIVIDER).append(interfaceName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_OPERATIONS) + .append(BlueprintConstants.PATH_DIVIDER).append(operationName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_OUTPUTS) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() put(path, value) } override fun getInputValue(propertyName: String): JsonNode { - val path = StringBuilder(BluePrintConstants.PATH_INPUTS) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path = StringBuilder(BlueprintConstants.PATH_INPUTS) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() return getJsonNode(path) } @@ -688,31 +688,31 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl operationName: String, propertyName: String ): JsonNode { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES) - .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS) - .append(BluePrintConstants.PATH_DIVIDER).append(operationName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_INTERFACES) + .append(BlueprintConstants.PATH_DIVIDER).append(interfaceName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_OPERATIONS) + .append(BlueprintConstants.PATH_DIVIDER).append(operationName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_OUTPUTS) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() return getJsonNode(path) } override fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() return getJsonNode(path) } override fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode { - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES) - .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_ATTRIBUTES) + .append(BlueprintConstants.PATH_DIVIDER).append(attributeName).toString() return getJsonNode(path) } @@ -720,10 +720,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl relationshipTemplateName: String, propertyName: String ): JsonNode? { - val path: String = StringBuilder(BluePrintConstants.PATH_RELATIONSHIP_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(relationshipTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES) - .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_RELATIONSHIP_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(relationshipTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_PROPERTIES) + .append(BlueprintConstants.PATH_DIVIDER).append(propertyName).toString() return getJsonNode(path) } @@ -731,17 +731,17 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl relationshipTemplateName: String, attributeName: String ): JsonNode? { - val path: String = StringBuilder(BluePrintConstants.PATH_RELATIONSHIP_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(relationshipTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES) - .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_RELATIONSHIP_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(relationshipTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_ATTRIBUTES) + .append(BlueprintConstants.PATH_DIVIDER).append(attributeName).toString() return getJsonNode(path) } override fun assignInputs(jsonNode: JsonNode) { log.info("assignInputs from input JSON ({})", jsonNode.toString()) bluePrintContext.inputs()?.forEach { propertyName, property -> - val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName) + val valueNode: JsonNode = jsonNode.at(BlueprintConstants.PATH_DIVIDER + propertyName) ?: property.defaultValue ?: NullNode.getInstance() setInputValue(propertyName, valueNode) @@ -765,7 +765,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl } private fun findAndSetInputValue(propertyName: String, property: PropertyDefinition, jsonNode: JsonNode) { - val valueNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName) + val valueNode = jsonNode.at(BlueprintConstants.PATH_DIVIDER + propertyName) .returnNullIfMissing() ?: property.defaultValue ?: NullNode.getInstance() @@ -777,10 +777,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl override fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode { val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode() - val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES) - .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName) - .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES) - .append(BluePrintConstants.PATH_DIVIDER).toString() + val path: String = StringBuilder(BlueprintConstants.PATH_NODE_TEMPLATES) + .append(BlueprintConstants.PATH_DIVIDER).append(nodeTemplateName) + .append(BlueprintConstants.PATH_DIVIDER).append(BlueprintConstants.PATH_ATTRIBUTES) + .append(BlueprintConstants.PATH_DIVIDER).toString() store.keys.filter { it.startsWith(path) }.map { diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt index d7f7b9a60..d953bd54f 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt @@ -15,18 +15,18 @@ */ package org.onap.ccsdk.cds.controllerblueprints.core.service -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.config.BlueprintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTemplateService import org.springframework.stereotype.Service @Service -class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration) : +class BlueprintTemplateService(private val bluePrintLoadConfiguration: BlueprintLoadConfiguration) : BlueprintTemplateService { override suspend fun generateContent( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, nodeTemplateName: String, artifactName: String, jsonData: String, @@ -40,8 +40,8 @@ class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrint val template = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName) return when (templateType) { - BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA -> { - BluePrintJinjaTemplateService.generateContent( + BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA -> { + BlueprintJinjaTemplateService.generateContent( template, jsonData, ignoreJsonNull, @@ -51,13 +51,13 @@ class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrint bluePrintRuntimeService.bluePrintContext().version() ) } - BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY -> { - BluePrintVelocityTemplateService.generateContent(template, jsonData, ignoreJsonNull, additionalContext) + BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY -> { + BlueprintVelocityTemplateService.generateContent(template, jsonData, ignoreJsonNull, additionalContext) } else -> { - throw BluePrintProcessorException( - "Unknown Artifact type, expecting ${BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA}" + - "or ${BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY}" + throw BlueprintProcessorException( + "Unknown Artifact type, expecting ${BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA}" + + "or ${BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY}" ) } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintValidatorService.kt index 8a8ded752..888c5c0c6 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintValidatorService.kt @@ -20,9 +20,9 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service import com.fasterxml.jackson.databind.JsonNode import com.google.common.base.Preconditions import org.apache.commons.lang3.StringUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType @@ -51,35 +51,35 @@ import java.io.Serializable * * @author Brinda Santh */ -interface BluePrintValidatorService : Serializable { +interface BlueprintValidatorService : Serializable { - @Throws(BluePrintException::class) - fun validateBlueprint(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>) + @Throws(BlueprintException::class) + fun validateBlueprint(bluePrintContext: BlueprintContext, properties: MutableMap<String, Any>) - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) fun validateBlueprint(serviceTemplate: ServiceTemplate, properties: MutableMap<String, Any>) } @Deprecated("Decomposed implementation moved to blueprint-validation module") -open class BluePrintValidatorDefaultService : BluePrintValidatorService { +open class BlueprintValidatorDefaultService : BlueprintValidatorService { - val log = LoggerFactory.getLogger(BluePrintValidatorDefaultService::class.toString()) + val log = LoggerFactory.getLogger(BlueprintValidatorDefaultService::class.toString()) - lateinit var bluePrintContext: BluePrintContext + lateinit var bluePrintContext: BlueprintContext lateinit var serviceTemplate: ServiceTemplate lateinit var properties: MutableMap<String, Any> var message: StringBuilder = StringBuilder() - private val separator: String = BluePrintConstants.PATH_DIVIDER + private val separator: String = BlueprintConstants.PATH_DIVIDER var paths: MutableList<String> = arrayListOf() - @Throws(BluePrintException::class) - override fun validateBlueprint(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>) { + @Throws(BlueprintException::class) + override fun validateBlueprint(bluePrintContext: BlueprintContext, properties: MutableMap<String, Any>) { validateBlueprint(bluePrintContext.serviceTemplate, properties) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) override fun validateBlueprint(serviceTemplate: ServiceTemplate, properties: MutableMap<String, Any>) { - this.bluePrintContext = BluePrintContext(serviceTemplate) + this.bluePrintContext = BlueprintContext(serviceTemplate) this.serviceTemplate = serviceTemplate this.properties = properties try { @@ -92,21 +92,21 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } catch (e: Exception) { log.error("validation failed in the path : {}", paths.joinToString(separator), e) log.error("validation trace message :{} ", message) - throw BluePrintException( + throw BlueprintException( e, format("failed to validate blueprint on path ({}) with message {}", paths.joinToString(separator), e.message) ) } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateMetadata(metaDataMap: MutableMap<String, String>) { paths.add("metadata") - val templateName = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_NAME] - val templateVersion = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_VERSION] - val templateTags = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_TAGS] - val templateAuthor = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] + val templateName = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_NAME] + val templateVersion = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_VERSION] + val templateTags = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_TAGS] + val templateAuthor = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_AUTHOR] Preconditions.checkArgument(StringUtils.isNotBlank(templateName), "failed to get template name metadata") Preconditions.checkArgument(StringUtils.isNotBlank(templateVersion), "failed to get template version metadata") @@ -115,7 +115,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateArtifactTypes(artifactTypes: MutableMap<String, ArtifactType>) { paths.add("artifact_types") artifactTypes.forEach { artifactName, artifactType -> @@ -127,7 +127,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateDataTypes(dataTypes: MutableMap<String, DataType>) { paths.add("dataTypes") dataTypes.forEach { dataTypeName, dataType -> @@ -139,7 +139,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateNodeTypes(nodeTypes: MutableMap<String, NodeType>) { paths.add("nodeTypes") nodeTypes.forEach { nodeTypeName, nodeType -> @@ -149,7 +149,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateNodeType(nodeTypeName: String, nodeType: NodeType) { paths.add(nodeTypeName) message.appendln("--> Node Type :" + paths.joinToString(separator)) @@ -157,9 +157,9 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { // Check Derived From checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom) - if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) { + if (!BlueprintTypes.rootNodeTypes().contains(derivedFrom)) { serviceTemplate.nodeTypes?.get(derivedFrom) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get derivedFrom NodeType({})'s for NodeType({}) ", derivedFrom, nodeTypeName @@ -174,14 +174,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun checkValidNodeTypesDerivedFrom(nodeTypeName: String, derivedFrom: String) { - check(BluePrintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) { - throw BluePrintException(format("Failed to get node type ({})'s derivedFrom({}) definition ", nodeTypeName, derivedFrom)) + check(BlueprintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) { + throw BlueprintException(format("Failed to get node type ({})'s derivedFrom({}) definition ", nodeTypeName, derivedFrom)) } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) { paths.add("topology") message.appendln("--> Topology Template") @@ -191,7 +191,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateInputs(inputs: MutableMap<String, PropertyDefinition>) { paths.add("inputs") message.appendln("---> Input :" + paths.joinToString(separator)) @@ -199,7 +199,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) { paths.add("nodeTemplates") nodeTemplates.forEach { nodeTemplateName, nodeTemplate -> @@ -208,14 +208,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) { paths.add(nodeTemplateName) message.appendln("---> NodeTemplate :" + paths.joinToString(separator)) val type: String = nodeTemplate.type val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type) - ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName)) + ?: throw BlueprintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName)) nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) } nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) } @@ -225,26 +225,26 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) { paths.add("artifacts") artifacts.forEach { artifactDefinitionName, artifactDefinition -> paths.add(artifactDefinitionName) message.appendln("Validating artifact " + paths.joinToString(separator)) val type: String = artifactDefinition.type - ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName)) + ?: throw BlueprintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName)) // Check Artifact Type checkValidArtifactType(artifactDefinitionName, type) val file: String = artifactDefinition.file - ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName)) + ?: throw BlueprintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName)) paths.removeAt(paths.lastIndex) } paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateWorkFlows(workflows: MutableMap<String, Workflow>) { paths.add("workflows") workflows.forEach { workflowName, workflow -> @@ -255,7 +255,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateWorkFlow(workflowName: String, workflow: Workflow) { paths.add(workflowName) message.appendln("---> Workflow :" + paths.joinToString(separator)) @@ -271,19 +271,19 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validatePropertyDefinitions(properties: MutableMap<String, PropertyDefinition>) { paths.add("properties") properties.forEach { propertyName, propertyDefinition -> paths.add(propertyName) val dataType: String = propertyDefinition.type when { - BluePrintTypes.validPrimitiveTypes().contains(dataType) -> { + BlueprintTypes.validPrimitiveTypes().contains(dataType) -> { // Do Nothing } - BluePrintTypes.validCollectionTypes().contains(dataType) -> { + BlueprintTypes.validCollectionTypes().contains(dataType) -> { val entrySchemaType: String = propertyDefinition.entrySchema?.type - ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName)) + ?: throw BlueprintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName)) checkPrimitiveOrComplex(entrySchemaType, propertyName) } else -> checkPropertyDataType(dataType, propertyName) @@ -294,33 +294,33 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validatePropertyAssignments( nodeTypeProperties: MutableMap<String, PropertyDefinition>, properties: MutableMap<String, JsonNode> ) { properties.forEach { propertyName, propertyAssignment -> val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName] - ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName)) + ?: throw BlueprintException(format("failed to get definition for the property ({})", propertyName)) validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment) } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validatePropertyAssignment( propertyName: String, propertyDefinition: PropertyDefinition, propertyAssignment: JsonNode ) { // Check and Validate if Expression Node - val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment) + val expressionData = BlueprintExpressionService.getExpressionData(propertyAssignment) if (!expressionData.isExpression) { checkPropertyValue(propertyName, propertyDefinition, propertyAssignment) } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateCapabilityAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) { val capabilities = nodeTemplate.capabilities paths.add("capabilities") @@ -328,7 +328,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.add(capabilityName) val capabilityDefinition = nodeType.capabilities?.get(capabilityName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get NodeTemplate({}) capability definition ({}) " + "from NodeType({}) ", @@ -343,7 +343,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateCapabilityAssignment( nodeTemplateName: String, capabilityName: String, @@ -354,14 +354,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateRequirementAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) { val requirements = nodeTemplate.requirements paths.add("requirements") requirements?.forEach { requirementName, requirementAssignment -> paths.add(requirementName) val requirementDefinition = nodeType.requirements?.get(requirementName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get NodeTemplate({}) requirement definition ({}) from" + " NodeType({}) ", @@ -375,7 +375,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateRequirementAssignment( nodeTemplateName: String, requirementAssignmentName: String, @@ -387,8 +387,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { val capabilityName = requirementAssignment.capability val relationship = requirementAssignment.relationship!! - check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) { - throw BluePrintException( + check(BlueprintTypes.validRelationShipDerivedFroms.contains(relationship)) { + throw BlueprintException( format( "Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ", relationship, nodeTemplateName, requirementAssignmentName @@ -397,7 +397,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } val relationShipNodeTemplate = serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ", requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName @@ -405,7 +405,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { ) relationShipNodeTemplate.capabilities?.get(capabilityName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ", requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName @@ -413,7 +413,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { ) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateInterfaceAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) { val interfaces = nodeTemplate.interfaces @@ -421,7 +421,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { interfaces?.forEach { interfaceAssignmentName, interfaceAssignment -> paths.add(interfaceAssignmentName) val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get NodeTemplate({}) interface definition ({}) from" + " NodeType({}) ", @@ -438,7 +438,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateInterfaceAssignment( nodeTemplateName: String, interfaceAssignmentName: String, @@ -455,7 +455,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateInterfaceOperationsAssignment( nodeTemplateName: String, interfaceAssignmentName: String, @@ -468,7 +468,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { it.forEach { operationAssignmentName, operationAssignments -> val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get NodeTemplate({}) operation definition ({}) ", nodeTemplateName, operationAssignmentName @@ -485,7 +485,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { inputs?.forEach { propertyName, propertyAssignment -> val propertyDefinition = operationDefinition.inputs?.get(propertyName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get NodeTemplate({}) operation definition ({}) " + "property definition({})", @@ -498,7 +498,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { outputs?.forEach { propertyName, propertyAssignment -> val propertyDefinition = operationDefinition.outputs?.get(propertyName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get NodeTemplate({}) operation definition ({}) " + "output property definition({})", @@ -513,7 +513,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateCapabilityDefinitions(nodeTypeName: String, nodeType: NodeType) { val capabilities = nodeType.capabilities paths.add("capabilities") @@ -527,7 +527,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateCapabilityDefinition( nodeTypeName: String, nodeType: NodeType, @@ -535,8 +535,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { capabilityDefinition: CapabilityDefinition ) { val capabilityType = capabilityDefinition.type - check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) { - throw BluePrintException( + check(BlueprintTypes.validCapabilityTypes.contains(capabilityType)) { + throw BlueprintException( format( "Failed to get CapabilityType({}) for NodeType({})", capabilityType, nodeTypeName @@ -545,7 +545,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateRequirementDefinitions(nodeName: String, nodeType: NodeType) { paths.add("requirements") val requirements = nodeType.requirements @@ -559,7 +559,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateRequirementDefinition( nodeTypeName: String, nodeType: NodeType, @@ -572,8 +572,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { val capabilityName = requirementDefinition.capability val relationship = requirementDefinition.relationship!! - check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) { - throw BluePrintException( + check(BlueprintTypes.validRelationShipDerivedFroms.contains(relationship)) { + throw BlueprintException( format( "Failed to get relationship({}) for NodeType({})'s requirement({}) ", relationship, nodeTypeName, requirementDefinitionName @@ -582,7 +582,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } val relationShipNodeType = serviceTemplate.nodeTypes?.get(requirementNodeTypeName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get requirement NodeType({})'s for requirement({}) ", requirementNodeTypeName, requirementDefinitionName @@ -590,7 +590,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { ) relationShipNodeType.capabilities?.get(capabilityName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ", requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName @@ -598,7 +598,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { ) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) { paths.add("interfaces") interfaces.forEach { interfaceName, interfaceDefinition -> @@ -610,7 +610,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateOperationDefinitions(operations: MutableMap<String, OperationDefinition>) { paths.add("operations") operations.forEach { opertaionName, operationDefinition -> @@ -624,38 +624,38 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.removeAt(paths.lastIndex) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun validateImplementation(implementation: Implementation) { checkNotEmpty(implementation.primary) { "couldn't get implementation" } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) { val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName) - ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)") + ?: throw BlueprintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)") checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom) } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun checkValidArtifactTypeDerivedFrom(artifactTypeName: String, derivedFrom: String) { - check(BluePrintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) { - throw BluePrintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition") + check(BlueprintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) { + throw BlueprintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition") } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) { - check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { - throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom)) + check(BlueprintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { + throw BlueprintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom)) } } - @Throws(BluePrintException::class) + @Throws(BlueprintException::class) open fun checkValidRelationshipTypeDerivedFrom(relationshipTypeName: String, derivedFrom: String) { - check(BluePrintTypes.validRelationShipDerivedFroms.contains(derivedFrom)) { - throw BluePrintException(format("Failed to get relationship type ({})'s derivedFrom({}) definition ", relationshipTypeName, derivedFrom)) + check(BlueprintTypes.validRelationShipDerivedFroms.contains(derivedFrom)) { + throw BlueprintException(format("Failed to get relationship type ({})'s derivedFrom({}) definition ", relationshipTypeName, derivedFrom)) } } @@ -663,14 +663,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { val propertyType = propertyDefinition.type val isValid: Boolean - if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) { + if (BlueprintTypes.validPrimitiveTypes().contains(propertyType)) { isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment) - } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) { + } else if (BlueprintTypes.validCollectionTypes().contains(propertyType)) { val entrySchemaType = propertyDefinition.entrySchema?.type - ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName)) + ?: throw BlueprintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName)) - if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) { + if (!BlueprintTypes.validPropertyTypes().contains(entrySchemaType)) { checkPropertyDataType(entrySchemaType, propertyName) } isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment) @@ -680,7 +680,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } check(isValid) { - throw BluePrintException( + throw BlueprintException( format( "property({}) defined of type({}) is not comptable with the value ({})", propertyName, propertyType, propertyAssignment @@ -692,16 +692,16 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { private fun checkPropertyDataType(dataTypeName: String, propertyName: String) { val dataType = serviceTemplate.dataTypes?.get(dataTypeName) - ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName)) + ?: throw BlueprintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName)) checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom) } private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean { - if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) { + if (BlueprintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) { return true } else { - throw BluePrintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName)) + throw BlueprintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName)) } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintVelocityTemplateService.kt index 43e27d047..1c4847900 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintVelocityTemplateService.kt @@ -24,12 +24,12 @@ import org.apache.commons.lang3.BooleanUtils import org.apache.commons.lang3.StringUtils import org.apache.velocity.VelocityContext import org.apache.velocity.app.VelocityEngine -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintJsonNodeFactory import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode import java.io.StringWriter -object BluePrintVelocityTemplateService { +object BlueprintVelocityTemplateService { /** * Generate Content from Velocity Template and JSON Content with injected API @@ -43,12 +43,12 @@ object BluePrintVelocityTemplateService { // Customized Object Mapper to remove String double quotes val mapper = ObjectMapper() - val nodeFactory = BluePrintJsonNodeFactory() + val nodeFactory = BlueprintJsonNodeFactory() mapper.nodeFactory = nodeFactory val jsonNode: JsonNode? = if (json.isNotEmpty()) { mapper.readValue(json, JsonNode::class.java) - ?: throw BluePrintProcessorException("couldn't get json node from json") + ?: throw BlueprintProcessorException("couldn't get json node from json") } else { null } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintWorkflowService.kt index f3e4e59aa..b5121caac 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintWorkflowService.kt @@ -25,8 +25,8 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.actor import kotlinx.coroutines.channels.consumeEach import kotlinx.coroutines.launch -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.data.EdgeLabel import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeStatus import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph @@ -39,11 +39,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.outgoingEdgesNotInLabels import org.onap.ccsdk.cds.controllerblueprints.core.startNodes import kotlin.coroutines.CoroutineContext -interface BluePrintWorkFlowService<In, Out> { +interface BlueprintWorkFlowService<In, Out> { /** Executes imperative workflow graph [graph] for the bluePrintRuntimeService [bluePrintRuntimeService] * and workflow input [input]*/ - suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>, input: In): Out + suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BlueprintRuntimeService<*>, input: In): Out suspend fun initializeWorkflow(input: In): EdgeLabel @@ -91,11 +91,11 @@ enum class EdgeAction(val id: String) { } /** Abstract workflow service implementation */ -abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BluePrintWorkFlowService<In, Out> { +abstract class AbstractBlueprintWorkFlowService<In, Out> : CoroutineScope, BlueprintWorkFlowService<In, Out> { lateinit var graph: Graph - private val log = logger(AbstractBluePrintWorkFlowService::class) + private val log = logger(AbstractBlueprintWorkFlowService::class) private val job = Job() @@ -131,7 +131,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP // Wait for workflow completion or Error nodeActor.invokeOnClose { exception -> launch { - if (exception != null) exceptions.add(BluePrintProcessorException(exception)) + if (exception != null) exceptions.add(BlueprintProcessorException(exception)) log.info("workflow($workflowId) nodes completed with (${exceptions.size})exceptions") val workflowOutput = prepareWorkflowOutput() workflowExecuteMessage.output.complete(workflowOutput) @@ -235,8 +235,8 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP suspend fun executeNodeWorker(message: NodeExecuteMessage<In, Out>) { val node = message.node node.status = NodeStatus.EXECUTING - val nodeState = if (node.id == BluePrintConstants.GRAPH_START_NODE_NAME || - node.id == BluePrintConstants.GRAPH_END_NODE_NAME + val nodeState = if (node.id == BlueprintConstants.GRAPH_START_NODE_NAME || + node.id == BlueprintConstants.GRAPH_END_NODE_NAME ) { EdgeLabel.SUCCESS } else { @@ -255,7 +255,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP // Close the current channel channel.close() } else if (!edgePresent) { - throw BluePrintProcessorException("node(${node.id}) outgoing edge($nodeState) is missing.") + throw BlueprintProcessorException("node(${node.id}) outgoing edge($nodeState) is missing.") } else { val skippingEdges = graph.outgoingEdgesNotInLabels(node.id, arrayListOf(nodeState)) log.debug("Skipping node($node)'s outgoing edges($skippingEdges)") diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt index b246054e2..7a5a2d58f 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt @@ -19,8 +19,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.NullNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactExpression @@ -40,11 +40,11 @@ import org.slf4j.LoggerFactory * * @author Brinda Santh */ -open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>>) { +open class PropertyAssignmentService(var bluePrintRuntimeService: BlueprintRuntimeService<MutableMap<String, JsonNode>>) { private val log = LoggerFactory.getLogger(this::class.toString()) - private var bluePrintContext: BluePrintContext = bluePrintRuntimeService.bluePrintContext() + private var bluePrintContext: BlueprintContext = bluePrintRuntimeService.bluePrintContext() /* @@ -60,7 +60,7 @@ open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRunti assignment: JsonNode ): JsonNode { log.trace("Assignment ({})", assignment) - val expressionData = BluePrintExpressionService.getExpressionData(assignment) + val expressionData = BlueprintExpressionService.getExpressionData(assignment) return if (expressionData.isExpression) { resolveExpression(definitionType, definitionName, assignmentName, expressionData) @@ -82,32 +82,32 @@ open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRunti val command = expressionData.command!! when (command) { - BluePrintConstants.EXPRESSION_GET_INPUT -> { + BlueprintConstants.EXPRESSION_GET_INPUT -> { valueNode = bluePrintRuntimeService.getInputValue(expressionData.inputExpression?.propertyName!!) } - BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> { + BlueprintConstants.EXPRESSION_GET_ATTRIBUTE -> { valueNode = resolveAttributeExpression(definitionType, definitionName, expressionData.attributeExpression!!) } - BluePrintConstants.EXPRESSION_GET_PROPERTY -> { + BlueprintConstants.EXPRESSION_GET_PROPERTY -> { valueNode = resolvePropertyExpression(definitionType, definitionName, expressionData.propertyExpression!!) } - BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> { + BlueprintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> { valueNode = resolveOperationOutputExpression(definitionName, expressionData.operationOutputExpression!!) } - BluePrintConstants.EXPRESSION_GET_ARTIFACT -> { + BlueprintConstants.EXPRESSION_GET_ARTIFACT -> { valueNode = resolveArtifactExpression(definitionName, expressionData.artifactExpression!!) } - BluePrintConstants.EXPRESSION_DSL_REFERENCE -> { + BlueprintConstants.EXPRESSION_DSL_REFERENCE -> { valueNode = bluePrintRuntimeService.resolveDSLExpression(expressionData.dslExpression!!.propertyName) } - BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE -> { + BlueprintConstants.EXPRESSION_GET_NODE_OF_TYPE -> { } else -> { - throw BluePrintException( + throw BlueprintException( "for $definitionType($definitionName) property ($propName), " + "command ($command) is not supported " ) @@ -140,53 +140,53 @@ open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRunti * SELF : Current Node Template properties. */ when (attributeExpression.modelableEntityName) { - BluePrintConstants.PROPERTY_ENV -> { + BlueprintConstants.PROPERTY_ENV -> { val environmentValue = System.getenv(attributeName) valueNode = environmentValue.asJsonPrimitive() } - BluePrintConstants.PROPERTY_APP -> { + BlueprintConstants.PROPERTY_APP -> { val environmentValue = System.getProperty(attributeName) valueNode = environmentValue.asJsonPrimitive() } - BluePrintConstants.PROPERTY_BPP -> { + BlueprintConstants.PROPERTY_BPP -> { valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue( - BluePrintConstants.PROPERTY_BPP, + BlueprintConstants.PROPERTY_BPP, attributeName - ) ?: throw BluePrintException("failed to get env attribute name ($attributeName) ") + ) ?: throw BlueprintException("failed to get env attribute name ($attributeName) ") } else -> { - if (!attributeExpression.modelableEntityName.equals(BluePrintConstants.PROPERTY_SELF, true)) { + if (!attributeExpression.modelableEntityName.equals(BlueprintConstants.PROPERTY_SELF, true)) { attributeDefinitionName = attributeExpression.modelableEntityName } /** This block is to Validate, if Attribute definition is present */ when (definitionType) { - BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, - BluePrintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, - BluePrintConstants.MODEL_DEFINITION_TYPE_DSL -> + BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, + BlueprintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, + BlueprintConstants.MODEL_DEFINITION_TYPE_DSL -> bluePrintContext.nodeTemplateNodeType(attributeDefinitionName).attributes - BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> + BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> bluePrintContext.relationshipTemplateRelationshipType(attributeDefinitionName).attributes - else -> throw BluePrintException("failed to understand template type($definitionType), it is not supported") + else -> throw BlueprintException("failed to understand template type($definitionType), it is not supported") }?.get(attributeName) - ?: throw BluePrintException( + ?: throw BlueprintException( "failed to get attribute definitions for " + "$definitionType ($attributeDefinitionName)'s attribute name ($attributeName) " ) valueNode = when (definitionType) { - BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, - BluePrintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, - BluePrintConstants.MODEL_DEFINITION_TYPE_DSL -> + BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, + BlueprintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, + BlueprintConstants.MODEL_DEFINITION_TYPE_DSL -> bluePrintRuntimeService.getNodeTemplateAttributeValue(attributeDefinitionName, attributeName) - BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> + BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> bluePrintRuntimeService.getRelationshipTemplateAttributeValue( attributeDefinitionName, attributeName ) - else -> throw BluePrintException("failed to understand template type($definitionType), it is not supported") + else -> throw BlueprintException("failed to understand template type($definitionType), it is not supported") } - ?: throw BluePrintException("failed to get node template ($attributeDefinitionName)'s attribute name ($attributeName) ") + ?: throw BlueprintException("failed to get node template ($attributeDefinitionName)'s attribute name ($attributeName) ") } } if (subAttributeName != null) { @@ -212,32 +212,32 @@ open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRunti var propertyDefinitionName = definitionName - if (!propertyExpression.modelableEntityName.equals(BluePrintConstants.PROPERTY_SELF, true)) { + if (!propertyExpression.modelableEntityName.equals(BlueprintConstants.PROPERTY_SELF, true)) { propertyDefinitionName = propertyExpression.modelableEntityName } val nodeTemplatePropertyExpression = when (definitionType) { - BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, - BluePrintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, - BluePrintConstants.MODEL_DEFINITION_TYPE_DSL -> + BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, + BlueprintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, + BlueprintConstants.MODEL_DEFINITION_TYPE_DSL -> bluePrintContext.nodeTemplateByName(propertyDefinitionName).properties - BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> + BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> bluePrintContext.relationshipTemplateByName(propertyDefinitionName).properties - else -> throw BluePrintException("failed to understand template type($definitionType), it is not supported") + else -> throw BlueprintException("failed to understand template type($definitionType), it is not supported") }?.get(propertyName) - ?: throw BluePrintException("failed to get property assignment for node template ($definitionName)'s property name ($propertyName).") + ?: throw BlueprintException("failed to get property assignment for node template ($definitionName)'s property name ($propertyName).") /** This block is to Validate, if Property definition is present */ when (definitionType) { - BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, - BluePrintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, - BluePrintConstants.MODEL_DEFINITION_TYPE_DSL -> + BlueprintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE, + BlueprintConstants.MODEL_DEFINITION_TYPE_WORKFLOW, + BlueprintConstants.MODEL_DEFINITION_TYPE_DSL -> bluePrintContext.nodeTemplateNodeType(propertyDefinitionName).properties - BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> + BlueprintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TEMPLATE -> bluePrintContext.relationshipTemplateRelationshipType(propertyDefinitionName).properties - else -> throw BluePrintException("failed to understand template type($definitionType), it is not supported") + else -> throw BlueprintException("failed to understand template type($definitionType), it is not supported") }?.get(propertyName) - ?: throw BluePrintException("failed to get property definition for node template ($definitionName)'s property name ($propertyName).") + ?: throw BlueprintException("failed to get property definition for node template ($definitionName)'s property name ($propertyName).") log.info( "$definitionType($propertyDefinitionName), property($propertyName) resolved value ($nodeTemplatePropertyExpression)" @@ -295,7 +295,7 @@ open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRunti } val artifactDefinition: ArtifactDefinition = bluePrintContext.nodeTemplateByName(artifactNodeTemplateName) .artifacts?.get(artifactExpression.artifactName) - ?: throw BluePrintException( + ?: throw BlueprintException( format( "failed to get artifact definitions for node template ({})'s " + "artifact name ({}) ", diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintArchiveUtils.kt index 1a7c23cf1..a16f58042 100755..100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintArchiveUtils.kt @@ -30,7 +30,7 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream import org.apache.commons.compress.archivers.zip.ZipFile import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException import org.slf4j.LoggerFactory import java.io.BufferedInputStream import java.io.ByteArrayInputStream @@ -56,11 +56,11 @@ enum class ArchiveType { Zip } -class BluePrintArchiveUtils { +class BlueprintArchiveUtils { companion object { - private val log = LoggerFactory.getLogger(BluePrintArchiveUtils::class.java) + private val log = LoggerFactory.getLogger(BlueprintArchiveUtils::class.java) /** * Create a new Zip from a root directory @@ -208,7 +208,7 @@ class BluePrintArchiveUtils { val destinationDir = File(targetPath) check(destinationDir.isDirectory && destinationDir.exists()) { - throw BluePrintProcessorException("failed to decompress blueprint(${archiveFile.absolutePath}) to ($targetPath) ") + throw BlueprintProcessorException("failed to decompress blueprint(${archiveFile.absolutePath}) to ($targetPath) ") } return destinationDir diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintFileUtils.kt index 292eca92e..583709f08 100755..100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintFileUtils.kt @@ -21,14 +21,14 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils import kotlinx.coroutines.runBlocking import org.apache.commons.io.FileUtils import org.apache.commons.lang3.StringUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.onap.ccsdk.cds.controllerblueprints.core.data.ImportDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext import org.slf4j.LoggerFactory import java.io.File import java.io.FileFilter @@ -41,52 +41,52 @@ import java.nio.file.Path import java.nio.file.Paths import java.nio.file.StandardOpenOption -class BluePrintFileUtils { +class BlueprintFileUtils { companion object { const val COMPILED_JAR_SUFFIX = "cba-kts.jar" private val log = LoggerFactory.getLogger(this::class.toString()) - fun createEmptyBluePrint(basePath: String) { + fun createEmptyBlueprint(basePath: String) { val blueprintDir = File(basePath) FileUtils.deleteDirectory(blueprintDir) Files.createDirectories(blueprintDir.toPath()) - val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_DIR)) + val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BlueprintConstants.TOSCA_METADATA_DIR)) Files.createDirectories(metaDataDir.toPath()) val metaFile = File( blueprintDir.absolutePath.plus(File.separator).plus( - BluePrintConstants + BlueprintConstants .TOSCA_METADATA_ENTRY_DEFINITION_FILE ) ) Files.write(metaFile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW) - val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)) + val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BlueprintConstants.TOSCA_DEFINITIONS_DIR)) Files.createDirectories(definitionsDir.toPath()) - val scriptsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_SCRIPTS_DIR)) + val scriptsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BlueprintConstants.TOSCA_SCRIPTS_DIR)) Files.createDirectories(scriptsDir.toPath()) - val plansDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_PLANS_DIR)) + val plansDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BlueprintConstants.TOSCA_PLANS_DIR)) Files.createDirectories(plansDir.toPath()) - val templatesDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_TEMPLATES_DIR)) + val templatesDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BlueprintConstants.TOSCA_TEMPLATES_DIR)) Files.createDirectories(templatesDir.toPath()) } - fun copyBluePrint(sourcePath: String, targetPath: String) { + fun copyBlueprint(sourcePath: String, targetPath: String) { val sourceFile = File(sourcePath) val targetFile = File(targetPath) sourceFile.copyRecursively(targetFile, true) } - fun deleteBluePrintTypes(basePath: String) { - val definitionPath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR) + fun deleteBlueprintTypes(basePath: String) { + val definitionPath = basePath.plus(File.separator).plus(BlueprintConstants.TOSCA_DEFINITIONS_DIR) log.info("deleting definition types under : $definitionPath") val definitionDir = File(definitionPath) @@ -98,24 +98,24 @@ class BluePrintFileUtils { } } - fun writeEnhancedBluePrint(blueprintContext: BluePrintContext) { + fun writeEnhancedBlueprint(blueprintContext: BlueprintContext) { // Write Blueprint Types - writeBluePrintTypes(blueprintContext) + writeBlueprintTypes(blueprintContext) // Re Populate the Imports populateDefaultImports(blueprintContext) // Rewrite the Entry Definition Files writeEntryDefinitionFile(blueprintContext) } - fun writeBluePrintTypes(blueprintContext: BluePrintContext) { + fun writeBlueprintTypes(blueprintContext: BlueprintContext) { val basePath = blueprintContext.rootPath - val definitionPath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR) + val definitionPath = basePath.plus(File.separator).plus(BlueprintConstants.TOSCA_DEFINITIONS_DIR) val definitionDir = File(definitionPath) check(definitionDir.exists()) { - throw BluePrintException( + throw BlueprintException( ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " + "path(${definitionDir.absolutePath})" @@ -123,37 +123,37 @@ class BluePrintFileUtils { } blueprintContext.serviceTemplate.dataTypes?.let { - val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it.toSortedMap(), true) - writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent) + val dataTypesContent = JacksonUtils.getWrappedJson(BlueprintConstants.PATH_DATA_TYPES, it.toSortedMap(), true) + writeTypeFile(definitionDir.absolutePath, BlueprintConstants.PATH_DATA_TYPES, dataTypesContent) } blueprintContext.serviceTemplate.relationshipTypes?.let { - val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_RELATIONSHIP_TYPES, it.toSortedMap(), true) - writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_RELATIONSHIP_TYPES, nodeTypesContent) + val nodeTypesContent = JacksonUtils.getWrappedJson(BlueprintConstants.PATH_RELATIONSHIP_TYPES, it.toSortedMap(), true) + writeTypeFile(definitionDir.absolutePath, BlueprintConstants.PATH_RELATIONSHIP_TYPES, nodeTypesContent) } blueprintContext.serviceTemplate.artifactTypes?.let { - val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it.toSortedMap(), true) - writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) + val artifactTypesContent = JacksonUtils.getWrappedJson(BlueprintConstants.PATH_ARTIFACT_TYPES, it.toSortedMap(), true) + writeTypeFile(definitionDir.absolutePath, BlueprintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent) } blueprintContext.serviceTemplate.nodeTypes?.let { - val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it.toSortedMap(), true) - writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent) + val nodeTypesContent = JacksonUtils.getWrappedJson(BlueprintConstants.PATH_NODE_TYPES, it.toSortedMap(), true) + writeTypeFile(definitionDir.absolutePath, BlueprintConstants.PATH_NODE_TYPES, nodeTypesContent) } blueprintContext.serviceTemplate.policyTypes?.let { - val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it.toSortedMap(), true) - writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_POLICY_TYPES, nodeTypesContent) + val nodeTypesContent = JacksonUtils.getWrappedJson(BlueprintConstants.PATH_POLICY_TYPES, it.toSortedMap(), true) + writeTypeFile(definitionDir.absolutePath, BlueprintConstants.PATH_POLICY_TYPES, nodeTypesContent) } } - private fun populateDefaultImports(blueprintContext: BluePrintContext) { + private fun populateDefaultImports(blueprintContext: BlueprintContext) { // Get the Default Types val types = arrayListOf( - BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES, - BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES, - BluePrintConstants.PATH_POLICY_TYPES + BlueprintConstants.PATH_DATA_TYPES, BlueprintConstants.PATH_RELATIONSHIP_TYPES, + BlueprintConstants.PATH_ARTIFACT_TYPES, BlueprintConstants.PATH_NODE_TYPES, + BlueprintConstants.PATH_POLICY_TYPES ) // Clean Type Imports @@ -162,7 +162,7 @@ class BluePrintFileUtils { val imports = mutableListOf<ImportDefinition>() types.forEach { typeName -> val import = ImportDefinition() - import.file = BluePrintConstants.TOSCA_DEFINITIONS_DIR.plus("/$typeName.json") + import.file = BlueprintConstants.TOSCA_DEFINITIONS_DIR.plus("/$typeName.json") imports.add(import) } @@ -181,9 +181,9 @@ class BluePrintFileUtils { } /** - * Re Generate the Blueprint Service Template Definition file based on BluePrint Context. + * Re Generate the Blueprint Service Template Definition file based on Blueprint Context. */ - private fun writeEntryDefinitionFile(blueprintContext: BluePrintContext) { + private fun writeEntryDefinitionFile(blueprintContext: BlueprintContext) { val absoluteEntryDefinitionFile = blueprintContext.rootPath.plus(File.separator).plus(blueprintContext.entryDefinition) @@ -208,7 +208,7 @@ class BluePrintFileUtils { Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW) check(definitionFile.exists()) { - throw BluePrintException( + throw BlueprintException( ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " + "path(${definitionFile.absolutePath})" @@ -221,7 +221,7 @@ class BluePrintFileUtils { Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW) check(typeFile.exists()) { - throw BluePrintException( + throw BlueprintException( ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " + "path(${typeFile.absolutePath})" @@ -240,11 +240,11 @@ class BluePrintFileUtils { "\nTemplate-Tags: <TAGS>" } - fun getBluePrintFile(fileName: String, targetPath: Path): File { + fun getBlueprintFile(fileName: String, targetPath: Path): File { val filePath = targetPath.resolve(fileName).toString() val file = File(filePath) check(file.exists()) { - throw BluePrintException( + throw BlueprintException( ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " + "path(${file.absolutePath})" @@ -255,7 +255,7 @@ class BluePrintFileUtils { fun getCbaStorageDirectory(path: String): Path { check(StringUtils.isNotBlank(path)) { - throw BluePrintException( + throw BlueprintException( ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " + "Blueprint folder under path($path)" @@ -280,7 +280,7 @@ class BluePrintFileUtils { fun compileJarFilePathName(basePath: String, artifactName: String, artifactVersion: String): String { return normalizedPathName( - basePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR, + basePath, BlueprintConstants.TOSCA_SCRIPTS_KOTLIN_DIR, compileJarFileName(artifactName, artifactVersion) ) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintIOUtils.kt index d29fed0d9..c2e0ec39c 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintIOUtils.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils -object BluePrintIOUtils { +object BlueprintIOUtils { suspend fun <T> retry( times: Int = 1, diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintMetadataUtils.kt index 43f3a0b53..ffaa9e72f 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintMetadataUtils.kt @@ -19,45 +19,45 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils import com.fasterxml.jackson.databind.JsonNode import kotlinx.coroutines.runBlocking -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.ToscaMetaData -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDefinitions +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintDefinitions import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines -import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintImportService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BlueprintScriptsServiceImpl +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintImportService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService import org.slf4j.LoggerFactory import java.io.File import java.util.Properties -class BluePrintMetadataUtils { +class BlueprintMetadataUtils { companion object { private val log = LoggerFactory.getLogger(this::class.toString()) suspend fun toscaMetaData(basePath: String): ToscaMetaData { - val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE) + val toscaMetaPath = basePath.plus(BlueprintConstants.PATH_DIVIDER) + .plus(BlueprintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE) return toscaMetaDataFromMetaFile(toscaMetaPath) } suspend fun entryDefinitionFile(basePath: String): String { - val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER) - .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE) + val toscaMetaPath = basePath.plus(BlueprintConstants.PATH_DIVIDER) + .plus(BlueprintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE) return toscaMetaDataFromMetaFile(toscaMetaPath).entityDefinitions } fun bluePrintEnvProperties(basePath: String): Properties { val blueprintsEnvFilePath = basePath.plus(File.separator) - .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR) + .plus(BlueprintConstants.TOSCA_ENVIRONMENTS_DIR) return environmentFileProperties(blueprintsEnvFilePath) } @@ -103,59 +103,59 @@ class BluePrintMetadataUtils { } /** Get the default blueprint runtime for [id] and [blueprintBasePath] */ - suspend fun getBluePrintRuntime(id: String, blueprintBasePath: String): - BluePrintRuntimeService<MutableMap<String, JsonNode>> { - val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) - return getBluePrintRuntime(id, bluePrintContext) + suspend fun getBlueprintRuntime(id: String, blueprintBasePath: String): + BlueprintRuntimeService<MutableMap<String, JsonNode>> { + val bluePrintContext: BlueprintContext = getBlueprintContext(blueprintBasePath) + return getBlueprintRuntime(id, bluePrintContext) } /** Get the default blocking blueprint runtime api for [id] and [blueprintBasePath] used in testing */ fun bluePrintRuntime(id: String, blueprintBasePath: String): - BluePrintRuntimeService<MutableMap<String, JsonNode>> = runBlocking { - val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) - getBluePrintRuntime(id, bluePrintContext) + BlueprintRuntimeService<MutableMap<String, JsonNode>> = runBlocking { + val bluePrintContext: BlueprintContext = getBlueprintContext(blueprintBasePath) + getBlueprintRuntime(id, bluePrintContext) } /** Get the default blueprint runtime from [bluePrintContext] */ - fun getBluePrintRuntime(id: String, bluePrintContext: BluePrintContext): - BluePrintRuntimeService<MutableMap<String, JsonNode>> { + fun getBlueprintRuntime(id: String, bluePrintContext: BlueprintContext): + BlueprintRuntimeService<MutableMap<String, JsonNode>> { checkNotEmpty(bluePrintContext.rootPath) { "blueprint context root path is missing." } checkNotEmpty(bluePrintContext.entryDefinition) { "blueprint context entry definition is missing." } val blueprintBasePath = bluePrintContext.rootPath - val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) + val bluePrintRuntimeService = DefaultBlueprintRuntimeService(id, bluePrintContext) bluePrintRuntimeService.put( - BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH, + BlueprintConstants.PROPERTY_BLUEPRINT_BASE_PATH, blueprintBasePath.asJsonPrimitive() ) - bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive()) + bluePrintRuntimeService.put(BlueprintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive()) return bluePrintRuntimeService } /** Get the blueprint runtime for enhancement start for [id] and [blueprintBasePath] */ - suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String): - BluePrintRuntimeService<MutableMap<String, JsonNode>> { + suspend fun getBaseEnhancementBlueprintRuntime(id: String, blueprintBasePath: String): + BlueprintRuntimeService<MutableMap<String, JsonNode>> { - val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath) + val bluePrintContext: BlueprintContext = getBaseEnhancementBlueprintContext(blueprintBasePath) - val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) + val bluePrintRuntimeService = DefaultBlueprintRuntimeService(id, bluePrintContext) bluePrintRuntimeService.put( - BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH, + BlueprintConstants.PROPERTY_BLUEPRINT_BASE_PATH, blueprintBasePath.asJsonPrimitive() ) - bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive()) + bluePrintRuntimeService.put(BlueprintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive()) return bluePrintRuntimeService } /** Get the default blueprint runtime for enhancement start for [id], [blueprintBasePath] and [executionContext] */ - suspend fun getBluePrintRuntime( + suspend fun getBlueprintRuntime( id: String, blueprintBasePath: String, executionContext: MutableMap<String, JsonNode> ): - BluePrintRuntimeService<MutableMap<String, JsonNode>> { - val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath) - val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext) + BlueprintRuntimeService<MutableMap<String, JsonNode>> { + val bluePrintContext: BlueprintContext = getBlueprintContext(blueprintBasePath) + val bluePrintRuntimeService = DefaultBlueprintRuntimeService(id, bluePrintContext) executionContext.forEach { bluePrintRuntimeService.put(it.key, it.value) } @@ -165,7 +165,7 @@ class BluePrintMetadataUtils { } /** Get the default blueprint context for [blueprintBasePath]*/ - suspend fun getBluePrintContext(blueprintBasePath: String): BluePrintContext { + suspend fun getBlueprintContext(blueprintBasePath: String): BlueprintContext { val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath) @@ -176,24 +176,24 @@ class BluePrintMetadataUtils { // If the EntryDefinition is Kotlin file, compile and get Service Template val bluePrintContext = when (toscaMetaData.templateType.toUpperCase()) { - BluePrintConstants.BLUEPRINT_TYPE_KOTLIN_DSL -> readBlueprintKotlinFile( + BlueprintConstants.BLUEPRINT_TYPE_KOTLIN_DSL -> readBlueprintKotlinFile( toscaMetaData, blueprintBasePath ) - BluePrintConstants.BLUEPRINT_TYPE_GENERIC_SCRIPT -> readBlueprintGenericScript( + BlueprintConstants.BLUEPRINT_TYPE_GENERIC_SCRIPT -> readBlueprintGenericScript( toscaMetaData, blueprintBasePath ) - BluePrintConstants.BLUEPRINT_TYPE_DEFAULT -> readBlueprintFile( + BlueprintConstants.BLUEPRINT_TYPE_DEFAULT -> readBlueprintFile( toscaMetaData.entityDefinitions, blueprintBasePath ) else -> - throw BluePrintException( + throw BlueprintException( "Unknown blueprint type(${toscaMetaData.templateType}), " + - "It should be any one of these types[${BluePrintConstants.BLUEPRINT_TYPE_KOTLIN_DSL}," + - "${BluePrintConstants.BLUEPRINT_TYPE_GENERIC_SCRIPT}, " + - "${BluePrintConstants.BLUEPRINT_TYPE_DEFAULT}]" + "It should be any one of these types[${BlueprintConstants.BLUEPRINT_TYPE_KOTLIN_DSL}," + + "${BlueprintConstants.BLUEPRINT_TYPE_GENERIC_SCRIPT}, " + + "${BlueprintConstants.BLUEPRINT_TYPE_DEFAULT}]" ) } // Copy the metadata info @@ -202,11 +202,11 @@ class BluePrintMetadataUtils { return bluePrintContext } - private suspend fun getBaseEnhancementBluePrintContext(blueprintBasePath: String): BluePrintContext { + private suspend fun getBaseEnhancementBlueprintContext(blueprintBasePath: String): BlueprintContext { val toscaMetaData: ToscaMetaData = toscaMetaData(blueprintBasePath) // Clean Type files - BluePrintFileUtils.deleteBluePrintTypes(blueprintBasePath) + BlueprintFileUtils.deleteBlueprintTypes(blueprintBasePath) val rootFilePath: String = blueprintBasePath.plus(File.separator).plus(toscaMetaData.entityDefinitions) val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) @@ -214,9 +214,9 @@ class BluePrintMetadataUtils { copyMetaInfoToServiceTemplate(toscaMetaData, rootServiceTemplate) // Clean the Import Definitions - BluePrintFileUtils.cleanImportTypes(rootServiceTemplate) + BlueprintFileUtils.cleanImportTypes(rootServiceTemplate) - val blueprintContext = BluePrintContext(rootServiceTemplate) + val blueprintContext = BlueprintContext(rootServiceTemplate) blueprintContext.rootPath = blueprintBasePath blueprintContext.entryDefinition = toscaMetaData.entityDefinitions return blueprintContext @@ -226,36 +226,36 @@ class BluePrintMetadataUtils { private fun copyMetaInfoToServiceTemplate(toscaMetaData: ToscaMetaData, serviceTemplate: ServiceTemplate) { if (serviceTemplate.metadata == null) serviceTemplate.metadata = mutableMapOf() val metadata = serviceTemplate.metadata!! - metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] = toscaMetaData.createdBy - metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] = toscaMetaData.templateName - metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] = toscaMetaData.templateVersion - metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] = toscaMetaData.templateTags - metadata[BluePrintConstants.METADATA_TEMPLATE_TYPE] = toscaMetaData.templateType + metadata[BlueprintConstants.METADATA_TEMPLATE_AUTHOR] = toscaMetaData.createdBy + metadata[BlueprintConstants.METADATA_TEMPLATE_NAME] = toscaMetaData.templateName + metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION] = toscaMetaData.templateVersion + metadata[BlueprintConstants.METADATA_TEMPLATE_TAGS] = toscaMetaData.templateTags + metadata[BlueprintConstants.METADATA_TEMPLATE_TYPE] = toscaMetaData.templateType } - private suspend fun readBlueprintFile(entityDefinitions: String, basePath: String): BluePrintContext { + private suspend fun readBlueprintFile(entityDefinitions: String, basePath: String): BlueprintContext { val normalizedBasePath = normalizedPathName(basePath) val rootFilePath = normalizedPathName(normalizedBasePath, entityDefinitions) val rootServiceTemplate = ServiceTemplateUtils.getServiceTemplate(rootFilePath) // Recursively Import Template files - val schemaImportResolverUtils = BluePrintImportService(rootServiceTemplate, normalizedBasePath) + val schemaImportResolverUtils = BlueprintImportService(rootServiceTemplate, normalizedBasePath) val completeServiceTemplate = schemaImportResolverUtils.getImportResolvedServiceTemplate() - val blueprintContext = BluePrintContext(completeServiceTemplate) + val blueprintContext = BlueprintContext(completeServiceTemplate) blueprintContext.rootPath = normalizedBasePath blueprintContext.entryDefinition = entityDefinitions return blueprintContext } /** Reade the Service Template Definitions from the Kotlin file */ - private suspend fun readBlueprintKotlinFile(toscaMetaData: ToscaMetaData, basePath: String): BluePrintContext { + private suspend fun readBlueprintKotlinFile(toscaMetaData: ToscaMetaData, basePath: String): BlueprintContext { val definitionClassName = toscaMetaData.entityDefinitions.removeSuffix(".kt") val normalizedBasePath = normalizedPathName(basePath) - val bluePrintScriptsService = BluePrintScriptsServiceImpl() + val bluePrintScriptsService = BlueprintScriptsServiceImpl() val bluePrintDefinitions = bluePrintScriptsService - .scriptInstance<BluePrintDefinitions>( + .scriptInstance<BlueprintDefinitions>( normalizedBasePath, toscaMetaData.templateName, toscaMetaData.templateVersion, definitionClassName, false ) @@ -263,9 +263,9 @@ class BluePrintMetadataUtils { val serviceTemplate = bluePrintDefinitions.serviceTemplate() // Clean the Default type import Definitions - BluePrintFileUtils.cleanImportTypes(serviceTemplate) + BlueprintFileUtils.cleanImportTypes(serviceTemplate) - val blueprintContext = BluePrintContext(serviceTemplate) + val blueprintContext = BlueprintContext(serviceTemplate) blueprintContext.rootPath = normalizedBasePath blueprintContext.entryDefinition = toscaMetaData.entityDefinitions blueprintContext.otherDefinitions = bluePrintDefinitions.otherDefinitions() @@ -273,8 +273,8 @@ class BluePrintMetadataUtils { } /** Reade the Service Template Definitions from the generic script types */ - private fun readBlueprintGenericScript(toscaMetaData: ToscaMetaData, basePath: String): BluePrintContext { - return BluePrintContext(ServiceTemplate()) + private fun readBlueprintGenericScript(toscaMetaData: ToscaMetaData, basePath: String): BlueprintContext { + return BlueprintContext(ServiceTemplate()) } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintRuntimeUtils.kt index f4c51d455..1df185cf6 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BlueprintRuntimeUtils.kt @@ -18,8 +18,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.NullNode -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext import org.slf4j.LoggerFactory /** @@ -27,17 +27,17 @@ import org.slf4j.LoggerFactory * * @author Brinda Santh */ -object BluePrintRuntimeUtils { +object BlueprintRuntimeUtils { private val log = LoggerFactory.getLogger(this::class.toString()) - fun assignInputsFromFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String, JsonNode>) { + fun assignInputsFromFile(bluePrintContext: BlueprintContext, fileName: String, context: MutableMap<String, JsonNode>) { val jsonNode: JsonNode = JacksonUtils.jsonNodeFromFile(fileName) return assignInputs(bluePrintContext, jsonNode, context) } fun assignInputsFromClassPathFile( - bluePrintContext: BluePrintContext, + bluePrintContext: BlueprintContext, fileName: String, context: MutableMap<String, JsonNode> @@ -46,17 +46,17 @@ object BluePrintRuntimeUtils { return assignInputs(bluePrintContext, jsonNode, context) } - fun assignInputsFromContent(bluePrintContext: BluePrintContext, content: String, context: MutableMap<String, JsonNode>) { + fun assignInputsFromContent(bluePrintContext: BlueprintContext, content: String, context: MutableMap<String, JsonNode>) { val jsonNode: JsonNode = JacksonUtils.jsonNode(content) return assignInputs(bluePrintContext, jsonNode, context) } - fun assignInputs(bluePrintContext: BluePrintContext, jsonNode: JsonNode, context: MutableMap<String, JsonNode>) { + fun assignInputs(bluePrintContext: BlueprintContext, jsonNode: JsonNode, context: MutableMap<String, JsonNode>) { log.info("assignInputs from input JSON ({})", jsonNode.toString()) bluePrintContext.inputs()?.forEach { propertyName, _ -> val valueNode: JsonNode = jsonNode.at("/".plus(propertyName)) ?: NullNode.getInstance() - val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(propertyName) + val path = BlueprintConstants.PATH_INPUTS.plus(BlueprintConstants.PATH_DIVIDER).plus(propertyName) log.trace("setting input path ({}), values ({})", path, valueNode) context[path] = valueNode } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt index 7fe955b03..cacfc2cd2 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import java.net.InetAddress object ClusterUtils { @@ -28,19 +28,19 @@ object ClusterUtils { } fun applicationName(): String { - return BluePrintConstants.APP_NAME + return BlueprintConstants.APP_NAME } fun clusterId(): String { - return System.getenv(BluePrintConstants.PROPERTY_CLUSTER_ID) ?: "cds-cluster" + return System.getenv(BlueprintConstants.PROPERTY_CLUSTER_ID) ?: "cds-cluster" } fun clusterNodeId(): String { - return System.getenv(BluePrintConstants.PROPERTY_CLUSTER_NODE_ID) ?: "cds-controller-0" + return System.getenv(BlueprintConstants.PROPERTY_CLUSTER_NODE_ID) ?: "cds-controller-0" } fun clusterNodeAddress(): String { - return System.getenv(BluePrintConstants.PROPERTY_CLUSTER_NODE_ADDRESS) + return System.getenv(BlueprintConstants.PROPERTY_CLUSTER_NODE_ADDRESS) ?: clusterNodeId() } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt index 02dd2027d..14b308bc9 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import java.text.SimpleDateFormat import java.time.LocalDateTime import java.time.ZoneId @@ -31,19 +31,19 @@ fun controllerDate(): Date { fun currentTimestamp(): String { val localDateTime = LocalDateTime.now(ZoneId.systemDefault()) - val formatter = DateTimeFormatter.ofPattern(BluePrintConstants.DATE_TIME_PATTERN) + val formatter = DateTimeFormatter.ofPattern(BlueprintConstants.DATE_TIME_PATTERN) return formatter.format(localDateTime) } /** Parse string date in CDS string format */ fun String.toControllerDate(): Date { - val formatter = SimpleDateFormat(BluePrintConstants.DATE_TIME_PATTERN) + val formatter = SimpleDateFormat(BlueprintConstants.DATE_TIME_PATTERN) return formatter.parse(this) } /** Return date to CDS string format */ fun Date.currentTimestamp(): String { - val formatter = SimpleDateFormat(BluePrintConstants.DATE_TIME_PATTERN) + val formatter = SimpleDateFormat(BlueprintConstants.DATE_TIME_PATTERN) return formatter.format(this) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt index ace66cf7a..1110f6f34 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt @@ -33,10 +33,10 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import org.apache.commons.io.IOUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.readNBText import java.io.File @@ -76,7 +76,7 @@ class JacksonUtils { try { normalizedFile(fileName).readNBText() } catch (e: Exception) { - throw BluePrintException("couldn't get file ($fileName) content : ${e.message}") + throw BlueprintException("couldn't get file ($fileName) content : ${e.message}") } } @@ -191,13 +191,13 @@ class JacksonUtils { fun <T> getInstanceFromMap(properties: MutableMap<String, JsonNode>, classType: Class<T>): T { return readValue(getJson(properties), classType) - ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)") + ?: throw BlueprintProcessorException("failed to transform content ($properties) to type ($classType)") } fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean { - if (BluePrintTypes.validPrimitiveTypes().contains(type.toLowerCase())) { + if (BlueprintTypes.validPrimitiveTypes().contains(type.toLowerCase())) { return checkJsonNodeValueOfPrimitiveType(type, jsonNode) - } else if (BluePrintTypes.validCollectionTypes().contains(type)) { + } else if (BlueprintTypes.validCollectionTypes().contains(type)) { return checkJsonNodeValueOfCollectionType(type, jsonNode) } return false @@ -205,31 +205,31 @@ class JacksonUtils { fun checkIfPrimitiveType(primitiveType: String): Boolean { return when (primitiveType.toLowerCase()) { - BluePrintConstants.DATA_TYPE_STRING -> true - BluePrintConstants.DATA_TYPE_BOOLEAN -> true - BluePrintConstants.DATA_TYPE_INTEGER -> true - BluePrintConstants.DATA_TYPE_FLOAT -> true - BluePrintConstants.DATA_TYPE_DOUBLE -> true - BluePrintConstants.DATA_TYPE_TIMESTAMP -> true + BlueprintConstants.DATA_TYPE_STRING -> true + BlueprintConstants.DATA_TYPE_BOOLEAN -> true + BlueprintConstants.DATA_TYPE_INTEGER -> true + BlueprintConstants.DATA_TYPE_FLOAT -> true + BlueprintConstants.DATA_TYPE_DOUBLE -> true + BlueprintConstants.DATA_TYPE_TIMESTAMP -> true else -> false } } fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean { return when (primitiveType.toLowerCase()) { - BluePrintConstants.DATA_TYPE_STRING -> jsonNode.isTextual - BluePrintConstants.DATA_TYPE_BOOLEAN -> jsonNode.isBoolean - BluePrintConstants.DATA_TYPE_INTEGER -> jsonNode.isInt - BluePrintConstants.DATA_TYPE_FLOAT -> jsonNode.isDouble - BluePrintConstants.DATA_TYPE_DOUBLE -> jsonNode.isDouble - BluePrintConstants.DATA_TYPE_TIMESTAMP -> jsonNode.isTextual + BlueprintConstants.DATA_TYPE_STRING -> jsonNode.isTextual + BlueprintConstants.DATA_TYPE_BOOLEAN -> jsonNode.isBoolean + BlueprintConstants.DATA_TYPE_INTEGER -> jsonNode.isInt + BlueprintConstants.DATA_TYPE_FLOAT -> jsonNode.isDouble + BlueprintConstants.DATA_TYPE_DOUBLE -> jsonNode.isDouble + BlueprintConstants.DATA_TYPE_TIMESTAMP -> jsonNode.isTextual else -> false } } fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean { return when (type.toLowerCase()) { - BluePrintConstants.DATA_TYPE_LIST -> jsonNode.isArray + BlueprintConstants.DATA_TYPE_LIST -> jsonNode.isArray else -> false } } @@ -247,62 +247,62 @@ class JacksonUtils { fun getValue(value: Any, type: String): Any { return when (type.toLowerCase()) { - BluePrintConstants.DATA_TYPE_BOOLEAN -> (value as BooleanNode).booleanValue() - BluePrintConstants.DATA_TYPE_INTEGER -> (value as IntNode).intValue() - BluePrintConstants.DATA_TYPE_FLOAT -> (value as FloatNode).floatValue() - BluePrintConstants.DATA_TYPE_DOUBLE -> (value as DoubleNode).doubleValue() - BluePrintConstants.DATA_TYPE_STRING -> (value as TextNode).textValue() + BlueprintConstants.DATA_TYPE_BOOLEAN -> (value as BooleanNode).booleanValue() + BlueprintConstants.DATA_TYPE_INTEGER -> (value as IntNode).intValue() + BlueprintConstants.DATA_TYPE_FLOAT -> (value as FloatNode).floatValue() + BlueprintConstants.DATA_TYPE_DOUBLE -> (value as DoubleNode).doubleValue() + BlueprintConstants.DATA_TYPE_STRING -> (value as TextNode).textValue() else -> (value as JsonNode) } } fun populatePrimitiveValues(key: String, value: JsonNode, primitiveType: String, objectNode: ObjectNode) { when (primitiveType.toLowerCase()) { - BluePrintConstants.DATA_TYPE_BOOLEAN, - BluePrintConstants.DATA_TYPE_INTEGER, - BluePrintConstants.DATA_TYPE_FLOAT, - BluePrintConstants.DATA_TYPE_DOUBLE, - BluePrintConstants.DATA_TYPE_TIMESTAMP, - BluePrintConstants.DATA_TYPE_STRING, - BluePrintConstants.DATA_TYPE_NULL -> + BlueprintConstants.DATA_TYPE_BOOLEAN, + BlueprintConstants.DATA_TYPE_INTEGER, + BlueprintConstants.DATA_TYPE_FLOAT, + BlueprintConstants.DATA_TYPE_DOUBLE, + BlueprintConstants.DATA_TYPE_TIMESTAMP, + BlueprintConstants.DATA_TYPE_STRING, + BlueprintConstants.DATA_TYPE_NULL -> objectNode.set(key, value) - else -> throw BluePrintException("populatePrimitiveValues expected only primitive values! Received: ($value)") + else -> throw BlueprintException("populatePrimitiveValues expected only primitive values! Received: ($value)") } } fun populatePrimitiveValues(value: JsonNode, primitiveType: String, arrayNode: ArrayNode) { when (primitiveType.toLowerCase()) { - BluePrintConstants.DATA_TYPE_BOOLEAN, - BluePrintConstants.DATA_TYPE_INTEGER, - BluePrintConstants.DATA_TYPE_FLOAT, - BluePrintConstants.DATA_TYPE_DOUBLE, - BluePrintConstants.DATA_TYPE_TIMESTAMP, - BluePrintConstants.DATA_TYPE_STRING, - BluePrintConstants.DATA_TYPE_NULL -> + BlueprintConstants.DATA_TYPE_BOOLEAN, + BlueprintConstants.DATA_TYPE_INTEGER, + BlueprintConstants.DATA_TYPE_FLOAT, + BlueprintConstants.DATA_TYPE_DOUBLE, + BlueprintConstants.DATA_TYPE_TIMESTAMP, + BlueprintConstants.DATA_TYPE_STRING, + BlueprintConstants.DATA_TYPE_NULL -> arrayNode.add(value) - else -> throw BluePrintException("populatePrimitiveValues expected only primitive values! Received: ($value)") + else -> throw BlueprintException("populatePrimitiveValues expected only primitive values! Received: ($value)") } } fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) { val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType) - ?: throw BluePrintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)") + ?: throw BlueprintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)") objectNode.set<JsonNode>(key, defaultValue) } fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) { val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType) - ?: throw BluePrintException("populatePrimitiveDefaultValuesForArrayNode expected only primitive values! Received type ($primitiveType)") + ?: throw BlueprintException("populatePrimitiveDefaultValuesForArrayNode expected only primitive values! Received type ($primitiveType)") arrayNode.add(defaultValue) } private fun getDefaultValueOfPrimitiveAsJsonNode(primitiveType: String): JsonNode? { return when (primitiveType.toLowerCase()) { - BluePrintConstants.DATA_TYPE_BOOLEAN -> BooleanNode.valueOf(false) - BluePrintConstants.DATA_TYPE_INTEGER -> IntNode.valueOf(0) - BluePrintConstants.DATA_TYPE_FLOAT -> FloatNode.valueOf(0.0f) - BluePrintConstants.DATA_TYPE_DOUBLE -> DoubleNode.valueOf(0.0) - BluePrintConstants.DATA_TYPE_STRING -> MissingNode.getInstance() + BlueprintConstants.DATA_TYPE_BOOLEAN -> BooleanNode.valueOf(false) + BlueprintConstants.DATA_TYPE_INTEGER -> IntNode.valueOf(0) + BlueprintConstants.DATA_TYPE_FLOAT -> FloatNode.valueOf(0.0f) + BlueprintConstants.DATA_TYPE_DOUBLE -> DoubleNode.valueOf(0.0) + BlueprintConstants.DATA_TYPE_STRING -> MissingNode.getInstance() else -> null } } @@ -310,7 +310,7 @@ class JacksonUtils { fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) { if (nodeValue == null || nodeValue is NullNode) { objectNode.set<JsonNode>(key, nodeValue) - } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) { + } else if (BlueprintTypes.validPrimitiveTypes().contains(type)) { populatePrimitiveValues(key, nodeValue, type, objectNode) } else { objectNode.set<JsonNode>(key, nodeValue) @@ -319,11 +319,11 @@ class JacksonUtils { fun convertPrimitiveResourceValue(type: String, value: String): JsonNode { return when (type.toLowerCase()) { - BluePrintConstants.DATA_TYPE_BOOLEAN -> jsonNodeFromObject(value.toBoolean()) - BluePrintConstants.DATA_TYPE_INTEGER -> jsonNodeFromObject(value.toInt()) - BluePrintConstants.DATA_TYPE_FLOAT -> jsonNodeFromObject(value.toFloat()) - BluePrintConstants.DATA_TYPE_DOUBLE -> jsonNodeFromObject(value.toDouble()) - BluePrintConstants.DATA_TYPE_STRING -> jsonNodeFromObject(value) + BlueprintConstants.DATA_TYPE_BOOLEAN -> jsonNodeFromObject(value.toBoolean()) + BlueprintConstants.DATA_TYPE_INTEGER -> jsonNodeFromObject(value.toInt()) + BlueprintConstants.DATA_TYPE_FLOAT -> jsonNodeFromObject(value.toFloat()) + BlueprintConstants.DATA_TYPE_DOUBLE -> jsonNodeFromObject(value.toDouble()) + BlueprintConstants.DATA_TYPE_STRING -> jsonNodeFromObject(value) else -> getJsonNode(value) } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt index 48319325c..1a082d353 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.LOG_PROTECT +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants.LOG_PROTECT import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition class PropertyDefinitionUtils { diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt index c0204af8d..1b8af5897 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty import org.slf4j.LoggerFactory import java.io.File @@ -56,7 +56,7 @@ object ResourceResolverUtils { // FIXME("Convert into reactive") return JacksonUtils.getContent(resolvedFileName) } catch (e: Exception) { - throw BluePrintException(e, "failed to file (%s), basePath (%s) ", filename, basePath) + throw BlueprintException(e, "failed to file (%s), basePath (%s) ", filename, basePath) } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt index fea637f61..6ebe7c11a 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow @@ -36,10 +36,10 @@ object WorkflowGraphUtils { } } graph.startNodes().forEach { rootNode -> - graph.addEdge(BluePrintConstants.GRAPH_START_NODE_NAME, rootNode.id, EdgeLabel.SUCCESS) + graph.addEdge(BlueprintConstants.GRAPH_START_NODE_NAME, rootNode.id, EdgeLabel.SUCCESS) } graph.endNodes().forEach { endNode -> - graph.addEdge(endNode.id, BluePrintConstants.GRAPH_END_NODE_NAME, EdgeLabel.SUCCESS) + graph.addEdge(endNode.id, BlueprintConstants.GRAPH_END_NODE_NAME, EdgeLabel.SUCCESS) } return graph } |