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}")
}
}