summaryrefslogtreecommitdiffstats
path: root/components/resource-dict/src/main/kotlin
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-15 13:12:09 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-15 13:12:09 -0500
commit52797e239404c427012a53c1c57e6f7914a88e92 (patch)
tree8016d7041ea1fe96d80b053f4b035e2a72f98387 /components/resource-dict/src/main/kotlin
parent758fde46420ecf8dd1e8641322deff4ba85c9e6b (diff)
Blueprints Processor Microservice
Implement Resource Resolution Processor Interface definitions. Change-Id: Ic2eb7915d48b9473639494ee9d159003bf56e81e Issue-ID: CCSDK-724 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/resource-dict/src/main/kotlin')
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt43
1 files changed, 33 insertions, 10 deletions
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 a6802f677..327d50ac4 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<ResourceAssignment, ResourceAssignment> {
- @Throws(BluePrintProcessorException::class)
- fun validate(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+ private val log = LoggerFactory.getLogger(ResourceAssignmentProcessor::class.java)
- @Throws(BluePrintProcessorException::class)
- fun process(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+ private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null
- @Throws(BluePrintProcessorException::class)
- fun errorHandle(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+ open fun setBlueprintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) {
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ }
- @Throws(BluePrintProcessorException::class)
- fun reTrigger(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+ 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