Blueprints Processor Service 51/63151/1
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Mon, 27 Aug 2018 22:51:18 +0000 (22:51 +0000)
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Mon, 27 Aug 2018 22:51:18 +0000 (22:51 +0000)
Add component factory for resource resolution component and resource resolution processor factory framework for input and default sources.

Change-Id: Id2eb81454439857a1c252012d883661cb9b3d069
Issue-ID: CCSDK-411
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt [new file with mode: 0644]

diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
new file mode 100644 (file)
index 0000000..f42613c
--- /dev/null
@@ -0,0 +1,61 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.blueprintsprocessor.core.factory\r
+\r
+import com.att.eelf.configuration.EELFManager\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
+import org.slf4j.Logger\r
+import org.slf4j.LoggerFactory\r
+import org.springframework.context.ApplicationContext\r
+import org.springframework.context.ApplicationContextAware\r
+import org.springframework.stereotype.Service\r
+\r
+interface ComponentNode {\r
+\r
+    @Throws(BluePrintProcessorException::class)\r
+    fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)\r
+\r
+    @Throws(BluePrintProcessorException::class)\r
+    fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)\r
+\r
+    @Throws(BluePrintProcessorException::class)\r
+    fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)\r
+\r
+    @Throws(BluePrintProcessorException::class)\r
+    fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)\r
+}\r
+\r
+@Service\r
+class ComponentNodeFactory : ApplicationContextAware {\r
+    private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java)\r
+\r
+    var componentNodes: MutableMap<String, ComponentNode> = hashMapOf()\r
+\r
+    fun getInstance(instanceName: String): ComponentNode? {\r
+        log.trace("looking for Component Nodes : {}", instanceName)\r
+        return componentNodes.get(instanceName)\r
+    }\r
+\r
+    fun injectInstance(instanceName: String, componentNode: ComponentNode) {\r
+        this.componentNodes[instanceName] = componentNode\r
+    }\r
+\r
+    override fun setApplicationContext(context: ApplicationContext) {\r
+        componentNodes = context.getBeansOfType(ComponentNode::class.java)\r
+        log.info("Injected Component Nodes : {}", componentNodes)\r
+    }\r
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt
new file mode 100644 (file)
index 0000000..8104c10
--- /dev/null
@@ -0,0 +1,47 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.blueprintsprocessor.core.factory\r
+\r
+import com.att.eelf.configuration.EELFManager\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
+import org.slf4j.Logger\r
+import org.slf4j.LoggerFactory\r
+import org.springframework.context.ApplicationContext\r
+import org.springframework.context.ApplicationContextAware\r
+import org.springframework.stereotype.Service\r
+\r
+@Service\r
+class ResourceAssignmentProcessorFactory : ApplicationContextAware {\r
+\r
+    private val log = EELFManager.getInstance().getLogger(ResourceAssignmentProcessorFactory::class.java)\r
+\r
+    var resourceAssignmentProcessors: MutableMap<String, ResourceAssignmentProcessor> = hashMapOf()\r
+\r
+    fun getInstance(instanceName: String): ResourceAssignmentProcessor? {\r
+        log.trace("looking for Resource Assignment Processor : {}", instanceName)\r
+        return resourceAssignmentProcessors.get(instanceName)\r
+    }\r
+\r
+    fun injectInstance(instanceName: String, resourceAssignmentProcessor: ResourceAssignmentProcessor) {\r
+        this.resourceAssignmentProcessors[instanceName] = resourceAssignmentProcessor\r
+    }\r
+\r
+    override fun setApplicationContext(context: ApplicationContext) {\r
+        resourceAssignmentProcessors = context.getBeansOfType(ResourceAssignmentProcessor::class.java)\r
+        log.info("Injected Resource Assignment Processor : {}", resourceAssignmentProcessors)\r
+    }\r
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionComponent.kt
new file mode 100644 (file)
index 0000000..ff1a01d
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution\r
+\r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ComponentNode\r
+import org.springframework.stereotype.Component\r
+\r
+@Component("component-resource-resolution")\r
+open class ResourceResolutionComponent : ComponentNode {\r
+    override fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt
new file mode 100644 (file)
index 0000000..396ca1d
--- /dev/null
@@ -0,0 +1,40 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
+import org.springframework.stereotype.Service\r
+\r
+@Service("resource-assignment-processor-default")\r
+open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor {\r
+    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt
new file mode 100644 (file)
index 0000000..9d0734e
--- /dev/null
@@ -0,0 +1,40 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
+import org.springframework.stereotype.Service\r
+\r
+@Service("resource-assignment-processor-input")\r
+open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor {\r
+    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+}
\ No newline at end of file