diff options
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
3 files changed, 39 insertions, 10 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt index 2647083f..aab4e7c7 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt @@ -118,16 +118,13 @@ or Node Template and used by orchestration engine to facilitate deployment and i class ArtifactDefinition { @get:JsonIgnore var id: String? = null - var type: String? = null - var file: String? = null + lateinit var type: String + lateinit var file: String var repository: String? = null var description: String? = null @get:JsonProperty("deploy_Path") var deployPath: String? = null var properties: MutableMap<String, JsonNode>? = null - var content: String? = null - @Deprecated("Mapping content is define by the Type") - var mappingContent: String? = null } diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt index bea790fd..a485c677 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt @@ -1,3 +1,20 @@ +/* + * 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.apps.controllerblueprints.core.interfaces import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException @@ -18,6 +35,8 @@ interface BluePrintTopologyTemplateValidator : BluePrintValidator<TopologyTempla interface BluePrintArtifactTypeValidator : BluePrintValidator<ArtifactType> +interface BluePrintArtifactDefinitionValidator : BluePrintValidator<ArtifactDefinition> + interface BluePrintDataTypeValidator : BluePrintValidator<DataType> interface BluePrintNodeTypeValidator : BluePrintValidator<NodeType> @@ -45,12 +64,20 @@ interface BluePrintValidatorService { interface BluePrintTypeValidatorService { + 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(classType: Class<T>): List<T>? + fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> fun getDataTypeValidators(): List<BluePrintDataTypeValidator> fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> + fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> + fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> @@ -73,6 +100,12 @@ interface BluePrintTypeValidatorService { doValidation(bluePrintRuntimeService, name, artifactType, validators) } + fun validateArtifactDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, + artifactDefinition: ArtifactDefinition) { + val validators = getArtifactDefinitionsValidators() + doValidation(bluePrintRuntimeService, name, artifactDefinition, validators) + } + fun validateDataType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) { val validators = getDataTypeValidators() doValidation(bluePrintRuntimeService, name, dataType, validators) diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index 76f3f329..1bc25005 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.controllerblueprints.core.utils import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.node.ArrayNode @@ -148,22 +147,22 @@ class JacksonUtils { return objectMapper.valueToTree(any) } - fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? { + fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T> { return getListFromJson(node.toString(), valueType) } - fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? { + fun <T> getListFromJson(content: String, valueType: Class<T>): List<T> { val objectMapper = jacksonObjectMapper() val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType) return objectMapper.readValue<List<T>>(content, javaType) } - fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T>? { + fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T> { val content: String = getContent(fileName) return getListFromJson(content, valueType) } - fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T>? { + fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T> { val content: String = getClassPathFileContent(fileName) return getListFromJson(content, valueType) } |