import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.cbaMetricTags
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractServiceFunction
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.config.BlueprintLoadConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintCatalogService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.util.stream.Collectors
@Service
class ExecutionServiceHandler(
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintsProcessorCatalogService: BluePrintCatalogService,
+ private val bluePrintLoadConfiguration: BlueprintLoadConfiguration,
+ private val blueprintsProcessorCatalogService: BlueprintCatalogService,
private val bluePrintWorkflowExecutionService:
- BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>,
+ BlueprintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>,
private val publishAuditService: PublishAuditService,
private val meterRegistry: MeterRegistry
) {
val basePath = blueprintsProcessorCatalogService.getFromDatabase(blueprintName, blueprintVersion)
log.info("blueprint base path $basePath")
- val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath.toString())
+ val blueprintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(requestId, basePath.toString())
- executionServiceOutput = bluePrintWorkflowExecutionService.executeBluePrintWorkflow(
+ executionServiceOutput = bluePrintWorkflowExecutionService.executeBlueprintWorkflow(
blueprintRuntimeService,
executionServiceInput, hashMapOf()
)
- val errors = blueprintRuntimeService.getBluePrintError().errors
+ val errors = blueprintRuntimeService.getBlueprintError().errors
if (errors.isNotEmpty()) {
val errorMessage = errors.stream().map { it.toString() }.collect(Collectors.joining(", "))
setErrorStatus(errorMessage, executionServiceOutput.status)
/** If no blueprint is needed, then get the Service function instance mapping to the action name and execute it */
suspend fun executeServiceFunction(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
val actionName = executionServiceInput.actionIdentifiers.actionName
- val instance = BluePrintDependencyService.instance<AbstractServiceFunction>(actionName)
+ val instance = BlueprintDependencyService.instance<AbstractServiceFunction>(actionName)
checkNotNull(instance) { "failed to initialize service function($actionName)" }
instance.actionName = actionName
return instance.applyNB(executionServiceInput)
status.errorMessage = errorMessage
status.eventType = EventType.EVENT_COMPONENT_FAILURE.name
status.code = 500
- status.message = BluePrintConstants.STATUS_FAILURE
+ status.message = BlueprintConstants.STATUS_FAILURE
}
private fun response(
} else {
status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name
status.code = 200
- status.message = BluePrintConstants.STATUS_PROCESSING
+ status.message = BlueprintConstants.STATUS_PROCESSING
}
executionServiceOutput.status = status