From 13f780024e7ca0943f5409691fafbd503c26d837 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 15 Nov 2018 13:12:09 -0500 Subject: Blueprints Processor Microservice Implement Resource Resolution Processor Interface definitions. Change-Id: Ic2eb7915d48b9473639494ee9d159003bf56e81e Issue-ID: CCSDK-724 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../resource/dict/ResourceAssignmentProcessor.kt | 43 +++++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'components') diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt index a6802f67..327d50ac 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt @@ -1,5 +1,6 @@ /* * Copyright © 2018 IBM. + * Modifications Copyright © 2017-2018 AT&T Intellectual Property. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,19 +17,41 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService +import org.slf4j.LoggerFactory -interface ResourceAssignmentProcessor { +abstract class ResourceAssignmentProcessor : BlueprintFunctionNode { - @Throws(BluePrintProcessorException::class) - fun validate(resourceAssignment: ResourceAssignment, context : MutableMap) + private val log = LoggerFactory.getLogger(ResourceAssignmentProcessor::class.java) - @Throws(BluePrintProcessorException::class) - fun process(resourceAssignment: ResourceAssignment, context : MutableMap) + private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null - @Throws(BluePrintProcessorException::class) - fun errorHandle(resourceAssignment: ResourceAssignment, context : MutableMap) + open fun setBlueprintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) { + this.bluePrintRuntimeService = bluePrintRuntimeService + } - @Throws(BluePrintProcessorException::class) - fun reTrigger(resourceAssignment: ResourceAssignment, context : MutableMap) + open fun getBlueprintRuntimeService(): BluePrintRuntimeService<*> { + return this.bluePrintRuntimeService!! + } + + override fun prepareRequest(resourceAssignment: ResourceAssignment): ResourceAssignment { + log.info("prepareRequest...") + return resourceAssignment + } + + override fun prepareResponse(): ResourceAssignment { + log.info("Preparing Response...") + return ResourceAssignment() + } + + override fun apply(executionServiceInput: ResourceAssignment): ResourceAssignment { + prepareRequest(executionServiceInput) + process(executionServiceInput) + return prepareResponse() + } + + override abstract fun process(executionRequest: ResourceAssignment) + + override abstract fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) } \ No newline at end of file -- cgit 1.2.3-korg