aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorBrinda Santh Muthuramalingam <brindasanth@in.ibm.com>2019-10-24 15:34:33 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-24 15:34:33 +0000
commit16fefe6f40fad8f9708b3db40a2c809568cd995c (patch)
tree152be1df6a9f7883004f380a6db32425377af5c7 /ms/blueprintsprocessor/modules
parent0bba65f6de4d234e725d51e2926c38f9ac255296 (diff)
parent3d962090dad9de06cf854fab8daceaf18e0ec469 (diff)
Merge "Implemented UAT runtime services"
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt42
1 files changed, 35 insertions, 7 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
index 9fa13bdaf..384946ae8 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
@@ -29,16 +29,32 @@ import org.springframework.stereotype.Service
open class BluePrintRestLibPropertyService(private var bluePrintProperties:
BluePrintProperties) {
- open fun blueprintWebClientService(jsonNode: JsonNode):
- BlueprintWebClientService {
- val restClientProperties = restClientProperties(jsonNode)
- return blueprintWebClientService(restClientProperties)
+ private var preInterceptor: PreInterceptor? = null
+ private var postInterceptor: PostInterceptor? = null
+
+ fun setInterceptors(preInterceptor: PreInterceptor?, postInterceptor: PostInterceptor?) {
+ this.preInterceptor = preInterceptor
+ this.postInterceptor = postInterceptor
+ }
+
+ fun clearInterceptors() {
+ this.preInterceptor = null
+ this.postInterceptor = null
+ }
+
+ open fun blueprintWebClientService(jsonNode: JsonNode): BlueprintWebClientService {
+ val service = preInterceptor?.getInstance(jsonNode)
+ ?: blueprintWebClientService(restClientProperties(jsonNode))
+ return postInterceptor?.getInstance(jsonNode, service) ?: service
}
open fun blueprintWebClientService(selector: String): BlueprintWebClientService {
- val prefix = "blueprintsprocessor.restclient.$selector"
- val restClientProperties = restClientProperties(prefix)
- return blueprintWebClientService(restClientProperties)
+ val service = preInterceptor?.getInstance(selector) ?: run {
+ val prefix = "blueprintsprocessor.restclient.$selector"
+ val restClientProperties = restClientProperties(prefix)
+ blueprintWebClientService(restClientProperties)
+ }
+ return postInterceptor?.getInstance(selector, service) ?: service
}
fun restClientProperties(prefix: String): RestClientProperties {
@@ -182,6 +198,18 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties:
return bluePrintProperties.propertyBeanType(
prefix, PolicyManagerRestClientProperties::class.java)
}
+
+ interface PreInterceptor {
+ fun getInstance(jsonNode: JsonNode): BlueprintWebClientService?
+
+ fun getInstance(selector: String): BlueprintWebClientService?
+ }
+
+ interface PostInterceptor {
+ fun getInstance(jsonNode: JsonNode, service: BlueprintWebClientService): BlueprintWebClientService
+
+ fun getInstance(selector: String, service: BlueprintWebClientService): BlueprintWebClientService
+ }
}