diff options
author | Dan Timoney <dtimoney@att.com> | 2018-11-19 22:40:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-11-19 22:40:22 +0000 |
commit | ef4d3fedf15dc1d37245989e6f4ef36cf3d39491 (patch) | |
tree | bcc25049c8d319acf1f213ce1429f1d1e4ecdfca /components | |
parent | 511bc18a6f85bb3018406a4302c05c2a8a1493d7 (diff) | |
parent | 13f780024e7ca0943f5409691fafbd503c26d837 (diff) |
Merge "Blueprints Processor Microservice"
Diffstat (limited to 'components')
-rw-r--r-- | components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt | 43 |
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 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<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 |