From adcd4f2bc695840e9ecbc05003bc52c675f22fec Mon Sep 17 00:00:00 2001 From: KAPIL SINGAL Date: Fri, 22 Jan 2021 11:49:51 -0500 Subject: Renaming Files having BluePrint to have Blueprint Replacing BluePrint with Blueprint throughout Issue-ID: CCSDK-3098 Signed-off-by: KAPIL SINGAL Change-Id: Ibee8bad07ae7d9287073db2d4f2f2cd730fa8b96 --- .../BluePrintWorkflowExecutionServiceImpl.kt | 111 --------------------- .../services/workflow/BlueprintSvcLogicContext.kt | 8 +- .../services/workflow/BlueprintSvcLogicService.kt | 8 +- .../BlueprintWorkflowExecutionServiceImpl.kt | 111 +++++++++++++++++++++ .../workflow/ComponentWorkflowExecutionService.kt | 10 +- .../workflow/DGWorkflowExecutionService.kt | 10 +- .../workflow/ImperativeWorkflowExecutionService.kt | 38 +++---- .../workflow/NodeTemplateExecutionService.kt | 20 ++-- .../executor/ComponentExecuteNodeExecutor.kt | 2 +- 9 files changed, 159 insertions(+), 159 deletions(-) delete mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt create mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt (limited to 'ms/blueprintsprocessor/modules/services/workflow-service/src/main') diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt deleted file mode 100644 index c35e86cc6..000000000 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright © 2019 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.blueprintsprocessor.services.workflow - -import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.slf4j.LoggerFactory -import org.springframework.stereotype.Service - -@Service("bluePrintWorkflowExecutionService") -open class BluePrintWorkflowExecutionServiceImpl( - private val componentWorkflowExecutionService: ComponentWorkflowExecutionService, - private val dgWorkflowExecutionService: DGWorkflowExecutionService, - private val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService -) : BluePrintWorkflowExecutionService { - - private val log = LoggerFactory.getLogger(BluePrintWorkflowExecutionServiceImpl::class.java)!! - - override suspend fun executeBluePrintWorkflow( - bluePrintRuntimeService: BluePrintRuntimeService<*>, - executionServiceInput: ExecutionServiceInput, - properties: MutableMap - ): ExecutionServiceOutput { - - val bluePrintContext = bluePrintRuntimeService.bluePrintContext() - - val workflowName = executionServiceInput.actionIdentifiers.actionName - - // Assign Workflow inputs - // check if request structure exists - if (!executionServiceInput.payload.has("$workflowName-request")) { - throw BluePrintProcessorException("Input request missing the expected '$workflowName-request' block!") - } - val input = executionServiceInput.payload.get("$workflowName-request") - bluePrintRuntimeService.assignWorkflowInputs(workflowName, input) - - val workflow = bluePrintContext.workflowByName(workflowName) - - val steps = workflow.steps ?: throw BluePrintProcessorException("could't get steps for workflow($workflowName)") - - /** If workflow has multiple steps, then it is imperative workflow */ - val executionServiceOutput: ExecutionServiceOutput = if (steps.size > 1) { - imperativeWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties) - } else { - // Get the DG Node Template - val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName) - - val derivedFrom = bluePrintContext.nodeTemplateNodeType(nodeTemplateName).derivedFrom - - log.info("Executing workflow($workflowName) NodeTemplate($nodeTemplateName), derived from($derivedFrom)") - /** Return ExecutionServiceOutput based on DG node or Component Node */ - when { - derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> { - componentWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties) - } - derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW, true) -> { - dgWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties) - } - else -> { - throw BluePrintProcessorException( - "couldn't execute workflow($workflowName) step mapped " + - "to node template($nodeTemplateName) derived from($derivedFrom)" - ) - } - } - } - executionServiceOutput.commonHeader = executionServiceInput.commonHeader - executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers - - // Resolve Workflow Outputs - var workflowOutputs: MutableMap? = null - try { - workflowOutputs = bluePrintRuntimeService.resolveWorkflowOutputs(workflowName) - } catch (e: RuntimeException) { - log.error("Failed to resolve outputs for workflow: $workflowName", e) - e.message?.let { bluePrintRuntimeService.getBluePrintError().errors.add(it) } - } - - // Set the Response Payload - executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode() - executionServiceOutput.payload.set( - "$workflowName-response", - workflowOutputs?.asObjectNode() ?: JacksonUtils.objectMapper.createObjectNode() - ) - return executionServiceOutput - } -} diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt index 044e8cf53..64bb70e63 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt @@ -16,20 +16,20 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService import org.onap.ccsdk.sli.core.sli.SvcLogicContext class BlueprintSvcLogicContext : SvcLogicContext() { - private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null + private var bluePrintRuntimeService: BlueprintRuntimeService<*>? = null private var request: Any? = null private var response: Any? = null - fun getBluePrintService(): BluePrintRuntimeService<*> { + fun getBlueprintService(): BlueprintRuntimeService<*> { return this.bluePrintRuntimeService!! } - fun setBluePrintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) { + fun setBlueprintRuntimeService(bluePrintRuntimeService: BlueprintRuntimeService<*>) { this.bluePrintRuntimeService = bluePrintRuntimeService } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt index 4efe9f12d..ebad1501b 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt @@ -17,7 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService import org.onap.ccsdk.sli.core.sli.ExitNodeException import org.onap.ccsdk.sli.core.sli.SvcLogicContext import org.onap.ccsdk.sli.core.sli.SvcLogicException @@ -47,7 +47,7 @@ interface BlueprintSvcLogicService : SvcLogicServiceBase { fun unRegisterExecutors(name: String) - suspend fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BluePrintRuntimeService<*>, input: Any): Any + suspend fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BlueprintRuntimeService<*>, input: Any): Any override fun execute(module: String, rpc: String, version: String, mode: String, ctx: SvcLogicContext): SvcLogicContext { TODO("not implemented") @@ -104,12 +104,12 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService { override suspend fun execute( graph: SvcLogicGraph, - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, input: Any ): Any { // Initialise BlueprintSvcLogic Context with Blueprint Runtime Service and Input Request val blueprintSvcLogicContext = BlueprintSvcLogicContext() - blueprintSvcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService) + blueprintSvcLogicContext.setBlueprintRuntimeService(bluePrintRuntimeService) blueprintSvcLogicContext.setRequest(input) // Execute the Graph execute(graph, blueprintSvcLogicContext) diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt new file mode 100644 index 000000000..d690235e9 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt @@ -0,0 +1,111 @@ +/* + * Copyright © 2019 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.blueprintsprocessor.services.workflow + +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.slf4j.LoggerFactory +import org.springframework.stereotype.Service + +@Service("bluePrintWorkflowExecutionService") +open class BlueprintWorkflowExecutionServiceImpl( + private val componentWorkflowExecutionService: ComponentWorkflowExecutionService, + private val dgWorkflowExecutionService: DGWorkflowExecutionService, + private val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService +) : BlueprintWorkflowExecutionService { + + private val log = LoggerFactory.getLogger(BlueprintWorkflowExecutionServiceImpl::class.java)!! + + override suspend fun executeBlueprintWorkflow( + bluePrintRuntimeService: BlueprintRuntimeService<*>, + executionServiceInput: ExecutionServiceInput, + properties: MutableMap + ): ExecutionServiceOutput { + + val bluePrintContext = bluePrintRuntimeService.bluePrintContext() + + val workflowName = executionServiceInput.actionIdentifiers.actionName + + // Assign Workflow inputs + // check if request structure exists + if (!executionServiceInput.payload.has("$workflowName-request")) { + throw BlueprintProcessorException("Input request missing the expected '$workflowName-request' block!") + } + val input = executionServiceInput.payload.get("$workflowName-request") + bluePrintRuntimeService.assignWorkflowInputs(workflowName, input) + + val workflow = bluePrintContext.workflowByName(workflowName) + + val steps = workflow.steps ?: throw BlueprintProcessorException("could't get steps for workflow($workflowName)") + + /** If workflow has multiple steps, then it is imperative workflow */ + val executionServiceOutput: ExecutionServiceOutput = if (steps.size > 1) { + imperativeWorkflowExecutionService + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, properties) + } else { + // Get the DG Node Template + val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName) + + val derivedFrom = bluePrintContext.nodeTemplateNodeType(nodeTemplateName).derivedFrom + + log.info("Executing workflow($workflowName) NodeTemplate($nodeTemplateName), derived from($derivedFrom)") + /** Return ExecutionServiceOutput based on DG node or Component Node */ + when { + derivedFrom.startsWith(BlueprintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> { + componentWorkflowExecutionService + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, properties) + } + derivedFrom.startsWith(BlueprintConstants.MODEL_TYPE_NODE_WORKFLOW, true) -> { + dgWorkflowExecutionService + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, properties) + } + else -> { + throw BlueprintProcessorException( + "couldn't execute workflow($workflowName) step mapped " + + "to node template($nodeTemplateName) derived from($derivedFrom)" + ) + } + } + } + executionServiceOutput.commonHeader = executionServiceInput.commonHeader + executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers + + // Resolve Workflow Outputs + var workflowOutputs: MutableMap? = null + try { + workflowOutputs = bluePrintRuntimeService.resolveWorkflowOutputs(workflowName) + } catch (e: RuntimeException) { + log.error("Failed to resolve outputs for workflow: $workflowName", e) + e.message?.let { bluePrintRuntimeService.getBlueprintError().errors.add(it) } + } + + // Set the Response Payload + executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode() + executionServiceOutput.payload.set( + "$workflowName-response", + workflowOutputs?.asObjectNode() ?: JacksonUtils.objectMapper.createObjectNode() + ) + return executionServiceOutput + } +} diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt index 70910e15c..330d297c2 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt @@ -18,16 +18,16 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService import org.springframework.stereotype.Service @Service("componentWorkflowExecutionService") open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionService: NodeTemplateExecutionService) : - BluePrintWorkflowExecutionService { + BlueprintWorkflowExecutionService { - override suspend fun executeBluePrintWorkflow( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + override suspend fun executeBlueprintWorkflow( + bluePrintRuntimeService: BlueprintRuntimeService<*>, executionServiceInput: ExecutionServiceInput, properties: MutableMap ): ExecutionServiceOutput { diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt index b1847df43..c8d72a1a4 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt @@ -20,20 +20,20 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.utils.SvcGraphUtils -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @Service("dgWorkflowExecutionService") open class DGWorkflowExecutionService(private val blueprintSvcLogicService: BlueprintSvcLogicService) : - BluePrintWorkflowExecutionService { + BlueprintWorkflowExecutionService { private val log = LoggerFactory.getLogger(DGWorkflowExecutionService::class.java) - override suspend fun executeBluePrintWorkflow( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + override suspend fun executeBlueprintWorkflow( + bluePrintRuntimeService: BlueprintRuntimeService<*>, executionServiceInput: ExecutionServiceInput, properties: MutableMap ): ExecutionServiceOutput { diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt index 464ae8ddc..2278dbfb4 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt @@ -22,17 +22,17 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType -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.MDCContext import org.onap.ccsdk.cds.controllerblueprints.core.asGraph import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty 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.interfaces.BluePrintWorkflowExecutionService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.service.AbstractBluePrintWorkFlowService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.AbstractBlueprintWorkFlowService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.service.NodeExecuteMessage import org.onap.ccsdk.cds.controllerblueprints.core.service.NodeSkipMessage import org.onap.ccsdk.cds.controllerblueprints.core.service.WorkflowExecuteMessage @@ -43,10 +43,10 @@ import kotlin.coroutines.CoroutineContext class ImperativeWorkflowExecutionService( private val nodeTemplateExecutionService: NodeTemplateExecutionService ) : - BluePrintWorkflowExecutionService { + BlueprintWorkflowExecutionService { - override suspend fun executeBluePrintWorkflow( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + override suspend fun executeBlueprintWorkflow( + bluePrintRuntimeService: BlueprintRuntimeService<*>, executionServiceInput: ExecutionServiceInput, properties: MutableMap ): ExecutionServiceOutput { @@ -58,7 +58,7 @@ class ImperativeWorkflowExecutionService( val graph = bluePrintContext.workflowByName(workflowName).asGraph() return coroutineScope { - ImperativeBluePrintWorkflowService( + ImperativeBlueprintWorkflowService( nodeTemplateExecutionService, this.coroutineContext[MDCContext] ) @@ -66,21 +66,21 @@ class ImperativeWorkflowExecutionService( } } -open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionService: NodeTemplateExecutionService, private val mdcContext: CoroutineContext?) : - AbstractBluePrintWorkFlowService() { +open class ImperativeBlueprintWorkflowService(private val nodeTemplateExecutionService: NodeTemplateExecutionService, private val mdcContext: CoroutineContext?) : + AbstractBlueprintWorkFlowService() { final override val coroutineContext: CoroutineContext get() = mdcContext?.let { super.coroutineContext + it } ?: super.coroutineContext - val log = logger(ImperativeBluePrintWorkflowService::class) + val log = logger(ImperativeBlueprintWorkflowService::class) - lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var bluePrintRuntimeService: BlueprintRuntimeService<*> lateinit var executionServiceInput: ExecutionServiceInput lateinit var workflowName: String override suspend fun executeWorkflow( graph: Graph, - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, input: ExecutionServiceInput ): ExecutionServiceOutput { this.graph = graph @@ -94,7 +94,7 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS if (!workflowActor.isClosedForSend) { workflowActor.send(startMessage) } else { - throw BluePrintProcessorException("workflow($workflowActor) actor is closed") + throw BlueprintProcessorException("workflow($workflowActor) actor is closed") } return output.await() } @@ -108,12 +108,12 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS if (exceptions.isNotEmpty()) { exceptions.forEach { val errorMessage = it.message ?: "" - bluePrintRuntimeService.getBluePrintError().addError(errorMessage) + bluePrintRuntimeService.getBlueprintError().addError(errorMessage) log.error("workflow($workflowId) exception :", it) } - message = BluePrintConstants.STATUS_FAILURE + message = BlueprintConstants.STATUS_FAILURE } else { - message = BluePrintConstants.STATUS_SUCCESS + message = BlueprintConstants.STATUS_SUCCESS } eventType = EventType.EVENT_COMPONENT_EXECUTED.name } @@ -157,7 +157,7 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS .executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeInput) return when (executionServiceOutput.status.message) { - BluePrintConstants.STATUS_FAILURE -> EdgeLabel.FAILURE + BlueprintConstants.STATUS_FAILURE -> EdgeLabel.FAILURE else -> EdgeLabel.SUCCESS } } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt index c703deb37..1d179a1b7 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt @@ -20,23 +20,23 @@ import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData -import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterService +import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction -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.data.Implementation -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @Service -open class NodeTemplateExecutionService(private val bluePrintClusterService: BluePrintClusterService) { +open class NodeTemplateExecutionService(private val bluePrintClusterService: BlueprintClusterService) { private val log = LoggerFactory.getLogger(NodeTemplateExecutionService::class.java)!! suspend fun executeNodeTemplate( - bluePrintRuntimeService: BluePrintRuntimeService<*>, + bluePrintRuntimeService: BlueprintRuntimeService<*>, nodeTemplateName: String, executionServiceInput: ExecutionServiceInput ): ExecutionServiceOutput { @@ -62,7 +62,7 @@ open class NodeTemplateExecutionService(private val bluePrintClusterService: Blu ) // Get the Component Instance - val plugin = BluePrintDependencyService.instance(componentName) + val plugin = BlueprintDependencyService.instance(componentName) // Set the Blueprint Services plugin.bluePrintRuntimeService = bluePrintRuntimeService plugin.bluePrintClusterService = bluePrintClusterService @@ -77,9 +77,9 @@ open class NodeTemplateExecutionService(private val bluePrintClusterService: Blu // Populate Step Meta Data val stepInputs: MutableMap = hashMapOf() - stepInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = nodeTemplateName.asJsonPrimitive() - stepInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = interfaceName.asJsonPrimitive() - stepInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = operationName.asJsonPrimitive() + stepInputs[BlueprintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = nodeTemplateName.asJsonPrimitive() + stepInputs[BlueprintConstants.PROPERTY_CURRENT_INTERFACE] = interfaceName.asJsonPrimitive() + stepInputs[BlueprintConstants.PROPERTY_CURRENT_OPERATION] = operationName.asJsonPrimitive() val stepInputData = StepData().apply { name = nodeTemplateName properties = stepInputs diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt index 2ff06061a..cf5955e33 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt @@ -50,7 +50,7 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService try { // Get the Request from the Context and Set to the Function Input and Invoke the function val executionOutput = nodeTemplateExecutionService.executeNodeTemplate( - ctx.getBluePrintService(), + ctx.getBlueprintService(), nodeTemplateName, executionInput ) -- cgit 1.2.3-korg