aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorebo <eliezio.oliveira@est.tech>2019-09-30 13:23:43 +0100
committerebo <eliezio.oliveira@est.tech>2019-10-07 21:13:19 +0100
commit3d962090dad9de06cf854fab8daceaf18e0ec469 (patch)
treef271d54e091024bfe0ee100bc45b8d0cea5203fb /ms/blueprintsprocessor/modules
parent809993fe658026f4cb953e49ab0331e2d4e5c8f8 (diff)
Implemented UAT runtime services
Issue-ID: CCSDK-1759 Change-Id: I9e3df315074bfcfa5e341feefdabd00671194dc3 Signed-off-by: ebo <eliezio.oliveira@est.tech>
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
+ }
}