aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons')
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt42
2 files changed, 37 insertions, 8 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
index 2f9ea4a25..d63f34ced 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
@@ -39,7 +39,8 @@ data class RemoteScriptExecutionInput(var requestId: String,
data class RemoteScriptExecutionOutput(var requestId: String,
var response: List<String>,
var status: StatusType = StatusType.SUCCESS,
- var timestamp: Date = Date())
+ var timestamp: Date = Date(),
+ var payload: JsonNode)
data class PrepareRemoteEnvInput(var requestId: String,
var correlationId: String? = null,
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
+ }
}